Пример #1
0
  /**
   * Init workspace root node. If it's the system workspace init jcr:system too.
   *
   * @param wsConfig
   * @throws RepositoryException
   */
  private void initWorkspace(WorkspaceEntry wsConfig) throws RepositoryException {

    WorkspaceContainer workspaceContainer = getWorkspaceContainer(wsConfig.getName());

    // touch independent components
    workspaceContainer.getComponentInstanceOfType(IdGenerator.class);

    // Init Root and jcr:system if workspace is system workspace
    WorkspaceInitializer wsInitializer =
        (WorkspaceInitializer)
            workspaceContainer.getComponentInstanceOfType(WorkspaceInitializer.class);
    RepositoryCreationSynchronizer synchronizer =
        (RepositoryCreationSynchronizer)
            getComponentInstanceOfType(RepositoryCreationSynchronizer.class);
    // The synchronizer will be used to synchronize all the cluster
    // nodes to prevent any concurrent jcr initialization i.e. EXOJCR-887
    synchronizer.waitForApproval(wsInitializer.isWorkspaceInitialized());

    SystemParametersPersistenceConfigurator sppc =
        (SystemParametersPersistenceConfigurator)
            parent.getComponentInstanceOfType(SystemParametersPersistenceConfigurator.class);

    if (sppc != null) {
      setInitializerAndValidateOverriddenParameters(wsConfig, wsInitializer);
    }

    wsInitializer.initWorkspace();
  }
Пример #2
0
  /**
   * Initialize worspaces (root node and jcr:system for system workspace).
   *
   * <p>Runs on container start.
   *
   * @throws RepositoryException
   * @throws RepositoryConfigurationException
   */
  private void init() throws RepositoryException, RepositoryConfigurationException {
    List<WorkspaceEntry> wsEntries = config.getWorkspaceEntries();

    NodeTypeDataManager typeManager =
        (NodeTypeDataManager) this.getComponentInstanceOfType(NodeTypeDataManager.class);
    NamespaceRegistryImpl namespaceRegistry =
        (NamespaceRegistryImpl) this.getComponentInstanceOfType(NamespaceRegistry.class);

    for (WorkspaceEntry ws : wsEntries) {
      initWorkspace(ws);
      WorkspaceContainer workspaceContainer = getWorkspaceContainer(ws.getName());
      SearchManager searchManager =
          (SearchManager) workspaceContainer.getComponentInstanceOfType(SearchManager.class);
      //         if (searchManager != null)
      //         {
      //            typeManager.addQueryHandler(searchManager.getHandler());
      //            namespaceRegistry.addQueryHandler(searchManager.getHandler());
      //         }
      //         else
      //         {
      //            log.warn("Search manager not configured for " + ws.getName());
      //         }
    }

    SystemSearchManagerHolder searchManager =
        (SystemSearchManagerHolder)
            this.getComponentInstanceOfType(SystemSearchManagerHolder.class);
    //      if (searchManager != null)
    //      {
    //         typeManager.addQueryHandler(searchManager.get().getHandler());
    //         namespaceRegistry.addQueryHandler(searchManager.get().getHandler());
    //      }
    //      else
    //      {
    //         log.warn("System search manager not configured ");
    //      }

  }