/** * Parses a named bean configuration from the given element. * Bean configuration uses the following format: * <pre> * <BeanName class="..."> * <param name="..." value="..."/> * ... * </BeanName> * </pre> * <p> * The returned bean configuration object contains the configured * class name and configuration parameters. Variable replacement * is performed on the parameter values. * * @param parent parent element * @param name name of the bean configuration element * @return bean configuration, * @throws ConfigurationException if the configuration element does not * exist or is broken */ protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException { // Bean configuration element Element element = getElement(parent, name); return parseBeanConfig(element); }
/** * Parses the given XML document and returns the DOM root element. * A custom entity resolver is used to make the included configuration * file DTD available using the specified public identifiers. * This implementation does not validate the XML. * * @see ConfigurationEntityResolver * @param xml xml document * @return root element * @throws ConfigurationException if the configuration document could * not be read or parsed */ protected Element parseXML(InputSource xml) throws ConfigurationException { return parseXML(xml, false); }
DocumentBuilder builder = factory.newDocumentBuilder(); if (validate) { builder.setErrorHandler(getErrorHandler()); builder.setEntityResolver(getEntityResolver()); Document document = builder.parse(xml); return postParseModificationHook(document).getDocumentElement(); } catch (ParserConfigurationException e) { throw new ConfigurationException(
/** * Parses a named bean configuration from the given element. * Bean configuration uses the following format: * <pre> * <BeanName class="..."> * <param name="..." value="..."/> * ... * </BeanName> * </pre> * <p> * The returned bean configuration object contains the configured * class name and configuration parameters. Variable replacement * is performed on the parameter values. * * @param element * @return bean configuration, * @throws ConfigurationException if the configuration element does not * exist or is broken */ protected BeanConfig parseBeanConfig(Element element) throws ConfigurationException { // Bean implementation class String className = getAttribute(element, CLASS_ATTRIBUTE); // Bean properties Properties properties = parseParameters(element); return new BeanConfig(className, properties); }
/** * Creates a new workspace configuration with the specified name. This * method uses the provided workspace <code>template</code> to create the * repository config instead of the template that is present in the * repository configuration. * <p> * This method creates a workspace configuration subdirectory, * copies the workspace configuration template into it, and finally * adds the created workspace configuration to the repository. * The initialized workspace configuration object is returned to * the caller. * * @param name workspace name * @param template the workspace template * @return created workspace configuration * @throws ConfigurationException if creating the workspace configuration * failed */ public WorkspaceConfig createWorkspaceConfig(String name, InputSource template) throws ConfigurationException { ConfigurationParser parser = new ConfigurationParser(new Properties()); Element workspaceTemplate = parser.parseXML(template); return internalCreateWorkspaceConfig(name, workspaceTemplate, null); }
/** * {@inheritDoc} */ @Override protected BeanConfig parseBeanConfig(Element element) throws ConfigurationException { BeanConfig cfg = super.parseBeanConfig(element); cfg.setConnectionFactory(connectionFactory); cfg.setInstanceFactory(beanFactory); configVisitor.visit(cfg); return cfg; }
/** * Returns the named child of the given parent element. * * @param parent parent element * @param name name of the child element * @return named child element * @throws ConfigurationException * @throws ConfigurationException if the child element is not found */ protected Element getElement(Element parent, String name) throws ConfigurationException { return getElement(parent, name, true); }
replaceVariables(value.getValue()));
DocumentBuilder builder = factory.newDocumentBuilder(); if (validate) { builder.setErrorHandler(getErrorHandler()); builder.setEntityResolver(getEntityResolver()); Document document = builder.parse(xml); return postParseModificationHook(document).getDocumentElement(); } catch (ParserConfigurationException e) { throw new ConfigurationException(
/** * Parses a named bean configuration from the given element. * Bean configuration uses the following format: * <pre> * <BeanName class="..."> * <param name="..." value="..."/> * ... * </BeanName> * </pre> * <p> * The returned bean configuration object contains the configured * class name and configuration parameters. Variable replacement * is performed on the parameter values. * * @param element * @return bean configuration, * @throws ConfigurationException if the configuration element does not * exist or is broken */ protected BeanConfig parseBeanConfig(Element element) throws ConfigurationException { // Bean implementation class String className = getAttribute(element, CLASS_ATTRIBUTE); // Bean properties Properties properties = parseParameters(element); return new BeanConfig(className, properties); }
/** * Creates a new workspace configuration with the specified name. This * method uses the provided workspace <code>template</code> to create the * repository config instead of the template that is present in the * repository configuration. * <p> * This method creates a workspace configuration subdirectory, * copies the workspace configuration template into it, and finally * adds the created workspace configuration to the repository. * The initialized workspace configuration object is returned to * the caller. * * @param name workspace name * @param template the workspace template * @return created workspace configuration * @throws ConfigurationException if creating the workspace configuration * failed */ public WorkspaceConfig createWorkspaceConfig(String name, InputSource template) throws ConfigurationException { ConfigurationParser parser = new ConfigurationParser(new Properties()); Element workspaceTemplate = parser.parseXML(template); return internalCreateWorkspaceConfig(name, workspaceTemplate, null); }
/** * {@inheritDoc} */ @Override protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException { BeanConfig cfg = super.parseBeanConfig(parent, name); cfg.setConnectionFactory(connectionFactory); cfg.setInstanceFactory(beanFactory); configVisitor.visit(cfg); return cfg; }
/** * Returns the named child of the given parent element. * * @param parent parent element * @param name name of the child element * @return named child element * @throws ConfigurationException * @throws ConfigurationException if the child element is not found */ protected Element getElement(Element parent, String name) throws ConfigurationException { return getElement(parent, name, true); }
replaceVariables(value.getValue()));
/** * Parses a named bean configuration from the given element. * Bean configuration uses the following format: * <pre> * <BeanName class="..."> * <param name="..." value="..."/> * ... * </BeanName> * </pre> * <p> * The returned bean configuration object contains the configured * class name and configuration parameters. Variable replacement * is performed on the parameter values. * * @param parent parent element * @param name name of the bean configuration element * @return bean configuration, * @throws ConfigurationException if the configuration element does not * exist or is broken */ protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException { // Bean configuration element Element element = getElement(parent, name); return parseBeanConfig(element); }
/** * {@inheritDoc} */ @Override protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException { BeanConfig cfg = super.parseBeanConfig(parent, name); cfg.setConnectionFactory(connectionFactory); cfg.setInstanceFactory(beanFactory); configVisitor.visit(cfg); return cfg; }
/** * Parses the given XML document and returns the DOM root element. * A custom entity resolver is used to make the included configuration * file DTD available using the specified public identifiers. * This implementation does not validate the XML. * * @see ConfigurationEntityResolver * @param xml xml document * @return root element * @throws ConfigurationException if the configuration document could * not be read or parsed */ protected Element parseXML(InputSource xml) throws ConfigurationException { return parseXML(xml, false); }
/** * {@inheritDoc} */ @Override protected BeanConfig parseBeanConfig(Element element) throws ConfigurationException { BeanConfig cfg = super.parseBeanConfig(element); cfg.setConnectionFactory(connectionFactory); cfg.setInstanceFactory(beanFactory); configVisitor.visit(cfg); return cfg; }