Package org.exoplatform.services.jcr.config

Examples of org.exoplatform.services.jcr.config.RepositoryConfigurationException


                  .getComponentInstanceOfType(WorkspaceDataContainer.class)));
            }
         }
         catch (ClassNotFoundException e)
         {
            throw new RepositoryConfigurationException("Class not found for workspace data container "
               + wsConfig.getUniqueName() + " : " + e);
         }

         // cache type
         try
         {
            String className = wsConfig.getCache().getType();
            if (className != null && className.length() > 0)
            {
               workspaceContainer.registerComponentImplementation(Class.forName(className));
            }
            else
               workspaceContainer.registerComponentImplementation(LinkedWorkspaceStorageCacheImpl.class);
         }
         catch (ClassNotFoundException e)
         {
            log.warn("Workspace cache class not found " + wsConfig.getCache().getType()
               + ", will use default. Error : " + e);
            workspaceContainer.registerComponentImplementation(LinkedWorkspaceStorageCacheImpl.class);
         }

         workspaceContainer.registerComponentImplementation(CacheableWorkspaceDataManager.class);
         workspaceContainer.registerComponentImplementation(LocalWorkspaceDataManagerStub.class);
         workspaceContainer.registerComponentImplementation(ObservationManagerRegistry.class);

         // Lock manager and Lock persister is a optional parameters
         if (wsConfig.getLockManager() != null && wsConfig.getLockManager().getPersister() != null)
         {
            try
            {
               Class<?> lockPersister = Class.forName(wsConfig.getLockManager().getPersister().getType());
               workspaceContainer.registerComponentImplementation(lockPersister);
            }
            catch (ClassNotFoundException e)
            {
               throw new RepositoryConfigurationException("Class not found for workspace lock persister "
                  + wsConfig.getLockManager().getPersister().getType() + ", container " + wsConfig.getUniqueName()
                  + " : " + e);
            }
         }

         if (wsConfig.getLockManager() != null && wsConfig.getLockManager().getType() != null)
         {
            try
            {
               Class<?> lockManagerType = Class.forName(wsConfig.getLockManager().getType());
               workspaceContainer.registerComponentImplementation(lockManagerType);
            }
            catch (ClassNotFoundException e)
            {
               throw new RepositoryConfigurationException("Class not found for workspace lock manager "
                  + wsConfig.getLockManager().getType() + ", container " + wsConfig.getUniqueName() + " : " + e);
            }
         }
         else
         {
            workspaceContainer.registerComponentImplementation(LockManagerImpl.class);
         }

         // Query handler
         if (wsConfig.getQueryHandler() != null)
         {
            workspaceContainer.registerComponentImplementation(SearchManager.class);
            workspaceContainer.registerComponentImplementation(QueryManager.class);
            workspaceContainer.registerComponentImplementation(QueryManagerFactory.class);
            workspaceContainer.registerComponentInstance(wsConfig.getQueryHandler());
            if (isSystem)
            {
               workspaceContainer.registerComponentImplementation(SystemSearchManager.class);
            }
         }

         // access manager
         if (wsConfig.getAccessManager() != null && wsConfig.getAccessManager().getType() != null)
         {
            try
            {
               Class<?> am = Class.forName(wsConfig.getAccessManager().getType());
               workspaceContainer.registerComponentImplementation(am);
            }
            catch (ClassNotFoundException e)
            {
               throw new RepositoryConfigurationException("Class not found for workspace access manager "
                  + wsConfig.getAccessManager().getType() + ", container " + wsConfig.getUniqueName() + " : " + e);
            }
         }

         // initializer
         Class<?> initilizerType;
         if (wsConfig.getInitializer() != null && wsConfig.getInitializer().getType() != null)
         {
            // use user defined
            try
            {
               initilizerType = Class.forName(wsConfig.getInitializer().getType());
            }
            catch (ClassNotFoundException e)
            {
               throw new RepositoryConfigurationException("Class not found for workspace initializer "
                  + wsConfig.getInitializer().getType() + ", container " + wsConfig.getUniqueName() + " : " + e);
            }
         }
         else
         {
            // use default
            initilizerType = ScratchWorkspaceInitializer.class;
         }
         workspaceContainer.registerComponentImplementation(initilizerType);
         workspaceContainer.registerComponentImplementation(SessionFactory.class);

         LocalWorkspaceDataManagerStub wsDataManager =
            (LocalWorkspaceDataManagerStub)workspaceContainer
               .getComponentInstanceOfType(LocalWorkspaceDataManagerStub.class);

         if (isSystem)
         {
            // system workspace
            systemDataManager = wsDataManager;
            registerComponentInstance(systemDataManager);
         }

         wsDataManager.setSystemDataManager(systemDataManager);

         if (!config.getWorkspaceEntries().contains(wsConfig))
            config.getWorkspaceEntries().add(wsConfig);

      }
      catch (RuntimeException e)
      {
         int depth = 0;
         Throwable retval = e;
         while (retval.getCause() != null && depth < 100)
         {
            retval = retval.getCause();
            if (retval instanceof RepositoryException)
            {
               throw new RepositoryException(retval.getMessage(), e);
            }
            else if (retval instanceof RepositoryConfigurationException)
            {
               throw new RepositoryConfigurationException(retval.getMessage(), e);
            }
            else if (retval instanceof NameNotFoundException)
            {
               throw new RepositoryException(retval.getMessage(), e);
            }
View Full Code Here


      {
         registerComponentImplementation(Class.forName(config.getAuthenticationPolicy()));
      }
      catch (ClassNotFoundException e)
      {
         throw new RepositoryConfigurationException("Class not found for repository authentication policy: " + e);
      }

      // Repository
      RepositoryImpl repository = new RepositoryImpl(this);
      registerComponentInstance(repository);
View Full Code Here

            WorkspaceDataContainer.DEF_MAXBUFFERSIZE);

      this.restorePath =
         config.getInitializer().getParameterValue(SysViewWorkspaceInitializer.RESTORE_PATH_PARAMETER, null);
      if (this.restorePath == null)
         throw new RepositoryConfigurationException("Workspace (" + workspaceName
            + ") RestoreIntializer should have mandatory parameter "
            + SysViewWorkspaceInitializer.RESTORE_PATH_PARAMETER);

      this.tempDir = new File(System.getProperty("java.io.tmpdir"));
   }
View Full Code Here

         // Context recall is a workaround of JDBCCacheLoader starting.
         context.recall();
      }
      else
      {
         throw new RepositoryConfigurationException("Cache configuration not found");
      }
   }
View Full Code Here

   private void init() throws RepositoryConfigurationException, RepositoryException
   {
      String root = config.getParameterValue(PARAM_ROOT_DIR);

      if (root == null)
         throw new RepositoryConfigurationException("Repository service configuration." + " Source name ("
            + PARAM_ROOT_DIR + ") is expected");
      rootDir = new File(root);
      if (PrivilegedFileHelper.exists(rootDir))
      {
         if (!rootDir.isDirectory())
         {
            throw new RepositoryConfigurationException("'" + root + "' is not a directory");
         }
      }
      else
      {
         if (!PrivilegedFileHelper.mkdirs(rootDir))
View Full Code Here

   public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
      ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
   {
      if (wsConfig.getCache() == null)
      {
         throw new RepositoryConfigurationException("Cache configuration not found");
      }

      // create cache using custom factory
      ExoJBossCacheFactory<Serializable, Object> factory;
View Full Code Here

      {
         return wsConfig.getCache().getParameterValue(JBOSSCACHE_CONFIG);
      }
      else
      {
         throw new RepositoryConfigurationException("Cache configuration not found");
      }
   }
View Full Code Here

         // fill template
         configStream = configurationHelper.fillTemplate(jBossCacheConfigurationPath, parameterEntry.getParameters());
      }
      catch (IOException e)
      {
         throw new RepositoryConfigurationException(e);
      }

      // create cache
      final CacheFactory<K, V> factory = new DefaultCacheFactory<K, V>();
      final InputStream stream = configStream;

      PrivilegedAction<Cache<K, V>> action = new PrivilegedAction<Cache<K, V>>()
      {
         public Cache<K, V> run()
         {
            return factory.createCache(stream, false);
         }
      };
      Cache<K, V> cache = AccessController.doPrivileged(action);

      // inject transaction manager if defined
      if (transactionManager != null)
      {
         cache.getConfiguration().getRuntimeConfig().setTransactionManager(transactionManager);
      }

      // JGroups multiplexer configuration if enabled
      if (parameterEntry.getParameterBoolean(JGROUPS_MUX_ENABLED, false))
      {
         try
         {
            // Get path to JGroups configuration
            String jgroupsConfigurationFilePath = parameterEntry.getParameterValue(JGROUPS_CONFIG);
            if (jgroupsConfigurationFilePath != null)
            {
               // Create and inject multiplexer factory
               CHANNEL_FACTORY.setMultiplexerConfig(configurationManager.getResource(jgroupsConfigurationFilePath));
               cache.getConfiguration().getRuntimeConfig().setMuxChannelFactory(CHANNEL_FACTORY);
               log.info("Multiplexer stack successfully enabled for the cache.");
            }
         }
         catch (Exception e)
         {
            // exception occurred setting mux factory
            throw new RepositoryConfigurationException("Error setting multiplexer configuration.", e);
         }
      }
      else
      {
         // Multiplexer is not enabled. If jGroups configuration preset it is applied
         String jgroupsConfigurationFilePath = parameterEntry.getParameterValue(JGROUPS_CONFIG, null);
         if (jgroupsConfigurationFilePath != null)
         {
            try
            {
               cache.getConfiguration().setJgroupsConfigFile(
                  configurationManager.getResource(jgroupsConfigurationFilePath));
               log.info("Custom JGroups configuration set:"
                  + configurationManager.getResource(jgroupsConfigurationFilePath));
            }
            catch (Exception e)
            {
               throw new RepositoryConfigurationException("Error setting JGroups configuration.", e);
            }
         }
      }
      return cache;
   }
View Full Code Here

      {
         key = new ConfigurationKey(cfg);
      }
      catch (CloneNotSupportedException e)
      {
         throw new RepositoryConfigurationException("Cannot clone the configuration.", e);
      }
      if (caches.containsKey(key))
      {
         cache = caches.get(key);
      }
View Full Code Here

   public synchronized void createRepository(RepositoryEntry rEntry) throws RepositoryConfigurationException,
      RepositoryException
   {
      if (repositoryContainers.containsKey(rEntry.getName()))
      {
         throw new RepositoryConfigurationException("Repository container " + rEntry.getName() + " already started");
      }

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

      // Storing and starting the repository container under
      // key=repository_name
      try
      {
         repositoryContainers.put(rEntry.getName(), repositoryContainer);
         managerStartChanges.registerListeners(repositoryContainer);

         repositoryContainer.start();
      }
      catch (Throwable t)
      {
         //TODO will be implemented unregistration in managerStartChanges
         //managerStartChanges.removeListeners(repositoryContainer);
         repositoryContainers.remove(rEntry.getName());

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

      if (!config.getRepositoryConfigurations().contains(rEntry))
      {
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.config.RepositoryConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.