/** * Creates and returns a factory object that creates {@link FileSystem} * instances based on the bean configuration at the named element. * * @param parent parent element * @param name name of the bean configuration element * @return file system factory * @throws ConfigurationException if the bean configuration is invalid */ protected FileSystemFactory getFileSystemFactory(Element parent, String name) throws ConfigurationException { final BeanConfig config = parseBeanConfig(parent, name); return new FileSystemFactory() { 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); } } }; }
/** * Creates and returns a factory object that creates {@link FileSystem} * instances based on the bean configuration at the named element. * * @param parent parent element * @param name name of the bean configuration element * @return file system factory * @throws ConfigurationException if the bean configuration is invalid */ protected FileSystemFactory getFileSystemFactory(Element parent, String name) throws ConfigurationException { final BeanConfig config = parseBeanConfig(parent, name); return new FileSystemFactory() { 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); } } }; }
/** * Parses the PersistenceManager config. * * @param parent parent of the <code>PersistenceManager</code> element * @return persistence manager configuration * @throws ConfigurationException if the configuration is broken */ protected PersistenceManagerConfig parsePersistenceManagerConfig( Element parent) throws ConfigurationException { return new PersistenceManagerConfig( parseBeanConfig(parent, PERSISTENCE_MANAGER_ELEMENT)); }
/** * Parses the PersistenceManager config. * * @param parent parent of the <code>PersistenceManager</code> element * @return persistence manager configuration * @throws ConfigurationException if the configuration is broken */ protected PersistenceManagerConfig parsePersistenceManagerConfig( Element parent) throws ConfigurationException { return new PersistenceManagerConfig( parseBeanConfig(parent, PERSISTENCE_MANAGER_ELEMENT)); }
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(); } };
/** * Parses the login module configuration. * * @param security the <security> element. * @return the login module configuration or <code>null</code>. * @throws ConfigurationException if the configuration is broken */ public LoginModuleConfig parseLoginModuleConfig(Element security) throws ConfigurationException { // Optional login module Element loginModule = getElement(security, LOGIN_MODULE_ELEMENT, false); if (loginModule != null) { return new LoginModuleConfig(parseBeanConfig(security, LOGIN_MODULE_ELEMENT)); } else { return null; } }
IMPORT_PPI_ELEMENT.equals(child.getNodeName()) || IMPORT_PII_ELEMENT.equals(child.getNodeName())) { BeanConfig bc = parseBeanConfig((Element) child); bc.setValidate(false); protectedItemImporters.add(bc);
/** * Parses the access manager configuration. * * @param security the <security> element. * @return the access manager configuration or <code>null</code>. * @throws ConfigurationException if the configuration is broken */ public AccessManagerConfig parseAccessManagerConfig(Element security) throws ConfigurationException { // Optional access manager config entry Element accessMgr = getElement(security, ACCESS_MANAGER_ELEMENT, false); if (accessMgr != null) { return new AccessManagerConfig(parseBeanConfig(accessMgr)); } else { return null; } }
/** * Parses the access manager configuration. * * @param security the <security> element. * @return the access manager configuration or <code>null</code>. * @throws ConfigurationException if the configuration is broken */ public AccessManagerConfig parseAccessManagerConfig(Element security) throws ConfigurationException { // Optional access manager config entry Element accessMgr = getElement(security, ACCESS_MANAGER_ELEMENT, false); if (accessMgr != null) { return new AccessManagerConfig(parseBeanConfig(accessMgr)); } else { return null; } }
/** * Parses the login module configuration. * * @param security the <security> element. * @return the login module configuration or <code>null</code>. * @throws ConfigurationException if the configuration is broken */ public LoginModuleConfig parseLoginModuleConfig(Element security) throws ConfigurationException { // Optional login module Element loginModule = getElement(security, LOGIN_MODULE_ELEMENT, false); if (loginModule != null) { return new LoginModuleConfig(parseBeanConfig(security, LOGIN_MODULE_ELEMENT)); } else { return null; } }
IMPORT_PPI_ELEMENT.equals(child.getNodeName()) || IMPORT_PII_ELEMENT.equals(child.getNodeName())) { BeanConfig bc = parseBeanConfig((Element) child); bc.setValidate(false); protectedItemImporters.add(bc);
BeanConfig bc = parseBeanConfig(smElement); String wspAttr = getAttribute(smElement, WSP_NAME_ATTRIBUTE, null); Element element = getElement(smElement, WORKSPACE_ACCESS_ELEMENT, false); if (element != null) { wac = parseBeanConfig(smElement, WORKSPACE_ACCESS_ELEMENT); BeanConfig[] aaConfig = new BeanConfig[acElements.length]; for (int i = 0; i < acElements.length; i++) { aaConfig[i] = parseBeanConfig(acElements[i]); umc = new UserManagerConfig(parseBeanConfig(element), aaConfig); element = getElement(smElement, USERID_CLASS_ELEMENT, false); if (element != null) { uidcc = parseBeanConfig(element);
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(smElement); String wspAttr = getAttribute(smElement, WSP_NAME_ATTRIBUTE, null); Element element = getElement(smElement, WORKSPACE_ACCESS_ELEMENT, false); if (element != null) { wac = parseBeanConfig(smElement, WORKSPACE_ACCESS_ELEMENT); BeanConfig[] aaConfig = new BeanConfig[acElements.length]; for (int i = 0; i < acElements.length; i++) { aaConfig[i] = parseBeanConfig(acElements[i]); umc = new UserManagerConfig(parseBeanConfig(element), aaConfig); element = getElement(smElement, USERID_CLASS_ELEMENT, false); if (element != null) { uidcc = parseBeanConfig(element);
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 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; } };
/** * Read the optional WorkspaceSecurity Element of Workspace's configuration. * It uses the following format: * <pre> * <WorkspaceSecurity> * <AccessControlProvider class="..." (optional)> * </WorkspaceSecurity> * </pre> * * @param parent Workspace-Root-Element * @return a new <code>WorkspaceSecurityConfig</code> or <code>null</code> * if none is configured. * @throws ConfigurationException */ public WorkspaceSecurityConfig parseWorkspaceSecurityConfig(Element parent) throws ConfigurationException { BeanConfig acProviderConfig = null; Element element = getElement(parent, WSP_SECURITY_ELEMENT, false); if (element != null) { Element provFact = getElement(element, AC_PROVIDER_ELEMENT, false); if (provFact != null) { acProviderConfig = parseBeanConfig(element, AC_PROVIDER_ELEMENT); acProviderConfig.setValidate(false); // JCR-1920 } return new WorkspaceSecurityConfig(acProviderConfig); } return null; }
/** * Read the optional WorkspaceSecurity Element of Workspace's configuration. * It uses the following format: * <pre> * <WorkspaceSecurity> * <AccessControlProvider class="..." (optional)> * </WorkspaceSecurity> * </pre> * * @param parent Workspace-Root-Element * @return a new <code>WorkspaceSecurityConfig</code> or <code>null</code> * if none is configured. * @throws ConfigurationException */ public WorkspaceSecurityConfig parseWorkspaceSecurityConfig(Element parent) throws ConfigurationException { BeanConfig acProviderConfig = null; Element element = getElement(parent, WSP_SECURITY_ELEMENT, false); if (element != null) { Element provFact = getElement(element, AC_PROVIDER_ELEMENT, false); if (provFact != null) { acProviderConfig = parseBeanConfig(element, AC_PROVIDER_ELEMENT); acProviderConfig.setValidate(false); // JCR-1920 } return new WorkspaceSecurityConfig(acProviderConfig); } return null; }