Omaha #3152 removed monitorsrv
jmx plugin that is currently not used and required dependency maintenance Former-commit-id:083b68d7b4
[formerly2de644c9e3
] [formerly87aa26bf5a
] [formerlyed8b9f5a89
[formerly87aa26bf5a
[formerly 7a00a651afb1c4251b52a852b01696cc861640be]]] Former-commit-id:ed8b9f5a89
Former-commit-id: e2220ff9eabf1270c1ef05bef631dcc980ffdf3f [formerlyb75243d000
] Former-commit-id:7d9eaa94c5
This commit is contained in:
parent
baa755e914
commit
bc2ac0198b
18 changed files with 0 additions and 1246 deletions
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.edex.monitorsrv</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,7 +0,0 @@
|
|||
#Thu Mar 26 09:21:50 CDT 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,15 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Monitorsrv Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.edex.monitorsrv
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Export-Package: com.raytheon.edex.monitors,
|
||||
com.raytheon.edex.services
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.edex.util,
|
||||
org.apache.commons.logging,
|
||||
org.apache.log4j
|
||||
Require-Bundle: com.raytheon.uf.edex.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.util;bundle-version="1.12.1174"
|
|
@ -1,5 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/
|
|
@ -1,18 +0,0 @@
|
|||
<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-3.1.xsd">
|
||||
|
||||
<bean id="jmxExporter"
|
||||
class="org.springframework.jmx.export.MBeanExporter">
|
||||
<property name="beans">
|
||||
<map>
|
||||
<entry key="log4j:name=settings" value-ref="log4jBean" />
|
||||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="log4jBean"
|
||||
class="com.raytheon.edex.logging.Log4jLevels" />
|
||||
|
||||
</beans>
|
|
@ -1,93 +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.edex.logging;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Class to modify log4j levels at runtime
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 12/13/07 629 garmendariz Initial check-in
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author garmendariz
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Log4jLevels {
|
||||
|
||||
public String setLevel(String loggerName, String level) {
|
||||
|
||||
if(!checkLevel(level))
|
||||
{
|
||||
return "Can not set level. Valid levels are: debug, info, error, fatal, warn";
|
||||
}
|
||||
|
||||
int nLevel = Level.toLevel(level.toLowerCase()).toInt();
|
||||
|
||||
switch (nLevel) {
|
||||
case Level.DEBUG_INT:
|
||||
Logger.getLogger(loggerName).setLevel(Level.DEBUG);
|
||||
break;
|
||||
case Level.INFO_INT:
|
||||
Logger.getLogger(loggerName).setLevel(Level.INFO);
|
||||
break;
|
||||
case Level.ERROR_INT:
|
||||
Logger.getLogger(loggerName).setLevel(Level.ERROR);
|
||||
break;
|
||||
case Level.FATAL_INT:
|
||||
Logger.getLogger(loggerName).setLevel(Level.FATAL);
|
||||
break;
|
||||
case Level.WARN_INT:
|
||||
Logger.getLogger(loggerName).setLevel(Level.WARN);
|
||||
break;
|
||||
}
|
||||
|
||||
return loggerName + " has been set to " + level + ".\nModify log4j.properties in the Mule conf for permanent changes";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the level is a valid one
|
||||
* @param level
|
||||
*/
|
||||
private boolean checkLevel(String level) {
|
||||
|
||||
if(level.equalsIgnoreCase("debug") ||
|
||||
level.equalsIgnoreCase("error") ||
|
||||
level.equalsIgnoreCase("debug") ||
|
||||
level.equalsIgnoreCase("fatal") ||
|
||||
level.equalsIgnoreCase("warn") ||
|
||||
level.equalsIgnoreCase("info"))
|
||||
{
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,71 +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.edex.monitors;
|
||||
|
||||
/**
|
||||
* An abstract base class for EDEX Database Monitors.
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 12May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AEdexDBMonitor extends AEdexMonitor {
|
||||
protected String query
|
||||
= "select count(*) from pg_stat_activity where usename='awips' and datname='metadata'";
|
||||
|
||||
protected static final String REPORT_FORMAT = "Database: %s, connections = %s";
|
||||
/**
|
||||
* Constructor. Creates a default object with the default query.
|
||||
*/
|
||||
public AEdexDBMonitor() {
|
||||
// Intentionally empty.
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates an object for the specified query.
|
||||
* @param query
|
||||
*/
|
||||
public AEdexDBMonitor(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
abstract public void execute();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#setData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setData(String data) {
|
||||
this.query = data;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +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.edex.monitors;
|
||||
|
||||
import java.io.FilenameFilter;
|
||||
|
||||
import com.raytheon.uf.common.util.file.FilenameFilters;
|
||||
|
||||
/**
|
||||
* An abstract base class for directory monitors.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 08May2008 1113 MW Fegan Initial creation.
|
||||
* Mar 14, 2013 1794 djohnson Consolidate common FilenameFilter implementations.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AEdexDirMonitor extends AEdexMonitor {
|
||||
/** format string for invalid directory messages */
|
||||
protected static final String DIR_ERROR_FORMAT = "Specified path [%s] is not a directory";
|
||||
/** indicates if the directory search is recursive */
|
||||
protected boolean recursive = false;
|
||||
|
||||
/** path to the directory to scan */
|
||||
protected String dirToCheck = ".";
|
||||
|
||||
/* file filter that screens out "dot" files */
|
||||
protected FilenameFilter filter = FilenameFilters.NO_LINUX_HIDDEN_FILES;
|
||||
|
||||
/**
|
||||
* Constructor. Takes no action.
|
||||
*/
|
||||
public AEdexDirMonitor() {
|
||||
// intentionally empty
|
||||
}
|
||||
/**
|
||||
* Constructor. Sets the {@code dirToCheck} to the specified value.
|
||||
*/
|
||||
public AEdexDirMonitor(String directory) {
|
||||
this.dirToCheck = directory;
|
||||
}
|
||||
/**
|
||||
* Constructor. Sets the {@code dirToCheck} and {@code recursive} attributes
|
||||
* to the specified values.
|
||||
*/
|
||||
public AEdexDirMonitor(String directory, String tree) {
|
||||
this.dirToCheck = directory;
|
||||
this.recursive = Boolean.valueOf(tree);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
abstract public void execute();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#setData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
abstract public void setData(String data);
|
||||
}
|
|
@ -1,59 +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.edex.monitors;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 06May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AEdexMonitor implements IEdexMonitor {
|
||||
protected transient Log logger = LogFactory.getLog(getClass());
|
||||
/**
|
||||
* Constructor. Creates an empty object.
|
||||
*/
|
||||
public AEdexMonitor() {
|
||||
/* intentionally empty */
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.IEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
abstract public void execute();
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.IEdexMonitor#setData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
abstract public void setData(String data);}
|
|
@ -1,89 +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.edex.monitors;
|
||||
|
||||
import com.raytheon.edex.services.MonitorSrv;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
|
||||
/**
|
||||
* Performs a database monitoring task on the database utilized by the Mule
|
||||
* instance. The number of connections is reported to the system log. The format
|
||||
* of the log message is
|
||||
* <P>
|
||||
* Database: {connection URL}, connections = {count}
|
||||
* <P>
|
||||
* This class is intended to be injected into an {@link MonitorSrv} instance by
|
||||
* Mule. Because of that, all constructor arguments are of type String.
|
||||
* <P>
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 06May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EdexDBLocalMonitor extends AEdexDBMonitor {
|
||||
|
||||
/**
|
||||
* Constructor. Creates a Local Database Monitor using the default query
|
||||
* string.
|
||||
*/
|
||||
public EdexDBLocalMonitor() {
|
||||
// Intentionally Empty
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Creates a Local Database Monitor using the specified query
|
||||
* string.
|
||||
*
|
||||
* @param query
|
||||
* the monitoring query string
|
||||
*/
|
||||
public EdexDBLocalMonitor(String query) {
|
||||
super(query);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.monitors.AEdexDBMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
CoreDao dao = new CoreDao(DaoConfig.DEFAULT);
|
||||
|
||||
Object[] results = dao.executeSQLQuery(query);
|
||||
if (results == null || results.length == 0) {
|
||||
logger.info("No results returned from query [" + query + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info(String.format(REPORT_FORMAT, "localhost/"
|
||||
+ DaoConfig.DEFAULT_DB_NAME, results[0].toString()));
|
||||
|
||||
}
|
||||
}
|
|
@ -1,193 +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.edex.monitors;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
//import com.raytheon.edex.db.dao.CoreDao;
|
||||
//import com.raytheon.edex.db.dao.pool.DaoConfig;
|
||||
//import com.raytheon.edex.db.dao.pool.DaoPool;
|
||||
import com.raytheon.edex.services.MonitorSrv;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
|
||||
/**
|
||||
* Performs a database monitoring task on a remote database. This monitor
|
||||
* is intended to allow an instance of EDEX to monitor database connections
|
||||
* on another server. The number of connections is reported to the system
|
||||
* log. The format of the log message is
|
||||
* <P>
|
||||
* Database: {connection URL}, connections = {count}
|
||||
* <P>
|
||||
* This class is intended to be injected into an {@link MonitorSrv} instance by
|
||||
* Mule. Because of that, all constructor arguments are of type String.
|
||||
* <P>
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 12May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EdexDBRemoteMonitor extends AEdexDBMonitor {
|
||||
private static final String DB_DRIVER = "org.postgresql.Driver";
|
||||
private String connectionURL = "jdbc:postgresql://localhost:5432/metadata";
|
||||
private String user = "awips:awips";
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName(DB_DRIVER);
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println(new EdexException("Unable to load PostgresSQL driver",e));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates an empty object.
|
||||
*/
|
||||
public EdexDBRemoteMonitor() {
|
||||
super();
|
||||
}
|
||||
/**
|
||||
* Constructor. Initialized the SQL query to the argument.
|
||||
*
|
||||
* @param data SQL string used to monitor the database.
|
||||
*/
|
||||
public EdexDBRemoteMonitor(String query) {
|
||||
super(query);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
* @param user
|
||||
* @param query
|
||||
*/
|
||||
public EdexDBRemoteMonitor(String url, String user, String query) {
|
||||
super();
|
||||
this.connectionURL = url;
|
||||
this.user = user;
|
||||
this.query = query;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.IEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = getConnection(connectionURL, user);
|
||||
if (conn == null) {
|
||||
return;
|
||||
}
|
||||
List<Object> results = performQuery(conn, query);
|
||||
printResult(results);
|
||||
} finally {
|
||||
closeConnection(conn);
|
||||
}
|
||||
}
|
||||
private void printResult(List<Object> results) {
|
||||
if (results.size() != 1) {
|
||||
logger.warn("obtained invalid result from status query.");
|
||||
}
|
||||
logger.info(String.format(REPORT_FORMAT,connectionURL, results.get(0).toString()));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param conn
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
private List<Object> performQuery(Connection conn, String query) {
|
||||
List<Object> retVal = new ArrayList<Object>();
|
||||
Statement s = null;
|
||||
ResultSet r = null;
|
||||
try {
|
||||
s = conn.createStatement();
|
||||
r = s.executeQuery(query);
|
||||
while (r.next()) {
|
||||
retVal.add(r.getObject(1));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Encountered problems executing status query",e);
|
||||
} finally {
|
||||
try {
|
||||
if (r != null) {
|
||||
r.close();
|
||||
}
|
||||
if (s != null) {
|
||||
s.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Unable to close resultset/statement for status query", e);
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param url
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
private Connection getConnection(String url, String user) {
|
||||
Connection conn = null;
|
||||
try {
|
||||
Pattern p = Pattern.compile("(.+)[:=@](.+)");
|
||||
Matcher m = p.matcher(user);
|
||||
String name = "";
|
||||
String passwd = "";
|
||||
if (m.matches()) {
|
||||
name = m.group(1);
|
||||
passwd = m.group(2);
|
||||
}
|
||||
conn = DriverManager.getConnection(url, name, passwd);
|
||||
} catch (SQLException e) {
|
||||
logger.warn("Unable to create connection to database, url=" + url + ", user=" + user, e);
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param conn
|
||||
*/
|
||||
private void closeConnection(Connection conn) {
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
// can't do much, just log and return
|
||||
logger.warn("Unable to close DB Connection",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,121 +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.edex.monitors;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.raytheon.edex.services.MonitorSrv;
|
||||
|
||||
/**
|
||||
* Performs a count of the files in a directory or directory tree. The total
|
||||
* file count is reported by logging to the application log. The format
|
||||
* of the log message is
|
||||
* <P>
|
||||
* {directory path}: Directory contains {count} files
|
||||
* <P>
|
||||
* File scan defaults to the current directory (not tree search).
|
||||
* <P>
|
||||
* This class is intended to be injected into an {@link MonitorSrv} instance by
|
||||
* Mule. Because of that, all constructor arguments are of type String.
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 08May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EdexDirCountMonitor extends AEdexDirMonitor {
|
||||
/* format string for reporting statistics */
|
||||
private static final String REPORT_FORMAT = "%s: Directory contains %d files";
|
||||
|
||||
/**
|
||||
* Constructor. Creates a monitor using the defaults.
|
||||
*/
|
||||
public EdexDirCountMonitor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Creates a monitor for the specified directory.
|
||||
* The scan is non-recursive.
|
||||
*
|
||||
* @param directory the directory to scan.
|
||||
*/
|
||||
public EdexDirCountMonitor(String directory) {
|
||||
super(directory);
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates a monitor for the specified directory.The second
|
||||
* argument controls scanning depth. Pass "true" to scan the tree, pass
|
||||
* "false" to scan just the specified directory.
|
||||
*
|
||||
* @param path path to the directory to scan
|
||||
* @param tree scan tree flag. Use "true" to scan entire tree.
|
||||
*/
|
||||
public EdexDirCountMonitor(String directory, String tree) {
|
||||
super(directory,tree);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.IEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
File dir = new File(dirToCheck);
|
||||
if (!dir.isDirectory()) {
|
||||
logger.warn(String.format(DIR_ERROR_FORMAT, dirToCheck));
|
||||
return;
|
||||
}
|
||||
long count = getCounts(dir,this.recursive);
|
||||
logger.info(String.format(REPORT_FORMAT, dirToCheck, count));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param dir
|
||||
* @param recursive
|
||||
* @return
|
||||
*/
|
||||
private long getCounts(File dir,boolean recursive) {
|
||||
long retVal = 0;
|
||||
for(File file : dir.listFiles(filter)){
|
||||
if (recursive && file.isDirectory()) {
|
||||
retVal += getCounts(file,recursive);
|
||||
} else {
|
||||
retVal++;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.IEdexMonitor#setData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setData(String data) {
|
||||
this.dirToCheck = data;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,125 +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.edex.monitors;
|
||||
|
||||
import java.io.File;
|
||||
import com.raytheon.edex.services.MonitorSrv;
|
||||
|
||||
/**
|
||||
* Performs a file size calculation on a directory or directory tree. The total
|
||||
* file size is reported by logging to the application log. The format
|
||||
* of the log message is
|
||||
* <P>
|
||||
* {directory path}: Total file size {size} bytes
|
||||
* <P>
|
||||
* File scan defaults to the current directory (not tree search).
|
||||
* <P>
|
||||
* This class is intended to be injected into an {@link MonitorSrv} instance by
|
||||
* Mule. Because of that, all constructor arguments are of type String.
|
||||
* <P>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 08May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EdexDirSizeMonitor extends AEdexDirMonitor {
|
||||
|
||||
private static final String REPORT_FORMAT = "%s: Total file size %d bytes";
|
||||
|
||||
/**
|
||||
* Constructor. Creates a directory size monitor using the default settings.
|
||||
*/
|
||||
public EdexDirSizeMonitor() {
|
||||
super();
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates a directory size monitor for the specified directory.
|
||||
* The scan is limited to the specified directory.
|
||||
*
|
||||
* @param directory path to the directory to scan
|
||||
*/
|
||||
public EdexDirSizeMonitor(String directory) {
|
||||
super(directory);
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates a directory size monitor for the specified directory.
|
||||
* The second argument controls scanning depth. Pass "true" to scan the tree,
|
||||
* pass "false" to scan just the specified directory.
|
||||
*
|
||||
* @param directory path to the directory to scan
|
||||
* @param tree scan tree flag. Use "true" to scan entire tree.
|
||||
*/
|
||||
public EdexDirSizeMonitor(String directory, String tree) {
|
||||
super(directory,tree);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
File dir = new File(dirToCheck);
|
||||
if (!dir.isDirectory()) {
|
||||
logger.warn(String.format(DIR_ERROR_FORMAT, dirToCheck));
|
||||
return;
|
||||
}
|
||||
long size = getSizes(dir,this.recursive);
|
||||
logger.info(String.format(REPORT_FORMAT, dirToCheck,size));
|
||||
}
|
||||
/**
|
||||
* Finds the total size of the files in a directory. Recursively
|
||||
* scans the directory and finds the total number of bytes in the
|
||||
* files in the directory. Setting the recursive flag to false limits
|
||||
* the search to a single directory.
|
||||
*
|
||||
* @param dir the directory to search
|
||||
* @param recursive set true to search entire tree
|
||||
*
|
||||
* @return number of bytes used by files in the directory
|
||||
*/
|
||||
private long getSizes(File dir, boolean recursive) {
|
||||
long retVal = 0;
|
||||
for(File file : dir.listFiles(filter)){
|
||||
if (recursive && file.isDirectory()) {
|
||||
retVal += getSizes(file,recursive);
|
||||
} else {
|
||||
retVal += file.length();
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#setData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setData(String data) {
|
||||
dirToCheck = data;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,194 +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.edex.monitors;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
import com.raytheon.edex.services.MonitorSrv;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
|
||||
/**
|
||||
* Uses JMX to obtain latency information for an end-point. Reports queue size,
|
||||
* event backlog and average execution time for the end-point. The format of the
|
||||
* log message is
|
||||
* <P>
|
||||
* {end-point name}: Queue Size = {count}, Event Backlog = {count}, Average Execution Time = {count}
|
||||
* <P>
|
||||
* The monitoring defaults to the current Mule instance on the local computer.
|
||||
* There is no default for the end-point parameter.
|
||||
* <P>
|
||||
* This class is intended to be injected into an {@link MonitorSrv} instance by
|
||||
* Mule. Because of that, all constructor arguments are of type String.
|
||||
* <P>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 07May2008 1113 MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EdexLatencyMonitor extends AEdexMonitor {
|
||||
/* format string for creating the connection URL */
|
||||
private static final String URL_FORMAT = "service:jmx:rmi://%s/jndi/rmi://%s:%s/%s";
|
||||
/* format string for reporting statistics */
|
||||
private static final String REPORT_FORMAT = "%s: Queue Size = %d, Event Backlog = %d, Average Execution Time = %d";
|
||||
/** host name for connection string */
|
||||
private String server = "localhost";
|
||||
/** port for connection string */
|
||||
private String port = "1099";
|
||||
/** application for connection string */
|
||||
private String application = "Mule";
|
||||
/** complete connection URL */
|
||||
private String strurl = String.format(URL_FORMAT, server,server,port,application);
|
||||
/** name of end-point to monitor */
|
||||
private String beanName = null;
|
||||
|
||||
MBeanServerConnection connection = null;
|
||||
/**
|
||||
* Constructor. Creates a monitor using defaults.
|
||||
*/
|
||||
public EdexLatencyMonitor() {
|
||||
// intentionally empty
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates a monitor for the specified end-point. The monitor uses
|
||||
* the default connection URL.
|
||||
*
|
||||
* @param beanName name of end-point to monitor
|
||||
*/
|
||||
public EdexLatencyMonitor(String beanName) {
|
||||
this.beanName = beanName;
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates a monitor for the specified Mule instance using the
|
||||
* specified end-point.
|
||||
*
|
||||
* @param server the server hosting the mule instance
|
||||
* @param port the port to which Mule is listening
|
||||
* @param application the Mule application identifier (usually "Mule")
|
||||
* @param beanName name of end-point to monitor
|
||||
*/
|
||||
public EdexLatencyMonitor(String server, String port, String application, String beanName) {
|
||||
this.server = server;
|
||||
this.port = port;
|
||||
this.application = application;
|
||||
this.strurl = String.format(URL_FORMAT, server,server,port,application);
|
||||
this.beanName = beanName;
|
||||
}
|
||||
/**
|
||||
* Constructor. Creates a monitor for the specified connection URL using the
|
||||
* specified end-point. The format of the connection URL is
|
||||
* <P>
|
||||
* service:jmx:rmi://{server}/jndi/rmi://{server}:{port}/{application}
|
||||
*
|
||||
* @param strurl the connection URL
|
||||
* @param beanName name of end-point to monitor
|
||||
*/
|
||||
public EdexLatencyMonitor(String strurl, String beanName) {
|
||||
this.strurl = strurl;
|
||||
this.beanName = beanName;
|
||||
}
|
||||
/**
|
||||
* Initializes the JMX connection.
|
||||
*/
|
||||
private void init() {
|
||||
if (this.connection != null) {
|
||||
return;
|
||||
}
|
||||
JMXConnector connector = null;
|
||||
try {
|
||||
JMXServiceURL url = new JMXServiceURL(strurl);
|
||||
connector = JMXConnectorFactory.connect(url);
|
||||
} catch (MalformedURLException e) {
|
||||
logger.warn(connection + "is invalid",e);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Unable to connect to " + strurl,e);
|
||||
}
|
||||
if (connector != null) {
|
||||
try {
|
||||
this.connection = connector.getMBeanServerConnection();
|
||||
} catch (IOException e) {
|
||||
logger.warn("Unable to create connection to " + strurl,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#execute()
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
init();
|
||||
if (this.connection == null) {
|
||||
logger.warn("connection to " + strurl + " is unavailable, unable to monitor");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String[] domainNames = this.connection.getDomains();
|
||||
String domainName = "";
|
||||
for (String name : domainNames) {
|
||||
if (name.startsWith("Mule")) {
|
||||
domainName = name;
|
||||
}
|
||||
}
|
||||
String objStr = domainName+":type=org.mule.Component,name=\""+beanName+"\"";
|
||||
Set<ObjectName> sets = null;
|
||||
ObjectName obName = new ObjectName(objStr);
|
||||
sets = this.connection.queryNames(obName, null);
|
||||
if (sets.size() != 1) {
|
||||
logger.warn("unable to get access to " + objStr);
|
||||
return;
|
||||
}
|
||||
ObjectName theObject = (ObjectName)sets.toArray()[0];
|
||||
Integer queueSize = (Integer)connection.getAttribute(theObject, "QueueSize");
|
||||
Long queuedEvents = (Long)connection.getAttribute(theObject, "QueuedEvents");
|
||||
Long averageTime = (Long)connection.getAttribute(theObject, "AverageExecutionTime");
|
||||
logger.info(String.format(REPORT_FORMAT,StringUtil.printString(beanName),
|
||||
queueSize,queuedEvents,averageTime));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.edex.monitors.AEdexMonitor#setData(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setData(String data) {
|
||||
this.beanName = data;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,54 +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.edex.monitors;
|
||||
|
||||
import com.raytheon.edex.services.MonitorSrv;
|
||||
|
||||
/**
|
||||
* Specifies the interface defining the capabilities of the EDEX monitor
|
||||
* classes. These are used by the {@link MonitorSrv} to monitor and report
|
||||
* various system conditions.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02May2008 TBD MW Fegan Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IEdexMonitor {
|
||||
/**
|
||||
* Sets the user data from the monitor. This should be called just
|
||||
* prior to running the {@link #execute()} method.
|
||||
* @param data the data to provide to the monitor
|
||||
*/
|
||||
public void setData(final String data);
|
||||
/**
|
||||
* Triggers a single monitoring event in the monitor.
|
||||
*/
|
||||
public void execute();
|
||||
}
|
|
@ -1,79 +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.edex.services;
|
||||
|
||||
import com.raytheon.edex.monitors.IEdexMonitor;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
|
||||
/**
|
||||
* This is a service endpoint for EDEX monitoring. It receives an
|
||||
* {@link IEdexMonitor} instance by injection and calls the
|
||||
* {@link IEdexMonitor#execute()} method. All error handling is managed here as
|
||||
* well.
|
||||
* <P>
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 02May2008 1113 MW Fegan Initial implementation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mfegan
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MonitorSrv {
|
||||
private IEdexMonitor edexMonitor = null;
|
||||
|
||||
/**
|
||||
* Constructor. Creates an empty end-point ready for use by Mule.
|
||||
*/
|
||||
public MonitorSrv() {
|
||||
// Intentionally empty.
|
||||
}
|
||||
|
||||
public void process() throws EdexException {
|
||||
if (edexMonitor == null) {
|
||||
throw new EdexException("Monitor is null - unable to process");
|
||||
}
|
||||
edexMonitor.execute();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link IEdexMonitor} instance used by this end-point.
|
||||
*/
|
||||
public IEdexMonitor getEdexMonitor() {
|
||||
return edexMonitor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link IEdexMonitor} instance for the monitor to use.
|
||||
* <P>
|
||||
* Note: This is provided to allow dependency injection by the container.
|
||||
*/
|
||||
public void setEdexMonitor(IEdexMonitor edexMonitor) {
|
||||
this.edexMonitor = edexMonitor;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue