private static FontQualifier getQualfierFromConfiguration(Configuration cfg) throws FOPException { String fontFamily = cfg.getAttribute("font-family", null); if (fontFamily == null) { throw new FOPException("substitution qualifier must have a font-family"); } FontQualifier qualifier = new FontQualifier(); qualifier.setFontFamily(fontFamily); String fontWeight = cfg.getAttribute("font-weight", null); if (fontWeight != null) { qualifier.setFontWeight(fontWeight); } String fontStyle = cfg.getAttribute("font-style", null); if (fontStyle != null) { qualifier.setFontStyle(fontStyle); } return qualifier; }
private Attributes getAttributes(Configuration configuration) throws ConfigurationException { final AttributesImpl attributes = new AttributesImpl(); final String[] avalonAttributeNames = configuration.getAttributeNames(); if (avalonAttributeNames != null && avalonAttributeNames.length > 0) { for (int i = 0; i < avalonAttributeNames.length; ++i) { if (LOG.isDebugEnabled()) { LOG.debug("Adding attribute " + avalonAttributeNames[i] + " with value " + configuration.getAttribute(avalonAttributeNames[i])); } attributes.addAttribute("", avalonAttributeNames[i], avalonAttributeNames[i], "CDATA", configuration.getAttribute(avalonAttributeNames[i])); LOG.debug("In attributes: " + avalonAttributeNames[i] + " with value " + attributes.getValue(avalonAttributeNames[i])); } } return attributes; } }
/** * @param conf * @throws ConfigurationException */ private void setupSingleRefreshJob(final Configuration conf) throws ConfigurationException { try { String key = NetUtils.decode(conf.getAttribute(ATTR_KEY), "utf-8"); String uri = NetUtils.decode(conf.getAttribute(ATTR_URI), "utf-8"); long interval = conf.getAttributeAsLong(ATTR_INTERVAL); addRefreshSource(key, uri, 10, interval); } catch (UnsupportedEncodingException e) { /* Won't happen */ } }
public ProcessingNode buildNode(Configuration config) throws Exception { final Settings settings = (Settings)manager.lookup(Settings.ROLE); MountNode node = new MountNode( VariableResolverFactory.getResolver(config.getAttribute("uri-prefix"), manager), VariableResolverFactory.getResolver(config.getAttribute("src"), manager), this.treeBuilder.getProcessor().getWrappingProcessor(), config.getAttributeAsBoolean("check-reload", settings.isReloadingEnabled("sitemap")), config.getAttributeAsBoolean("pass-through", false) ); return (this.treeBuilder.setupNode(node, config)); } }
public ProcessingNode buildNode(Configuration config) throws Exception { String type = this.treeBuilder.getTypeForStatement(config, Reader.ROLE); String mimeType = config.getAttribute("mime-type", null); if (mimeType == null) { mimeType = ((SitemapLanguage)this.treeBuilder).getMimeType(Reader.ROLE, type); } ReadNode node = new ReadNode( type, VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager), VariableResolverFactory.getResolver(mimeType, this.manager), config.getAttributeAsInteger("status-code", -1) ); return this.treeBuilder.setupNode(node, config); } }
private static void createReferencedFontsMatcher(Configuration referencedFontsCfg, boolean strict, FontManager fontManager) throws FOPException { List matcherList = new java.util.ArrayList(); Configuration[] matches = referencedFontsCfg.getChildren("match"); for (int i = 0; i < matches.length; i++) { try { matcherList.add(new FontFamilyRegExFontTripletMatcher( matches[i].getAttribute("font-family"))); } catch (ConfigurationException ce) { LogUtil.handleException(log, ce, strict); continue; } } FontTriplet.Matcher orMatcher = new OrFontTripletMatcher( (FontTriplet.Matcher[])matcherList.toArray( new FontTriplet.Matcher[matcherList.size()])); fontManager.setReferencedFontsMatcher(orMatcher); }
/** * Avalon component lifecycle method */ @Override public void configure(Configuration conf) { globalGroupName = conf.getAttribute( TurbineModelManager.GLOBAL_GROUP_ATTR_NAME, TurbineModelManager.GLOBAL_GROUP_NAME); //cascadeDelete = conf.getAttributeAsBoolean( TurbineModelManager.CASCADE_DELETE_ATTR_NAME, false ); }
public boolean hasConfiguredLazyInit() { return this.configuration != null && this.configuration.getAttribute("lazy-init", null) != null; } }
/** * Retrieve a dynamic Configuration for a specific InputModule. * @param scheme InputModule name * @return Configuration for specified scheme, from the map:transformer block. */ private Configuration getConf(String scheme) { Configuration[] schemeConfs = this.conf.getChildren(); for (int i=0; i<schemeConfs.length; i++) { if (scheme.equals(schemeConfs[i].getAttribute("name", null))) { return schemeConfs[i]; } } return null; }
/** * Retrieve a dynamic configuration for a specific InputModule. * * @param scheme InputModule name * @return Configuration for specified scheme, from the map:transformer block. */ private Configuration getConf(String scheme) { Configuration[] schemeConfs = this.conf.getChildren("input-module"); for (int i = 0; i < schemeConfs.length; i++) { if (scheme.equals(schemeConfs[i].getAttribute("name", null))) { return schemeConfs[i]; } } return null; }
public void configure(Configuration config) throws ConfigurationException { this.startElement = new ElementData(); this.startElement.uri = config.getChild("start").getAttribute("uri", ""); this.startElement.loc = config.getChild("start").getAttribute("local-name", "form-instance"); this.startElement.raw = config.getChild("start").getAttribute("raw-name", "form-instance"); this.nameElement = new ElementData(); this.nameElement.uri = config.getChild("name").getAttribute("uri", ""); this.nameElement.loc = config.getChild("name").getAttribute("local-name", "form"); this.nameElement.raw = config.getChild("name").getAttribute("raw-name", "form"); this.qname = config.getChild("name").getAttribute("name-attribute", "name"); this.nameAsRoot = config.getChild("name-as-root").getValueAsBoolean(this.nameAsRoot); this.outputConf = config.getChild("output"); this.outputModuleName = this.outputConf.getAttribute("name",this.outputModuleName); }
public ProcessingNode buildNode(Configuration config) throws Exception { NamedContainerNode node = new NamedContainerNode(config.getAttribute(this.nameAttr)); this.setupNode(node, config); return node; } }
public ProcessingNode buildNode(Configuration config) throws Exception { String source = config.getAttribute("src"); this.node = new ScriptNode(source); this.treeBuilder.setupNode(this.node, config); return this.node; }
private static void createReferencedFontsMatcher(Configuration referencedFontsCfg, boolean strict, FontManager fontManager) throws FOPException { List matcherList = new java.util.ArrayList(); Configuration[] matches = referencedFontsCfg.getChildren("match"); for (int i = 0; i < matches.length; i++) { try { matcherList.add(new FontFamilyRegExFontTripletMatcher( matches[i].getAttribute("font-family"))); } catch (ConfigurationException ce) { LogUtil.handleException(log, ce, strict); continue; } } FontTriplet.Matcher orMatcher = new OrFontTripletMatcher( (FontTriplet.Matcher[])matcherList.toArray( new FontTriplet.Matcher[matcherList.size()])); fontManager.setReferencedFontsMatcher(orMatcher); }
/** * The category name is the value of the "category-name" child, or if not * present, the name of the configuration element. */ public void configure(Configuration config) throws ConfigurationException { super.configure(config); this.name = config.getChild("category-name").getValue(config.getAttribute("name")); }
private void initializeRoleManager( Configuration roleManagerConfig ) throws Exception { // Get the logger for the role manager Logger rmLogger = m_loggerManager.getLoggerForCategory( roleManagerConfig.getAttribute( "logger", "system.roles" ) ); // Setup the RoleManager DefaultRoleManager roleManager = new DefaultRoleManager(); roleManager.enableLogging( rmLogger ); roleManager.configure( roleManagerConfig ); m_roleManager = roleManager; }
private void initializeInstrumentManager( Configuration instrumentManagerConfig ) throws Exception { if( instrumentManagerConfig != null ) { // Get the logger for the instrument manager Logger imLogger = m_loggerManager.getLoggerForCategory( instrumentManagerConfig.getAttribute( "logger", "system.instrument" ) ); // Set up the Instrument Manager DefaultInstrumentManagerImpl instrumentManager = new DefaultInstrumentManagerImpl(); instrumentManager.enableLogging( imLogger ); instrumentManager.configure( instrumentManagerConfig ); instrumentManager.initialize(); m_instrumentManager = instrumentManager; } }
public ProcessingNode buildNode(Configuration config) throws Exception { HandleErrorsNode node = new HandleErrorsNode(config.getAttribute("when", "external")); this.treeBuilder.setupNode(node, config); // Set a flag that will prevent redirects ((SitemapLanguage) this.treeBuilder).setBuildingErrorHandler(true); try { // Get all children node.setChildren(buildChildNodes(config)); } finally { // And clear the flag ((SitemapLanguage) this.treeBuilder).setBuildingErrorHandler(false); } return node; } }
public ProcessingNode buildNode(Configuration config) throws Exception { String type = this.treeBuilder.getTypeForStatement(config, Generator.ROLE); this.views = ((SitemapLanguage)this.treeBuilder).getViewsForStatement(Generator.ROLE, type, config); this.pipelineHints = ((SitemapLanguage)this.treeBuilder).getHintsForStatement(Generator.ROLE, type, config); this.node = new GenerateNode( type, VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager) ); this.node.setPipelineHints(this.pipelineHints); return this.treeBuilder.setupNode(this.node, config); }
/** * @see org.apache.cocoon.components.treeprocessor.ProcessingNodeBuilder#buildNode(org.apache.avalon.framework.configuration.Configuration) */ public ProcessingNode buildNode(Configuration config) throws Exception { String type = this.treeBuilder.getTypeForStatement(config, Transformer.ROLE); this.views = ((SitemapLanguage)this.treeBuilder).getViewsForStatement(Transformer.ROLE, type, config); this.pipelineHints = ((SitemapLanguage)this.treeBuilder).getHintsForStatement(Transformer.ROLE, type, config); this.node = new TransformNode( type, VariableResolverFactory.getResolver(config.getAttribute("src", null), this.manager) ); this.node.setPipelineHints(this.pipelineHints); return this.treeBuilder.setupNode(node, config); }