public AuthorizableAction[] getAuthorizableActions() throws ConfigurationException { if (actionConfig == null || actionConfig.length == 0) { return new AuthorizableAction[0]; } else { List<AuthorizableAction> actions = new ArrayList<AuthorizableAction>(actionConfig.length); for (BeanConfig c : actionConfig) { AuthorizableAction action = c.newInstance(AuthorizableAction.class); actions.add(action); } return actions.toArray(new AuthorizableAction[actions.size()]); } } }
public AuthorizableAction[] getAuthorizableActions() throws ConfigurationException { if (actionConfig == null || actionConfig.length == 0) { return new AuthorizableAction[0]; } else { List<AuthorizableAction> actions = new ArrayList<AuthorizableAction>(actionConfig.length); for (BeanConfig c : actionConfig) { AuthorizableAction action = c.newInstance(AuthorizableAction.class); actions.add(action); } return actions.toArray(new AuthorizableAction[actions.size()]); } } }
public List<? extends ProtectedItemImporter> getProtectedItemImporters() { List<ProtectedItemImporter> piis = new ArrayList<ProtectedItemImporter>(); for (BeanConfig bc : protectedItemImporters) { try { piis.add(bc.newInstance(ProtectedItemImporter.class)); } catch (ConfigurationException e) { log.warn(e.getMessage()); } } return piis; }
public List<? extends ProtectedItemImporter> getProtectedItemImporters() { List<ProtectedItemImporter> piis = new ArrayList<ProtectedItemImporter>(); for (BeanConfig bc : protectedItemImporters) { try { piis.add(bc.newInstance(ProtectedItemImporter.class)); } catch (ConfigurationException e) { log.warn(e.getMessage()); } } return piis; }
public RepositoryLockMechanism getRepositoryLockMechanism() throws RepositoryException { NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE && REPOSITORY_LOCK_MECHANISM_ELEMENT.equals(child.getNodeName())) { BeanConfig bc = parseBeanConfig(root, REPOSITORY_LOCK_MECHANISM_ELEMENT); return bc.newInstance(RepositoryLockMechanism.class); } } return new RepositoryLock(); } };
public RepositoryLockMechanism getRepositoryLockMechanism() throws RepositoryException { NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE && REPOSITORY_LOCK_MECHANISM_ELEMENT.equals(child.getNodeName())) { BeanConfig bc = parseBeanConfig(root, REPOSITORY_LOCK_MECHANISM_ELEMENT); return bc.newInstance(RepositoryLockMechanism.class); } } return new RepositoryLock(); } };
public FileSystem getFileSystem() throws RepositoryException { try { FileSystem fs = config.newInstance(FileSystem.class); fs.init(); return fs; } catch (FileSystemException e) { throw new RepositoryException( "File system initialization failure.", e); } } };
public FileSystem getFileSystem() throws RepositoryException { try { FileSystem fs = config.newInstance(FileSystem.class); fs.init(); return fs; } catch (FileSystemException e) { throw new RepositoryException( "File system initialization failure.", e); } } };
public ISMLocking getISMLocking() throws RepositoryException { Element element = getElement(parent, ISM_LOCKING_ELEMENT, false); if (element != null) { return parseBeanConfig(element).newInstance(ISMLocking.class); } else { return new DefaultISMLocking(); } } };
public ISMLocking getISMLocking() throws RepositoryException { Element element = getElement(parent, ISM_LOCKING_ELEMENT, false); if (element != null) { return parseBeanConfig(element).newInstance(ISMLocking.class); } else { return new DefaultISMLocking(); } } };
BeanConfig bc = parseBeanConfig(parent, DATA_STORE_ELEMENT); bc.setValidate(false); DataStore store = bc.newInstance(DataStore.class); if (store instanceof MultiDataStore) { DataStore primary = null;
/** * @see AccessControlProviderFactory#createProvider(Session, WorkspaceSecurityConfig) */ public AccessControlProvider createProvider(Session systemSession, WorkspaceSecurityConfig config) throws RepositoryException { String workspaceName = systemSession.getWorkspace().getName(); AccessControlProvider prov; Map props; if (config != null && config.getAccessControlProviderConfig() != null) { BeanConfig bc = config.getAccessControlProviderConfig(); prov = bc.newInstance(AccessControlProvider.class); props = bc.getParameters(); } else { log.debug("No ac-provider configuration for workspace " + workspaceName + " -> using defaults."); if (workspaceName.equals(secWorkspaceName) && !workspaceName.equals(defaultWorkspaceName)) { // UserAccessControlProvider is designed to work with an extra // workspace storing user and groups. therefore avoid returning // this ac provider for the default workspace. prov = new UserAccessControlProvider(); } else { prov = new ACLProvider(); } log.debug("Default provider for workspace " + workspaceName + " = " + prov.getClass().getName()); props = Collections.emptyMap(); } prov.init(systemSession, props); return prov; } }
/** * @see AccessControlProviderFactory#createProvider(Session, WorkspaceSecurityConfig) */ public AccessControlProvider createProvider(Session systemSession, WorkspaceSecurityConfig config) throws RepositoryException { String workspaceName = systemSession.getWorkspace().getName(); AccessControlProvider prov; Map props; if (config != null && config.getAccessControlProviderConfig() != null) { BeanConfig bc = config.getAccessControlProviderConfig(); prov = bc.newInstance(AccessControlProvider.class); props = bc.getParameters(); } else { log.debug("No ac-provider configuration for workspace " + workspaceName + " -> using defaults."); if (workspaceName.equals(secWorkspaceName) && !workspaceName.equals(defaultWorkspaceName)) { // UserAccessControlProvider is designed to work with an extra // workspace storing user and groups. therefore avoid returning // this ac provider for the default workspace. prov = new UserAccessControlProvider(); } else { prov = new ACLProvider(); } log.debug("Default provider for workspace " + workspaceName + " = " + prov.getClass().getName()); props = Collections.emptyMap(); } prov.init(systemSession, props); return prov; } }
public Journal getJournal(NamespaceResolver resolver) throws RepositoryException { BeanConfig config = parseBeanConfig(cluster, JOURNAL_ELEMENT); Journal journal = config.newInstance(Journal.class); if (journal instanceof AbstractJournal) { ((AbstractJournal) journal).setRepositoryHome(home); } try { journal.init(id, resolver); } catch (JournalException e) { // TODO: Should JournalException extend RepositoryException? throw new RepositoryException( "Journal initialization failed: " + journal, e); } return journal; } };
public Journal getJournal(NamespaceResolver resolver) throws RepositoryException { BeanConfig config = parseBeanConfig(cluster, JOURNAL_ELEMENT); Journal journal = config.newInstance(Journal.class); if (journal instanceof AbstractJournal) { ((AbstractJournal) journal).setRepositoryHome(home); } try { journal.init(id, resolver); } catch (JournalException e) { // TODO: Should JournalException extend RepositoryException? throw new RepositoryException( "Journal initialization failed: " + journal, e); } return journal; } };
if (smc != null && smc.getWorkspaceAccessConfig() != null) { workspaceAccessManager = smc.getWorkspaceAccessConfig().newInstance(WorkspaceAccessManager.class); } else {
public QueryHandler getQueryHandler(QueryHandlerContext context) throws RepositoryException { Element element = (Element) child; // Optional file system implementation FileSystem fs = null; if (getElement(element, FILE_SYSTEM_ELEMENT, false) != null) { fs = getFileSystemFactory( element, FILE_SYSTEM_ELEMENT).getFileSystem(); } // Search implementation class String className = getAttribute( element, CLASS_ATTRIBUTE, DEFAULT_QUERY_HANDLER); BeanConfig config = new BeanConfig( className, parseParameters(element)); QueryHandler handler = config.newInstance(QueryHandler.class); try { handler.init(fs, context); return handler; } catch (IOException e) { throw new RepositoryException( "Unable to initialize query handler: " + handler, e); } } };
public QueryHandler getQueryHandler(QueryHandlerContext context) throws RepositoryException { Element element = (Element) child; // Optional file system implementation FileSystem fs = null; if (getElement(element, FILE_SYSTEM_ELEMENT, false) != null) { fs = getFileSystemFactory( element, FILE_SYSTEM_ELEMENT).getFileSystem(); } // Search implementation class String className = getAttribute( element, CLASS_ATTRIBUTE, DEFAULT_QUERY_HANDLER); BeanConfig config = new BeanConfig( className, parseParameters(element)); QueryHandler handler = config.newInstance(QueryHandler.class); try { handler.init(fs, context); return handler; } catch (IOException e) { throw new RepositoryException( "Unable to initialize query handler: " + handler, e); } } };
/** * 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); } } }
if (bc != null) { WorkspaceAccessManager wac = smc.getWorkspaceAccessConfig().newInstance(WorkspaceAccessManager.class); assertEquals("org.apache.jackrabbit.core.security.simple.SimpleWorkspaceAccessManager", wac.getClass().getName());