Package org.apache.avalon.framework.parameters

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


      // Will use specific class
      getLogger().debug("Using factory " + factoryName);
      try {
        this.tfactoryClass = ClassUtils.loadClass(factoryName);
      } catch(ClassNotFoundException cnfe) {
        throw new ParameterException("Cannot load TransformerFactory class", cnfe);
      }

      if (! TransformerFactory.class.isAssignableFrom(tfactoryClass)) {
        throw new ParameterException("Class " + factoryName + " isn't a TransformerFactory");
      }
    }
  }
View Full Code Here


            // Will use specific class
            getLogger().debug("Using factory " + factoryName);
            try {
                this.tfactoryClass = ClassUtils.loadClass(factoryName);
            } catch(ClassNotFoundException cnfe) {
                throw new ParameterException("Cannot load TransformerFactory class", cnfe);
            }

            if (! TransformerFactory.class.isAssignableFrom(tfactoryClass)) {
                throw new ParameterException("Class " + factoryName + " isn't a TransformerFactory");
            }
        }
    }
View Full Code Here

                } catch (IOException e) {
                    // Legacy: Always was ignored
                }
            }
        } catch (IOException e) {
            throw new ParameterException("Unable to set directory", e);
        }
    }
View Full Code Here

            }
            catch (Throwable t)
            {
                String msg = "Parameterizing the following service failed : " + this.getShorthand();
                this.getParentLogger().error(msg,t);
                throw new ParameterException(msg,t);
            }
        }
    }
View Full Code Here

        int percent = params.getParameterAsInteger("percent_to_free", 10);
        this.invokeGC = params.getParameterAsBoolean("invokegc", this.invokeGC);
        this.freeingAlgorithm = params.getParameter("freeingalgorithm", ALG_ROUND_ROBIN);

        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");
        }

        if (!(this.freeingAlgorithm.equals(ALG_ROUND_ROBIN) || this.freeingAlgorithm.equals(ALG_ALL_STORES))) {
            throw new ParameterException("StoreJanitorImpl freeingAlgorithm, has to be 'round-robin' or 'all-stores'. '" +
                                         this.freeingAlgorithm + "' is not supported.");
        }

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

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

    }
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 an unexpanded WAR file. " +
                                         "Real path for <" + dbCfgPath + "> is null.");
        }

        String dbName = params.getParameter("name", DEFAULT_DB_NAME);
        try {
            hsqlServer.setDatabasePath(0, new File(dbPath).getCanonicalPath() + File.separator + dbName);
            hsqlServer.setDatabaseName(0, 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

        try {
          try {
            resolver = (org.apache.excalibur.source.SourceResolver) this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
            source = resolver.resolveURI(configurationFile);
          } catch (IOException ioe) {
        throw new ParameterException("Unable to read configuration from " + configurationFile, ioe);
          } catch (ServiceException se) {
          throw new ParameterException("Unable to lookup source resolver.", se);
          }
          SourceValidity newValidity = source.getValidity();
          if ( this.oldValidity == null
                 || this.oldValidity.isValid() == SourceValidity.INVALID
                 || this.oldValidity.isValid(newValidity) == SourceValidity.INVALID)  {
                this.oldValidity = newValidity;
            try {
              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);
            }
            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);
                }
              }
            }
          }
        } finally {
View Full Code Here

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

        }
       
        try {
            this.cache = (Cache)this.manager.lookup(cacheRole);
        } catch (ComponentException ce) {
            throw new ParameterException("Unable to lookup cache: " + cacheRole, ce);
        }
    }
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.