Create a crud service for given class and context, and registers it
@param clazz
@param context
@param repository
@throws RepositoryException
194866
public void addCrudService(Class clazz, BundleContext bundleContext, JcrRepository repository) throws RepositoryException {
        jcrom.map(clazz);
        JcrCrudService<? extends Object> jcromCrudService;
        jcromCrudService = new JcrCrudService<>(repository, jcrom, clazz);
        crudServiceRegistrations.put(jcromCrudService, registerCrud(bundleContext, jcromCrudService));
    }
1173457
@Override
    public void process(Class clazz, EntityMetadata metadata)
    {

        if (LOG.isDebugEnabled())
            LOG.debug("Processing @Entity(" + clazz.getName() + ") for Persistence Object.");
        populateMetadata(metadata, clazz, puProperties);
    }
329393
private void registerJsonSchemaRepository(Element element, ParserContext parserContext) {
        BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class);
        addLocationsToBuilder(element, builder);
        parseSchemasElement(element, builder, parserContext);
        parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
    }
185153
public void registerPrototype(String name, Class<?> clazz) throws BeansException {
        GenericBeanDefinition bd = new GenericBeanDefinition();
        bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE);
        bd.setBeanClass(clazz);
        getDefaultListableBeanFactory().registerBeanDefinition(name, bd);
    }
138864
public void configureFactory(Class<?> clazz) {
        ConnectionConfiguration connectionConfiguration = resolveConnectionConfiguration(clazz);
        if (connectionConfiguration == null) {
            return;
        }
        connectionFactory.setHost(connectionConfiguration.host());
        connectionFactory.setVirtualHost(connectionConfiguration.virtualHost());
        connectionFactory.setPort(connectionConfiguration.port());
        connectionFactory.setConnectionTimeout(connectionConfiguration.timeout());
        connectionFactory.setRequestedHeartbeat(connectionConfiguration.heartbeat());
        connectionFactory.setUsername(connectionConfiguration.username());
        connectionFactory.setPassword(connectionConfiguration.password());
        connectionFactory.setRequestedFrameMax(connectionConfiguration.frameMax());
    }
1246768
private static void setSchemaAndPU(Class<?> clazz, EntityMetadata metadata)
    {
        Table table = clazz.getAnnotation(Table.class);
        if (table != null)
        {
            metadata.setTableName(!StringUtils.isBlank(table.name()) ? table.name() : clazz.getSimpleName());
            String schemaStr = table.schema();

            MetadataUtils.setSchemaAndPersistenceUnit(metadata, schemaStr,
                    em.getEntityManagerFactory().getProperties());
        }
        else
        {
            metadata.setTableName(clazz.getSimpleName());
            metadata.setSchema((String) em.getEntityManagerFactory().getProperties().get("kundera.keyspace"));
        }

        if (metadata.getPersistenceUnit() == null)
        {
            metadata.setPersistenceUnit(getPersistenceUnit());
        }
    }
345882
protected void removeRepository(RepositoryService repositoryService, String repositoryName)
      throws RepositoryException,
      RepositoryConfigurationException
   {
      ManageableRepository mr = null;

      try
      {
         mr = repositoryService.getRepository(repositoryName);
      }
      catch (RepositoryException e)
      {
         // The repository not exist.
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }

      if (mr != null)
      {
         closeAllSession(mr);
         repositoryService.removeRepository(repositoryName);
         repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
      }
   }
835548
@SuppressWarnings( "deprecation" )
    @Override
    public org.modeshape.jcr.api.query.QueryResult execute() throws RepositoryException {
        context.checkValid();
        final long start = System.nanoTime();
        // Create an executable query and set it on this object ...
        CancellableQuery newExecutable = context.createExecutableQuery(query, hints, variables);
        CancellableQuery executable = executingQuery.getAndSet(newExecutable);
        if (executable == null) {
            // We are the first to call 'execute()', so use our newly-created one ...
            executable = newExecutable;
        }
        // otherwise, some other thread called execute, so we can use it and just wait for the results ...
        final QueryResults result = executable.execute(); // may be cancelled

        // And reset the reference to null (if not already set to something else) ...
        executingQuery.compareAndSet(executable, null);

        checkForProblems(result.getProblems());
        context.recordDuration(Math.abs(System.nanoTime() - start), TimeUnit.NANOSECONDS, statement, language);
        if (Query.XPATH.equals(language)) {
            return new XPathQueryResult(context, statement, result, hints.restartable, hints.rowsKeptInMemory);
        } else if (Query.SQL.equals(language)) {
            return new JcrSqlQueryResult(context, statement, result, hints.restartable, hints.rowsKeptInMemory);
        }
        return new JcrQueryResult(context, statement, result, hints.restartable, hints.rowsKeptInMemory);
    }
1239844
public <T> void addRepository(JpaRepositoryConfig<T> config) {
        Class<?> resourceClass = config.getResourceClass();
        if (repositoryConfigurationMap.containsKey(resourceClass)) {
            throw new IllegalStateException(resourceClass.getName() + " is already registered");
        }
        repositoryConfigurationMap.put(resourceClass, config);
    }
633855
@Override
	public void start(BundleContext context) throws Exception {
		final String sourceMethod = "start"; //$NON-NLS-1$
		boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(Activator.class.getName(), sourceMethod, new Object[]{context});
		}
		super.start(context);

		// Verify the bundle id.
		if (!context.getBundle().getSymbolicName().equals(BUNDLE_NAME)) {
			throw new IllegalStateException();
		}
		serviceRegistrations = new LinkedList<ServiceRegistration<?>>();
		Activator.context = context;
		Dictionary<String, String> dict = new Hashtable<String, String>();
		dict.put("name", BUNDLE_NAME); //$NON-NLS-1$

		ServiceRegistration<?> commandProviderReg = registerCommandProvider();
		if (commandProviderReg != null) {
			serviceRegistrations.add(commandProviderReg);
		}
		// Create the executors provider.  The executors provider is created by the
		// activator primarily to allow executors to be shared by all of the
		// aggregators created by this bundle.
		dict = new Hashtable<String, String>();
		dict.put("name", BUNDLE_NAME); //$NON-NLS-1$
		executors = newExecutors();
		serviceRegistrations.add(
				context.registerService(IExecutors.class.getName(), executors, dict));

		if (isTraceLogging) {
			log.exiting(Activator.class.getName(), sourceMethod);
		}
	}
635341
public void createRepository(RepositoryEntry rEntry) throws RepositoryConfigurationException, RepositoryException
   {
      // Need privileges to manage repository.
      SecurityManager security = System.getSecurityManager();
      if (security != null)
      {
         security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
      }

      if (repositoryContainers.containsKey(rEntry.getName()))
      {
         throw new RepositoryConfigurationException("Repository container " + rEntry.getName() + " already started");
      }

      final RepositoryContainer repositoryContainer =
         new RepositoryContainer(parentContainer, rEntry, addNamespacesPlugins);

      // Storing and starting the repository container under
      // key=repository_name
      try
      {
         if (repositoryContainers.putIfAbsent(rEntry.getName(), repositoryContainer) == null)
         {
            SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
            {
               public Void run()
               {
                  repositoryContainer.start();
                  return null;
               }
            });
         }
         else
         {
            throw new RepositoryConfigurationException("Repository container " + rEntry.getName() + " already started");
         }
      }
      catch (Throwable t) //NOSONAR
      {
         repositoryContainers.remove(rEntry.getName());

         throw new RepositoryConfigurationException("Repository container " + rEntry.getName() + " was not started.", t);
      }

      if (!config.getRepositoryConfigurations().contains(rEntry))
      {
         config.getRepositoryConfigurations().add(rEntry);
      }

      registerNodeTypes(rEntry.getName());

      // turn on Repository ONLINE
      ManageableRepository mr =
         (ManageableRepository)repositoryContainer.getComponentInstanceOfType(ManageableRepository.class);
      mr.setState(ManageableRepository.ONLINE);
   }
1030347
@PostConstruct
    public void buildRepository() {
        try {
            LOGGER.info("Using repo config (classpath): {}", repositoryConfiguration.getURL());
            getPropertiesLoader().loadSystemProperties();

            final RepositoryConfiguration config =
                    RepositoryConfiguration.read(repositoryConfiguration.getURL());
            repository = modeShapeEngine.deploy(config);

            // next line ensures that repository starts before the factory is used.
            final org.modeshape.common.collection.Problems problems =
                    repository.getStartupProblems();
            for (final org.modeshape.common.collection.Problem p : problems) {
                LOGGER.error("ModeShape Start Problem: {}", p.getMessageString());
                // TODO determine problems that should be runtime errors
            }
        } catch (final Exception e) {
            throw new RepositoryRuntimeException(e);
        }
    }
1335203
public void addRepositoryClass(I_CmsRepository repository) throws CmsConfigurationException {

        // check if new repositories can still be added
        if (m_frozen) {
            throw new CmsConfigurationException(Messages.get().container(Messages.ERR_NO_CONFIG_AFTER_STARTUP_0));
        }
        m_repositoryList.add(repository);
    }
1369967
@SuppressWarnings("UNCHECKED_CAST")
    public void delete(Class clazz, Object identifier) {

        EntityManager entityManager = null;
        try {
            entityManager = entityManagers.poll();
            entityManager.getTransaction().begin();
            try {

                @SuppressWarnings("unchecked") Object object = entityManager.find(clazz, identifier);
                entityManager.remove(object);
                entityManager.getTransaction().commit();
            } catch (Exception e) {
                e.printStackTrace();
                entityManager.getTransaction().rollback();
            }
        } finally {
            if(entityManager != null)
                entityManagers.add(entityManager);
        }
    }
675528
public void setRepositories( List<String> urls ) throws ProjectException {
        List<Repository> repositories = new ArrayList<Repository>();
        for ( String url : urls  ) {
            try {
                Repository repository = RepoBuilder.repositoryFromUrl( url );
                repositories.add( repository );
            } catch (MalformedURLException e) {
                throw new ProjectException( e );
            }
        }
        getMavenModel().setRepositories( repositories);
    }
1279106
@Override
    public void add(Statement st, Resource... contexts) throws RepositoryException {
        add(st.getSubject(), st.getPredicate(), st.getObject(), mergeResource(st.getContext(), contexts));
    }
517599
public function addRepository($repository)
    {
        $class = $repository->getModelClass();
        if ($this->getByClass($class)) {
            throw new RepositoryException("The manager already contains a repository for the model class '$class'");
        }
        
        $repository->setManager($this);
        $this->repositories[$class] = $repository;
    }