You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/01/04 22:00:25 UTC
svn commit: r492738 - in /incubator/servicemix/trunk:
core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/
core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/jdbc/
core/servicemix-audit/src/main/java/org/apache/servicem...
Author: gnodet
Date: Thu Jan 4 13:00:24 2007
New Revision: 492738
URL: http://svn.apache.org/viewvc?view=rev&rev=492738
Log:
SM-802: Refactor the Auditor MBean interface to avoid method overloading (which cause problems with JMX)
Add a Start / Stop button on the console for the Auditor service
Added:
incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java (with props)
Modified:
incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java
incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AuditorMBean.java
incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java
incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java
incubator/servicemix/trunk/core/servicemix-audit/src/test/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditorTest.java
incubator/servicemix/trunk/distributions/apache-servicemix-web/pom.xml
incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/http/HttpComponentListener.java
incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/servicemix.xml
incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/Auditor.java
incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/web.xml
incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/audit.jsp
Modified: incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java (original)
+++ incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java Thu Jan 4 13:00:24 2007
@@ -98,10 +98,10 @@
public MBeanOperationInfo[] getOperationInfos() throws JMException {
// TODO: add other operations infos
OperationInfoHelper helper = new OperationInfoHelper();
- ParameterHelper ph = helper.addOperation(getObjectToManage(), "getExchanges", 2, "retrieve a bunch messages");
+ ParameterHelper ph = helper.addOperation(getObjectToManage(), "getExchangesByRange", 2, "retrieve a bunch messages");
ph.setDescription(0, "fromIndex", "lower index of message (start from 0)");
ph.setDescription(1, "toIndex", "upper index of message (exclusive, > fromIndex)");
- ph = helper.addOperation(getObjectToManage(), "getExchange", 1, "retrieve an exchange given its id");
+ ph = helper.addOperation(getObjectToManage(), "getExchangeById", 1, "retrieve an exchange given its id");
ph.setDescription(0, "id", "id of the exchange to retrieve");
return OperationInfoHelper.join(super.getOperationInfos(), helper.getOperationInfos());
}
@@ -114,99 +114,99 @@
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchangeId(int)
*/
- public String getExchangeId(int index) throws AuditorException {
+ public String getExchangeIdByIndex(int index) throws AuditorException {
if (index < 0) {
throw new IllegalArgumentException("index should be greater or equal to zero");
}
- return getExchangeIds(index, index + 1)[0];
+ return getExchangeIdsByRange(index, index + 1)[0];
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchangeIds()
*/
- public String[] getExchangeIds() throws AuditorException {
- return getExchangeIds(0, getExchangeCount());
+ public String[] getAllExchangeIds() throws AuditorException {
+ return getExchangeIdsByRange(0, getExchangeCount());
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchangeIds(int, int)
*/
- public abstract String[] getExchangeIds(int fromIndex, int toIndex) throws AuditorException;
+ public abstract String[] getExchangeIdsByRange(int fromIndex, int toIndex) throws AuditorException;
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchange(int)
*/
- public MessageExchange getExchange(int index) throws AuditorException {
+ public MessageExchange getExchangeByIndex(int index) throws AuditorException {
if (index < 0) {
throw new IllegalArgumentException("index should be greater or equal to zero");
}
- return getExchanges(index, index + 1)[0];
+ return getExchangesByRange(index, index + 1)[0];
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchange(java.lang.String)
*/
- public MessageExchange getExchange(String id) throws AuditorException {
+ public MessageExchange getExchangeById(String id) throws AuditorException {
if (id == null || id.length() == 0) {
throw new IllegalArgumentException("id should be non null and non empty");
}
- return getExchanges(new String[] { id })[0];
+ return getExchangesByIds(new String[] { id })[0];
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchanges()
*/
- public MessageExchange[] getExchanges() throws AuditorException {
- return getExchanges(0, getExchangeCount());
+ public MessageExchange[] getAllExchanges() throws AuditorException {
+ return getExchangesByRange(0, getExchangeCount());
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchanges(int, int)
*/
- public MessageExchange[] getExchanges(int fromIndex, int toIndex) throws AuditorException {
- return getExchanges(getExchangeIds(fromIndex, toIndex));
+ public MessageExchange[] getExchangesByRange(int fromIndex, int toIndex) throws AuditorException {
+ return getExchangesByIds(getExchangeIdsByRange(fromIndex, toIndex));
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchanges(java.lang.String[])
*/
- public abstract MessageExchange[] getExchanges(String[] ids) throws AuditorException;
+ public abstract MessageExchange[] getExchangesByIds(String[] ids) throws AuditorException;
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#deleteExchanges()
*/
- public int deleteExchanges() throws AuditorException {
- return deleteExchanges(0, getExchangeCount());
+ public int deleteAllExchanges() throws AuditorException {
+ return deleteExchangesByRange(0, getExchangeCount());
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#deleteExchange(int)
*/
- public boolean deleteExchange(int index) throws AuditorException {
+ public boolean deleteExchangeByIndex(int index) throws AuditorException {
if (index < 0) {
throw new IllegalArgumentException("index should be greater or equal to zero");
}
- return deleteExchanges(index, index + 1) == 1;
+ return deleteExchangesByRange(index, index + 1) == 1;
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#deleteExchange(java.lang.String)
*/
- public boolean deleteExchange(String id) throws AuditorException {
- return deleteExchanges(new String[] { id }) == 1;
+ public boolean deleteExchangeById(String id) throws AuditorException {
+ return deleteExchangesByIds(new String[] { id }) == 1;
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#deleteExchanges(int, int)
*/
- public int deleteExchanges(int fromIndex, int toIndex) throws AuditorException {
- return deleteExchanges(getExchangeIds(fromIndex, toIndex));
+ public int deleteExchangesByRange(int fromIndex, int toIndex) throws AuditorException {
+ return deleteExchangesByIds(getExchangeIdsByRange(fromIndex, toIndex));
}
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#deleteExchanges(java.lang.String[])
*/
- public abstract int deleteExchanges(String[] ids) throws AuditorException;
+ public abstract int deleteExchangesByIds(String[] ids) throws AuditorException;
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#resendExchange(javax.jbi.messaging.MessageExchange)
Modified: incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AuditorMBean.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AuditorMBean.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AuditorMBean.java (original)
+++ incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/AuditorMBean.java Thu Jan 4 13:00:24 2007
@@ -55,7 +55,7 @@
* @throws AuditorException if an error occurs accessing the data store.
* @throws IllegalArgumentException if index is less than zero
*/
- String getExchangeId(int index) throws AuditorException;
+ String getExchangeIdByIndex(int index) throws AuditorException;
/**
* Retrieve all exchanges ids from the data store.
@@ -63,7 +63,7 @@
* @return an array of exchange ids
* @throws AuditorException if an error occurs accessing the data store.
*/
- String[] getExchangeIds() throws AuditorException;
+ String[] getAllExchangeIds() throws AuditorException;
/**
* Retrieve a range of message exchange ids.
@@ -86,7 +86,7 @@
* @throws IllegalArgumentException if fromIndex is less than zero or if toIndex is
* less than fromIndex.
*/
- String[] getExchangeIds(int fromIndex, int toIndex) throws AuditorException;
+ String[] getExchangeIdsByRange(int fromIndex, int toIndex) throws AuditorException;
/**
* Retrieve the exchange at the specified index.
@@ -100,7 +100,7 @@
* @throws AuditorException if an error occurs accessing the data store.
* @throws IllegalArgumentException if index is less than zero
*/
- MessageExchange getExchange(int index) throws AuditorException;
+ MessageExchange getExchangeByIndex(int index) throws AuditorException;
/**
* Retrieve the exchange for a specified id.
@@ -112,7 +112,7 @@
* @throws AuditorException if an error occurs accessing the data store.
* @throws IllegalArgumentException if id is null or empty
*/
- MessageExchange getExchange(String id) throws AuditorException;
+ MessageExchange getExchangeById(String id) throws AuditorException;
/**
* Retrieve all exchanges =from the data store.
@@ -120,7 +120,7 @@
* @return an array of exchange
* @throws AuditorException if an error occurs accessing the data store.
*/
- MessageExchange[] getExchanges() throws AuditorException;
+ MessageExchange[] getAllExchanges() throws AuditorException;
/**
* Retrieve a range of message exchange.
@@ -143,7 +143,7 @@
* @throws IllegalArgumentException if fromIndex is less than zero or if toIndex is
* less than fromIndex.
*/
- MessageExchange[] getExchanges(int fromIndex, int toIndex) throws AuditorException;
+ MessageExchange[] getExchangesByRange(int fromIndex, int toIndex) throws AuditorException;
/**
* Retrieve exchanges for the specified ids.
@@ -157,7 +157,7 @@
* @throws IllegalArgumentException if ids is null, or one of its
* element is null or empty.
*/
- MessageExchange[] getExchanges(String[] ids) throws AuditorException;
+ MessageExchange[] getExchangesByIds(String[] ids) throws AuditorException;
/**
* Delete all exchanges =from the data store.
@@ -166,7 +166,7 @@
* can not be provided
* @throws AuditorException if an error occurs accessing the data store.
*/
- int deleteExchanges() throws AuditorException;
+ int deleteAllExchanges() throws AuditorException;
/**
* Delete a message, given its index.
@@ -181,7 +181,7 @@
* @throws AuditorException if an error occurs accessing the data store.
* @throws IllegalArgumentException if index is less than zero
*/
- boolean deleteExchange(int index) throws AuditorException;
+ boolean deleteExchangeByIndex(int index) throws AuditorException;
/**
* Delete the exchange with the specified id.
@@ -193,7 +193,7 @@
* @throws AuditorException if an error occurs accessing the data store.
* @throws IllegalArgumentException if id is null or empty
*/
- boolean deleteExchange(String id) throws AuditorException;
+ boolean deleteExchangeById(String id) throws AuditorException;
/**
* Delete exchanges ranging from fromIndex to toIndex.
@@ -207,7 +207,7 @@
* @throws IllegalArgumentException if fromIndex is less than zero or if toIndex is
* less than fromIndex.
*/
- int deleteExchanges(int fromIndex, int toIndex) throws AuditorException;
+ int deleteExchangesByRange(int fromIndex, int toIndex) throws AuditorException;
/**
* Delete exchanges given their ids.
@@ -219,7 +219,7 @@
* @throws IllegalArgumentException if ids is null, or one of its
* element is null or empty.
*/
- int deleteExchanges(String[] ids) throws AuditorException;
+ int deleteExchangesByIds(String[] ids) throws AuditorException;
/**
* Resend an exchange on behalf of the consumer component that initiated this exchange.
@@ -235,5 +235,5 @@
* @param exchange the exchange to be sent
* @throws JBIException if an error occurs re-sending the exchange
*/
- void resendExchange(MessageExchange exchange)throws JBIException;
+ void resendExchange(MessageExchange exchange) throws JBIException;
}
Modified: incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java (original)
+++ incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java Thu Jan 4 13:00:24 2007
@@ -172,7 +172,7 @@
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchangeIds(int, int)
*/
- public String[] getExchangeIds(int fromIndex, int toIndex) throws AuditorException {
+ public String[] getExchangeIdsByRange(int fromIndex, int toIndex) throws AuditorException {
if (fromIndex < 0) {
throw new IllegalArgumentException("fromIndex should be greater or equal to zero");
}
@@ -198,7 +198,7 @@
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#getExchanges(java.lang.String[])
*/
- public MessageExchange[] getExchanges(String[] ids) throws AuditorException {
+ public MessageExchange[] getExchangesByIds(String[] ids) throws AuditorException {
MessageExchange[] exchanges = new MessageExchange[ids.length];
Connection connection = null;
try {
@@ -217,7 +217,7 @@
/* (non-Javadoc)
* @see org.apache.servicemix.jbi.audit.AuditorMBean#deleteExchanges(java.lang.String[])
*/
- public int deleteExchanges(String[] ids) throws AuditorException {
+ public int deleteExchangesByIds(String[] ids) throws AuditorException {
Connection connection = null;
boolean restoreAutoCommit = false;
try {
Modified: incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java (original)
+++ incubator/servicemix/trunk/core/servicemix-audit/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java Thu Jan 4 13:00:24 2007
@@ -108,26 +108,26 @@
return this.delegatedAuditor.getExchangeCount();
}
- public String[] getExchangeIds(int fromIndex, int toIndex) throws AuditorException {
- return this.delegatedAuditor.getExchangeIds(fromIndex,toIndex);
+ public String[] getExchangeIdsByRange(int fromIndex, int toIndex) throws AuditorException {
+ return this.delegatedAuditor.getExchangeIdsByRange(fromIndex,toIndex);
}
- public MessageExchange[] getExchanges(String[] ids) throws AuditorException {
- return this.delegatedAuditor.getExchanges(ids);
+ public MessageExchange[] getExchangesByIds(String[] ids) throws AuditorException {
+ return this.delegatedAuditor.getExchangesByIds(ids);
}
- public int deleteExchanges(int fromIndex, int toIndex) throws AuditorException {
+ public int deleteExchangesByRange(int fromIndex, int toIndex) throws AuditorException {
//TODO: Remove ids from Lucene Index
- return this.delegatedAuditor.deleteExchanges(fromIndex,toIndex);
+ return this.delegatedAuditor.deleteExchangesByRange(fromIndex,toIndex);
}
- public int deleteExchanges(String[] ids) throws AuditorException {
+ public int deleteExchangesByIds(String[] ids) throws AuditorException {
try {
this.luceneIndexer.remove(ids);
} catch (IOException io) {
throw new AuditorException(io);
}
- return this.delegatedAuditor.deleteExchanges(ids);
+ return this.delegatedAuditor.deleteExchangesByIds(ids);
}
public void exchangeSent(ExchangeEvent event) {
Modified: incubator/servicemix/trunk/core/servicemix-audit/src/test/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditorTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-audit/src/test/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditorTest.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-audit/src/test/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditorTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-audit/src/test/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditorTest.java Thu Jan 4 13:00:24 2007
@@ -81,7 +81,7 @@
int nbMessages = auditor.getExchangeCount();
assertEquals(1, nbMessages);
- MessageExchange[] exchanges = auditor.getExchanges(0, 1);
+ MessageExchange[] exchanges = auditor.getExchangesByRange(0, 1);
assertNotNull(exchanges);
assertEquals(1, exchanges.length);
assertEquals(ExchangeStatus.DONE, exchanges[0].getStatus());
@@ -90,7 +90,7 @@
nbMessages = auditor.getExchangeCount();
assertEquals(2, nbMessages);
- MessageExchange exchange = auditor.getExchange(1);
+ MessageExchange exchange = auditor.getExchangeByIndex(1);
assertNotNull(exchange);
assertEquals(ExchangeStatus.DONE, exchange.getStatus());
Modified: incubator/servicemix/trunk/distributions/apache-servicemix-web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/distributions/apache-servicemix-web/pom.xml?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/distributions/apache-servicemix-web/pom.xml (original)
+++ incubator/servicemix/trunk/distributions/apache-servicemix-web/pom.xml Thu Jan 4 13:00:24 2007
@@ -110,6 +110,24 @@
<artifactId>spring-web</artifactId>
<version>${spring-version}</version>
</dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ </dependency>
</dependencies>
<build>
@@ -129,7 +147,32 @@
<warSourceDirectory>src/main/webapp/</warSourceDirectory>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>${jetty-version}</version>
+ <configuration>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>${jetty.port}</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ <systemProperties>
+ <!-- enable easy connection to JConsole -->
+ <systemProperty>
+ <name>com.sun.management.jmxremote</name>
+ <value></value>
+ </systemProperty>
+ </systemProperties>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ </configuration>
+ </plugin>
</plugins>
</build>
+
+ <properties>
+ <jetty.port>8080</jetty.port>
+ </properties>
</project>
Modified: incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/http/HttpComponentListener.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/http/HttpComponentListener.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/http/HttpComponentListener.java (original)
+++ incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/java/org/apache/servicemix/web/http/HttpComponentListener.java Thu Jan 4 13:00:24 2007
@@ -76,9 +76,6 @@
}
public void componentInitialized(ComponentEvent event) {
- }
-
- public void componentStarted(ComponentEvent event) {
if (getName().equals(event.getComponent().getName())) {
try {
Component component = event.getComponent().getComponent();
@@ -89,13 +86,15 @@
if (!b.booleanValue()) {
m = cfg.getClass().getMethod("setManaged", new Class[] { boolean.class });
m.invoke(cfg, new Object[] { Boolean.TRUE });
- event.getComponent().shutDown();
- event.getComponent().start();
}
+ log.info("Component " + getName() + " configured.");
} catch (Exception e) {
log.error("Unable to update component configuration", e);
}
}
+ }
+
+ public void componentStarted(ComponentEvent event) {
}
public void componentStopped(ComponentEvent event) {
Modified: incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/servicemix.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/servicemix.xml?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/servicemix.xml (original)
+++ incubator/servicemix/trunk/distributions/apache-servicemix-web/src/main/webapp/WEB-INF/servicemix.xml Thu Jan 4 13:00:24 2007
@@ -17,6 +17,7 @@
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sm="http://servicemix.apache.org/config/1.0"
+ xmlns:audit="http://servicemix.apache.org/audit/1.0"
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.0.xsd">
@@ -39,6 +40,21 @@
<bean class="org.apache.servicemix.web.http.HttpComponentListener" />
</sm:listeners>
+ <sm:services>
+ <sm:statistics statsInterval="10" dumpStats="true" />
+ </sm:services>
+
</sm:container>
+ <audit:jdbcAuditor container="#jbi" autoStart="false">
+ <audit:dataSource>
+ <bean class="org.apache.derby.jdbc.EmbeddedDataSource">
+ <property name="databaseName" value="servicemixDB"/>
+ <property name="createDatabase" value="create"/>
+ </bean>
+ </audit:dataSource>
+ </audit:jdbcAuditor>
+
+ <sm:dotViewService container="#jbi" autoStart="true" />
+
</beans>
Modified: incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/Auditor.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/Auditor.java?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/Auditor.java (original)
+++ incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/Auditor.java Thu Jan 4 13:00:24 2007
@@ -43,6 +43,11 @@
this.mbean = mbean;
}
+ public String getStatus() {
+ String status = mbean.getCurrentState();
+ return status;
+ }
+
public int getPage() {
return page;
}
@@ -65,7 +70,7 @@
}
public List<ExchangeInfo> getExchanges() throws AuditorException {
- MessageExchange[] exchanges = mbean.getExchanges(page * 10, Math.min((page + 1) * 10, getCount()));
+ MessageExchange[] exchanges = mbean.getExchangesByRange(page * 10, Math.min((page + 1) * 10, getCount()));
ExchangeInfo[] infos = prepare(exchanges);
return Arrays.asList(infos);
}
@@ -74,7 +79,7 @@
if (exchangeId == null) {
return null;
}
- MessageExchange exchange = mbean.getExchange(exchangeId);
+ MessageExchange exchange = mbean.getExchangeById(exchangeId);
if (exchange != null) {
return new ExchangeInfo(exchange);
} else {
Added: incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java?view=auto&rev=492738
==============================================================================
--- incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java (added)
+++ incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java Thu Jan 4 13:00:24 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.servicemix.web.controller;
+
+import javax.jbi.management.LifeCycleMBean;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.mvc.Controller;
+
+public class ServiceLifeCycle implements Controller {
+
+ public static final String START = "start";
+ public static final String STOP = "stop";
+ public static final String SHUTDOWN = "shutdown";
+
+ private LifeCycleMBean serviceMBean;
+ private String name;
+ private String view;
+ private String action;
+
+ public ServiceLifeCycle(LifeCycleMBean serviceMBean, String action) {
+ if (serviceMBean == null) {
+ throw new IllegalArgumentException("serviceMBean is null");
+ }
+ if (action == null) {
+ throw new IllegalArgumentException("action is null");
+ } else if (!START.equals(action) &&
+ !STOP.equals(action) &&
+ !SHUTDOWN.equals(action)) {
+ throw new IllegalArgumentException("action must be start, stop, shutdown");
+ }
+
+ this.serviceMBean = serviceMBean;
+ this.action = action;
+ }
+
+ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ if (START.equals(action)) {
+ serviceMBean.start();
+ } else if (STOP.equals(action)) {
+ serviceMBean.stop();
+ } else if (SHUTDOWN.equals(action)) {
+ serviceMBean.shutDown();
+ }
+ return new ModelAndView(getView());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getView() {
+ return view;
+ }
+
+ public void setView(String view) {
+ this.view = view;
+ }
+
+}
Propchange: incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: incubator/servicemix/trunk/web/servicemix-web-console/src/main/java/org/apache/servicemix/web/controller/ServiceLifeCycle.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml (original)
+++ incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/dispatcher-servlet.xml Thu Jan 4 13:00:24 2007
@@ -87,6 +87,16 @@
<constructor-arg value="undeploy" />
<property name="view" value="redirect:/service-assemblies.jsp" />
</bean>
+ <bean name="/startAuditor.action" class="org.apache.servicemix.web.controller.ServiceLifeCycle" scope="request">
+ <constructor-arg ref="jdbcAuditorMBean" />
+ <constructor-arg value="start" />
+ <property name="view" value="redirect:/audit.jsp" />
+ </bean>
+ <bean name="/stopAuditor.action" class="org.apache.servicemix.web.controller.ServiceLifeCycle" scope="request">
+ <constructor-arg ref="jdbcAuditorMBean" />
+ <constructor-arg value="stop" />
+ <property name="view" value="redirect:/audit.jsp" />
+ </bean>
<bean name="/dot-flow.svg" class="org.apache.servicemix.web.controller.DotViewController" scope="session">
<constructor-arg ref="dotViewServiceMBean" />
Modified: incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/web.xml?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/WEB-INF/web.xml Thu Jan 4 13:00:24 2007
@@ -31,6 +31,10 @@
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml /WEB-INF/servicemix.xml</param-value>
</context-param>
+ <context-param>
+ <param-name>contextClass</param-name>
+ <param-value>org.apache.xbean.spring.context.XmlWebApplicationContext</param-value>
+ </context-param>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Configuration of the SiteMesh Filter. -->
Modified: incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/audit.jsp
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/audit.jsp?view=diff&rev=492738&r1=492737&r2=492738
==============================================================================
--- incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/audit.jsp (original)
+++ incubator/servicemix/trunk/web/servicemix-web-console/src/main/webapp/audit.jsp Thu Jan 4 13:00:24 2007
@@ -23,6 +23,18 @@
<h2>Audit</h2>
<fieldset>
+ <legend>Service</legend>
+ <table class="align"><tr>
+ <c:if test="${requestContext.auditor.status == 'Started'}">
+ <td class="align"><form method="post" action="stopAuditor.action"><input type="submit" value="Stop"/></form></td>
+ </c:if>
+ <c:if test="${requestContext.auditor.status == 'Stopped'}">
+ <td class="align"><form method="post" action="startAuditor.action"><input type="submit" value="Start"/></form></td>
+ </c:if>
+ </tr></table>
+</fieldset>
+
+<fieldset>
<legend>Exchanges</legend>
<table class="autostripe">
<thead>