Author: heiko.braun(a)jboss.com
Date: 2009-11-23 05:49:55 -0500 (Mon, 23 Nov 2009)
New Revision: 896
Added:
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorService.java
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorServiceMBean.java
Removed:
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMService.java
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMServiceMBean.java
Modified:
sam/trunk/sam/dist/src/main/resources/META-INF/jboss-beans.xml
Log:
Rename integration service
Modified: sam/trunk/sam/dist/src/main/resources/META-INF/jboss-beans.xml
===================================================================
--- sam/trunk/sam/dist/src/main/resources/META-INF/jboss-beans.xml 2009-11-23 10:44:24 UTC
(rev 895)
+++ sam/trunk/sam/dist/src/main/resources/META-INF/jboss-beans.xml 2009-11-23 10:49:55 UTC
(rev 896)
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean class="org.jboss.sam.service.SAMService"
+ <bean class="org.jboss.sam.service.MonitorService"
name="MonitoringService">
-
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.sam:service=MonitoringService",
exposedInterface=org.jboss.sam.service.SAMServiceMBean.class,registerDirectly=true)</annotation>
+
<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.sam:service=MonitoringService",
+
exposedInterface=org.jboss.sam.service.MonitorServiceMBean.class,registerDirectly=true)</annotation>
<property
name="jndiName"><value>sam/MonitoringService</value></property>
<property name="monitor">
<inject bean="TwitterMonitor" />
Added: sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorService.java
===================================================================
--- sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorService.java
(rev 0)
+++
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorService.java 2009-11-23
10:49:55 UTC (rev 896)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.sam.service;
+
+import org.jboss.util.naming.NonSerializableFactory;
+import org.jboss.logging.Logger;
+
+import javax.naming.NamingException;
+import javax.naming.InitialContext;
+import javax.naming.Name;
+
+import org.jboss.sam.ActivityMonitor;
+
+/**
+ * Wraps an {@link org.jboss.sam.ActivityMonitor} and binds a reference to JNDI.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class MonitorService extends org.jboss.system.ServiceMBeanSupport implements
MonitorServiceMBean
+{
+ private final static Logger logger = Logger.getLogger(MonitorService.class);
+
+ private String jndiName;
+
+ private ActivityMonitor monitor;
+
+ protected void startService() throws Exception {
+ logger.info("Starting ActivityMonitor");
+
+ if(null==monitor)
+ throw new IllegalStateException("No monitor implementation provided!");
+
+ rebind();
+
+ monitor.getEventProcessor().start();
+ }
+
+ protected void stopService() throws Exception {
+ logger.info("Stopping ActivityMonitor");
+
+ monitor.getEventProcessor().stop();
+
+ unbind(jndiName);
+
+ }
+
+ public String getJndiName()
+ {
+ return this.jndiName;
+ }
+
+ public void setJndiName(String jndiName) throws NamingException
+ {
+ this.jndiName = jndiName;
+ }
+
+ public ActivityMonitor getMonitor()
+ {
+ return monitor;
+ }
+
+ public void setMonitor(ActivityMonitor monitor)
+ {
+ this.monitor = monitor;
+ }
+
+ private void rebind() throws NamingException
+ {
+ InitialContext rootCtx = new InitialContext();
+ Name fullName = rootCtx.getNameParser("").parse(jndiName);
+ logger.info("fullName="+fullName);
+ NonSerializableFactory.rebind(fullName, monitor, true);
+ }
+
+ private void unbind(String jndiName) {
+ try
+ {
+ InitialContext rootCtx = new InitialContext();
+ rootCtx.unbind(jndiName);
+ NonSerializableFactory.unbind(jndiName);
+ }
+ catch(NamingException e)
+ {
+ logger.error("Failed to unbind map", e);
+ }
+ }
+}
Added: sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorServiceMBean.java
===================================================================
--- sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorServiceMBean.java
(rev 0)
+++
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/MonitorServiceMBean.java 2009-11-23
10:49:55 UTC (rev 896)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.sam.service;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface MonitorServiceMBean extends ServiceMBean
+{
+
+ public String getJndiName();
+
+ public void setJndiName(String jndiName) throws javax.naming.NamingException;
+
+}
Deleted: sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMService.java
===================================================================
--- sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMService.java 2009-11-23
10:44:24 UTC (rev 895)
+++ sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMService.java 2009-11-23
10:49:55 UTC (rev 896)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.sam.service;
-
-import org.jboss.util.naming.NonSerializableFactory;
-import org.jboss.logging.Logger;
-
-import javax.naming.NamingException;
-import javax.naming.InitialContext;
-import javax.naming.Name;
-
-import org.jboss.sam.ActivityMonitor;
-
-/**
- * Wraps an {@link org.jboss.sam.ActivityMonitor} and binds a reference to JNDI.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class SAMService extends org.jboss.system.ServiceMBeanSupport implements
SAMServiceMBean
-{
- private final static Logger logger = Logger.getLogger(SAMService.class);
-
- private String jndiName;
-
- private ActivityMonitor monitor;
-
- protected void startService() throws Exception {
- logger.info("Starting ActivityMonitor");
-
- if(null==monitor)
- throw new IllegalStateException("No monitor implementation provided!");
-
- rebind();
-
- monitor.getEventProcessor().start();
- }
-
- protected void stopService() throws Exception {
- logger.info("Stopping ActivityMonitor");
-
- monitor.getEventProcessor().stop();
-
- unbind(jndiName);
-
- }
-
- public String getJndiName()
- {
- return this.jndiName;
- }
-
- public void setJndiName(String jndiName) throws NamingException
- {
- this.jndiName = jndiName;
- }
-
- public ActivityMonitor getMonitor()
- {
- return monitor;
- }
-
- public void setMonitor(ActivityMonitor monitor)
- {
- this.monitor = monitor;
- }
-
- private void rebind() throws NamingException
- {
- InitialContext rootCtx = new InitialContext();
- Name fullName = rootCtx.getNameParser("").parse(jndiName);
- logger.info("fullName="+fullName);
- NonSerializableFactory.rebind(fullName, monitor, true);
- }
-
- private void unbind(String jndiName) {
- try
- {
- InitialContext rootCtx = new InitialContext();
- rootCtx.unbind(jndiName);
- NonSerializableFactory.unbind(jndiName);
- }
- catch(NamingException e)
- {
- logger.error("Failed to unbind map", e);
- }
- }
-}
Deleted: sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMServiceMBean.java
===================================================================
---
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMServiceMBean.java 2009-11-23
10:44:24 UTC (rev 895)
+++
sam/trunk/sam/service/src/main/java/org/jboss/sam/service/SAMServiceMBean.java 2009-11-23
10:49:55 UTC (rev 896)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.sam.service;
-
-import org.jboss.system.ServiceMBean;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface SAMServiceMBean extends ServiceMBean
-{
-
- public String getJndiName();
-
- public void setJndiName(String jndiName) throws javax.naming.NamingException;
-
-}