Skip to content

Commit

Permalink
adding system-jmx module with ServiceMBean interface, adding new modu…
Browse files Browse the repository at this point in the history
…le as automatically dependency for sar deployments, reusing existent integration test to validate deploy of ServiceMBeans

I (Kabir squashed this commit) so it also includes the following:
-adding limited support for ServiceMBeanSupport
-reverting usage of servicembean by an existent integration test
-removing dep from sar to system-jmx, only needed by deployments, and making deployment dep to system-jmx optional
-changing all lifecycle related logs to debug level, except exceptions due to user code, and activating checkstyle maven plugin
-reverting pom.xml license info mess introduced by Eclipse
  • Loading branch information
emmartins authored and kabir committed Aug 8, 2012
1 parent 5648726 commit 618fe96
Show file tree
Hide file tree
Showing 16 changed files with 1,187 additions and 6 deletions.
6 changes: 5 additions & 1 deletion build/build.xml
Expand Up @@ -885,7 +885,11 @@
<module-def name="org.jboss.as.security">
<maven-resource group="org.jboss.as" artifact="jboss-as-security"/>
</module-def>


<module-def name="org.jboss.as.system-jmx">
<maven-resource group="org.jboss.as" artifact="jboss-as-system-jmx"/>
</module-def>

<module-def name="org.jboss.as.transactions">
<maven-resource group="org.jboss.as" artifact="jboss-as-transactions"/>
</module-def>
Expand Down
13 changes: 9 additions & 4 deletions build/pom.xml
Expand Up @@ -995,21 +995,26 @@
<artifactId>jboss-as-remoting</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-sar</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-security</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-sos</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-sar</artifactId>
<artifactId>jboss-as-system-jmx</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-threads</artifactId>
Expand Down
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2012, Red Hat, Inc., 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.
-->

<module xmlns="urn:jboss:module:1.1" name="org.jboss.as.system-jmx">
<properties>
<property name="jboss.api" value="private"/>
</properties>

<resources>
<!-- Insert resources here -->
</resources>

<dependencies>
<module name="javax.api"/>
<module name="org.jboss.common-beans"/>
<module name="org.jboss.staxmapper"/>
<module name="org.jboss.as.controller"/>
<module name="org.jboss.as.server"/>
<module name="org.jboss.as.ee"/>
<module name="org.jboss.as.jmx"/>
<module name="org.jboss.modules"/>
<module name="org.jboss.msc"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
<module name="org.jboss.metadata"/>
</dependencies>
</module>
9 changes: 8 additions & 1 deletion pom.xml
Expand Up @@ -1102,6 +1102,12 @@
<artifactId>jboss-as-server</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-sos</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.as</groupId>
Expand All @@ -1111,7 +1117,7 @@

<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-sos</artifactId>
<artifactId>jboss-as-system-jmx</artifactId>
<version>${project.version}</version>
</dependency>

Expand Down Expand Up @@ -6084,6 +6090,7 @@
<module>osgi</module>
<module>pojo</module>
<module>remoting-test</module>
<module>system-jmx</module>
<module>sar</module>
<module>security</module>
<module>spec-api</module>
Expand Down
Expand Up @@ -41,6 +41,7 @@
public class SarModuleDependencyProcessor implements DeploymentUnitProcessor {

private static ModuleIdentifier JBOSS_MODULES_ID = ModuleIdentifier.create("org.jboss.modules");
private static ModuleIdentifier JBOSS_AS_SYSTEM_JMX_ID = ModuleIdentifier.create("org.jboss.as.system-jmx");

/**
* Add dependencies for modules required for manged bean deployments, if managed bean configurations are attached
Expand All @@ -58,6 +59,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro
}

moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_MODULES_ID, false, false, false, false));
moduleSpecification.addSystemDependency(new ModuleDependency(Module.getBootModuleLoader(), JBOSS_AS_SYSTEM_JMX_ID, true, false, false, false));
}

public void undeploy(final DeploymentUnit context) {
Expand Down
84 changes: 84 additions & 0 deletions system-jmx/pom.xml
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2012, Red Hat, Inc., 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-parent</artifactId>
<version>7.2.0.Alpha1-SNAPSHOT</version>
</parent>

<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-system-jmx</artifactId>
<version>7.2.0.Alpha1-SNAPSHOT</version>

<name>JBoss Application Server: System JMX Module</name>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>
-AgeneratedTranslationFilesPath=${project.build.directory}/generated-translation-files
</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*TestCase.java</include>
</includes>
<enableAssertions>false</enableAssertions>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
54 changes: 54 additions & 0 deletions system-jmx/src/main/java/org/jboss/system/Service.java
@@ -0,0 +1,54 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2012, 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.system;

/**
* The Service interface.
*
* @author <a href="mailto:marc.fleury@jboss.org">Marc Fleury</a>.
* @version $Revision: 81032 $
*/
public interface Service {
/**
* create the service, do expensive operations etc
*
* @throws Exception for any error
*/
void create() throws Exception;

/**
* start the service, create is already called
*
* @throws Exception for any error
*/
void start() throws Exception;

/**
* stop the service
*/
void stop();

/**
* destroy the service, tear down
*/
void destroy();
}
76 changes: 76 additions & 0 deletions system-jmx/src/main/java/org/jboss/system/ServiceMBean.java
@@ -0,0 +1,76 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2012, 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.system;

/**
* An interface describing a JBoss service MBean.
*
* @see Service
* @see ServiceMBeanSupport
*
* @author <a href="mailto:rickard.oberg@telkel.com">Rickard Oberg</a>
* @author <a href="mailto:andreas@jboss.org">Andreas Schaefer</a>
* @author Scott.Stark@jboss.org
* @version $Revision: 81033 $
*/
public interface ServiceMBean extends Service {
// Constants -----------------------------------------------------

/** ServiceController notification types corresponding to service lifecycle events */
String CREATE_EVENT = "org.jboss.system.ServiceMBean.create";
String START_EVENT = "org.jboss.system.ServiceMBean.start";
String STOP_EVENT = "org.jboss.system.ServiceMBean.stop";
String DESTROY_EVENT = "org.jboss.system.ServiceMBean.destroy";

String[] states = { "Stopped", "Stopping", "Starting", "Started", "Failed", "Destroyed", "Created",
"Unregistered", "Registered" };

/** The Service.stop has completed */
int STOPPED = 0;
/** The Service.stop has been invoked */
int STOPPING = 1;
/** The Service.start has been invoked */
int STARTING = 2;
/** The Service.start has completed */
int STARTED = 3;
/** There has been an error during some operation */
int FAILED = 4;
/** The Service.destroy has completed */
int DESTROYED = 5;
/** The Service.create has completed */
int CREATED = 6;
/** The MBean has been created but has not completed MBeanRegistration.postRegister */
int UNREGISTERED = 7;
/** The MBean has been created and has completed MBeanRegistration.postRegister */
int REGISTERED = 8;

// Public --------------------------------------------------------

String getName();

int getState();

String getStateString();

/** Detyped lifecycle invocation */
void jbossInternalLifecycle(String method) throws Exception;
}

0 comments on commit 618fe96

Please sign in to comment.