Package org.exoplatform.services.jcr.config

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


   }

   public void setCurrentRepositoryName(String repositoryName) throws RepositoryConfigurationException
   {
      if (!repositoryContainers.containsKey(repositoryName))
         throw new RepositoryConfigurationException("Repository is not configured. Name " + repositoryName);
      currentRepositoryName.set(repositoryName);
   }
View Full Code Here


         security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
      }

      if (isWorkspaceInitialized(wsConfig.getName()))
      {
         throw new RepositoryConfigurationException("Workspace '" + wsConfig.getName()
            + "' is presumably initialized. config canceled");
      }

      try
      {
         PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
         {
            public Object run() throws Exception
            {
               repositoryContainer.registerWorkspace(wsConfig);
               return null;
            }
         };
         try
         {
            AccessController.doPrivileged(action);
         }
         catch (PrivilegedActionException pae)
         {
            Throwable cause = pae.getCause();
            if (cause instanceof RepositoryException)
            {
               throw (RepositoryException)cause;
            }
            else if (cause instanceof RepositoryConfigurationException)
            {
               throw (RepositoryConfigurationException)cause;
            }
            else if (cause instanceof RuntimeException)
            {
               throw (RuntimeException)cause;
            }
            else
            {
               throw new RuntimeException(cause);
            }
         }
      }
      catch (RepositoryConfigurationException e)
      {
         WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
         repositoryContainer.unregisterComponentByInstance(workspaceContainer);
         repositoryContainer.unregisterComponent(wsConfig.getName());
         throw new RepositoryConfigurationException(e);
      }
      catch (RepositoryException e)
      {
         WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
         repositoryContainer.unregisterComponentByInstance(workspaceContainer);
View Full Code Here

   protected void initializeQueryHandler() throws RepositoryException, RepositoryConfigurationException
   {
      // initialize query handler
      String className = config.getType();
      if (className == null)
         throw new RepositoryConfigurationException("Content hanler       configuration fail");

      try
      {
         Class qHandlerClass = Class.forName(className, true, this.getClass().getClassLoader());
         Constructor constuctor = qHandlerClass.getConstructor(QueryHandlerEntry.class, ConfigurationManager.class);
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

         // Context recall is a workaround of JDBCCacheLoader starting.
         context.recall();
      }
      else
      {
         throw new RepositoryConfigurationException("Cache configuration not found");
      }
   }
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

                        .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
                  {
                     final 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
                  {
                     final 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
                  {
                     final 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
               final 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(TransactionableResourceManager.class);
               workspaceContainer.registerComponentImplementation(SessionFactory.class);
               final 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);
               return null;
            }
         });

      }
      catch (PrivilegedActionException pae)
      {
         Throwable cause = pae.getCause();
         if (cause instanceof RepositoryConfigurationException)
         {
            throw (RepositoryConfigurationException)cause;
         }
         else if (cause instanceof RepositoryException)
         {
            throw (RepositoryException)cause;
         }
         else if (cause instanceof RuntimeException)
         {
            RuntimeException e = (RuntimeException)cause;
            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

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

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

   {
      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 (!PrivilegedFileHelper.isDirectory(rootDir))
         {
            throw new RepositoryConfigurationException("'" + root + "' is not a directory");
         }
      }
      else
      {
         if (!PrivilegedFileHelper.mkdirs(rootDir))
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.