Omaha #3521 - removed dependency on now non-existent apache commons logging FOSS library. Eliminated configuration parameters
that are no longer required by EDEX. Change-Id: If0387c4f87054bbec898d8371d1b182a146c4c3f Former-commit-id:53f036b5a5
[formerlyce78f461a3
] [formerlya61c35fcb5
] [formerlyfec755cc93
[formerlya61c35fcb5
[formerly e4623ff1a31816aefd717d2ae494e81441710b79]]] Former-commit-id:fec755cc93
Former-commit-id: eee6fef1c421700ddb8ab1f81c3a13446011c87e [formerly4f82e0ba7d
] Former-commit-id:601726b27c
This commit is contained in:
parent
2cd54418af
commit
395122dc26
9 changed files with 417 additions and 378 deletions
|
@ -5,6 +5,6 @@ Bundle-SymbolicName: com.raytheon.wes2bridge.common
|
|||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.apache.commons.configuration;bundle-version="1.6.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
Export-Package: com.raytheon.wes2bridge.common.configuration
|
||||
Require-Bundle: org.apache.commons.lang;bundle-version="2.3.0"
|
||||
Export-Package: com.raytheon.wes2bridge.common.configuration,
|
||||
com.raytheon.wes2bridge.configuration.jaxb
|
||||
|
|
|
@ -0,0 +1,215 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.wes2bridge.common.configuration;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* Represents a Wes2Bridge test case that will be used to configure a new edex
|
||||
* environment.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 12, 2014 3521 bkowal Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "Wes2BridgeCase")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class Wes2BridgeCase {
|
||||
@XmlElement
|
||||
private String name;
|
||||
|
||||
@XmlElement
|
||||
private String dataArchiveRoot;
|
||||
|
||||
@XmlElement
|
||||
private int databasePort;
|
||||
|
||||
@XmlElement
|
||||
private int edexHttpPort;
|
||||
|
||||
@XmlElement
|
||||
private int qpidHttpPort;
|
||||
|
||||
@XmlElement
|
||||
private int qpidJmxPort;
|
||||
|
||||
@XmlElement
|
||||
private int jmsPort;
|
||||
|
||||
@XmlElement
|
||||
private int httpdPypiesPort;
|
||||
|
||||
@XmlElement
|
||||
private int pypiesLoggingPort;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Wes2BridgeCase() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataArchiveRoot
|
||||
*/
|
||||
public String getDataArchiveRoot() {
|
||||
return dataArchiveRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataArchiveRoot
|
||||
* the dataArchiveRoot to set
|
||||
*/
|
||||
public void setDataArchiveRoot(String dataArchiveRoot) {
|
||||
this.dataArchiveRoot = dataArchiveRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the databasePort
|
||||
*/
|
||||
public int getDatabasePort() {
|
||||
return databasePort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param databasePort
|
||||
* the databasePort to set
|
||||
*/
|
||||
public void setDatabasePort(int databasePort) {
|
||||
this.databasePort = databasePort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the edexHttpPort
|
||||
*/
|
||||
public int getEdexHttpPort() {
|
||||
return edexHttpPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param edexHttpPort
|
||||
* the edexHttpPort to set
|
||||
*/
|
||||
public void setEdexHttpPort(int edexHttpPort) {
|
||||
this.edexHttpPort = edexHttpPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the qpidHttpPort
|
||||
*/
|
||||
public int getQpidHttpPort() {
|
||||
return qpidHttpPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param qpidHttpPort
|
||||
* the qpidHttpPort to set
|
||||
*/
|
||||
public void setQpidHttpPort(int qpidHttpPort) {
|
||||
this.qpidHttpPort = qpidHttpPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the qpidJmxPort
|
||||
*/
|
||||
public int getQpidJmxPort() {
|
||||
return qpidJmxPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param qpidJmxPort
|
||||
* the qpidJmxPort to set
|
||||
*/
|
||||
public void setQpidJmxPort(int qpidJmxPort) {
|
||||
this.qpidJmxPort = qpidJmxPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the jmsPort
|
||||
*/
|
||||
public int getJmsPort() {
|
||||
return jmsPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jmsPort
|
||||
* the jmsPort to set
|
||||
*/
|
||||
public void setJmsPort(int jmsPort) {
|
||||
this.jmsPort = jmsPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the httpdPypiesPort
|
||||
*/
|
||||
public int getHttpdPypiesPort() {
|
||||
return httpdPypiesPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param httpdPypiesPort
|
||||
* the httpdPypiesPort to set
|
||||
*/
|
||||
public void setHttpdPypiesPort(int httpdPypiesPort) {
|
||||
this.httpdPypiesPort = httpdPypiesPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pypiesLoggingPort
|
||||
*/
|
||||
public int getPypiesLoggingPort() {
|
||||
return pypiesLoggingPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pypiesLoggingPort
|
||||
* the pypiesLoggingPort to set
|
||||
*/
|
||||
public void setPypiesLoggingPort(int pypiesLoggingPort) {
|
||||
this.pypiesLoggingPort = pypiesLoggingPort;
|
||||
}
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.wes2bridge.common.configuration;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.configuration.XMLConfiguration;
|
||||
|
||||
/**
|
||||
* Reads the edex-environment XML configuration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 18, 2012 1490 bkowal Added httpdPypiesPort and
|
||||
* pypiesLoggingPort as configurable
|
||||
* parameters.
|
||||
* Apr 18, 2013 1899 bkowal Added qpidHttpPort and qpidJmxPort
|
||||
* as configurable parameters.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
/*
|
||||
* Example:
|
||||
* <Wes2BridgeCase>
|
||||
* <name>String</name>
|
||||
* <dataArchiveRoot>String</dataArchiveRoot>
|
||||
* <databasePort>int</databasePort>
|
||||
* <edexHttpPort>int</edexHttpPort>
|
||||
* <jmsPort>int</jmsPort>
|
||||
* <qpidHttpPort>int</qpidHttpPort>
|
||||
* <qpidJmxPort>int</qpidJmxPort>
|
||||
* <webPort>int</webPort>
|
||||
* <confidentialPort>int</confidentialPort>
|
||||
* <httpdPypiesPort>int</httpdPypiesPort>
|
||||
* <pypiesLoggingPort>int</pypiesLoggingPort>
|
||||
* </Wes2BridgeCase>
|
||||
*/
|
||||
public class Wes2BridgeConfiguration {
|
||||
private static class XML_SCHEMA {
|
||||
public static final String XML_TEST_CASE_NAME = "name";
|
||||
public static final String XML_DATA_ARCHIVE_ROOT = "dataArchiveRoot";
|
||||
public static final String XML_DATABASE_PORT = "databasePort";
|
||||
public static final String XML_EDEX_HTTP_PORT = "edexHttpPort";
|
||||
public static final String XML_JMS_PORT = "jmsPort";
|
||||
public static final String XML_QPID_HTTP_PORT = "qpidHttpPort";
|
||||
public static final String XML_QPID_JMX_PORT = "qpidJmxPort";
|
||||
public static final String XML_WEB_PORT = "webPort";
|
||||
public static final String XML_CONFIDENTIAL_PORT = "confidentialPort";
|
||||
public static final String XML_HTTPD_PYPIES_PORT = "httpdPypiesPort";
|
||||
public static final String XML_PYPIES_LOGGING_PORT = "pypiesLoggingPort";
|
||||
}
|
||||
|
||||
private static final String __SPACE = " ";
|
||||
|
||||
private String configurationFile = null;
|
||||
|
||||
private String testCaseName = null;
|
||||
private String dataArchiveRoot = null;
|
||||
private int databasePort = -1;
|
||||
private int edexHttpPort = -1;
|
||||
private int jmsPort = -1;
|
||||
private int qpidHttpPort = -1;
|
||||
private int qpidJmxPort = -1;
|
||||
private int webPort = -1;
|
||||
private int confidentialPort = -1;
|
||||
private int httpdPypiesPort = -1;
|
||||
private int pypiesLoggingPort = -1;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Wes2BridgeConfiguration(String configurationFile) {
|
||||
this.configurationFile = configurationFile;
|
||||
}
|
||||
|
||||
public void init() throws ConfigurationException {
|
||||
XMLConfiguration xmlConfiguration = new XMLConfiguration(
|
||||
this.configurationFile);
|
||||
|
||||
this.testCaseName = xmlConfiguration
|
||||
.getString(XML_SCHEMA.XML_TEST_CASE_NAME);
|
||||
/*
|
||||
* Currently spaces are not allowed in the name of a test case.
|
||||
*/
|
||||
if (this.testCaseName.contains(__SPACE)) {
|
||||
ConfigurationException exception = new ConfigurationException(
|
||||
"The Edex Environment name cannot contain spaces.");
|
||||
exception.fillInStackTrace();
|
||||
|
||||
throw exception;
|
||||
}
|
||||
this.dataArchiveRoot = xmlConfiguration
|
||||
.getString(XML_SCHEMA.XML_DATA_ARCHIVE_ROOT);
|
||||
this.databasePort = xmlConfiguration
|
||||
.getInt(XML_SCHEMA.XML_DATABASE_PORT);
|
||||
this.edexHttpPort = xmlConfiguration
|
||||
.getInt(XML_SCHEMA.XML_EDEX_HTTP_PORT);
|
||||
this.jmsPort = xmlConfiguration.getInt(XML_SCHEMA.XML_JMS_PORT);
|
||||
this.qpidHttpPort =
|
||||
xmlConfiguration.getInt(XML_SCHEMA.XML_QPID_HTTP_PORT);
|
||||
this.qpidJmxPort =
|
||||
xmlConfiguration.getInt(XML_SCHEMA.XML_QPID_JMX_PORT);
|
||||
this.webPort = xmlConfiguration.getInt(XML_SCHEMA.XML_WEB_PORT);
|
||||
this.confidentialPort = xmlConfiguration
|
||||
.getInt(XML_SCHEMA.XML_CONFIDENTIAL_PORT);
|
||||
this.httpdPypiesPort = xmlConfiguration
|
||||
.getInt(XML_SCHEMA.XML_HTTPD_PYPIES_PORT);
|
||||
this.pypiesLoggingPort = xmlConfiguration
|
||||
.getInt(XML_SCHEMA.XML_PYPIES_LOGGING_PORT);
|
||||
}
|
||||
|
||||
public String getTestCaseName() {
|
||||
return testCaseName;
|
||||
}
|
||||
|
||||
public void setTestCaseName(String testCaseName) {
|
||||
this.testCaseName = testCaseName;
|
||||
}
|
||||
|
||||
public String getDataArchiveRoot() {
|
||||
return dataArchiveRoot;
|
||||
}
|
||||
|
||||
public void setDataArchiveRoot(String dataArchiveRoot) {
|
||||
this.dataArchiveRoot = dataArchiveRoot;
|
||||
}
|
||||
|
||||
public int getDatabasePort() {
|
||||
return databasePort;
|
||||
}
|
||||
|
||||
public void setDatabasePort(int databasePort) {
|
||||
this.databasePort = databasePort;
|
||||
}
|
||||
|
||||
public int getEdexHttpPort() {
|
||||
return edexHttpPort;
|
||||
}
|
||||
|
||||
public void setEdexHttpPort(int edexHttpPort) {
|
||||
this.edexHttpPort = edexHttpPort;
|
||||
}
|
||||
|
||||
public int getJmsPort() {
|
||||
return jmsPort;
|
||||
}
|
||||
|
||||
public void setJmsPort(int jmsPort) {
|
||||
this.jmsPort = jmsPort;
|
||||
}
|
||||
|
||||
public int getQpidHttpPort() {
|
||||
return qpidHttpPort;
|
||||
}
|
||||
|
||||
public void setQpidHttpPort(int qpidHttpPort) {
|
||||
this.qpidHttpPort = qpidHttpPort;
|
||||
}
|
||||
|
||||
public int getQpidJmxPort() {
|
||||
return qpidJmxPort;
|
||||
}
|
||||
|
||||
public void setQpidJmxPort(int qpidJmxPort) {
|
||||
this.qpidJmxPort = qpidJmxPort;
|
||||
}
|
||||
|
||||
public int getWebPort() {
|
||||
return webPort;
|
||||
}
|
||||
|
||||
public void setWebPort(int webPort) {
|
||||
this.webPort = webPort;
|
||||
}
|
||||
|
||||
public int getConfidentialPort() {
|
||||
return confidentialPort;
|
||||
}
|
||||
|
||||
public void setConfidentialPort(int confidentialPort) {
|
||||
this.confidentialPort = confidentialPort;
|
||||
}
|
||||
|
||||
public int getHttpdPypiesPort() {
|
||||
return httpdPypiesPort;
|
||||
}
|
||||
|
||||
public void setHttpdPypiesPort(int httpdPypiesPort) {
|
||||
this.httpdPypiesPort = httpdPypiesPort;
|
||||
}
|
||||
|
||||
public int getPypiesLoggingPort() {
|
||||
return pypiesLoggingPort;
|
||||
}
|
||||
|
||||
public void setPypiesLoggingPort(int pypiesLoggingPort) {
|
||||
this.pypiesLoggingPort = pypiesLoggingPort;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.wes2bridge.configuration.jaxb;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import com.raytheon.wes2bridge.common.configuration.Wes2BridgeCase;
|
||||
|
||||
/**
|
||||
* Uses jaxb to convert Wes2Bridge configuration in XML format to a Java POJO.
|
||||
*
|
||||
* <pre>
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 12, 2014 3521 bkowal Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class Wes2BridgeJaxbManager {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected Wes2BridgeJaxbManager() {
|
||||
}
|
||||
|
||||
public static Wes2BridgeCase toWes2BridgeCase(File wes2bridgeXMLFile)
|
||||
throws JAXBException {
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(Wes2BridgeCase.class);
|
||||
|
||||
return (Wes2BridgeCase) jaxbContext.createUnmarshaller().unmarshal(
|
||||
wes2bridgeXMLFile);
|
||||
}
|
||||
}
|
|
@ -36,7 +36,6 @@
|
|||
<zipfileset dir="${baseline.directory}/org.apache.commons.beanutils" includes="commons-beanutils-1.8.3.jar"/>
|
||||
<zipfileset dir="${baseline.directory}/org.apache.commons.digester" includes="commons-digester-1.8.1.jar"/>
|
||||
<zipfileset dir="${baseline.directory}/org.apache.commons.lang" includes="commons-lang-2.3.jar"/>
|
||||
<zipfileset dir="${baseline.directory}/org.apache.commons.configuration" includes="commons-configuration-1.6.jar"/>
|
||||
<fileset dir="${baseline.directory}/com.raytheon.wes2bridge.common/${bin.dir}"/>
|
||||
<fileset dir="${baseline.directory}/com.raytheon.wes2bridge.configuration/${bin.dir}"/>
|
||||
</jar>
|
||||
|
|
|
@ -3,78 +3,75 @@
|
|||
*/
|
||||
package com.raytheon.wes2bridge.configuration;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import java.io.File;
|
||||
|
||||
import com.raytheon.wes2bridge.common.configuration.Wes2BridgeConfiguration;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import com.raytheon.wes2bridge.common.configuration.Wes2BridgeCase;
|
||||
import com.raytheon.wes2bridge.configuration.jaxb.Wes2BridgeJaxbManager;
|
||||
|
||||
/**
|
||||
* A command line utility that can be used to retrieve individual values from configuration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* ? ? bkowal Initial Creation.
|
||||
* Aug 14, 2014 3521 bkowal Updated to use Wes2BridgeCase.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bkowal
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ConfigurationUtility
|
||||
{
|
||||
private static final String FIELD_NAME = "-name";
|
||||
private static final String FIELD_ARCHIVE = "-archiveRoot";
|
||||
private static final String FIELD_DBPORT = "-databasePort";
|
||||
private static final String FIELD_HTTPPORT = "-httpPort";
|
||||
private static final String FIELD_JMSPORT = "-jmsPort";
|
||||
private static final String FIELD_WEBPORT =
|
||||
"-webPort";
|
||||
private static final String FIELD_CONFPORT =
|
||||
"-confidentialPort";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
if (args.length != 2)
|
||||
{
|
||||
System.out.println("Error: both a configuration file and a field must be specified.");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
Wes2BridgeConfiguration configuration =
|
||||
new Wes2BridgeConfiguration(args[0]);
|
||||
try
|
||||
{
|
||||
configuration.init();
|
||||
}
|
||||
catch (ConfigurationException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
final String field = args[1];
|
||||
if (field.equals(FIELD_NAME))
|
||||
{
|
||||
System.out.print(configuration.getTestCaseName());
|
||||
}
|
||||
else if (field.equals(FIELD_ARCHIVE))
|
||||
{
|
||||
System.out.print(configuration.getDataArchiveRoot());
|
||||
}
|
||||
else if (field.equals(FIELD_DBPORT))
|
||||
{
|
||||
System.out.print(configuration.getDatabasePort());
|
||||
}
|
||||
else if (field.equals(FIELD_HTTPPORT))
|
||||
{
|
||||
System.out.print(configuration.getEdexHttpPort());
|
||||
}
|
||||
else if (field.equals(FIELD_JMSPORT))
|
||||
{
|
||||
System.out.print(configuration.getJmsPort());
|
||||
}
|
||||
else if (field.equals(FIELD_WEBPORT))
|
||||
{
|
||||
System.out.println(configuration.getWebPort());
|
||||
}
|
||||
else if (field.equals(FIELD_CONFPORT))
|
||||
{
|
||||
System.out.println(configuration.getConfidentialPort());
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
public class ConfigurationUtility {
|
||||
private static final String FIELD_NAME = "-name";
|
||||
|
||||
private static final String FIELD_ARCHIVE = "-archiveRoot";
|
||||
|
||||
private static final String FIELD_DBPORT = "-databasePort";
|
||||
|
||||
private static final String FIELD_HTTPPORT = "-httpPort";
|
||||
|
||||
private static final String FIELD_JMSPORT = "-jmsPort";
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 2) {
|
||||
System.out
|
||||
.println("Error: both a configuration file and a field must be specified.");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
Wes2BridgeCase wes2BridgeCase = null;
|
||||
try {
|
||||
wes2BridgeCase = Wes2BridgeJaxbManager.toWes2BridgeCase(new File(
|
||||
args[0]));
|
||||
} catch (JAXBException e) {
|
||||
e.printStackTrace();
|
||||
System.out
|
||||
.println("FAILED TO READ THE SPECIFIED CONFIGURATION FILE: "
|
||||
+ args[0] + "!");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
final String field = args[1];
|
||||
if (field.equals(FIELD_NAME)) {
|
||||
System.out.print(wes2BridgeCase.getName());
|
||||
} else if (field.equals(FIELD_ARCHIVE)) {
|
||||
System.out.print(wes2BridgeCase.getDataArchiveRoot());
|
||||
} else if (field.equals(FIELD_DBPORT)) {
|
||||
System.out.print(wes2BridgeCase.getDatabasePort());
|
||||
} else if (field.equals(FIELD_HTTPPORT)) {
|
||||
System.out.print(wes2BridgeCase.getEdexHttpPort());
|
||||
} else if (field.equals(FIELD_JMSPORT)) {
|
||||
System.out.print(wes2BridgeCase.getJmsPort());
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
|
@ -6,5 +6,4 @@ Bundle-Version: 1.0.0.qualifier
|
|||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: com.raytheon.wes2bridge.common;bundle-version="1.0.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
org.apache.commons.configuration;bundle-version="1.6.0"
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
<zipfileset dir="${baseline.directory}/org.apache.commons.beanutils" includes="commons-beanutils-1.8.3.jar"/>
|
||||
<zipfileset dir="${baseline.directory}/org.apache.commons.digester" includes="commons-digester-1.8.1.jar"/>
|
||||
<zipfileset dir="${baseline.directory}/org.apache.commons.lang" includes="commons-lang-2.3.jar"/>
|
||||
<zipfileset dir="${baseline.directory}/org.apache.commons.configuration" includes="commons-configuration-1.6.jar"/>
|
||||
<fileset dir="${baseline.directory}/com.raytheon.wes2bridge.common/${bin.dir}"/>
|
||||
<fileset dir="${baseline.directory}/com.raytheon.wes2bridge.manager/${bin.dir}"/>
|
||||
</jar>
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.io.BufferedWriter;
|
|||
import java.io.IOException;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
@ -38,7 +40,6 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
|
|||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.commons.configuration.ConfigurationException;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -46,7 +47,8 @@ import org.w3c.dom.NodeList;
|
|||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.raytheon.wes2bridge.manager.IQpidConfigurationXML;
|
||||
import com.raytheon.wes2bridge.common.configuration.Wes2BridgeConfiguration;
|
||||
import com.raytheon.wes2bridge.common.configuration.Wes2BridgeCase;
|
||||
import com.raytheon.wes2bridge.configuration.jaxb.Wes2BridgeJaxbManager;
|
||||
|
||||
/**
|
||||
* This java-based utility is used to update a wes2bridge environment. This
|
||||
|
@ -68,6 +70,9 @@ import com.raytheon.wes2bridge.common.configuration.Wes2BridgeConfiguration;
|
|||
* Dec 11, 2013 2182 bkowal Update the postgresql port in
|
||||
* postgresql.conf instead of the
|
||||
* postgresql startup scripts
|
||||
* Aug 14, 2014 3521 bkowal Updated to use Wes2BridgeCase. Eliminated
|
||||
* configuration that is no longer used and
|
||||
* updated EDEX re-configuration.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -92,7 +97,7 @@ public class Wes2BridgeManager {
|
|||
|
||||
private static final String DEFAULT_HDF5_DIRECTORY = "/edex/data/hdf5";
|
||||
|
||||
private Wes2BridgeConfiguration configuration = null;
|
||||
private Wes2BridgeCase wes2BridgeCase;
|
||||
|
||||
private String wes2BridgeScripts = null;
|
||||
|
||||
|
@ -151,11 +156,12 @@ public class Wes2BridgeManager {
|
|||
System.exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
public void init(String arg1) throws ConfigurationException {
|
||||
configuration = new Wes2BridgeConfiguration(arg1);
|
||||
configuration.init();
|
||||
public void init(String arg1) throws JAXBException {
|
||||
this.wes2BridgeCase = Wes2BridgeJaxbManager.toWes2BridgeCase(new File(
|
||||
arg1));
|
||||
|
||||
this.wes2BridgeScripts = WES2BRIDGE_DIRECTORY + "/"
|
||||
+ configuration.getTestCaseName() + "/" + "edex-environment";
|
||||
+ this.wes2BridgeCase.getName() + "/" + "edex-environment";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -164,7 +170,7 @@ public class Wes2BridgeManager {
|
|||
public void reconfigureEdex() throws FileNotFoundException, IOException {
|
||||
final String srcEdexDirectory = AWIPSII + "/" + "edex";
|
||||
final String edexDirectory = WES2BRIDGE_DIRECTORY + "/"
|
||||
+ this.configuration.getTestCaseName() + "/" + "edex";
|
||||
+ this.wes2BridgeCase.getName() + "/" + "edex";
|
||||
|
||||
this.updateEdexSetup(srcEdexDirectory, edexDirectory);
|
||||
this.updateEdexWrapper(srcEdexDirectory, edexDirectory);
|
||||
|
@ -197,22 +203,22 @@ public class Wes2BridgeManager {
|
|||
Matcher matcher = pattern7.matcher(line);
|
||||
|
||||
if (line.startsWith(line1)) {
|
||||
line = line1 + this.configuration.getDataArchiveRoot();
|
||||
line = line1 + this.wes2BridgeCase.getDataArchiveRoot();
|
||||
} else if (line.startsWith(line2)) {
|
||||
line = line2 + this.configuration.getDatabasePort();
|
||||
line = line2 + this.wes2BridgeCase.getDatabasePort();
|
||||
} else if (line.startsWith(line3)) {
|
||||
line = line3 + "localhost:"
|
||||
+ this.configuration.getJmsPort();
|
||||
+ this.wes2BridgeCase.getJmsPort();
|
||||
} else if (line.startsWith(line4)) {
|
||||
line = line4 + this.configuration.getEdexHttpPort();
|
||||
line = line4 + this.wes2BridgeCase.getEdexHttpPort();
|
||||
} else if (line.startsWith(line5)) {
|
||||
line = line5 + "tcp://localhost:"
|
||||
+ this.configuration.getJmsPort();
|
||||
+ this.wes2BridgeCase.getJmsPort();
|
||||
} else if (line.startsWith(line6)) {
|
||||
line = line6 + edexDirectory + "/data/share";
|
||||
} else if (matcher.matches()) {
|
||||
line = matcher.group(GROUP_INDEX_ONE)
|
||||
+ this.configuration.getHttpdPypiesPort();
|
||||
+ this.wes2BridgeCase.getHttpdPypiesPort();
|
||||
}
|
||||
|
||||
bw.write(line + "\n");
|
||||
|
@ -236,69 +242,55 @@ public class Wes2BridgeManager {
|
|||
bw = this.getBufferedWriter(wrapper_conf);
|
||||
|
||||
/*
|
||||
* We want to replace at least one of the jmx jvm arguments with the
|
||||
* wes2bridge.instance argument.
|
||||
* Add a new wes2bridge.instance JVM argument so that it will be
|
||||
* possible to determine which edex instance belongs to which test
|
||||
* case.
|
||||
*/
|
||||
boolean wes2BridgeInstanceAdded = false;
|
||||
|
||||
/*
|
||||
* Disable JMX Remote and add a new wes2bridge.instance JVM argument
|
||||
* so that it will be possible to determine which edex instance
|
||||
* belongs to which test case.
|
||||
*/
|
||||
/*
|
||||
* This may apply to multiple jvm arguments including: 1)
|
||||
* -Dcom.sun.management.jmxremote.port 2)
|
||||
* -Dcom.sun.management.jmxremote.authenticate 3)
|
||||
* -Dcom.sun.management.jmxremote.ssl
|
||||
*/
|
||||
final String line1 = "-Dcom.sun.management.jmxremote";
|
||||
/* Set the web port; used by uengine spring. */
|
||||
final String line2 = "-Dweb.port";
|
||||
/* Set the confidential port; used by uengine spring. */
|
||||
final String line3 = "-Dconfidential.port";
|
||||
int javaAdditionalMax = 0;
|
||||
|
||||
final String line1 = "wrapper.jvm.parameter.order.2=-Daw.site.identifier";
|
||||
|
||||
final String javaAdditionalPatternRegex = "wrapper\\.java\\.additional\\.([0-9]+)=.+";
|
||||
final Pattern javaAdditionalPattern = Pattern
|
||||
.compile(javaAdditionalPatternRegex);
|
||||
|
||||
String line = StringUtils.EMPTY;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.contains(line1)) {
|
||||
line = this.getJVMArgumentName(line);
|
||||
if (wes2BridgeInstanceAdded == false) {
|
||||
line += "-Dwes2bridge.instance="
|
||||
+ this.configuration.getTestCaseName();
|
||||
wes2BridgeInstanceAdded = true;
|
||||
Matcher matcher = javaAdditionalPattern.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
/* Guaranteed to be numeric based on the regex */
|
||||
int javaAdditional = Integer.parseInt(matcher.group(1));
|
||||
if (javaAdditional > javaAdditionalMax) {
|
||||
javaAdditionalMax = javaAdditional;
|
||||
}
|
||||
} else if (line.contains(line2)) {
|
||||
line = this.getJVMArgumentName(line);
|
||||
line += line2 + "=" + this.configuration.getWebPort();
|
||||
} else if (line.contains(line3)) {
|
||||
line = this.getJVMArgumentName(line);
|
||||
line += line3 + "="
|
||||
+ this.configuration.getConfidentialPort();
|
||||
}
|
||||
|
||||
if (line.equals(line1)) {
|
||||
bw.write(line + "\n");
|
||||
/*
|
||||
* Ensure that the wes2bridge test name will be third in the
|
||||
* list of jvm arguments.
|
||||
*/
|
||||
line = "wrapper.jvm.parameter.order.3=-Dwes2bridge.instance";
|
||||
}
|
||||
|
||||
bw.write(line + "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* add the additional JVM argument.
|
||||
*/
|
||||
++javaAdditionalMax;
|
||||
String jvmArg = "wrapper.java.additional." + javaAdditionalMax
|
||||
+ "=-Dwes2bridge.instance=" + this.wes2BridgeCase.getName();
|
||||
bw.write(jvmArg);
|
||||
} finally {
|
||||
br.close();
|
||||
bw.close();
|
||||
}
|
||||
}
|
||||
|
||||
private String getJVMArgumentName(String jvmArgument) {
|
||||
if (jvmArgument == null) {
|
||||
System.out.println("ERROR: Invalid wrapper.conf file.");
|
||||
System.exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
String[] splitJVMArg = jvmArgument.split("=");
|
||||
if (splitJVMArg.length <= 0) {
|
||||
System.out.println("ERROR: Invalid wrapper.conf file.");
|
||||
System.exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return splitJVMArg[0] + "=";
|
||||
}
|
||||
|
||||
private void updateEdexCamel(String edexDirectory)
|
||||
throws FileNotFoundException, IOException {
|
||||
final String srcedex_camel = AWIPSII_WES2BRIDGE_SCRIPTS + "/"
|
||||
|
@ -311,21 +303,25 @@ public class Wes2BridgeManager {
|
|||
br = this.getBufferedReader(srcedex_camel);
|
||||
bw = this.getBufferedWriter(edex_camel);
|
||||
|
||||
final String line1 = "EDEX_INSTALL=";
|
||||
final String line1 = "export EDEX_INSTALL=";
|
||||
final String line2 = "export DATA_ARCHIVE_ROOT=";
|
||||
final String line3 = "CAMELPROCESS=`ps -ef | grep \"aw.site.identifier\"|grep -c \"edex.run.mode=${1} \" `";
|
||||
final String line4 = "_camel_pid=`pgrep -f \"java.*-Dedex.run.mode=${1} \"`";
|
||||
|
||||
String line = StringUtils.EMPTY;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (line.trim().startsWith(line1)) {
|
||||
line = line1 + edexDirectory;
|
||||
} else if (line.trim().startsWith(line2)) {
|
||||
line = line2 + this.configuration.getDataArchiveRoot();
|
||||
line = line2 + this.wes2BridgeCase.getDataArchiveRoot();
|
||||
} else if (line.trim().startsWith(line3)) {
|
||||
line = "CAMELPROCESS=`ps -ef | "
|
||||
+ "grep \"wes2bridge.instance="
|
||||
+ this.configuration.getTestCaseName() + "\" | "
|
||||
+ this.wes2BridgeCase.getName() + "\" | "
|
||||
+ "grep -c \"edex.run.mode=${1} \" `";
|
||||
} else if (line.trim().startsWith(line4)) {
|
||||
line = "_camel_pid=`pgrep -f \"java.*-Dedex.run.mode=${1} -Daw.site.identifier=.+ -Dwes2bridge.instance="
|
||||
+ this.wes2BridgeCase.getName() + " \"`";
|
||||
}
|
||||
|
||||
bw.write(line + "\n");
|
||||
|
@ -339,7 +335,7 @@ public class Wes2BridgeManager {
|
|||
public void reconfigurePostgreSQL() throws FileNotFoundException,
|
||||
IOException {
|
||||
final String postgresqlRootDirectory = WES2BRIDGE_DIRECTORY
|
||||
+ File.separator + this.configuration.getTestCaseName();
|
||||
+ File.separator + this.wes2BridgeCase.getName();
|
||||
final String srcDataDirectory = AWIPSII + File.separator + "data";
|
||||
|
||||
this.updateEdexPostgres(postgresqlRootDirectory);
|
||||
|
@ -380,8 +376,8 @@ public class Wes2BridgeManager {
|
|||
final String srcPostgresqlConf = srcDataDirectory + File.separator
|
||||
+ postgresqlConf;
|
||||
final String destPostgresqlConf = WES2BRIDGE_DIRECTORY + File.separator
|
||||
+ this.configuration.getTestCaseName() + File.separator
|
||||
+ "data" + File.separator + postgresqlConf;
|
||||
+ this.wes2BridgeCase.getName() + File.separator + "data"
|
||||
+ File.separator + postgresqlConf;
|
||||
|
||||
final String regex1 = "^(port = )([0-9]+)(.+)";
|
||||
final Pattern pattern1 = Pattern.compile(regex1);
|
||||
|
@ -399,7 +395,7 @@ public class Wes2BridgeManager {
|
|||
Matcher matcher = pattern1.matcher(line);
|
||||
if (matcher.matches()) {
|
||||
stringBuilder.append(matcher.group(1));
|
||||
stringBuilder.append(this.configuration.getDatabasePort());
|
||||
stringBuilder.append(this.wes2BridgeCase.getDatabasePort());
|
||||
stringBuilder.append(matcher.group(3));
|
||||
|
||||
line = stringBuilder.toString();
|
||||
|
@ -418,7 +414,7 @@ public class Wes2BridgeManager {
|
|||
TransformerFactoryConfigurationError, TransformerException {
|
||||
final String srcQpidDirectory = AWIPSII + "/" + "qpid";
|
||||
final String qpidDirectory = WES2BRIDGE_DIRECTORY + "/"
|
||||
+ this.configuration.getTestCaseName() + "/" + "qpid";
|
||||
+ this.wes2BridgeCase.getName() + "/" + "qpid";
|
||||
|
||||
this.updateQpidConfigXML(srcQpidDirectory, qpidDirectory);
|
||||
this.updateQPIDD(qpidDirectory);
|
||||
|
@ -457,17 +453,17 @@ public class Wes2BridgeManager {
|
|||
// Get the connector port node.
|
||||
portNode = this.getChildNodeByName(connectorNode,
|
||||
IQpidConfigurationXML.XML_PORT);
|
||||
portNode.setTextContent(Integer.toString(this.configuration
|
||||
portNode.setTextContent(Integer.toString(this.wes2BridgeCase
|
||||
.getJmsPort()));
|
||||
// Get the jmxport registryServer node
|
||||
portNode = this.getChildNodeByName(jmxPortNode,
|
||||
IQpidConfigurationXML.XML_REGISTRY_SERVER);
|
||||
portNode.setTextContent(Integer.toString(this.configuration
|
||||
portNode.setTextContent(Integer.toString(this.wes2BridgeCase
|
||||
.getQpidJmxPort()));
|
||||
// Get the http port node.
|
||||
portNode = this.getChildNodeByName(httpPortNode,
|
||||
IQpidConfigurationXML.XML_PORT);
|
||||
portNode.setTextContent(Integer.toString(this.configuration
|
||||
portNode.setTextContent(Integer.toString(this.wes2BridgeCase
|
||||
.getQpidHttpPort()));
|
||||
|
||||
/*
|
||||
|
@ -529,13 +525,12 @@ public class Wes2BridgeManager {
|
|||
public void reconfigurePypies() throws FileNotFoundException, IOException {
|
||||
final String srcPypiesDirectory = AWIPSII + File.separator + "pypies";
|
||||
final String pypiesDirectory = WES2BRIDGE_DIRECTORY + File.separator
|
||||
+ this.configuration.getTestCaseName() + File.separator
|
||||
+ "pypies";
|
||||
+ this.wes2BridgeCase.getName() + File.separator + "pypies";
|
||||
|
||||
final String srcHttpdPypiesDirectory = AWIPSII + File.separator
|
||||
+ "httpd_pypies";
|
||||
final String httpdPypiesDirectory = WES2BRIDGE_DIRECTORY
|
||||
+ File.separator + this.configuration.getTestCaseName()
|
||||
+ File.separator + this.wes2BridgeCase.getName()
|
||||
+ File.separator + "httpd_pypies";
|
||||
|
||||
this.updatePypiesCfg(srcPypiesDirectory, pypiesDirectory);
|
||||
|
@ -553,7 +548,7 @@ public class Wes2BridgeManager {
|
|||
|
||||
// use the default location for the hdf5 root
|
||||
final String hdf5DirectoryLocation = WES2BRIDGE_DIRECTORY
|
||||
+ File.separator + this.configuration.getTestCaseName()
|
||||
+ File.separator + this.wes2BridgeCase.getName()
|
||||
+ DEFAULT_HDF5_DIRECTORY;
|
||||
final String logFileDirectoryLocation = pypiesDirectory
|
||||
+ File.separator + "logs";
|
||||
|
@ -585,7 +580,7 @@ public class Wes2BridgeManager {
|
|||
line += logFileDirectoryLocation;
|
||||
} else if (matcher3.matches()) {
|
||||
line = matcher3.group(GROUP_INDEX_ONE);
|
||||
line += this.configuration.getPypiesLoggingPort();
|
||||
line += this.wes2BridgeCase.getPypiesLoggingPort();
|
||||
}
|
||||
|
||||
bw.write(line + "\n");
|
||||
|
@ -625,7 +620,7 @@ public class Wes2BridgeManager {
|
|||
Matcher matcher2 = pattern2.matcher(line);
|
||||
if (matcher1.matches()) {
|
||||
line = matcher1.group(GROUP_INDEX_ONE);
|
||||
line += this.configuration.getHttpdPypiesPort();
|
||||
line += this.wes2BridgeCase.getHttpdPypiesPort();
|
||||
} else if (matcher2.matches()) {
|
||||
line = matcher2.group(GROUP_INDEX_ONE);
|
||||
line += serverRoot;
|
||||
|
@ -671,7 +666,7 @@ public class Wes2BridgeManager {
|
|||
line += httpdPypiesDirectory;
|
||||
} else if (matcher2.matches()) {
|
||||
line = matcher2.group(GROUP_INDEX_ONE);
|
||||
line += this.configuration.getTestCaseName();
|
||||
line += this.wes2BridgeCase.getName();
|
||||
line += matcher2.group(GROUP_INDEX_TWO);
|
||||
} else if (matcher3.matches()) {
|
||||
line = matcher3.group(GROUP_INDEX_ONE) + pypiesDirectory
|
||||
|
|
Loading…
Add table
Reference in a new issue