You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2013/04/03 23:41:33 UTC
svn commit: r1464211 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli:
JobSpecificationProperties.java PropertiesHelper.java
Author: degenaro
Date: Wed Apr 3 21:41:33 2013
New Revision: 1464211
URL: http://svn.apache.org/r1464211
Log:
UIMA-2793 Support driver and process common specification for each of classpath, environment and jvmargs
Added:
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/PropertiesHelper.java
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java?rev=1464211&r1=1464210&r2=1464211&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/JobSpecificationProperties.java Wed Apr 3 21:41:33 2013
@@ -36,6 +36,9 @@ public class JobSpecificationProperties
public static String key_scheduling_priority = "scheduling_priority";
public static String key_jvm = "jvm";
+ public static String key_jvm_args = "jvm_args";
+ public static String key_classpath = "classpath";
+ public static String key_environment = "environment";
public static String key_process_debug = "process_debug";
public static String key_driver_debug = "driver_debug";
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/PropertiesHelper.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/PropertiesHelper.java?rev=1464211&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/PropertiesHelper.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/event/cli/PropertiesHelper.java Wed Apr 3 21:41:33 2013
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.transport.event.cli;
+
+import java.util.Properties;
+
+public class PropertiesHelper {
+
+ private static void checkConflict(Properties properties, String key1, String key2) {
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ if(properties.containsKey(key2)) {
+ throw new IllegalArgumentException("Cannot specify both "+key1+" and "+key2);
+ }
+ }
+ }
+ }
+
+ /////
+
+ public static void checkConflictDriverClasspath(Properties properties) {
+ String key1 = JobSpecificationProperties.key_classpath;
+ String key2 = JobSpecificationProperties.key_driver_classpath;
+ checkConflict(properties, key1, key2);
+ return;
+ }
+
+ public static String getDriverClasspath(Properties properties) {
+ String value = null;
+ String key1 = JobSpecificationProperties.key_classpath;
+ String key2 = JobSpecificationProperties.key_driver_classpath;
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ value = properties.getProperty(key1);
+ }
+ else if(properties.containsKey(key2)) {
+ value = properties.getProperty(key2);
+ }
+ }
+ return value;
+ }
+
+ public static void checkConflictDriverEnvironment(Properties properties) {
+ String key1 = JobSpecificationProperties.key_environment;
+ String key2 = JobSpecificationProperties.key_driver_environment;
+ checkConflict(properties, key1, key2);
+ return;
+ }
+
+ public static String getDriverEnvironment(Properties properties) {
+ String value = null;
+ String key1 = JobSpecificationProperties.key_environment;
+ String key2 = JobSpecificationProperties.key_driver_environment;
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ value = properties.getProperty(key1);
+ }
+ else if(properties.containsKey(key2)) {
+ value = properties.getProperty(key2);
+ }
+ }
+ return value;
+ }
+
+ public static void checkConflictDriverJvmArgs(Properties properties) {
+ String key1 = JobSpecificationProperties.key_jvm_args;
+ String key2 = JobSpecificationProperties.key_driver_jvm_args;
+ checkConflict(properties, key1, key2);
+ return;
+ }
+
+ public static String getDriverJvmArgs(Properties properties) {
+ String value = null;
+ String key1 = JobSpecificationProperties.key_jvm_args;
+ String key2 = JobSpecificationProperties.key_driver_jvm_args;
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ value = properties.getProperty(key1);
+ }
+ else if(properties.containsKey(key2)) {
+ value = properties.getProperty(key2);
+ }
+ }
+ return value;
+ }
+
+ /////
+
+
+ public static void checkConflictProccessClasspath(Properties properties) {
+ String key1 = JobSpecificationProperties.key_classpath;
+ String key2 = JobSpecificationProperties.key_process_classpath;
+ checkConflict(properties, key1, key2);
+ return;
+ }
+
+ public static String getProcessClasspath(Properties properties) {
+ String value = null;
+ String key1 = JobSpecificationProperties.key_classpath;
+ String key2 = JobSpecificationProperties.key_process_classpath;
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ value = properties.getProperty(key1);
+ }
+ else if(properties.containsKey(key2)) {
+ value = properties.getProperty(key2);
+ }
+ }
+ return value;
+ }
+
+ public static void checkConflictProcessEnvironment(Properties properties) {
+ String key1 = JobSpecificationProperties.key_environment;
+ String key2 = JobSpecificationProperties.key_process_environment;
+ checkConflict(properties, key1, key2);
+ return;
+ }
+
+ public static String getProcessEnvironment(Properties properties) {
+ String value = null;
+ String key1 = JobSpecificationProperties.key_environment;
+ String key2 = JobSpecificationProperties.key_process_environment;
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ value = properties.getProperty(key1);
+ }
+ else if(properties.containsKey(key2)) {
+ value = properties.getProperty(key2);
+ }
+ }
+ return value;
+ }
+
+ public static void checkConflictProcessJvmArgs(Properties properties) {
+ String key1 = JobSpecificationProperties.key_jvm_args;
+ String key2 = JobSpecificationProperties.key_process_jvm_args;
+ checkConflict(properties, key1, key2);
+ return;
+ }
+
+ public static String getProcessJvmArgs(Properties properties) {
+ String value = null;
+ String key1 = JobSpecificationProperties.key_jvm_args;
+ String key2 = JobSpecificationProperties.key_process_jvm_args;
+ if(properties != null) {
+ if(properties.containsKey(key1)) {
+ value = properties.getProperty(key1);
+ }
+ else if(properties.containsKey(key2)) {
+ value = properties.getProperty(key2);
+ }
+ }
+ return value;
+ }
+
+}