You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2017/09/02 15:35:47 UTC
[27/50] [abbrv] oodt git commit: Altered config publisher CLI to use
cas-cli
Altered config publisher CLI to use cas-cli
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/01331125
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/01331125
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/01331125
Branch: refs/heads/development
Commit: 01331125b24dafa374af6f5a6789c060651474fd
Parents: 39b6c88
Author: Imesha Sudasingha <im...@gmail.com>
Authored: Wed Jul 26 23:50:52 2017 +0530
Committer: Imesha Sudasingha <im...@gmail.com>
Committed: Fri Jul 28 21:20:43 2017 +0530
----------------------------------------------------------------------
config/pom.xml | 4 +-
config/src/main/assembly/assembly.xml | 18 ++-
.../oodt/config/distributed/cli/CLIAction.java | 116 +++++++++++++++++++
.../config/distributed/cli/CmdLineOptions.java | 58 ----------
.../config/distributed/cli/ConfigPublisher.java | 84 ++------------
config/src/main/resources/cmd-line-actions.xml | 38 ++++++
config/src/main/resources/cmd-line-options.xml | 50 ++++++++
config/src/main/resources/config-publisher.xml | 42 +++++++
.../src/main/resources/etc/config-publisher.xml | 42 -------
config/src/main/resources/etc/log4j.xml | 54 ---------
config/src/main/resources/log4j.xml | 54 +++++++++
config/src/main/scripts/conf-publisher | 4 +
.../AbstractDistributedConfigurationTest.java | 2 +
.../DistributedConfigurationManagerTest.java | 4 +-
.../DistributedConfigurationPublisherTest.java | 5 +-
core/pom.xml | 5 -
16 files changed, 337 insertions(+), 243 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/pom.xml
----------------------------------------------------------------------
diff --git a/config/pom.xml b/config/pom.xml
index 6719c48..438efc4 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -17,8 +17,8 @@
<dependencies>
<dependency>
- <groupId>args4j</groupId>
- <artifactId>args4j</artifactId>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-cli</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/config/src/main/assembly/assembly.xml b/config/src/main/assembly/assembly.xml
index bb6f31e..a6db0fc 100644
--- a/config/src/main/assembly/assembly.xml
+++ b/config/src/main/assembly/assembly.xml
@@ -40,7 +40,23 @@
</fileSet>
<fileSet>
<directory>${basedir}/src/main/resources</directory>
- <outputDirectory>.</outputDirectory>
+ <outputDirectory>etc</outputDirectory>
+ <includes>
+ <include>config-publisher.xml</include>
+ <include>log4j.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources</directory>
+ <outputDirectory>policy</outputDirectory>
+ <includes>
+ <include>cmd-line-actions.xml</include>
+ <include>cmd-line-options.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/examples</directory>
+ <outputDirectory>examples</outputDirectory>
<includes/>
</fileSet>
</fileSets>
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/java/org/apache/oodt/config/distributed/cli/CLIAction.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/oodt/config/distributed/cli/CLIAction.java b/config/src/main/java/org/apache/oodt/config/distributed/cli/CLIAction.java
new file mode 100644
index 0000000..32fd640
--- /dev/null
+++ b/config/src/main/java/org/apache/oodt/config/distributed/cli/CLIAction.java
@@ -0,0 +1,116 @@
+/*
+ * 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.oodt.config.distributed.cli;
+
+import org.apache.oodt.cas.cli.action.CmdLineAction;
+import org.apache.oodt.cas.cli.exception.CmdLineActionException;
+import org.apache.oodt.config.Constants;
+import org.apache.oodt.config.distributed.DistributedConfigurationPublisher;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.Map;
+
+import static org.apache.oodt.config.Constants.Properties.ZK_CONNECT_STRING;
+
+/**
+ * {@link CmdLineAction} specifying the verify, publish and clear tasks of distributed configuration management.
+ *
+ * @author Imesha Sudasingha
+ */
+public class CLIAction extends CmdLineAction {
+
+ public enum Action {
+ PUBLISH, VERIFY, CLEAR
+ }
+
+ private String connectString;
+ private Action action;
+
+ public CLIAction(Action action) {
+ this.action = action;
+ }
+
+ @Override
+ public void execute(ActionMessagePrinter printer) throws CmdLineActionException {
+ try {
+ ApplicationContext applicationContext = new ClassPathXmlApplicationContext(Constants.CONFIG_PUBLISHER_XML);
+ Map distributedConfigurationPublisher = applicationContext.getBeansOfType(DistributedConfigurationPublisher.class);
+
+ for (Object bean : distributedConfigurationPublisher.values()) {
+ DistributedConfigurationPublisher publisher = (DistributedConfigurationPublisher) bean;
+ switch (action) {
+ case PUBLISH:
+ publish(publisher);
+ break;
+ case VERIFY:
+ verify(publisher);
+ break;
+ case CLEAR:
+ clear(publisher);
+ break;
+ }
+ publisher.destroy();
+ }
+ } catch (BeansException e) {
+ System.out.println(String.format("Error occurred when obtaining configuration publisher beans: '%s'", e.getMessage()));
+ } catch (Exception e) {
+ System.out.println(String.format("Error occurred when publishing configuration to zookeeper: '%s'", e.getMessage()));
+ }
+
+ System.out.println("Exiting CLI ...");
+ }
+
+ private void publish(DistributedConfigurationPublisher publisher) throws Exception {
+ System.out.println();
+ System.out.println(String.format("Publishing configuration for : %s", publisher.getComponent()));
+ publisher.publishConfiguration();
+ System.out.println(String.format("Published configuration for : %s", publisher.getComponent()));
+ System.out.println();
+ }
+
+ private void verify(DistributedConfigurationPublisher publisher) throws Exception {
+ System.out.println();
+ System.out.println(String.format("Verifying configuration for : %s", publisher.getComponent()));
+ if (publisher.verifyPublishedConfiguration()) {
+ System.out.println("OK... Configuration verified");
+ System.out.println(String.format("Verified configuration for : %s", publisher.getComponent()));
+ } else {
+ System.err.println("ERROR... Published configuration doesn't match the local files. Please check above logs");
+ }
+ System.out.println();
+ }
+
+ private void clear(DistributedConfigurationPublisher publisher) throws Exception {
+ System.out.println();
+ System.out.println(String.format("Clearing configuration for : %s", publisher.getComponent()));
+ publisher.clearConfiguration();
+ System.out.println(String.format("Cleared configuration for : %s", publisher.getComponent()));
+ System.out.println();
+ }
+
+ public String getConnectString() {
+ return connectString;
+ }
+
+ public void setConnectString(String connectString) {
+ System.setProperty(ZK_CONNECT_STRING, connectString);
+ this.connectString = connectString;
+ }
+}
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/java/org/apache/oodt/config/distributed/cli/CmdLineOptions.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/oodt/config/distributed/cli/CmdLineOptions.java b/config/src/main/java/org/apache/oodt/config/distributed/cli/CmdLineOptions.java
deleted file mode 100644
index a262387..0000000
--- a/config/src/main/java/org/apache/oodt/config/distributed/cli/CmdLineOptions.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.oodt.config.distributed.cli;
-
-import org.kohsuke.args4j.Option;
-
-/**
- * Bean class used to map CLI options and arguments provided by the user when publishing configuration to zookeeper
- *
- * @author Imesha Sudaingha
- */
-public class CmdLineOptions {
-
- @Option(name = "-connectString", usage = "Zookeeper connect string", required = true)
- private String connectString;
-
- @Option(name = "-publish", usage = "Publishes configuration specified in the spring config file to zookeeper. " +
- "Any current similar config in zookeeper will be overwritten. If not specified, " +
- "command will be assumed as a publish")
- private boolean publish = false;
-
- @Option(name = "-verify", usage = "Verifies the content in the local files and the published ones. Results will be printed.")
- private boolean verify = false;
-
- @Option(name = "-clear", usage = "Unpublish any configuration which has been published earlier using the same spring config file")
- private boolean clear = false;
-
- public String getConnectString() {
- return connectString;
- }
-
- public boolean isPublish() {
- return publish;
- }
-
- public boolean isVerify() {
- return verify;
- }
-
- public boolean isClear() {
- return clear;
- }
-}
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/java/org/apache/oodt/config/distributed/cli/ConfigPublisher.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/oodt/config/distributed/cli/ConfigPublisher.java b/config/src/main/java/org/apache/oodt/config/distributed/cli/ConfigPublisher.java
index 7a78a8c..f4c45a7 100644
--- a/config/src/main/java/org/apache/oodt/config/distributed/cli/ConfigPublisher.java
+++ b/config/src/main/java/org/apache/oodt/config/distributed/cli/ConfigPublisher.java
@@ -17,89 +17,21 @@
package org.apache.oodt.config.distributed.cli;
-import org.apache.oodt.config.Constants;
-import org.apache.oodt.config.distributed.DistributedConfigurationPublisher;
-import org.kohsuke.args4j.CmdLineException;
-import org.kohsuke.args4j.CmdLineParser;
+import org.apache.oodt.cas.cli.CmdLineUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.util.Map;
-
-import static org.apache.oodt.config.Constants.Properties.ZK_CONNECT_STRING;
+/**
+ * Class with main method which gets invoked by the CLI.
+ *
+ * @author Imesha Sudasingha
+ */
public class ConfigPublisher {
private static final Logger logger = LoggerFactory.getLogger(ConfigPublisher.class);
public static void main(String[] args) throws Exception {
- CmdLineOptions cmdLineOptions = new CmdLineOptions();
- CmdLineParser parser = new CmdLineParser(cmdLineOptions);
-
- try {
- parser.parseArgument(args);
- } catch (CmdLineException e) {
- System.err.println("There's an error in your command");
- parser.printUsage(System.err);
- return;
- }
-
- if (cmdLineOptions.getConnectString() == null && System.getProperty(ZK_CONNECT_STRING) == null) {
- System.err.println("Zookeeper connect string is not found");
- parser.printUsage(System.err);
- return;
- } else {
- System.setProperty(ZK_CONNECT_STRING, cmdLineOptions.getConnectString());
- }
-
- System.out.println("Starting configuration publishing");
-
- try {
- ApplicationContext applicationContext = new ClassPathXmlApplicationContext(Constants.CONFIG_PUBLISHER_XML);
- Map distributedConfigurationPublisher = applicationContext.getBeansOfType(DistributedConfigurationPublisher.class);
-
- for (Object bean : distributedConfigurationPublisher.values()) {
- DistributedConfigurationPublisher publisher = (DistributedConfigurationPublisher) bean;
- System.out.println(String.format("\nProcessing commands for component : %s", publisher.getComponent()));
-
- if (cmdLineOptions.isPublish()) {
- System.out.println(String.format("Publishing configuration for : %s", publisher.getComponent()));
- publisher.publishConfiguration();
- System.out.println(String.format("Published configuration for : %s", publisher.getComponent()));
- System.out.println();
- }
-
- if (cmdLineOptions.isVerify()) {
- System.out.println(String.format("Verifying configuration for : %s", publisher.getComponent()));
- if (publisher.verifyPublishedConfiguration()) {
- System.out.println("OK... Configuration verified");
- System.out.println(String.format("Verified configuration for : %s", publisher.getComponent()));
- } else {
- System.err.println("ERROR... Published configuration doesn't match the local files. Please check above logs");
- }
- System.out.println();
- }
-
- if (cmdLineOptions.isClear()) {
- System.out.println(String.format("Clearing configuration for : %s", publisher.getComponent()));
- publisher.clearConfiguration();
- System.out.println(String.format("Cleared configuration for : %s", publisher.getComponent()));
- System.out.println();
- }
-
- publisher.destroy();
- }
- } catch (BeansException e) {
- logger.error("Error occurred when obtaining configuration publisher beans", e);
- throw e;
- } catch (Exception e) {
- logger.error("Error occurred when publishing configuration to zookeeper", e);
- throw e;
- }
-
- logger.info("Exiting CLI ...");
+ CmdLineUtility cmdLineUtility = new CmdLineUtility();
+ cmdLineUtility.run(args);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/resources/cmd-line-actions.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/cmd-line-actions.xml b/config/src/main/resources/cmd-line-actions.xml
new file mode 100644
index 0000000..08f5415
--- /dev/null
+++ b/config/src/main/resources/cmd-line-actions.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean id="publish" class="org.apache.oodt.config.distributed.cli.CLIAction">
+ <constructor-arg value="PUBLISH"/>
+ <property name="description" value="Publishes configuration to zookeeper"/>
+ </bean>
+
+ <bean id="verify" class="org.apache.oodt.config.distributed.cli.CLIAction">
+ <constructor-arg value="VERIFY"/>
+ <property name="description" value="Verifies configuration published to zookeeper"/>
+ </bean>
+
+ <bean id="clear" class="org.apache.oodt.config.distributed.cli.CLIAction">
+ <constructor-arg value="CLEAR"/>
+ <property name="description" value="Clears all published configuration from zookeeper"/>
+ </bean>
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/resources/cmd-line-options.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/cmd-line-options.xml b/config/src/main/resources/cmd-line-options.xml
new file mode 100644
index 0000000..9aff21e
--- /dev/null
+++ b/config/src/main/resources/cmd-line-options.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean id="connectStringOption" class="org.apache.oodt.cas.cli.option.AdvancedCmdLineOption">
+ <property name="shortOption" value="cs"/>
+ <property name="longOption" value="connectString"/>
+ <property name="description" value="Connect String to Zookeeper (ip1:port1,ip2:port2,..)"/>
+ <property name="hasArgs" value="true"/>
+ <property name="requirementRules">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.require.ActionDependencyRule"
+ p:actionName="publishConfiguration" p:relation="REQUIRED"/>
+ </list>
+ </property>
+ <property name="handler">
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToActionHandler">
+ <property name="applyToActions">
+ <list>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="publish" p:methodName="setConnectString"/>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="verify" p:methodName="setConnectString"/>
+ <bean class="org.apache.oodt.cas.cli.option.handler.ApplyToAction"
+ p:actionName="clear" p:methodName="setConnectString"/>
+ </list>
+ </property>
+ </bean>
+ </property>
+ </bean>
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/resources/config-publisher.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/config-publisher.xml b/config/src/main/resources/config-publisher.xml
new file mode 100644
index 0000000..88ba33b
--- /dev/null
+++ b/config/src/main/resources/config-publisher.xml
@@ -0,0 +1,42 @@
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <!-- Configuration publisher for File Manager OODT Component -->
+ <bean id="filemgr-config-publisher" class="org.apache.oodt.config.distributed.DistributedConfigurationPublisher">
+ <constructor-arg value="FILE_MANAGER"/>
+ <property name="propertiesFiles">
+ <map key-type="java.lang.String" value-type="java.lang.String">
+ <entry key="examples/filemgr/filemgr.properties" value="/etc/filemgr.properties"/>
+ </map>
+ </property>
+ <property name="configFiles">
+ <map key-type="java.lang.String" value-type="java.lang.String">
+ <entry key="examples/filemgr/mime-types.xml" value="/etc/mime-types.xml"/>
+ <entry key="examples/filemgr/cmd-line-actions.xml" value="/policy/cmd-line-actions.xml"/>
+ <entry key="examples/filemgr/cmd-line-options.xml" value="/policy/cmd-line-options.xml"/>
+ <entry key="examples/filemgr/oodt/elements.xml" value="/policy/oodt/elements.xml"/>
+ <entry key="examples/filemgr/oodt/product-types.xml" value="/policy/oodt/product-types.xml"/>
+ <entry key="examples/filemgr/oodt/product-type-element-map.xml" value="/policy/oodt/product-type-element-map.xml"/>
+ </map>
+ </property>
+ </bean>
+
+</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/resources/etc/config-publisher.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/etc/config-publisher.xml b/config/src/main/resources/etc/config-publisher.xml
deleted file mode 100644
index 88ba33b..0000000
--- a/config/src/main/resources/etc/config-publisher.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<!--
- ~ 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.
- -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <!-- Configuration publisher for File Manager OODT Component -->
- <bean id="filemgr-config-publisher" class="org.apache.oodt.config.distributed.DistributedConfigurationPublisher">
- <constructor-arg value="FILE_MANAGER"/>
- <property name="propertiesFiles">
- <map key-type="java.lang.String" value-type="java.lang.String">
- <entry key="examples/filemgr/filemgr.properties" value="/etc/filemgr.properties"/>
- </map>
- </property>
- <property name="configFiles">
- <map key-type="java.lang.String" value-type="java.lang.String">
- <entry key="examples/filemgr/mime-types.xml" value="/etc/mime-types.xml"/>
- <entry key="examples/filemgr/cmd-line-actions.xml" value="/policy/cmd-line-actions.xml"/>
- <entry key="examples/filemgr/cmd-line-options.xml" value="/policy/cmd-line-options.xml"/>
- <entry key="examples/filemgr/oodt/elements.xml" value="/policy/oodt/elements.xml"/>
- <entry key="examples/filemgr/oodt/product-types.xml" value="/policy/oodt/product-types.xml"/>
- <entry key="examples/filemgr/oodt/product-type-element-map.xml" value="/policy/oodt/product-type-element-map.xml"/>
- </map>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/resources/etc/log4j.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/etc/log4j.xml b/config/src/main/resources/etc/log4j.xml
deleted file mode 100644
index 8cc1919..0000000
--- a/config/src/main/resources/etc/log4j.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- ~ 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.
- -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
- </layout>
- </appender>
-
- <appender name="file" class="org.apache.log4j.FileAppender">
- <param name="file" value="logs/log.out"/>
- <param name="immediateFlush" value="true"/>
- <param name="threshold" value="debug"/>
- <param name="append" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
- </layout>
- </appender>
-
- <root>
- <priority value="INFO"/>
- <appender-ref ref="console"/>
- <appender-ref ref="file"/>
- </root>
-
- <logger name="org.apache.zookeeper">
- <level value="ERROR"/>
- </logger>
- <logger name="org.springframework">
- <level value="ERROR"/>
- </logger>
- <logger name="org.apache.curator">
- <level value="ERROR"/>
- </logger>
-</log4j:configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/config/src/main/resources/log4j.xml b/config/src/main/resources/log4j.xml
new file mode 100644
index 0000000..8cc1919
--- /dev/null
+++ b/config/src/main/resources/log4j.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ~ 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.
+ -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="file" class="org.apache.log4j.FileAppender">
+ <param name="file" value="logs/log.out"/>
+ <param name="immediateFlush" value="true"/>
+ <param name="threshold" value="debug"/>
+ <param name="append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <priority value="INFO"/>
+ <appender-ref ref="console"/>
+ <appender-ref ref="file"/>
+ </root>
+
+ <logger name="org.apache.zookeeper">
+ <level value="ERROR"/>
+ </logger>
+ <logger name="org.springframework">
+ <level value="ERROR"/>
+ </logger>
+ <logger name="org.apache.curator">
+ <level value="ERROR"/>
+ </logger>
+</log4j:configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/main/scripts/conf-publisher
----------------------------------------------------------------------
diff --git a/config/src/main/scripts/conf-publisher b/config/src/main/scripts/conf-publisher
index 618af4b..47c32f2 100644
--- a/config/src/main/scripts/conf-publisher
+++ b/config/src/main/scripts/conf-publisher
@@ -30,6 +30,10 @@ echo -n "Starting Configuration Publisher"
$JAVA_HOME/bin/java \
-cp ${LIB_DEPS} \
-Dlog4j.configuration=etc/log4j.xml \
+ -Djava.ext.dirs=. \
+ -Djava.util.logging.config.file=${CONF_HOME}/etc/logging.properties \
+ -Dorg.apache.oodt.cas.cli.action.spring.config=${CONF_HOME}/policy/cmd-line-actions.xml \
+ -Dorg.apache.oodt.cas.cli.option.spring.config=${CONF_HOME}/policy/cmd-line-options.xml \
org.apache.oodt.config.distributed.cli.ConfigPublisher "$@"
echo "OK"
sleep 1
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/test/java/org/apache/oodt/config/distributed/AbstractDistributedConfigurationTest.java
----------------------------------------------------------------------
diff --git a/config/src/test/java/org/apache/oodt/config/distributed/AbstractDistributedConfigurationTest.java b/config/src/test/java/org/apache/oodt/config/distributed/AbstractDistributedConfigurationTest.java
index e14d43a..4694dfa 100644
--- a/config/src/test/java/org/apache/oodt/config/distributed/AbstractDistributedConfigurationTest.java
+++ b/config/src/test/java/org/apache/oodt/config/distributed/AbstractDistributedConfigurationTest.java
@@ -36,6 +36,8 @@ public abstract class AbstractDistributedConfigurationTest {
zookeeper.start();
System.setProperty(ZK_CONNECT_STRING, zookeeper.getConnectString());
+ System.setProperty("org.apache.oodt.cas.cli.action.spring.config", "src/main/resources/cmd-line-actions.xml");
+ System.setProperty("org.apache.oodt.cas.cli.option.spring.config", "src/main/resources/cmd-line-options.xml");
client = CuratorUtils.newCuratorFrameworkClient(zookeeper.getConnectString());
client.start();
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationManagerTest.java b/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationManagerTest.java
index 9052ac3..71ce713 100644
--- a/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationManagerTest.java
+++ b/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationManagerTest.java
@@ -58,7 +58,7 @@ public class DistributedConfigurationManagerTest extends AbstractDistributedConf
ConfigPublisher.main(new String[]{
"-connectString", zookeeper.getConnectString(),
- "-publish"
+ "-a", "publish"
});
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(CONFIG_PUBLISHER_XML);
@@ -140,7 +140,7 @@ public class DistributedConfigurationManagerTest extends AbstractDistributedConf
ConfigPublisher.main(new String[]{
"-connectString", zookeeper.getConnectString(),
- "-clear"
+ "-a", "clear"
});
AbstractDistributedConfigurationTest.tearDown();
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationPublisherTest.java
----------------------------------------------------------------------
diff --git a/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationPublisherTest.java b/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationPublisherTest.java
index 2c130db..5a529ed 100644
--- a/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationPublisherTest.java
+++ b/config/src/test/java/org/apache/oodt/config/distributed/DistributedConfigurationPublisherTest.java
@@ -43,8 +43,7 @@ public class DistributedConfigurationPublisherTest extends AbstractDistributedCo
// Publishing configuration through CLI and verifying whether they were stored correctly
ConfigPublisher.main(new String[]{
"-connectString", zookeeper.getConnectString(),
- "-publish",
- "-verify"
+ "-a", "publish"
});
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(CONFIG_PUBLISHER_XML);
@@ -84,7 +83,7 @@ public class DistributedConfigurationPublisherTest extends AbstractDistributedCo
// Clearing configuration through CLI and checking whether the configuration has actually been gone
ConfigPublisher.main(new String[]{
"-connectString", zookeeper.getConnectString(),
- "-clear"
+ "-a", "clear"
});
for (DistributedConfigurationPublisher publisher : publishers) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/01331125/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index f6382f4..118d171 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -254,11 +254,6 @@ the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>args4j</groupId>
- <artifactId>args4j</artifactId>
- <version>2.33</version>
- </dependency>
- <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.6.0</version>