Package org.apache.avalon.framework.parameters

Examples of org.apache.avalon.framework.parameters.ParameterException


        int percent = params.getParameterAsInteger("percent_to_free", 10);
        this.invokeGC = params.getParameterAsBoolean("invokegc", this.invokeGC);
       
        if (getMinFreeMemory() < 1)
        {
            throw new ParameterException("StoreJanitorImpl freememory parameter has to be greater then 1");
        }
        if (getMaxHeapSize() < 1)
        {
            throw new ParameterException("StoreJanitorImpl heapsize parameter has to be greater then 1");
        }
        if (getThreadInterval() < 1)
        {
            throw new ParameterException("StoreJanitorImpl cleanupthreadinterval parameter has to be greater then 1");
        }
        if (getPriority() < 1 || getPriority() > 10)
        {
            throw new ParameterException("StoreJanitorImpl threadpriority has to be between 1 and 10");
        }
        if (percent > 100 && percent < 1)
        {
            throw new ParameterException("StoreJanitorImpl percent_to_free, has to be between 1 and 100");
        }

        this.fraction = percent / 100.0D;
        setStoreList(new ArrayList());
       
View Full Code Here


    {
        m_maxobjects = params.getParameterAsInteger( "maxobjects", 100 );
        m_persistent = params.getParameterAsBoolean( "use-persistent-cache", false );
        if( ( m_maxobjects < 1 ) )
        {
            throw new ParameterException( "MRUMemoryStore maxobjects must be at least 1!" );
        }

        if ( m_persistent )
        {
            if( getLogger().isDebugEnabled() )
            {
                getLogger().debug( "Looking up " + Store.PERSISTENT_STORE );
            }
            try
            {
                m_persistentStore = (Store)m_manager.lookup( Store.PERSISTENT_STORE );
            }
            catch (ServiceException se)
            {
                throw new ParameterException("Unable to look up persistent store.", se);
            }
        }

        m_cache = new Hashtable( (int)( m_maxobjects * 1.2 ) );
        m_mrulist = new LinkedList();
View Full Code Here

        this.priority = params.getParameterAsInteger("threadpriority", Thread.currentThread().getPriority());
        int percent = params.getParameterAsInteger("percent_to_free", 10);
        this.invokeGC = params.getParameterAsBoolean("invokegc", this.invokeGC);

        if (getMinFreeMemory() < 1) {
            throw new ParameterException("StoreJanitorImpl freememory parameter has to be greater then 1");
        }
        if (getMaxHeapSize() < 1) {
            throw new ParameterException("StoreJanitorImpl heapsize parameter has to be greater then 1");
        }
        if (getThreadInterval() < 1) {
            throw new ParameterException("StoreJanitorImpl cleanupthreadinterval parameter has to be greater then 1");
        }
        if (getPriority() < 1 || getPriority() > 10) {
            throw new ParameterException("StoreJanitorImpl threadpriority has to be between 1 and 10");
        }
        if (percent > 100 && percent < 1) {
            throw new ParameterException("StoreJanitorImpl percent_to_free, has to be between 1 and 100");
        }

        this.fraction = percent / 100.0D;
        this.storelist = new ArrayList();
View Full Code Here

                    setDirectory(workDir);
                } catch (IOException e) {
                }
            }
        } catch (IOException e) {
            throw new ParameterException("Unable to set directory", e);
        }

    }
View Full Code Here

    public void parameterize(Parameters parameters) throws ParameterException {
        String storeName = parameters.getParameter("store", Store.ROLE);
        try {
            this.store = (Store)this.manager.lookup(storeName);
        } catch (ServiceException e) {
            throw new ParameterException("Unable to lookup store: " + storeName, e);
        }
    }
View Full Code Here

    // lookup parameter 'host'
    try {
      host = parameters.getParameter("host");
      // test if host is not the empty string
      if (host == "") {
        throw new ParameterException("The parameter 'host' may not be the empty string");
      }
    } catch (ParameterException pe) {
      // rethrow as a ProcessingException
      throw new ProcessingException("Parameter 'host' not specified",pe);
    }
   
    String bindname;
   
    // lookup parameter 'bindname'
    try {
      bindname = parameters.getParameter("bindname");
      // test if bindname is not the empty string
      if (bindname == "") {
        throw new ParameterException("The parameter 'bindname' may not be the empty string");
      }
    } catch (ParameterException pe) {
      // rethrow as a ProcessingException
      throw new ProcessingException("Parameter 'bindname' not specified",pe);
    }
View Full Code Here

        // Test if we are running inside a WAR file
        if(dbPath.startsWith(ServerImpl.CONTEXT_PROTOCOL)) {
            dbPath = this.cocoonContext.getRealPath(dbPath.substring(ServerImpl.CONTEXT_PROTOCOL.length()));
        }
        if (dbPath == null) {
            throw new ParameterException("The hsqldb cannot be used inside a WAR file. " +
                                         "Real path for <" + dbPath + "> is null.");
        }

        String dbName = params.getParameter("name", DEFAULT_DB_NAME);
        try {
            hsqlServer.setDatabasePath(0, new File(dbPath).getCanonicalPath() + File.separator + dbName);
        } catch (IOException e) {
            throw new ParameterException("Could not get database directory <" + dbPath + ">", e);
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Database path is <" + hsqlServer.getDatabasePath(0, true) + ">");
        }
View Full Code Here

                source = resolver.resolveURI(configurationFile);
                SAXConfigurationHandler handler = new SAXConfigurationHandler();
                SourceUtil.toSAX(source, handler);
                config = handler.getConfiguration();
            } catch (ProcessingException se) {
                throw new ParameterException("Unable to read configuration from " + configurationFile, se);
            } catch (SAXException se) {
                throw new ParameterException("Unable to read configuration from " + configurationFile, se);
            } catch (IOException ioe) {
                throw new ParameterException("Unable to read configuration from " + configurationFile, ioe);
            } finally {
                resolver.release(source);
            }
        } catch (ServiceException se) {
            throw new ParameterException("Unable to lookup source resolver.", se);
        } finally {
            this.manager.release(resolver);
        }
        Configuration[] events = config.getChild("events").getChildren("event");
        if ( events != null ) {
            for(int i=0; i<events.length;i++) {
                try {
                    final String type = events[i].getAttribute("type");
                    final String id = events[i].getAttribute("id");
                    if ( "jxpath".equals(type) ) {
                        if ( this.eventMap.containsKey(id)) {
                            throw new ParameterException("The id for the event " + id + " is not unique.");
                        }
                        final String targetType = events[i].getChild("targettype").getValue();
                        final String targetId = events[i].getChild("targetid").getValue();
                        final String path = events[i].getChild("path").getValue();
                        if ( "layout".equals(targetType) ) {
                            LayoutMapping mapping = new LayoutMapping();
                            mapping.layoutId = targetId;
                            mapping.path = path;
                            this.eventMap.put(id, mapping);
                        } else if ( "coplet".equals(targetType) ) {
                            CopletMapping mapping = new CopletMapping();
                            mapping.copletId = targetId;
                            mapping.path = path; 
                            this.eventMap.put(id, mapping);
                        } else {
                            throw new ParameterException("Unknown target type " + targetType);
                        }
                    } else if ( "fullscreen".equals(type) ) {
                        if ( this.eventMap.containsKey(id)) {
                            throw new ParameterException("The id for the event " + id + " is not unique.");
                        }
                        final String targetId = events[i].getChild("targetid").getValue();
                        final String layoutId = events[i].getChild("layoutid").getValue();
                        FullScreenMapping mapping = new FullScreenMapping();
                        mapping.copletId = targetId;
                        mapping.layoutId = layoutId;
                        this.eventMap.put(id, mapping);                       
                    } else {
                        throw new ParameterException("Unknown event type for event " + id + ": " + type);                       
                    }
                } catch (ConfigurationException ce) {
                    throw new ParameterException("Configuration exception" ,ce);
                }
            }
        }
       
        // Nullify config filename so as not to reload it.
View Full Code Here

        pc.xsltRole = configuration.getParameter("xslt-processor-role", XSLTProcessor.ROLE);
        String stylesheet = configuration.getParameter("style");
        try {
            pc.stylesheet = this.variableFactory.lookup( stylesheet );
        } catch (PatternException pe) {
            throw new ParameterException("Unknown pattern for stylesheet " + stylesheet, pe);
        }
        this.variables.add(pc.stylesheet);
        if (this.parameters != null) {
            String[] name = this.parameters.getNames();
            for (int i=0; i < name.length; ++i) {
                try {
                    VariableResolver resolver =
                        this.variableFactory.lookup(this.parameters.getParameter(name[i]));
                    this.variables.add(resolver);
                    pc.parameters.put(name[i], resolver);
                } catch (PatternException e) {
                    throw new ParameterException("Invalid value for parameter " + name[i], e);
                }
            }
        }
        return pc;
    }
View Full Code Here

        String compilerClass = params.getParameter("compiler");
        try {
            this.compilerClass = ClassUtils.loadClass(compilerClass);
        } catch (ClassNotFoundException e) {
            throw new ParameterException("Unable to load compiler: " + compilerClass, e);
        }
        this.deleteSources = params.getParameterAsBoolean("delete-sources", false);
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.parameters.ParameterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.