Refine search
/** * Get the type for a statement : it returns the 'type' attribute if * present, and otherwhise the default type defined for this role in the * components declarations. * * @throws ConfigurationException * if the type could not be found. */ public String getTypeForStatement(Configuration statement, String role) throws ConfigurationException { // Get the component type for the statement String type = statement.getAttribute("type", null); if (type == null) { type = this.itsComponentInfo.getDefaultType(role); } if (type == null) { throw new ConfigurationException("No default type exists for 'map:" + statement.getName() + "' at " + statement.getLocation()); } final String beanName = role + '/' + type; if ( !this.itsContainer.containsBean(beanName) ) { throw new ConfigurationException("Type '" + type + "' does not exist for 'map:" + statement.getName() + "' at " + statement.getLocation()); } return type; }
/** * Configure user manager - third step. */ public void configure(Configuration config) throws ConfigurationException { mConfig = config; Configuration adminConf = mConfig.getChild("ftp-admin-name", false); mstAdminName = "admin"; if(adminConf != null) { mstAdminName = adminConf.getValue(mstAdminName); } mBaseDirectory = config.getChild("base-directory").getValue(null); if(mBaseDirectory == null) throw new ConfigurationException("Missing configuration element 'base-directory'"); }
configuration.getChild( "datasource", true ).getValue(); configuration.getChild( "normalized", true ).getValueAsBoolean( false ); throw new ConfigurationException( "Cannot lookup data source", ne );
configuration.getChild( "connection-factory", true ).getValue(); configuration.getChild( "destination", true ); final String destinationName = destinationConf.getValue(); throw new ConfigurationException( "Cannot lookup object", nnfe ); throw new ConfigurationException( "Cannot get naming context", ne );
/** * Configure user manager - third step. */ public void configure(Configuration config) throws ConfigurationException { mConfig = config; // get server address Configuration tmpConf = mConfig.getChild("allow-ip", false); mbAllowIp = false; if(tmpConf != null) { mbAllowIp = tmpConf.getValueAsBoolean(mbAllowIp); } mBaseDirectory = config.getChild("base-directory").getValue(null); if(mBaseDirectory == null) throw new ConfigurationException("Missing configuration element 'base-directory'"); }
private RoleEntry[] mapFromFortress(Configuration roleConfiguration) throws ConfigurationException { Validate.notNull(roleConfiguration, "roleConfiguration"); throw new ConfigurationException("Not supported yet"); } }
public void setupInstructions(Configuration conf) throws ConfigurationException { Configuration[] instructionSets = conf.getChildren("instructions"); for (int i = 0; i < instructionSets.length; i++) { Configuration instructionSet = instructionSets[i]; String namespace = instructionSet.getAttribute("targetNamespace", ""); Configuration[] instr = instructionSet.getChildren("instruction"); for (int j = 0; j < instr.length; j++) { Configuration currentInstruction = instr[j]; String name = currentInstruction.getAttribute("name"); if (name == null) throw new ConfigurationException("@name for instruction required"); String className = currentInstruction.getAttribute("class"); if (className == null) throw new ConfigurationException("@class for instruction required"); registerInstruction(name, namespace, className); } } }
throws ConfigurationException final String type = conf.getAttribute( "type" ); conf.getChild( "offset", true ).getValueAsInteger( 0 ); final int period = conf.getChild( "period", true ).getValueAsInteger( -1 ); throw new ConfigurationException( "Unknown trigger type" );
final Configuration configChild = conf.getChild( "address", false ); if( null == configChild ) throw new ConfigurationException( "target address not specified in the config" ); address = InetAddress.getByName( configChild.getAttribute( "hostname" ) ); throw new ConfigurationException( "Host specified in datagram target adress is unknown!", uhex ); int port = configChild.getAttributeAsInteger( "port" ); final Formatter formatter = getFormatter( conf.getChild( "format", false ) ); throw new ConfigurationException( "Failed to create target!", ioex );
/** * Configure the tree processor: * <processor file="{Location of the sitemap}" * check-reload="{true|false}" * config="{Location of sitemap tree processor config}> * <reload delay="10"/> * </processor> * * Only the file attribute is required; everything else is optional. * * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) */ public void configure(Configuration config) throws ConfigurationException { this.checkReload = config.getAttributeAsBoolean("check-reload", this.settings.isReloadingEnabled("sitemap")); // Reload check delay. Default is 1 second. this.lastModifiedDelay = config.getChild("reload").getAttributeAsLong("delay", this.settings.getReloadDelay("sitemap")); String fileName = config.getAttribute("file", "sitemap.xmap"); try { this.source = new DelayedRefreshSourceWrapper(this.resolver.resolveURI(fileName), lastModifiedDelay); } catch (Exception e) { throw new ConfigurationException("Cannot resolve " + fileName, e); } }
/** * Check that all top level elements are named proxool and hand them to * {@link XMLConfigurator}. * @param configuration the configuration handed over by the Avalon Framework. * @throws ConfigurationException if the configuration fails. */ public void configure(Configuration configuration) throws ConfigurationException { final XMLConfigurator xmlConfigurator = new XMLConfigurator(); this.closeOnDispose = configuration.getAttributeAsBoolean(CLOSE_ON_DISPOSE_ATTRIBUTE, true); final Configuration[] children = configuration.getChildren(); for (int i = 0; i < children.length; ++i) { if (!children[i].getName().equals(ProxoolConstants.PROXOOL)) { throw new ConfigurationException("Found element named " + children[i].getName() + ". Only " + ProxoolConstants.PROXOOL + " top level elements are alowed."); } } try { xmlConfigurator.startDocument(); reportProperties(xmlConfigurator, configuration.getChildren()); xmlConfigurator.endDocument(); } catch (SAXException e) { throw new ConfigurationException("", e); } }
protected LogTarget createTarget( final File file, final Configuration configuration ) throws ConfigurationException final Configuration confAppend = configuration.getChild( "append" ); final boolean append = confAppend.getValueAsBoolean( false ); final Configuration confFormat = configuration.getChild( "format" ); final Formatter formatter = getFormatter( confFormat ); throw new ConfigurationException( error ); final Configuration confStrategy = confRotation.getChildren()[ 0 ]; throw new ConfigurationException( "cannot create FileTarget", ioe );
/** * Configure the component. * * @param configuration the configuration */ public void configure(Configuration configuration) throws ConfigurationException { this.directory = configuration.getChild(ConfigurationKeys.ROOT_DIRECTORY).getValue(""); String cacheRole = configuration.getChild(ConfigurationKeys.STORE_ROLE).getValue(Store.TRANSIENT_STORE); try { this.cache = (Store) this.manager.lookup(cacheRole); } catch (ServiceException e) { throw new ConfigurationException("Unable to lookup store '" + cacheRole + "'"); } this.interval = configuration.getChild(ConfigurationKeys.RELOAD_INTERVAL).getValueAsLong(60000L); if (getLogger().isDebugEnabled()) { getLogger().debug("Bundle directory '" + this.directory + "'"); getLogger().debug("Store role '" + cacheRole + "'"); } }
/** * create a LogTarget based on a Configuration */ public final LogTarget createTarget( final Configuration configuration ) throws ConfigurationException { if( m_context == null ) { throw new ConfigurationException( "Context not available." ); } final String contextkey = m_configuration.getAttribute( "context-key", "servlet-context" ); final ServletContext sctx; final Configuration confFormat = configuration.getChild( "format" ); final Formatter formatter = getFormatter( confFormat ); try { sctx = (ServletContext)m_context.get( contextkey ); } catch( final ContextException ce ) { throw new ConfigurationException( "Cannot find ServletContext object in " + "application context", ce ); } return new ServletOutputLogTarget( sctx, formatter ); }
/** * Create a LogTarget based on a Configuration */ public LogTarget createTarget( final Configuration configuration ) throws ConfigurationException { OutputStream stream; final Configuration streamConfig = configuration.getChild( "stream", false ); if( null == streamConfig ) { stream = System.err; } else { final String streamName = streamConfig.getValue(); try { stream = (OutputStream)m_context.get( streamName ); } catch( Exception e ) { throw new ConfigurationException( "Error resolving stream '" + streamName + "' at " + streamConfig.getLocation(), e ); } } final Configuration formatterConf = configuration.getChild( "format" ); final Formatter formatter = getFormatter( formatterConf ); return new StreamTarget( stream, formatter ); }
public ProcessingNode buildNode(Configuration config) throws Exception { throw new ConfigurationException("'map:redirect' is forbidden inside a 'map:handle-errors', at " + config.getLocation()); this.resourceName = config.getAttribute("resource", null); if (this.resourceName != null) { config.getLocation());
component.getAttribute( "activation", m_defaultActivationPolicy ); final String classname = component.getAttribute( "class", null ); + "at " + component.getLocation(); throw new ConfigurationException( message );
final String name = target.getAttribute( "name" ); String location = target.getAttribute( "location" ).trim(); final String format = target.getAttribute( "format", DEFAULT_FORMAT ); final boolean append = target.getAttributeAsBoolean( "append", true ); "Error creating LogTarget named \"" + name + "\" for file " + file + ". (Reason: " + ioe.getMessage() + ")."; throw new ConfigurationException( message, ioe );
protected void convert(String relativePath) throws Exception { if (this.logger.isDebugEnabled()) { this.logger.debug("Reading Avalon configuration from " + relativePath); } Resource root = this.resolver.getResource(getUrl(relativePath, null)); final DefaultConfigurationBuilder b = new DefaultConfigurationBuilder(true); final Configuration config = b.build(this.getInputSource(root)); // validate cocoon.xconf if (!"cocoon".equals(config.getName())) { throw new ConfigurationException("Invalid configuration file\n" + config); } if (this.logger.isDebugEnabled()) { this.logger.debug("Configuration version: " + config.getAttribute("version")); } if (!Constants.CONF_VERSION.equals(config.getAttribute("version"))) { throw new ConfigurationException("Invalid configuration schema version. Must be '" + Constants.CONF_VERSION + "'."); } convert(config, null, getUrl(root)); }
protected boolean isParameter(Configuration config) throws ConfigurationException { final String name = config.getName(); if (name.equals("parameter")) { if (this.hasParameters()) { return true; } String msg = "Element '" + name + "' has no parameters at " + config.getLocation(); throw new ConfigurationException(msg); } return false; }