Package java.util

Examples of java.util.Properties


   * @param header an Instances object specifying the header of the relation.
   */
  public Attribute(String attributeName, Instances header) {

    this(attributeName, header,
   new ProtectedProperties(new Properties()));
  }
View Full Code Here


   * Sets the new attribute's weight
   *
   * @param value  the new weight
   */
  public void setWeight(double value) {
    Properties  props;
    Enumeration names;
    String  name;
   
    m_Weight = value;

    // generate new metadata object
    props = new Properties();
    names = m_Metadata.propertyNames();
    while (names.hasMoreElements()) {
      name = (String) names.nextElement();
      if (!name.equals("weight"))
  props.setProperty(name, m_Metadata.getProperty(name));
    }
    props.setProperty("weight", "" + m_Weight);
    m_Metadata = new ProtectedProperties(props);
  }
View Full Code Here

  public void testLogger1() {
        // load the process
        RuleBase ruleBase = createKnowledgeBase();
        // create a new session
        Properties properties = new Properties();
    properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
    properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");
    SessionConfiguration config = new SessionConfiguration(properties);
        StatefulSession session = ruleBase.newStatefulSession(config, EnvironmentFactory.newEnvironment());
        new WorkingMemoryDbLogger(session);
        session.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
View Full Code Here

 
  public void testLogger2() {
        // load the process
        RuleBase ruleBase = createKnowledgeBase();
        // create a new session
        Properties properties = new Properties();
    properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
    properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");
    SessionConfiguration config = new SessionConfiguration(properties);
        StatefulSession session = ruleBase.newStatefulSession(config, EnvironmentFactory.newEnvironment());
        new WorkingMemoryDbLogger(session);
        session.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
View Full Code Here

 
  public void testLogger3() {
        // load the process
        RuleBase ruleBase = createKnowledgeBase();
        // create a new session
        Properties properties = new Properties();
    properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
    properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");
    SessionConfiguration config = new SessionConfiguration(properties);
        StatefulSession session = ruleBase.newStatefulSession(config, EnvironmentFactory.newEnvironment());
        new WorkingMemoryDbLogger(session);
        session.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
View Full Code Here

            InputStream in = new FileInputStream(filename);
            try {
                // construct the xml element from the file, it has to be XML,
                // since all synapse artifacts are XML based
                OMElement element = OMXMLBuilderFactory.createOMBuilder(in).getDocumentElement();
                Properties properties = new Properties();
                properties.put(SynapseConstants.RESOLVE_ROOT, getSynapseEnvironment()
                        .getServerContextInformation()
                        .getServerConfigurationInformation().getResolveRoot());
                String artifatcName = null;
                if (deploymentStore.isUpdatingArtifact(filename)) {
View Full Code Here

        File repPropsFile = new File(PROPERTIES_DIR.toString() + File.separator
            + "PackageRepository.props");
       
       
        if (repPropsFile.exists()) {
          Properties repProps = new Properties();
          repProps.load(new FileInputStream(repPropsFile));
          repURL = repProps.getProperty("weka.core.wekaPackageRepositoryURL");
        }
      }
     
      if (repURL == null || repURL.length() == 0) {
        repURL = "http://weka.sourceforge.net/packageMetaData";
View Full Code Here

    return ok;
  }
 
  public static void removeExplorerProps(String installedPackageName) {
    try {
      Properties expProps = new Properties();
      String explorerProps = getPackageHome().getAbsolutePath()
        + File.separator + installedPackageName + File.separator
        + "Explorer.props";
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(explorerProps));
      expProps.load(bi);
      bi.close();
      bi = null;
      Set keys = expProps.keySet();
      Iterator keysI = keys.iterator();
      while (keysI.hasNext()) {
        String key = (String)keysI.next();
        if (!key.endsWith("Policy")) {
          // See if this key is in the Explorer props
          String existingVal = ExplorerDefaults.get(key, "");
          String toRemove = expProps.getProperty(key);
          if (existingVal.length() > 0) {
            // cover the case when the value to remove is at the start
            // or middle of a list
            existingVal = existingVal.replace(toRemove + ",", "");
           
View Full Code Here

    }
  }
 
  protected static void processGenericPropertiesCreatorProps(File propsFile) {
    try {
      Properties expProps = new Properties();
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(propsFile));
      expProps.load(bi);
      bi.close();
      bi = null;
      Properties GPCInputProps = GenericPropertiesCreator.getGlobalInputProperties();
     
      Set keys = expProps.keySet();
      Iterator keysI = keys.iterator();
      while (keysI.hasNext()) {
        String key = (String)keysI.next();
        // see if this key is in the GPC input props
        String existingVal = GPCInputProps.getProperty(key, "");
        if (existingVal.length() > 0) {
          // append
          String newVal = expProps.getProperty(key);
          // only append if this value is not already there!!
          if (existingVal.indexOf(newVal) < 0) {
            newVal = existingVal + "," + newVal;
            GPCInputProps.put(key, newVal);
          }
        } else {
          // simply add this new key/value combo
          String newVal = expProps.getProperty(key);
          GPCInputProps.put(key, newVal);
        }
      }
    } catch (Exception ex) {
      // ignore
    }
View Full Code Here

    }
  }
 
  protected static void processExplorerProps(File propsFile) {
    try {
      Properties expProps = new Properties();
      BufferedInputStream bi = new BufferedInputStream(new FileInputStream(propsFile));
      expProps.load(bi);
      bi.close();
      bi = null;
      Set keys = expProps.keySet();
      Iterator keysI = keys.iterator();
      while (keysI.hasNext()) {
        String key = (String)keysI.next();
        if (!key.endsWith("Policy")) {
          // See if this key is in the Explorer props
          String existingVal = ExplorerDefaults.get(key, "");
          if (existingVal.length() > 0) {
            // get the replacement policy (if any)
            String replacePolicy = expProps.getProperty(key + "Policy");
            if (replacePolicy != null && replacePolicy.length() > 0) {
              if (replacePolicy.equalsIgnoreCase("replace")) {
                String newVal = expProps.getProperty(key);
                ExplorerDefaults.set(key, newVal);               
              } else {
                // default to append               
                String newVal = expProps.getProperty(key);
               
                // only append if this value is not already there!!
                if (existingVal.indexOf(newVal) < 0) {
                  newVal = existingVal + "," + newVal;
                  ExplorerDefaults.set(key, newVal);
                }
              }
            } else {
              // default to append
              String newVal = expProps.getProperty(key);
              // only append if this value is not already there!!
              if (existingVal.indexOf(newVal) < 0) {
                newVal = existingVal + "," + newVal;
                ExplorerDefaults.set(key, newVal);
              }
            }
          } else {
            // simply add this new key/value combo
            String newVal = expProps.getProperty(key);
            ExplorerDefaults.set(key, newVal);
          }
        }
      }
    } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of java.util.Properties

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.