/**
   * This method "registers" a Schema to be generated. It allows a portions of the code to register
   * a Schema for generation without knowing whether code generation is enabled. A unique ID will be
   * passed back that can be used internally to refer to generated SchemaTuples (such as in the case
   * of serialization and deserialization). The context is necessary to allow the client to restrict
   * where generated code can be used.
   *
   * @param udfSchema This is the Schema of a Tuple that we will potentially generate
   * @param isAppendable This specifies whether or not we want the SchemaTuple to be appendable
   * @param context This is the context in which users should be able to access the SchemaTuple
   * @return identifier
   */
  public static int registerToGenerateIfPossible(
      Schema udfSchema, boolean isAppendable, GenContext context) {
    if (stf == null) {
      if (pigContextToReset != null) {
        Properties prop = pigContextToReset.getProperties();
        prop.remove(GENERATED_CLASSES_KEY);
        prop.remove(LOCAL_CODE_DIR);
        pigContextToReset = null;
      }
      SchemaTupleBackend.reset();
      SchemaTupleClassGenerator.resetGlobalClassIdentifier();
      stf = new SchemaTupleFrontend();
    }

    if (udfSchema == null) {
      return -1;
    }

    try {
      udfSchema = udfSchema.clone();
    } catch (CloneNotSupportedException e) {
      throw new RuntimeException("Unable to clone Schema: " + udfSchema, e);
    }
    stripAliases(udfSchema);

    return stf.internalRegisterToGenerateIfPossible(udfSchema, isAppendable, context);
  }
예제 #2
0
 public Properties getDataNucleusPropertiesForInternalInfrastructure() {
   Properties properties = new Properties();
   properties.putAll(coreConfigurationService.loadDatanucleusConfig());
   properties.remove("javax.jdo.option.Optimistic");
   properties.remove("datanucleus.flush.mode");
   return properties;
 }
 public static void loadVMProfile(Properties properties) {
   Properties profileProps = findVMProfile(properties);
   String systemExports = properties.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
   // set the system exports property using the vm profile; only if the property is not already set
   if (systemExports == null) {
     systemExports = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
     if (systemExports != null) properties.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemExports);
   }
   // set the org.osgi.framework.bootdelegation property according to the java profile
   String type =
       properties.getProperty(
           Constants.OSGI_JAVA_PROFILE_BOOTDELEGATION); // a null value means ignore
   String profileBootDelegation = profileProps.getProperty(Constants.FRAMEWORK_BOOTDELEGATION);
   if (Constants.OSGI_BOOTDELEGATION_OVERRIDE.equals(type)) {
     if (profileBootDelegation == null)
       properties.remove(Constants.FRAMEWORK_BOOTDELEGATION); // override with a null value
     else
       properties.put(
           Constants.FRAMEWORK_BOOTDELEGATION,
           profileBootDelegation); // override with the profile value
   } else if (Constants.OSGI_BOOTDELEGATION_NONE.equals(type))
     properties.remove(
         Constants
             .FRAMEWORK_BOOTDELEGATION); // remove the bootdelegation property in case it was set
   // set the org.osgi.framework.executionenvironment property according to the java profile
   if (properties.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT) == null) {
     // get the ee from the java profile; if no ee is defined then try the java profile name
     String ee =
         profileProps.getProperty(
             Constants.FRAMEWORK_EXECUTIONENVIRONMENT,
             profileProps.getProperty(Constants.OSGI_JAVA_PROFILE_NAME));
     if (ee != null) properties.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);
   }
 }
예제 #4
0
  public static void removeMyProxy() {

    Properties p = System.getProperties();
    p.remove("https.proxyHost");
    p.remove("https.proxyPort");
    p.remove("http.proxyHost");
    p.remove("http.proxyPort");
  }
예제 #5
0
 private void dropOutdatedProps() {
   String[] suffixesToDrop =
       isUnitSelectionVoice() ? SUFFIXES_TO_DROP_UNITSEL : SUFFIXES_TO_DROP_HMM;
   for (String suffix : suffixesToDrop) {
     String key = getPropertyPrefix() + suffix;
     config.remove(key);
   }
   for (String prop : PROPS_TO_DROP) {
     config.remove(prop);
   }
 }
예제 #6
0
  // Save a private copy of the system properties and remove
  // the system properties that are not intended for public access.
  //
  // This method can only be invoked during system initialization.
  public static void saveAndRemoveProperties(Properties props) {
    if (booted) throw new IllegalStateException("System initialization has completed");

    savedProps.putAll(props);

    // Set the maximum amount of direct memory.  This value is controlled
    // by the vm option -XX:MaxDirectMemorySize=<size>.
    // The maximum amount of allocatable direct buffer memory (in bytes)
    // from the system property sun.nio.MaxDirectMemorySize set by the VM.
    // The system property will be removed.
    String s = (String) props.remove("sun.nio.MaxDirectMemorySize");
    if (s != null) {
      if (s.equals("-1")) {
        // -XX:MaxDirectMemorySize not given, take default
        directMemory = Runtime.getRuntime().maxMemory();
      } else {
        long l = Long.parseLong(s);
        if (l > -1) directMemory = l;
      }
    }

    // Check if direct buffers should be page aligned
    s = (String) props.remove("sun.nio.PageAlignDirectMemory");
    if ("true".equals(s)) pageAlignDirectMemory = true;

    // Set a boolean to determine whether ClassLoader.loadClass accepts
    // array syntax.  This value is controlled by the system property
    // "sun.lang.ClassLoader.allowArraySyntax".
    s = props.getProperty("sun.lang.ClassLoader.allowArraySyntax");
    allowArraySyntax = (s == null ? defaultAllowArraySyntax : Boolean.parseBoolean(s));

    // Reflection.getCallerClass(int) is enabled by default.
    // It can be disabled by setting a system property (but only if
    // the logging stack walk is not enabled)
    s = props.getProperty("jdk.reflect.allowGetCallerClass");
    allowGetCallerClass =
        (s != null ? (s.isEmpty() || Boolean.parseBoolean(s)) : true)
            || Boolean.valueOf(props.getProperty("jdk.logging.allowStackWalkSearch"));

    // Remove other private system properties
    // used by java.lang.Integer.IntegerCache
    props.remove("java.lang.Integer.IntegerCache.high");

    // used by java.util.zip.ZipFile
    props.remove("sun.zip.disableMemoryMapping");

    // used by sun.launcher.LauncherHelper
    props.remove("sun.java.launcher.diag");
  }
 private void createItem(Properties ctx, TransformerHandler document, int AD_PrintFormatItem_ID)
     throws SAXException {
   Env.setContext(
       ctx, X_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormatItem_ID, AD_PrintFormatItem_ID);
   itemHandler.create(ctx, document);
   ctx.remove(X_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormatItem_ID);
 }
  @Test
  public void testClose() throws Exception {
    // use NullSender
    Properties props = System.getProperties();
    props.setProperty(Config.FLUENT_SENDER_CLASS, NullSender.class.getName());

    // create logger objects
    FluentLogger.getLogger("tag1");
    FluentLogger.getLogger("tag2");
    FluentLogger.getLogger("tag3");

    Map<String, FluentLogger> loggers;
    {
      loggers = FluentLogger.getLoggers();
      assertEquals(3, loggers.size());
    }

    // close and delete
    FluentLogger.closeAll();
    {
      loggers = FluentLogger.getLoggers();
      assertEquals(0, loggers.size());
    }

    props.remove(Config.FLUENT_SENDER_CLASS);
  }
 private void removeProperties(String propertiesFilePath, String... propertiesName) {
   if (propertiesName.length > 0) {
     Properties properties = CommandsUtils.readProperties(propertiesFilePath);
     if (properties != null && !properties.isEmpty()) {
       for (String propertieName : propertiesName) {
         if (properties.keySet().contains(propertieName)) {
           properties.remove(propertieName);
         }
       }
       FileOutputStream fos = null;
       try {
         fos = new FileOutputStream(propertiesFilePath);
         properties.store(fos, "");
       } catch (FileNotFoundException e) {
         // nothing to do
       } catch (IOException e) {
         // nothing to do
       } finally {
         if (fos != null) {
           try {
             fos.close();
           } catch (IOException e) {
             // nothing to do
           }
         }
       }
     }
   }
 }
예제 #10
0
 /**
  * 方法名: </br> 详述: </br>修改build文件配置文件 开发人员:谭明</br> 创建时间:Apr 1, 2014</br>
  *
  * @param project_path
  * @throws Exception
  */
 public static void update_sysconfig_properties(String project_path) throws Exception {
   File file =
       new File(project_path + File.separator + "src" + File.separator + "sysConfig.properties");
   if (!file.exists()) {
     throw new Exception("项目sysConfig.properties文件不存在!");
   }
   InputStream in;
   try {
     in = new BufferedInputStream(new FileInputStream(file));
     Properties p = new Properties();
     p.load(in);
     in.close();
     p.remove("a");
     OutputStream fos = new FileOutputStream(file);
     p.setProperty("URL_SOCKET", ResourceBundle.getBundle("config").getString("socket_ip"));
     String url = ResourceBundle.getBundle("config").getString("push_url");
     p.setProperty("URL_SERVER", url.replaceAll("\\\\", ""));
     p.setProperty("URL_SOCKETPORT", ResourceBundle.getBundle("config").getString("socket_port"));
     p.store(fos, "Update URL_SOCKET、URL_SERVER、URL_SOCKETPORT value");
     fos.close();
   } catch (FileNotFoundException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
  private java.sql.Connection connectFailover(String url, Properties info) throws SQLException {
    Properties parsedProps = parseURL(url, info);

    // People tend to drop this in, it doesn't make sense
    parsedProps.remove("roundRobinLoadBalance");
    parsedProps.setProperty("autoReconnect", "false");

    if (parsedProps == null) {
      return null;
    }

    int numHosts = Integer.parseInt(parsedProps.getProperty(NUM_HOSTS_PROPERTY_KEY));

    List<String> hostList = new ArrayList<String>();

    for (int i = 0; i < numHosts; i++) {
      int index = i + 1;

      hostList.add(
          parsedProps.getProperty(HOST_PROPERTY_KEY + "." + index)
              + ":"
              + parsedProps.getProperty(PORT_PROPERTY_KEY + "." + index));
    }

    FailoverConnectionProxy connProxy = new FailoverConnectionProxy(hostList, parsedProps);

    return (java.sql.Connection)
        java.lang.reflect.Proxy.newProxyInstance(
            this.getClass().getClassLoader(),
            new Class[] {com.mysql.jdbc.Connection.class},
            connProxy);
  }
예제 #12
0
 public static void removeGroupProperties(String id, Properties properties) {
   for (Object key : properties.keySet()) {
     if (key.toString().startsWith(id + ".")) {
       properties.remove(key);
     }
   }
 }
예제 #13
0
 public static void editGstoolSubtypeToPropertyFile(Object oldKey, Object[] mappingEntry)
     throws IOException {
   Properties properties = readPropertyFile(SUBTYPE_PROPERTIES_FILE);
   properties.remove(oldKey);
   properties.put((String) mappingEntry[0], (String) mappingEntry[1]);
   writePropertyFile(properties, SUBTYPE_PROPERTIES_FILE);
 }
예제 #14
0
 /**
  * Remove a String property if it is set and return the value.
  *
  * @param key the property name
  * @param defaultValue the default value
  * @return the value
  */
 String removeProperty(String key, String defaultValue) {
   if (SysProperties.CHECK && !isKnownSetting(key)) {
     DbException.throwInternalError(key);
   }
   Object x = prop.remove(key);
   return x == null ? defaultValue : x.toString();
 }
예제 #15
0
 /**
  * Mark the file for expiration (put true in marked_expiration key)
  *
  * @throws IOException
  * @throws FileNotFoundException
  */
 public void markForExpiration() throws FileNotFoundException, IOException {
   Properties metaP = new Properties();
   metaP.load(new FileInputStream(meta));
   metaP.remove("marked_expiration");
   metaP.put("marked_expiration", true + "");
   metaP.store(new FileOutputStream(meta), "Rhizome meta data for " + file.getName());
 }
  private static ScriptWorkDescription load(Properties properties) {
    assert properties != null;
    String name = properties.getProperty(K_NAME);
    String command = properties.getProperty(K_COMMAND);
    String profile = properties.getProperty(K_PROFILE);
    properties.remove(K_COMMAND);
    properties.remove(K_PROFILE);

    Map<String, String> env = new HashMap<String, String>();
    for (Map.Entry<?, ?> entry : properties.entrySet()) {
      if ((entry.getKey() instanceof String) == false) {
        throw new IllegalArgumentException(
            MessageFormat.format(
                "不正なキー{0}が含まれています ({1})", entry.getKey(), entry.getKey().getClass().getName()));
      }
      if ((entry.getValue() instanceof String) == false) {
        throw new IllegalArgumentException(
            MessageFormat.format(
                "不正な値{0}が含まれています ({1})", entry.getValue(), entry.getValue().getClass().getName()));
      }
      String key = (String) entry.getKey();
      if (key.startsWith(K_ENVIRONMENT_PREFIX) == false) {
        throw new IllegalArgumentException(
            MessageFormat.format(
                "不正なキー{0}が含まれています (\"{1}\" が先頭にありません)", entry.getKey(), K_ENVIRONMENT_PREFIX));
      }
      key = key.substring(K_ENVIRONMENT_PREFIX.length());
      String value = (String) entry.getValue();
      env.put(key, value);
    }
    return new ScriptWorkDescription(name, command, profile, env);
  }
예제 #17
0
 private void setProperty(String key, String value) {
   if (value != null) {
     properties.setProperty(key, value);
   } else {
     properties.remove(key);
   }
 }
 private void setProperty(String name, String value) {
   if (value == null) {
     properties.remove(name);
   } else {
     properties.setProperty(name, value);
   }
 }
  public static IStatus isWSDLAccessible(URL contextURL) {
    Properties props = System.getProperties();
    String oldPropValue = props.getProperty(DEF_FACTORY_PROPERTY_NAME);

    props.setProperty(DEF_FACTORY_PROPERTY_NAME, PRIVATE_DEF_FACTORY_CLASS);

    WSDLFactory factory;
    try {
      factory = WSDLFactory.newInstance();
      WSDLReader wsdlReader = factory.newWSDLReader();
      wsdlReader.setFeature(Constants.FEATURE_VERBOSE, false);
      wsdlReader.setFeature("javax.wsdl.importDocuments", true); // $NON-NLS-1$
      String context = null;
      if (contextURL != null) context = contextURL.toString();
      wsdlReader.readWSDL(context);
    } catch (WSDLException e) {
      if (contextURL.getProtocol().equalsIgnoreCase("https")) { // $NON-NLS-1$
        return StatusUtils.warningStatus(
            JBossWSUIMessages.TesterWSDLUtils_WSDL_HTTPS_Secured_Inaccessible);
      } else {
        return StatusUtils.errorStatus(JBossWSUIMessages.TesterWSDLUtils_WSDL_Inaccessible, e);
      }
    }

    if (oldPropValue != null) {
      props.setProperty(DEF_FACTORY_PROPERTY_NAME, oldPropValue);
    } else {
      props.remove(DEF_FACTORY_PROPERTY_NAME);
    }
    return Status.OK_STATUS;
  }
예제 #20
0
 /**
  * Programmatically set a local property, overriding an entry in the {@code spring.properties}
  * file (if any).
  *
  * @param key the property key
  * @param value the associated property value, or {@code null} to reset it
  */
 public static void setProperty(String key, String value) {
   if (value != null) {
     localProperties.setProperty(key, value);
   } else {
     localProperties.remove(key);
   }
 }
예제 #21
0
  /**
   * Updates/writes and replaces a complete user object keyed by username. This method allows for
   * renaming a user.
   *
   * @param username the old username
   * @param model the user object to use for username
   * @return true if update is successful
   */
  @Override
  public boolean updateUserModel(String username, UserModel model) {
    try {
      Properties allUsers = read();
      UserModel oldUser = getUserModel(username);
      ArrayList<String> roles = new ArrayList<String>(model.repositories);

      // Permissions
      if (model.canAdmin) {
        roles.add(Constants.ADMIN_ROLE);
      }
      if (model.excludeFromFederation) {
        roles.add(Constants.NOT_FEDERATED_ROLE);
      }

      StringBuilder sb = new StringBuilder();
      sb.append(model.password);
      sb.append(',');
      for (String role : roles) {
        sb.append(role);
        sb.append(',');
      }
      // trim trailing comma
      sb.setLength(sb.length() - 1);
      allUsers.remove(username.toLowerCase());
      allUsers.put(model.username.toLowerCase(), sb.toString());

      // null check on "final" teams because JSON-sourced UserModel
      // can have a null teams object
      if (model.teams != null) {
        // update team cache
        for (TeamModel team : model.teams) {
          TeamModel t = getTeamModel(team.name);
          if (t == null) {
            // new team
            t = team;
          }
          t.removeUser(username);
          t.addUser(model.username);
          updateTeamCache(allUsers, t.name, t);
        }

        // check for implicit team removal
        if (oldUser != null) {
          for (TeamModel team : oldUser.teams) {
            if (!model.isTeamMember(team.name)) {
              team.removeUser(username);
              updateTeamCache(allUsers, team.name, team);
            }
          }
        }
      }

      write(allUsers);
      return true;
    } catch (Throwable t) {
      logger.error(MessageFormat.format("Failed to update user model {0}!", model.username), t);
    }
    return false;
  }
 private void saveData() {
   String path = jtfConfigPath.getText();
   if (path == null || path.length() < 1) {
     JOptionPane.showMessageDialog(this, "文件目录不能为空!");
     return;
   }
   List<String> addList = new ArrayList<>();
   List<String> upList = new ArrayList<>();
   Properties config = LocalResourcesUtil.getProperties(path);
   for (int i = 0; i < tmDbInfo.getRowCount(); i++) {
     String code = tmDbInfo.getValueAt(i, 0).toString();
     if (config.containsKey(code)) {
       upList.add(config.getProperty(code));
       config.remove(code);
     } else {
       addList.add(StringUtils.unite(code, "DBConfig.properties"));
     }
   }
   StringBuilder sb = new StringBuilder();
   sb.append(StringUtils.unite("本次\r\n新增:", addList, "\r\n"));
   sb.append(StringUtils.unite("修改:", upList, "\r\n"));
   sb.append(StringUtils.unite("删除:", config.values(), "\r\n"));
   int isOk =
       JOptionPane.showConfirmDialog(this, sb.toString(), "确认要保存吗?", JOptionPane.OK_CANCEL_OPTION);
   if (isOk == 0) {
     if (tmDbInfo.saveList(path)) {
       JOptionPane.showMessageDialog(this, "保存成功!");
     } else {
       JOptionPane.showMessageDialog(this, "保存失败。");
     }
   }
 }
  private void filterNot(Properties properties, @Nullable List<String> exclusions) {
    if (exclusions == null) return;

    List<Predicate<CharSequence>> excludePredicates =
        Lists.transform(
            exclusions,
            new Function<String, Predicate<CharSequence>>() {
              @Override
              public Predicate<CharSequence> apply(String exclude) {
                return Predicates.containsPattern(exclude);
              }
            });

    Predicate<CharSequence> shouldExclude = Predicates.alwaysFalse();
    for (Predicate<CharSequence> predicate : excludePredicates) {
      shouldExclude = Predicates.or(shouldExclude, predicate);
    }

    for (String key : properties.stringPropertyNames()) {
      if (shouldExclude.apply(key)) {
        loggerBridge.debug("shouldExclude.apply(" + key + ") = " + shouldExclude.apply(key));
        properties.remove(key);
      }
    }
  }
예제 #24
0
 /**
  * deleteThese
  *
  * @param deleteServices a {@link java.util.List} object.
  * @throws java.io.IOException if any.
  */
 public void deleteThese(java.util.List<String> deleteServices) throws IOException {
   for (String svcname : deleteServices) {
     if (pkg != null) {
       boolean flag = false;
       Collection<Service> svcColl = pkg.getServices();
       if (svcColl != null) {
         for (Service svc : svcColl) {
           if (svc != null) {
             if (svc.getName().equals(svcname)) {
               pkg.removeService(svc);
               removeMonitor(svc.getName());
               deleteCapsdInfo(svc.getName());
               props.remove("service." + svc.getName() + ".protocol");
               props.store(
                   new FileOutputStream(
                       ConfigFileConstants.getFile(ConfigFileConstants.POLLER_CONF_FILE_NAME)),
                   null);
               break;
             }
           }
         }
       }
     }
   }
 }
예제 #25
0
 /**
  * 方法名: </br> 详述: </br>修改build文件配置文件 开发人员:谭明</br> 创建时间:Apr 1, 2014</br>
  *
  * @param project_path
  * @throws Exception
  */
 public static void update_build_properties(String project_path) throws Exception {
   File file = new File(project_path + File.separator + "build.properties");
   if (!file.exists()) {
     throw new Exception("项目build.properties文件不存在!");
   }
   InputStream in;
   String key = "outdir";
   String source_key = "app.source.path";
   try {
     in = new BufferedInputStream(new FileInputStream(file));
     Properties p = new Properties();
     p.load(in);
     in.close();
     System.out.println(p.get(key));
     p.remove("a");
     OutputStream fos = new FileOutputStream(file);
     p.setProperty(key, project_path + File.separator + "bin");
     p.setProperty(source_key, project_path);
     p.store(fos, "Update '" + key + " and " + source_key + "' value");
     fos.close();
   } catch (FileNotFoundException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
 private void cleanUpUris() {
   synchronized (uriUsages) {
     final List<Persistence.UriUsage> toBeDiscardedUriUsages = uriUsages.getUriUsages();
     Collections.sort(toBeDiscardedUriUsages);
     final int toBeDiscardedCount = toBeDiscardedUriUsages.size() / 2;
     for (int index = 0; index < toBeDiscardedCount; index++) {
       final Persistence.UriUsage discardedUriUsage =
           uriUsages.remove(toBeDiscardedUriUsages.get(index).uri);
       properties.remove(discardedUriUsage.uri);
       if (log.isDebugEnabled()) {
         log.debug(
             "Removed from the cache the URI "
                 + discardedUriUsage.uri
                 + "' accessed "
                 + discardedUriUsage.getAccessCount()
                 + " time(s), corresponding to the file '"
                 + discardedUriUsage.storageFilePath);
       }
     }
     // We reset the remaining usages
     uriUsages.resetAccessCount();
     if (log.isInfoEnabled()) {
       log.info(
           "The web cache has been cleaned-up and it now contains "
               + uriUsages.size()
               + " item(s)");
     }
   }
 }
예제 #27
0
 private void put(Properties p, Integer n, String key) {
   if (n == null) {
     p.remove(key);
   } else {
     p.put(key, n.toString());
   }
 }
예제 #28
0
 /** Update all the store-able properties to their current values */
 public void updateProperties() {
   // Kept up-to-date with event listeners
   // Manager.actorDetails.visible
   // Manager.groupTable.autoResize
   propertyBag.setProperty(
       "Manager.splitHorizontal.dividerLocation",
       String.valueOf(jSplitPaneHorizontal.getDividerLocation()));
   propertyBag.setProperty(
       "Manager.splitVertical.dividerLocation",
       String.valueOf(jSplitPaneVertical.getDividerLocation()));
   propertyBag.setProperty("Manager.location.x", String.valueOf(getLocation().x));
   propertyBag.setProperty("Manager.location.y", String.valueOf(getLocation().y));
   propertyBag.setProperty("Manager.size.width", String.valueOf(getSize().width));
   propertyBag.setProperty("Manager.size.height", String.valueOf(getSize().height));
   propertyBag.setProperty(
       "Manager.groupFileChooser.defaultLocation",
       groupFileChooser.getCurrentDirectory().getPath());
   propertyBag.setProperty(
       "Manager.gcaFileChooser.defaultLocation", gcaFileChooser.getCurrentDirectory().getPath());
   // Optional properties
   if (saveAsFile != null) {
     propertyBag.setProperty("Manager.currentLoadedFile", saveAsFile.getAbsolutePath());
   } else {
     propertyBag.remove("Manager.currentLoadedFile");
   }
   groupTable.updateProperties(); // Update properties for the table
 }
 /**
  * A put() method for Properties that is tolerent of 'null' values. If a null value is specified,
  * the property is unset.
  */
 private void putProperty(Properties props, String k, String v) {
   if (null == v) {
     props.remove(k);
   } else {
     props.setProperty(k, v);
   }
 }
  /**
   * Set the parameters to the supplied value. The supplied parameters value may suppliment or
   * replace the existing parameters value.
   *
   * @param parameters the supplied parameters
   * @param merge if TRUE the supplied parameters are merged with existing parameters otherwise the
   *     supplied parameters replace any existing parameters
   * @exception IllegalStateException if the component type backing the model does not implement the
   *     parameteriazable interface
   * @exception NullPointerException if the supplied parameters are null
   */
  public void setParameters(Parameters parameters, boolean merge) throws IllegalStateException {
    if (!isParameterizable()) {
      final String error =
          REZ.getString(
              "deployment.parameters.irrational", getDeploymentClass().getName(), this.toString());
      throw new IllegalStateException(error);
    }

    if (parameters == null) {
      throw new NullPointerException("parameters");
    }

    if (merge) {
      Properties props = Parameters.toProperties(m_parameters);
      Properties suppliment = Parameters.toProperties(parameters);
      Enumeration list = suppliment.propertyNames();
      while (list.hasMoreElements()) {
        String name = (String) list.nextElement();
        String value = suppliment.getProperty(name);
        if (value == null) {
          props.remove(name);
        } else {
          props.setProperty(name, value);
        }
      }
      m_parameters = Parameters.fromProperties(props);
    } else {
      m_parameters = parameters;
    }
  }