Package org.apache.avalon.framework.parameters

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


        if (this.classLoaderClass != null) {
            try {
                this.classLoaderManager = (ClassLoaderManager)
                        ClassUtils.newInstance(this.classLoaderClass);
            } catch (Exception e) {
                throw new ParameterException("Unable to load class loader: "
                                             + this.classLoaderClass, e);
            }
        } else {
            try {
                getLogger().debug("Looking up " + ClassLoaderManager.ROLE);
                this.classLoaderManager = (ClassLoaderManager)
                        manager.lookup(ClassLoaderManager.ROLE);
            } catch (ServiceException e) {
                throw new ParameterException("Lookup of ClassLoaderManager failed", e);
            }
        }
    }
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) ) {
                        throw new ParameterException("Unknown event type for event " + id + ": " + 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);
                    }
                } catch (ConfigurationException ce) {
                    throw new ParameterException("Configuration exception" ,ce);
                }
            }
        }
    }
View Full Code Here

    public void parameterize(Parameters parameters) throws ParameterException {

        super.parameterize(parameters);
        this.interval = parameters.getParameterAsInteger("cleanupthreadinterval",1000*60*60); // 1 hour
        if(this.interval < 1) {
            throw new ParameterException("EventAwareCacheImpl cleanupthreadinterval parameter has to be greater then 1");
        }

        String eventRegistryName = parameters.getParameter("registry", EventRegistry.ROLE);
        try {
            this.m_eventRegistry = (EventRegistry)m_manager.lookup(eventRegistryName);
        } catch (ServiceException e) {
            throw new ParameterException("Unable to lookup registry: " + eventRegistryName, e);
        }
    }
View Full Code Here

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

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

    }
View Full Code Here

            final String dir = params.getParameter("directory");
            this.setDirectory(new File(dir));
        }
        catch (IOException e)
        {
            throw new ParameterException("Unable to set directory", e);
        }

        final String databaseName = params.getParameter("data-file", "store.dat");
        final String indexName = params.getParameter("index-file", "store.idx");
        final int order = params.getParameterAsInteger("order", 301);
View Full Code Here

        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

    {
        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.setHeapsize(params.getParameterAsInteger("heapsize",60000000));
        this.setCleanupthreadinterval(params.getParameterAsInteger("cleanupthreadinterval",10));
        this.setPriority(params.getParameterAsInteger("threadpriority",Thread.currentThread().getPriority()));

        if ((this.getFreememory() < 1)) {
            throw new ParameterException("StoreJanitorImpl freememory parameter has to be greater then 1");
        }
        if ((this.getHeapsize() < 1)) {
            throw new ParameterException("StoreJanitorImpl heapsize parameter has to be greater then 1");
        }
        if ((this.getCleanupthreadinterval() < 1)) {
            throw new ParameterException("StoreJanitorImpl cleanupthreadinterval parameter has to be greater then 1");
        }
        if ((this.getPriority() < 1)) {
            throw new ParameterException("StoreJanitorImpl threadpriority has to be greater then 1");
        }

        this.setStoreList(new ArrayList());
    }
View Full Code Here

    public void parameterize(Parameters params)
        throws ParameterException {
        this.mMaxobjects = params.getParameterAsInteger("maxobjects", 100);
        if ((this.mMaxobjects < 1)) {
            throw new ParameterException("MRUMemoryStore maxobjects must be "
                                         + "at least 1 milli second!");
        }
        this.mCache = new Hashtable((int) (this.mMaxobjects * 1.2));
        this.mMRUList = new LinkedList();
        this.mStorejanitor.register(this);
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.