Package org.apache.avalon.framework.parameters

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


                } catch (IOException e) {
                    // Legacy: Always was ignored
                }
            }
        } catch (IOException e) {
            throw new ParameterException("Unable to set directory", 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

    try {
      final String fileName = parameters.getParameter(PARAM_WRITE_FILE, DEFAULT_WRITE_FILE);
      final File file = new File(workDir, fileName);
        this.writeSource = this.resolver.resolveURI(file.toString());
    } catch (IOException ioe) {
        throw new ParameterException("Error getting write-source.", ioe);
    }
    if (!(this.writeSource instanceof ModifiableSource)) {
        throw new ParameterException("Write-source is not modifiable.");
    }
    if (getLogger().isDebugEnabled()) {
      getLogger().debug("Write source location: " + this.writeSource.getURI());
    }
  }
View Full Code Here

        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

                } catch (IOException e) {
                    // Ignored
                }
            }
        } catch (ContextException ce) {
            throw new ParameterException("Unable to get directory information from context.", ce);
        } catch (IOException e) {
            throw new ParameterException("Unable to set directory", e);
        }

        // get store configuration
        final String databaseName = params.getParameter("datafile", "cocoon.dat");
        final String indexName = params.getParameter("m_indexFile", "cocoon.idx");
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

     */
    public void parameterize(Parameters parameters) throws ParameterException {
        this.preemptiveLoaderURI = parameters.getParameter("preemptive-loader-url", null);
        if ( null != this.preemptiveLoaderURI
             && this.preemptiveLoaderURI.indexOf("://") == -1) {
            throw new ParameterException("The preemptive-loader-url must be absolute: " + this.preemptiveLoaderURI);
        }
        final String storeRole = parameters.getParameter("use-store", Store.ROLE);
        try {
            this.store = (Store)this.manager.lookup(storeRole);
        } catch (ServiceException e) {
            throw new ParameterException("Unable to lookup store with role " + storeRole, e);
        }
        this.defaultCacheStorage = new StoreIncludeCacheStorageProxy(this.store, this.getLogger());
    }
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

                } catch (IOException e) {
                    // Ignored
                }
            }
        } catch (ContextException ce) {
            throw new ParameterException("Unable to get directory information from context.", ce);
        } catch (IOException e) {
            throw new ParameterException("Unable to set directory", e);
        }

        // get store configuration
        final String databaseName = params.getParameter("datafile", "cocoon.dat");
        final String indexName = params.getParameter("m_indexFile", "cocoon.idx");
View Full Code Here

*/
public class DefaultTransientStore extends MRUMemoryStore {
   
    public void parameterize(Parameters params) throws ParameterException {
        if (params.getParameterAsBoolean("use-persistent-cache", false)) {
            throw new ParameterException("A transient store cannot be backed by a persistent store.");
        }
        super.parameterize(params);
    }
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.