[jboss-svn-commits] JBL Code SVN: r12337 - in labs/jbossesb/trunk/product: core/listeners/src/org/jboss/soa/esb/listeners/lifecycle and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jun 5 13:21:58 EDT 2007
Author: tfennelly
Date: 2007-06-05 13:21:58 -0400 (Tue, 05 Jun 2007)
New Revision: 12337
Added:
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java
labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml
Removed:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java
Modified:
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java
labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
labs/jbossesb/trunk/product/services/smooks/base-project-build.xml
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
Log:
Replaced the lifecycle listeners stuff with a straightforward mbean.
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Configuration.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -102,7 +102,6 @@
instances.addAll(LifecycleUtil.getGateways(gatewayConfig));
ManagedLifecycleController controller = new ManagedLifecycleController(instances);
- controller.setLifecycleListeners(generator.getModel().getLifecycleListeners());
// In parallel, create a map of the contract publication info...
ServicePublisher.addServicePublishers(controller, generator.getModel());
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/ConfigurationController.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -312,7 +312,6 @@
instances.addAll(LifecycleUtil.getGateways(mGatewayConfigFile)) ;
controller = new ManagedLifecycleController(instances) ;
- controller.setLifecycleListeners(generator.getModel().getLifecycleListeners());
try
{
controller.start() ;
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/config/Generator.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -35,11 +35,9 @@
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
-import org.jboss.soa.esb.listeners.config.LifecycleListenerDocument.LifecycleListener;
import org.jboss.soa.esb.listeners.config.JbossesbDocument.Jbossesb;
import org.jboss.soa.esb.listeners.config.ServiceDocument.Service;
import org.jboss.soa.esb.listeners.config.ServicesDocument.Services;
-import org.jboss.soa.esb.listeners.lifecycle.EsbLifecycleListener;
import org.w3c.dom.Document;
/**
@@ -201,26 +199,6 @@
this.jbossesb = xmlBeansDoc.getJbossesb();
}
- /**
- * Get the esb lifecycle listeners for this ESB instance.
- * @return List of lifecycle listeners.
- */
- public List<EsbLifecycleListener> getLifecycleListeners() {
- List<EsbLifecycleListener> listeners = new ArrayList<EsbLifecycleListener>();
-
- if(jbossesb.getLifecycleListeners() != null) {
- List<LifecycleListener> listenersConfigs = jbossesb.getLifecycleListeners().getLifecycleListenerList();
-
- for(LifecycleListener listenerConfig : listenersConfigs) {
- EsbLifecycleListener listener = EsbLifecycleListener.Factory.createInstance(listenerConfig.getClass1().getStringValue());
- listener.setProperties(mapProperties(listenerConfig.getPropertyList()));
- listeners.add(listener);
- }
- }
-
- return listeners;
- }
-
private Properties mapProperties(List<Property> propertyList) {
Properties properties = new Properties();
Deleted: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListener.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.lifecycle;
-
-import org.apache.xmlbeans.XmlAnySimpleType;
-import org.jboss.soa.esb.util.ClassUtil;
-
-import java.util.Properties;
-
-/**
- * ESB lifecycle listener definition.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public interface EsbLifecycleListener {
-
- /**
- * Set the properties of the listener.
- * @param properties Listener properties.
- */
- public void setProperties(Properties properties);
-
- /**
- * On ESB instance startup and before listeners/gateways initialisation.
- */
- public void onEsbStartup();
-
- // TODO: Add lifecycle methods around listener and gateway startup and destruction (.e. all listeners started/destroyed etc)??
-
- /**
- * On ESB instance startup and after listeners/gateways destruction.
- */
- public void onEsbShutdown();
-
- /**
- * Instance factory class.
- */
- public static class Factory {
-
- public static EsbLifecycleListener createInstance(String className) {
- try {
- return (EsbLifecycleListener) ClassUtil.forName(className, Factory.class).newInstance();
- } catch (ClassNotFoundException e) {
- throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'. Unable to find class on classpath.", e);
- } catch (IllegalAccessException e) {
- throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'.", e);
- } catch (InstantiationException e) {
- throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'.", e);
- } catch(ClassCastException e) {
- throw new IllegalStateException("Error creating EsbLifecycleListener listener instance '" + className + "'. Must be an instance of '" + EsbLifecycleListener.class.getName() + "'", e);
- }
- }
- }
-}
Modified: labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleController.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -50,10 +50,6 @@
* The lifecycle identity.
*/
private final String lifecycleIdentity ;
- /**
- * ESB instance lifecycle listeners.
- */
- private List<EsbLifecycleListener> lifecycleListeners;
/**
* Construct the controller to manage the specified managed lifecycle instances.
@@ -84,8 +80,6 @@
final LifecycleIdentity lifecycleIdentitySingleton = LifecycleIdentity.getSingleton() ;
final String currentIdentity = lifecycleIdentitySingleton.getThreadLifecycleIdentity() ;
- onEsbStartup();
-
try
{
lifecycleIdentitySingleton.setThreadLifecycleIdentity(lifecycleIdentity) ;
@@ -156,7 +150,6 @@
finally
{
lifecycleIdentitySingleton.setThreadLifecycleIdentity(currentIdentity) ;
- onEsbShutdown();
}
}
@@ -311,29 +304,4 @@
} // Ignore exception
}
}
-
- public void setLifecycleListeners(List<EsbLifecycleListener> lifecycleListeners) {
- this.lifecycleListeners = lifecycleListeners;
- }
-
- private void onEsbStartup() {
- if(lifecycleListeners != null) {
- for(EsbLifecycleListener lifecycleListener : lifecycleListeners) {
- // Exceptions on startup are fatal...
- lifecycleListener.onEsbStartup();
- }
- }
- }
-
- private void onEsbShutdown() {
- if(lifecycleListeners != null) {
- for(EsbLifecycleListener lifecycleListener : lifecycleListeners) {
- try {
- lifecycleListener.onEsbShutdown();
- } catch(Throwable t) {
- logger.error("Error on 'onEsbShutdown' for lifecycle listener '" + lifecycleListener.getClass().getName() + "'.", t);
- }
- }
- }
- }
}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/EsbLifecycleListenerUnitTest.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -42,11 +42,6 @@
ManagedLifecycleController controller = Configuration.create(config);
controller.start();
- assertTrue(MockEsbLifecycleListener.onEsbStartupCalled);
- assertNotNull(MockEsbLifecycleListener.properties);
- assertEquals("vala", MockEsbLifecycleListener.properties.getProperty("prop1"));
- assertTrue(!MockEsbLifecycleListener.onEsbShutdownCalled);
controller.stop();
- assertTrue(MockEsbLifecycleListener.onEsbShutdownCalled);
}
}
Deleted: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/MockEsbLifecycleListener.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.listeners.lifecycle;
-
-import java.util.Properties;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class MockEsbLifecycleListener implements EsbLifecycleListener {
-
- public static Properties properties;
- public static boolean onEsbStartupCalled = false;
- public static boolean onEsbShutdownCalled = false;
-
- public void setProperties(Properties properties) {
- MockEsbLifecycleListener.properties = properties;
- }
-
- public void onEsbStartup() {
- onEsbStartupCalled = true;
- }
-
- public void onEsbShutdown() {
- onEsbShutdownCalled = true;
- }
-}
Modified: labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml
===================================================================
--- labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/core/listeners/tests/src/org/jboss/soa/esb/listeners/lifecycle/config-01.xml 2007-06-05 17:21:58 UTC (rev 12337)
@@ -1,12 +1,6 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
- <lifecycle-listeners>
- <lifecycle-listener class="org.jboss.soa.esb.listeners.lifecycle.MockEsbLifecycleListener">
- <property name="prop1" value="vala" />
- </lifecycle-listener>
- </lifecycle-listeners>
-
<providers>
<provider name="provider">
<property name="protocol" value="jms" />
Modified: labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd
===================================================================
--- labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd 2007-06-05 17:21:58 UTC (rev 12337)
@@ -16,7 +16,6 @@
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="jesb:lifecycle-listeners" minOccurs="0" />
<xsd:element ref="jesb:providers" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="jesb:services" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
@@ -38,29 +37,6 @@
</xsd:complexType>
</xsd:element>
- <xsd:element name="lifecycle-listeners">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">ESB instance lifecycle listeners.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:lifecycle-listener" minOccurs="1" maxOccurs="unbounded" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="lifecycle-listener">
- <xsd:annotation>
- <xsd:documentation xml:lang="en">ESB instance lifecycle listener.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="jesb:property" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="class" use="required"/>
- </xsd:complexType>
- </xsd:element>
-
<!-- 88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Provider and Bus base types.
88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888-->
Modified: labs/jbossesb/trunk/product/services/smooks/base-project-build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/base-project-build.xml 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/services/smooks/base-project-build.xml 2007-06-05 17:21:58 UTC (rev 12337)
@@ -30,6 +30,7 @@
<fileset dir="lib/ext/build-time" includes="*.jar" />
<fileset dir="${esb.product.lib.dir}" includes="*.jar" /> <!-- Product Jars. -->
<pathelement location="src/test/resources"/>
+ <fileset dir="../../lib/ext" includes="jboss-system.jar" />
</path>
<target name="echoCP">
Deleted: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksESBLifecycleListener.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.actions.converters;
-
-import org.jboss.soa.esb.listeners.lifecycle.EsbLifecycleListener;
-import org.apache.log4j.Logger;
-
-import java.util.Properties;
-
-/**
- * Smooks ESBLifecycleListener.
- * <p/>
- * Manages lifecycle around the centralised Console configuration and its associated
- * shared Smooks instance (available through {@link #getGlobalSmooksInstanceManager()}).
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class SmooksESBLifecycleListener implements EsbLifecycleListener {
-
- private static Logger logger = Logger.getLogger(SmooksESBLifecycleListener.class);
- private static SmooksInstanceManager globalSmooksInstanceManager;
- private static final String CONSOLE_URL = "console.url";
-
- public void setProperties(Properties properties) {
- }
-
- public void onEsbStartup() {
- Properties smooksEsbConfig = new SmooksConfiguration();
- String resourceConfig = smooksEsbConfig.getProperty(CONSOLE_URL);
-
- if(resourceConfig != null) {
- globalSmooksInstanceManager = new SmooksInstanceManager("Console", resourceConfig);
- logger.info("Centralized Smooks Instance (Console Based) started.");
- } else {
- logger.info("Centralized Smooks Instance (Console Based) instance not started. See the '" + CONSOLE_URL + "' property in '" + SmooksConfiguration.SMOOKS_ESB_PROPERTIES + "'");
- }
- }
-
- public void onEsbShutdown() {
- if(globalSmooksInstanceManager != null) {
- globalSmooksInstanceManager.close();
- logger.info("Centralized Smooks Instance (Console Based) stopped.");
- }
- }
-
- public static SmooksInstanceManager getGlobalSmooksInstanceManager() {
- return globalSmooksInstanceManager;
- }
-}
Added: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.converters;
+
+import org.jboss.system.ServiceMBeanSupport;
+import org.apache.log4j.Logger;
+
+import java.util.Properties;
+
+/**
+ * SmooksService implementation.
+ * <p/>
+ * Initialises the "global" Smooks instance.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class SmooksService extends ServiceMBeanSupport implements SmooksServiceMBean {
+
+ private static Logger logger = Logger.getLogger(SmooksService.class);
+ private static SmooksInstanceManager globalSmooksInstanceManager;
+ private static final String CONSOLE_URL = "console.url";
+
+ protected void startService() throws Exception {
+ super.startService();
+
+ Properties smooksEsbConfig = new SmooksConfiguration();
+ String resourceConfig = smooksEsbConfig.getProperty(CONSOLE_URL);
+
+ if(resourceConfig != null) {
+ globalSmooksInstanceManager = new SmooksInstanceManager("Console", resourceConfig);
+ logger.info("Centralized Smooks Instance (Console Based) started.");
+ } else {
+ logger.info("Centralized Smooks Instance (Console Based) instance not started. See the '" + CONSOLE_URL + "' property in '" + SmooksConfiguration.SMOOKS_ESB_PROPERTIES + "'");
+ }
+ }
+
+ protected void stopService() throws Exception {
+ if(globalSmooksInstanceManager != null) {
+ globalSmooksInstanceManager.close();
+ logger.info("Centralized Smooks Instance (Console Based) stopped.");
+ }
+
+ super.stopService();
+ }
+
+ public static SmooksInstanceManager getGlobalSmooksInstanceManager() {
+ return globalSmooksInstanceManager;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.converters;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * Smooks Service MBean.
+ * <p/>
+ * Initialization MBean.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface SmooksServiceMBean extends ServiceMBean {
+}
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksTransformer.java 2007-06-05 17:21:58 UTC (rev 12337)
@@ -178,7 +178,7 @@
if(resourceConfig != null) {
initialiseLocalSmooksInstanceManager(resourceConfig);
} else {
- smooksInstanceManager = SmooksESBLifecycleListener.getGlobalSmooksInstanceManager();
+ smooksInstanceManager = SmooksService.getGlobalSmooksInstanceManager();
}
if(smooksInstanceManager == null) {
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml 2007-06-05 17:18:29 UTC (rev 12336)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/META-INF/jboss-esb.xml 2007-06-05 17:21:58 UTC (rev 12337)
@@ -1,10 +1,5 @@
<?xml version = "1.0" encoding = "UTF-8"?>
<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
-
- <lifecycle-listeners>
- <lifecycle-listener class="org.jboss.soa.esb.actions.converters.SmooksESBLifecycleListener" />
- </lifecycle-listeners>
-
<!--
jbossesb internal services
-->
Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml 2007-06-05 17:21:58 UTC (rev 12337)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service>
+ <mbean code="org.jboss.soa.esb.actions.converters.SmooksService"
+ name="jboss.esb:service=SmooksService">
+ <depends>jms.destination:service=Topic,name=org.jboss.soa.esb.transformation.Update</depends>
+ </mbean>
+</service>
Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list