/** * Returns a Persistence manager configuration object via a WorkspaceInfo object * * @param workspaceInfo Workspaceinfo object * @return PersistenceManagerConfig - Persistence manager configuration * @throws NoSuchFieldException * @throws IllegalAccessException */ private PersistenceManagerConfig getPersistenceManagerConf(Object workspaceInfo) throws NoSuchFieldException, IllegalAccessException { Field configField = workspaceInfo.getClass().getDeclaredField("config"); configField.setAccessible(true); WorkspaceConfig workspaceConfig = (WorkspaceConfig) configField.get(workspaceInfo); PersistenceManagerConfig persistenceConfig = workspaceConfig.getPersistenceManagerConfig(); return persistenceConfig; }
/** * {@inheritDoc} */ public String getName() { return wspConfig.getName(); }
/** * Test that a standard workspace configuration file is * correctly parsed. * * @throws Exception on errors */ public void testWorkspaceXml() throws Exception { InputStream xml = getClass().getClassLoader().getResourceAsStream( "org/apache/jackrabbit/core/config/workspace.xml"); WorkspaceConfig config = parser.parseWorkspaceConfig(new InputSource(xml)); assertEquals("target", config.getHomeDir()); assertEquals("default", config.getName()); PersistenceManagerConfig pmc = config.getPersistenceManagerConfig(); assertEquals( "org.apache.jackrabbit.core.persistence.obj.ObjectPersistenceManager", pmc.getClassName()); assertTrue(pmc.getParameters().isEmpty()); assertTrue(config.isSearchEnabled()); WorkspaceSecurityConfig ws = config.getSecurityConfig(); if (ws != null) { BeanConfig ppfConfig = ws.getAccessControlProviderConfig(); if (ppfConfig != null) { ppfConfig.newInstance(AccessControlProvider.class); } } }
fs = config.getFileSystem(); new File(config.getHomeDir()), fs, config.getPersistenceManagerConfig()); ISMLocking ismLocking = config.getISMLocking(); if (clusterNode != null && config.isClustered()) { updateChannel = clusterNode.createUpdateChannel(getName()); itemStateMgr.setEventChannel(updateChannel);
/** * Returns the search manager for this workspace. * * @return the search manager for this workspace, or <code>null</code> * if no <code>SearchManager</code> * @throws RepositoryException if the search manager could not be created */ protected SearchManager getSearchManager() throws RepositoryException { if (!isInitialized()) { throw new IllegalStateException("workspace '" + getName() + "' not initialized"); } synchronized (this) { if (searchMgr == null && config.isSearchEnabled()) { // search manager is lazily instantiated in order to avoid // 'chicken & egg' bootstrap problems searchMgr = new SearchManager( getName(), context, config, itemStateMgr, persistMgr, context.getRootNodeId(), getSystemSearchManager(getName()), SYSTEM_ROOT_NODE_ID); } return searchMgr; } }
repository.getConfig().getWorkspaceConfig(workspaceName); if (conf != null) { secConf = conf.getSecurityConfig();
/** * {@inheritDoc} */ public Lock lock(boolean isDeep, boolean isSessionScoped) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException { // check state of this instance sanityCheck(); LockManager lockMgr = getSession().getWorkspace().getLockManager(); return lockMgr.lock(getPath(), isDeep, isSessionScoped, sessionContext.getWorkspace().getConfig().getDefaultLockTimeout(), null); }
return new WorkspaceConfig( home, name, clustered, fsf, pmc, qhf, ismLockingFactory, workspaceSecurityConfig, importConfig, defaultLockTimeout);
fs = config.getFileSystem(); new File(config.getHomeDir()), fs, config.getPersistenceManagerConfig()); ISMLocking ismLocking = config.getISMLocking(); if (clusterNode != null && config.isClustered()) { updateChannel = clusterNode.createUpdateChannel(getName()); itemStateMgr.setEventChannel(updateChannel);
/** * Returns the search manager for this workspace. * * @return the search manager for this workspace, or <code>null</code> * if no <code>SearchManager</code> * @throws RepositoryException if the search manager could not be created */ protected SearchManager getSearchManager() throws RepositoryException { if (!isInitialized()) { throw new IllegalStateException("workspace '" + getName() + "' not initialized"); } synchronized (this) { if (searchMgr == null && config.isSearchEnabled()) { // search manager is lazily instantiated in order to avoid // 'chicken & egg' bootstrap problems searchMgr = new SearchManager( getName(), context, config, itemStateMgr, persistMgr, context.getRootNodeId(), getSystemSearchManager(getName()), SYSTEM_ROOT_NODE_ID); } return searchMgr; } }
repository.getConfig().getWorkspaceConfig(workspaceName); if (conf != null) { secConf = conf.getSecurityConfig();
/** * {@inheritDoc} */ public Lock lock(boolean isDeep, boolean isSessionScoped) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException { // check state of this instance sanityCheck(); LockManager lockMgr = getSession().getWorkspace().getLockManager(); return lockMgr.lock(getPath(), isDeep, isSessionScoped, sessionContext.getWorkspace().getConfig().getDefaultLockTimeout(), null); }
return new WorkspaceConfig( home, name, clustered, fsf, pmc, qhf, ismLockingFactory, workspaceSecurityConfig, importConfig, defaultLockTimeout);
/** * Returns the workspace name. * * @return the workspace name */ protected String getName() { return config.getName(); }
@Override protected SearchManager getSearchManager() throws RepositoryException { if (!isInitialized()) { throw new IllegalStateException("workspace '" + getName() + "' not initialized"); } synchronized (this) { if (searchMgr == null && getConfig().isSearchEnabled()) { // search manager is lazily instantiated in order to avoid // 'chicken & egg' bootstrap problems searchMgr = new HippoSearchManager(getName(), context, HippoWorkspaceInfo.this.getConfig(), HippoWorkspaceInfo.this.getItemStateProvider(), HippoWorkspaceInfo.this.getPersistenceManager(), context.getRootNodeId(), getSystemSearchManager(HippoWorkspaceInfo.this.getName()), org.apache.jackrabbit.core.RepositoryImpl.SYSTEM_ROOT_NODE_ID); } return searchMgr; } }
/** * {@inheritDoc} */ public String getName() { return wspConfig.getName(); }
/** * Returns the workspace name. * * @return the workspace name */ protected String getName() { return config.getName(); }
/** * Adds the given workspace configuration to the repository. * * @param wc workspace configuration * @throws ConfigurationException if a workspace with the same name * already exists */ private void addWorkspaceConfig(WorkspaceConfig wc) throws ConfigurationException { String name = wc.getName(); if (!workspaces.containsKey(name)) { workspaces.put(name, wc); } else { throw new ConfigurationException( "Duplicate workspace configuration: " + name); } }
/** * Adds the given workspace configuration to the repository. * * @param wc workspace configuration * @throws ConfigurationException if a workspace with the same name * already exists */ private void addWorkspaceConfig(WorkspaceConfig wc) throws ConfigurationException { String name = wc.getName(); if (!workspaces.containsKey(name)) { workspaces.put(name, wc); } else { throw new ConfigurationException( "Duplicate workspace configuration: " + name); } }
/** * Return the internal effective retention/hold manager for this workspace. * If not already done, creates a new instance. * * @return effective retention/hold manager for this workspace * @throws RepositoryException if an error occurs */ synchronized RetentionRegistry getRetentionRegistry() throws RepositoryException { // check state of this instance sanityCheck(); if (retentionRegistry == null) { retentionRegistry = context.getRepository().getRetentionRegistry(wspConfig.getName()); } return retentionRegistry; }