Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.ConfigurationException


            String clerkName = properties.getProperty(BPEL_UDDI_CLERK, DEFAULT_BPEL_UDDI_CLERK);
        bpelClerk = clerks.get(clerkName);
        //Add the properties from the uddi.xml
        properties.putAll(bpelClerk.getUDDINode().getProperties());
        if (bpelClerk==null) {
          throw new ConfigurationException("Could not find UDDI Clerk named "+ bpelClerk.getName());
        }
        this.properties = properties;
        urlLocalizer = new JBossURLLocalizer(properties);
      } catch (Exception e) {
        log.error(e.getMessage(),e);
View Full Code Here


      String[] rules = values;
      value2factoryClass = new Object2ObjectLinkedOpenHashMap<String,Class<? extends DocumentFactory>>();
      int i, m = rules.length;
      for ( i = 0; i < m; i++ ) {
        int pos = rules[ i ].indexOf( ':' );
        if ( pos <= 0 || pos == rules[ i ].length() - 1 ) throw new ConfigurationException( "Rule " + rules[ i ] + " does not contain a colon or it is malformed" );
        if ( rules[ i ].indexOf( ':', pos + 1 ) >= 0 ) throw new ConfigurationException( "Rule " + rules[ i ] + " contains too many colons" );
        String factoryName = rules[ i ].substring( pos + 1 );
        Class<? extends DocumentFactory> factoryClass = null;
        try {
          factoryClass = (Class<? extends DocumentFactory>)Class.forName( factoryName );
          if ( ! ( DocumentFactory.class.isAssignableFrom( factoryClass ) ) ) throw new ClassNotFoundException();
        } catch ( ClassNotFoundException e ) {
          throw new ConfigurationException( "ParsingFactory " + factoryName + " is invalid; maybe the package name is missing" );
        }
        value2factoryClass.put( rules[ i ].substring( 0, pos ), factoryClass );
      }
      m = value2factoryClass.values().size();
      return true;
     
    }
    else if ( sameKey( MetadataKeys.MAP, key ) ) {
      String[] pieces = values;
      int i, m = pieces.length;
      rename = new int[ m ][];
      for ( i = 0; i < m; i++ ) {
        String[] subpieces = pieces[ i ].split( ":" );
        if ( i > 0 && subpieces.length != rename[ 0 ].length ) throw new ConfigurationException( "Length mismatch in the map " + values );
        rename[ i ] = new int[ subpieces.length ];
        for ( int k = 0; k < subpieces.length; k++ ) {
          try {
            rename[ i ][ k ] = Integer.parseInt( subpieces[ k ] );
          } catch ( NumberFormatException e ) {
            throw new ConfigurationException( "Number format exception in the map " + values );
          }
        }
      }
    }
    return super.parseProperty( key, values, metadata );
View Full Code Here

  protected boolean parseProperty( final String key, final String[] values, final Reference2ObjectMap<Enum<?>,Object> metadata ) throws ConfigurationException {
    if ( sameKey( MetadataKeys.PARSETITLE, key ) ) {
      /*metadata.put( PARSE_TITLE, value );
      return true;*/
      throw new ConfigurationException( "PARSETITLE is not yet implemented" );
    }
   
    return super.parseProperty( key, values, metadata );
  }
View Full Code Here

        metadata.put( PropertyBasedDocumentFactory.MetadataKeys.WORDREADER, spec );
        // Just to check
        ObjectParser.fromSpec( spec, WordReader.class, MG4JClassParser.PACKAGE );
      }
      catch ( ClassNotFoundException e ) {
        throw new ConfigurationException( e );
      }
      // TODO: this must turn into a more appropriate exception
      catch ( Exception e ) {
        throw new ConfigurationException( e );
      }
      return true;
    }
    else if ( sameKey( MetadataKeys.MAXPREANCHOR, key ) ) {
      metadata.put( MetadataKeys.MAXPREANCHOR, Integer.valueOf( ensureJustOne( key, values ) ) );
View Full Code Here

        metadata.put( PropertyBasedDocumentFactory.MetadataKeys.WORDREADER, spec );
        // Just to check
        ObjectParser.fromSpec( spec, WordReader.class, MG4JClassParser.PACKAGE );
      }
      catch ( ClassNotFoundException e ) {
        throw new ConfigurationException( e );
      }
      // TODO: this must turn into a more appropriate exception
      catch ( Exception e ) {
        throw new ConfigurationException( e );
      }
      return true;
    }
    if ( sameKey( MetadataKeys.FIELDNAME, key ) ) {
      ensureJustOne( key, values );
View Full Code Here

   * @param metadataUnused the metadata map.
   * @return true if the property was parsed correctly, false if it was ignored.
   *
   */
  protected boolean parseProperty( final String key, final String[] valuesUnused, final Reference2ObjectMap<Enum<?>,Object> metadataUnused ) throws ConfigurationException {
    if ( sameKey( MetadataKeys.LOCALE, key ) ) throw new ConfigurationException( "Locales are currently unsupported" );
    return false;
  }
View Full Code Here

   * @param values the array of values.
   * @return the only value (if the array contains exactly one element).
   * @throws ConfigurationException iff <var>values</var> does not contain a single element.
   */
  protected static String ensureJustOne( final String key, final String[] values ) throws ConfigurationException {
    if ( values.length != 1 ) throw new ConfigurationException( "Property " + key + " should have just one value" );
    return values[ 0 ];
  }
View Full Code Here

      qualifier = lastDot == -1 ? "" : key.substring( 0, lastDot );

      if ( className.startsWith( qualifier )
        && ! parseProperty( key.substring( lastDot + 1 ), properties.getStringArray( key ), metadata )
        && className.equals( qualifier ) )
          throw new ConfigurationException( "Unknown property " + key );
    }
   
    return metadata.isEmpty() ? Reference2ObjectMaps.EMPTY_MAP : metadata;
  }
View Full Code Here

      for (int i=0; i<names.length; i++) {
        UDDIClerk uddiClerk = new UDDIClerk();
        uddiClerk.setManagerName(managerName);
        uddiClerk.setName(     config.getString("manager.clerks.clerk(" + i + ")[@name]"));
        String nodeRef = config.getString("manager.clerks.clerk(" + i + ")[@node]");
        if (!uddiNodes.containsKey(nodeRef)) throw new ConfigurationException("Could not find Node with name=" + nodeRef);
        UDDINode uddiNode = uddiNodes.get(nodeRef);
        uddiClerk.setUDDINode(uddiNode);
        uddiClerk.setPublisher(config.getString("manager.clerks.clerk(" + i + ")[@publisher]"));
        uddiClerk.setPassword( config.getString("manager.clerks.clerk(" + i + ")[@password]"));
        String[] classes = config.getStringArray("manager.clerks.clerk(" + i + ").class");
View Full Code Here

    for (int i=0; i<entityKeys.length; i++) {
      XRegistration xRegistration = new XRegistration();
      xRegistration.setEntityKey(config.getString("manager.clerks.xregister." + entityType + "(" + i + ")[@entityKey]"));
     
      String fromClerkRef = config.getString("manager.clerks.xregister." + entityType + "(" + i + ")[@fromClerk]");
      if (!clerks.containsKey(fromClerkRef)) throw new ConfigurationException("Could not find fromClerk with name=" + fromClerkRef);
      UDDIClerk fromClerk = clerks.get(fromClerkRef);
      xRegistration.setFromClerk(fromClerk);
     
      String toClerkRef = config.getString("manager.clerks.xregister." + entityType + "(" + i + ")[@toClerk]");
      if (!clerks.containsKey(toClerkRef)) throw new ConfigurationException("Could not find toClerk with name=" + toClerkRef);
      UDDIClerk toClerk = clerks.get(toClerkRef);
      xRegistration.setToClerk(toClerk);
      log.info(xRegistration);
     
      xRegistrations.add(xRegistration);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.ConfigurationException

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.