/** * Check if the namespace URI of the given configuraition is the same as the * one given by the builder. */ protected void checkNamespace(Configuration config) throws ConfigurationException { if (!this.treeBuilder.getNamespace().equals(config.getNamespace())) { String msg = "Invalid namespace '" + config.getNamespace() + "' at " + config.getLocation(); throw new ConfigurationException(msg); } } }
public Location getLocation(Object obj, String description) { if (obj instanceof Configuration) { Configuration config = (Configuration)obj; String locString = config.getLocation(); Location result = LocationUtils.parse(locString); if (LocationUtils.isKnown(result)) { // Add description StringBuffer desc = new StringBuffer().append('<'); // Unfortunately Configuration.getPrefix() is not public try { if (config.getNamespace().startsWith("http://apache.org/cocoon/sitemap/")) { desc.append("map:"); } } catch (ConfigurationException e) { // no namespace: ignore } desc.append(config.getName()).append('>'); return new LocationImpl(desc.toString(), result); } else { return result; } } // Try next finders. return null; } };
namespace = config.getNamespace(); } catch (ConfigurationException e) {
final String nsURI = element.getNamespace(); String nsPrefix = "";
for (int i = 0; i < properties.length; ++i) { Configuration configuration = properties[i]; namespace = configuration.getNamespace(); if (namespace == null) { namespace = "";
/** * Copy constructor, to create a clone of another configuration. * To modify children, use <code>getChild()</code>, * <code>removeChild()</code> and <code>addChild()</code>. * * @param config the <code>Configuration</code> to copy * @param deepCopy true will cause clones of the children to be added, * false will add the original instances and is thus * faster. * * @throws ConfigurationException if an error occurs when copying */ public DefaultConfiguration( Configuration config, boolean deepCopy ) throws ConfigurationException { this( config.getName(), config.getLocation(), config.getNamespace(), ( (config instanceof AbstractConfiguration) ? ((AbstractConfiguration)config).getPrefix() : "") ); addAll( config, deepCopy ); }
for (int i = 0; i < properties.length; ++i) { Configuration configuration = properties[i]; namespace = configuration.getNamespace(); if (namespace == null) { namespace = "";
final Configuration configuration ) throws ConfigurationException { final Element element = document.createElementNS( configuration.getNamespace(), configuration.getName() ); element.setPrefix( configuration.getLocation() ); final String content = configuration.getValue( null );
m_namespace = config.getNamespace(); m_prefix = (config instanceof AbstractConfiguration) ? ((AbstractConfiguration)config).getPrefix() : "";
/** * Get the tree builder role from the sitemap program (as a configuration object). * This method should report very any problem very clearly, as it is the entry point of any * Cocoon application. * * @param sitemapProgram the sitemap * @return the treebuilder role * @throws ConfigurationException if a suitable role could not be found */ private TreeBuilder getTreeBuilder(Configuration sitemapProgram) throws ConfigurationException { String ns = sitemapProgram.getNamespace(); RE re = new RE("http://apache.org/cocoon/sitemap/(\\d\\.\\d)"); if (!re.match(ns)) { throw new ConfigurationException("Unknown sitemap namespace (" + ns + ") at " + this.source.getURI()); } String version = re.getParen(1); String result = TreeBuilder.ROLE + "/sitemap-" + version; try { return (TreeBuilder) this.manager.lookup(result); } catch (Exception e) { throw new ConfigurationException("This version of Cocoon does not handle sitemap version " + version + " at " + this.source.getURI(), e); } }
this.itsNamespace = tree.getNamespace();
componentConfig = new DefaultConfiguration("components", config.getLocation(), config.getNamespace(), ""); componentConfig.getNamespace(), ""); c.addAll(componentConfig);