Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.ConfigurationException


   
    private void parseConfig(List<String> args) throws ConfigurationException
    {
        if (args.size() < 3)
        {
            throw new ConfigurationException(String.format(NOT_ENOUGH_CONFIG_MSG, getLine()));
        }

        Map<String, Boolean> properties = toPluginProperties(args);
       
        getConfiguration().configure(properties);
View Full Code Here


        while (i.hasNext())
        {
            String key = i.next();
            if (!i.hasNext())
            {
                throw new ConfigurationException(String.format(PROPERTY_KEY_ONLY_MSG, getLine()));
            }
            if (!"=".equals(i.next()))
            {
                throw new ConfigurationException(String.format(PROPERTY_NO_EQUALS_MSG, getLine()));
            }
            if (!i.hasNext())
            {
                throw new ConfigurationException(String.format(PROPERTY_NO_VALUE_MSG, getLine()));
            }
            String value = i.next();
           
            // parse property key
            ObjectProperties.Property property = ObjectProperties.Property.parse(key);
View Full Code Here

        while (i.hasNext())
        {
            String key = i.next().toLowerCase();
            if (!i.hasNext())
            {
                throw new ConfigurationException(String.format(PROPERTY_KEY_ONLY_MSG, getLine()));
            }
            if (!"=".equals(i.next()))
            {
                throw new ConfigurationException(String.format(PROPERTY_NO_EQUALS_MSG, getLine()));
            }
            if (!i.hasNext())
            {
                throw new ConfigurationException(String.format(PROPERTY_NO_VALUE_MSG, getLine()));
            }
           
            // parse property value and save
            Boolean value = Boolean.valueOf(i.next());
            properties.put(key, value);
View Full Code Here

        TModel tModelKeyGen = (TModel)buildInstallEntity(fileTModelKeygen, "org.uddi.api_v3", config);
        String fileBusinessEntity = publisherStr + FILE_BUSINESSENTITY;
        org.uddi.api_v3.BusinessEntity businessEntity = (org.uddi.api_v3.BusinessEntity)buildInstallEntity(fileBusinessEntity, "org.uddi.api_v3",config);
        UddiEntityPublisher publisher = installPublisher(em, filePublisher, config);
        if (publisher==null) {
          throw new ConfigurationException("File " + filePublisher + " not found.");
        } else {
          if (tModelKeyGen!=null) installPublisherKeyGen(em, tModelKeyGen, publisher, nodeId);
          if (businessEntity!=null) installBusinessEntity(false, em, businessEntity, publisher, null, config);
          String fileTModels = publisherStr + FILE_TMODELS;
          installSaveTModel(em, fileTModels, publisher, nodeId, config);
View Full Code Here

        } catch (InterruptedException e) {
          log.error(e.getMessage(),e);
        }
      }
    }
    throw new ConfigurationException("Could not load the Root node data. Please check for errors.");
  }
View Full Code Here

    String path = null;
    if ("vfsfile".equals(url.getProtocol())) {
      try {
        path = url.toURI().getPath() ;
      } catch (URISyntaxException e) {
        throw new ConfigurationException(e);
      }
    } else {
      path = url.getPath();
    }
   
    File dir = new File(path);
    String rootPublisherStr = config.getString(Property.JUDDI_ROOT_PUBLISHER);
    if (dir.exists()) {
      log.debug("Discovering the Publisher XML data files in directory: " + path);
      File[] files = dir.listFiles(new PublisherFileFilter());
        for (File f : files)
        { 
            String publisher = f.getName().substring(0,f.getName().indexOf(FILE_PUBLISHER));
            if (! rootPublisherStr.equalsIgnoreCase(publisher)) {
              publishers.add(publisher);
            }
        }
    } else {
      String[] paths = path.split("!");
      try {
        log.debug("Discovering the Publisher XML data files in jar: " + paths[0]);
        Enumeration<JarEntry> en = new JarFile(new File(new URI(paths[0]))).entries();
        while (en.hasMoreElements()) {
          String name = en.nextElement().getName();
          if (name.endsWith(FILE_PUBLISHER)) {
            log.debug("Found publisher file=" + name);
            String publisher = name.substring(basePath.length(),name.indexOf(FILE_PUBLISHER));
                if (! rootPublisherStr.equalsIgnoreCase(publisher)) {
                  publishers.add(publisher);
                }
          }
        }
      } catch (IOException e) {
        throw new ConfigurationException(e);
      } catch (URISyntaxException e) {
        throw new ConfigurationException(e);
      }
    }
    return publishers;
  }
View Full Code Here

        resourceStream = url.openStream();
      }
      // If file still does not exist then return null;
      if (url ==null || resourceStream == null) {
        if (fileName.endsWith(FILE_PUBLISHER)) {
          throw new ConfigurationException("Could not locate " + JUDDI_INSTALL_DATA_DIR + fileName);
        } else {
          log.debug("Could not locate: " + url);
        }
        return null;
      }
View Full Code Here

    }
    if (missingProperties.size() > 0) {
      StringBuilder error = new StringBuilder();
      error.append("The following required properties are missing from the server configuration: ");
      error.append(Joiner.on(", ").join(missingProperties));
      throw new ConfigurationException(error.toString());
    }

    // bundle everything up in an injectable guice module
    return new AbstractModule() {
View Full Code Here

        TModel tModelKeyGen = (TModel)buildInstallEntity(fileTModelKeygen, "org.uddi.api_v3", config);
        String fileBusinessEntity = publisherStr + FILE_BUSINESSENTITY;
        org.uddi.api_v3.BusinessEntity businessEntity = (org.uddi.api_v3.BusinessEntity)buildInstallEntity(fileBusinessEntity, "org.uddi.api_v3",config);
        UddiEntityPublisher publisher = installPublisher(em, filePublisher, config);
        if (publisher==null) {
          throw new ConfigurationException("File " + filePublisher + " not found.");
        } else {
          if (tModelKeyGen!=null) installPublisherKeyGen(em, tModelKeyGen, publisher, nodeId);
          if (businessEntity!=null) installBusinessEntity(false, em, businessEntity, publisher, null, config);
          String fileTModels = publisherStr + FILE_TMODELS;
          installSaveTModel(em, fileTModels, publisher, nodeId, config);
View Full Code Here

        } catch (InterruptedException e) {
          log.error(e.getMessage(),e);
        }
      }
    }
    throw new ConfigurationException("Could not load the Root node data. Please check for errors.");
  }
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.