User: schaefera
Date: 01/05/21 22:08:00
Modified: src/main/org/jboss/mgt Application.java EJB.java Item.java
Module.java ServerDataCollector.java
ServerDataCollectorMBean.java
Log:
Modified the EJB deployment therefore that it can report the deployed
EJBs for a given application to the Data Collector.
Revision Changes Path
1.2 +39 -20 jboss/src/main/org/jboss/mgt/Application.java
Index: Application.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/mgt/Application.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Application.java 2001/05/14 18:39:27 1.1
+++ Application.java 2001/05/22 05:08:00 1.2
@@ -9,6 +9,8 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Map;
/**
* Contains the management information about
@@ -20,34 +22,39 @@
implements Serializable
{
// -------------------------------------------------------------------------
+ // Constants
+ // -------------------------------------------------------------------------
+
+ public static final int EJBS = 1;
+ public static final int SERVLETS = 2;
+ public static final int RARS = 3;
+
+ // -------------------------------------------------------------------------
// Members
// -------------------------------------------------------------------------
private String mApplicationId;
private String mDeploymentDescriptor;
- private Collection mModules;
+ private Map mModules = new Hashtable();
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
+ * Creates an empty application
+ *
* @param pApplicationId Id of these Application which must be unique within
* the node/server.
* @param pDeploymentDescriptor Deployment Descriptor of this application
* which maybe is not set.
- * @param pModules Collection of modules deployed with the given application
- * each item is of type {@link org.jboss.mgt.JBossModule
- * JBossModule}.
**/
public Application(
String pApplicationId,
- String pDeploymentDescriptor,
- Collection pModules
+ String pDeploymentDescriptor
) {
mApplicationId = pApplicationId;
setDeploymentDescriptor( pDeploymentDescriptor );
- setModules( pModules );
}
// -------------------------------------------------------------------------
@@ -82,27 +89,39 @@
/**
* @return Collection of Modules deployed with this application. Each
- * item is of type {@link org.jboss.mgt.JBossModule JBossModule}.
+ * item is of type {@link org.jboss.mgt.Module Module}.
**/
public Collection getModules() {
- return mModules;
+ return new ArrayList( mModules.values() );
}
/**
- * Sets a new list of modules
+ * Saves the given Module either by registering as new Module
+ * or updating the registered Module
*
- * @param pModules New list of modules to be set
+ * @param pModuleId Id of the Module to be saved. Please use the
+ * constants provided in here.
+ * @param pModule Module to be saved
+ **/
+ public void saveModule(
+ int pModuleId,
+ Module pModule
+ ) {
+ mModules.put( new Integer( pModuleId ), pModule );
+ }
+
+ /**
+ * Removes the registered Module if found
+ *
+ * @param pModuleId Id of the Module to be removed. Please use the
+ * constants provided in here.
**/
- public void setModules( Collection pModules ) {
- if( pModules == null ) {
- // If null is passed then keep the list
- mModules = new ArrayList();
- }
- else {
- mModules = pModules;
- }
+ public void removeModule(
+ int pModuleId
+ ) {
+ mModules.remove( new Integer( pModuleId ) );
}
-
+
public String toString() {
return "Application [ " + getId() +
", deployment descriptor : " + getDeploymentDescriptor() +
1.3 +25 -0 jboss/src/main/org/jboss/mgt/EJB.java
Index: EJB.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/mgt/EJB.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- EJB.java 2001/05/16 19:15:28 1.2
+++ EJB.java 2001/05/22 05:08:00 1.3
@@ -37,6 +37,12 @@
// -------------------------------------------------------------------------
/**
+ * Default (no-args) constructor
+ **/
+ public EJB() {
+ }
+
+ /**
* @param pName Name of the Servlet
* @param pType Type of the EJB
* @param pDeployed True if the EJB is deployed now
@@ -62,12 +68,30 @@
}
/**
+ * Sets the type of the Item
+ *
+ * @param pType Type to be set
+ **/
+ public void setType( int pType ) {
+ mType = pType;
+ }
+
+ /**
* @return True if the EJB is deployed now
**/
public boolean isDeployed() {
return mDeployed;
}
+ /**
+ * Defines if the given EJB is deployed or not
+ *
+ * @param pDeployed True if the EJB is delployed
+ **/
+ public void setDeployed( boolean pDeployed ) {
+ mDeployed = pDeployed;
+ }
+
public String toString() {
String lType = null;
switch( getType() ) {
@@ -89,6 +113,7 @@
return "EJB [ " + getName() +
", " + lType +
+ ", is deployed " + isDeployed() +
" ]";
}
}
1.2 +15 -0 jboss/src/main/org/jboss/mgt/Item.java
Index: Item.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/mgt/Item.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Item.java 2001/05/16 16:54:17 1.1
+++ Item.java 2001/05/22 05:08:00 1.2
@@ -28,6 +28,12 @@
// -------------------------------------------------------------------------
/**
+ * Default (no-args) constructor
+ **/
+ public Item() {
+ };
+
+ /**
* @param pName Name of the Item
**/
public Item(
@@ -45,6 +51,15 @@
**/
public String getName() {
return mName;
+ }
+
+ /**
+ * Sets the name of the Item
+ *
+ * @param pName Name to be set
+ **/
+ public void setName( String pName ) {
+ mName = pName;
}
public String toString() {
1.3 +3 -5 jboss/src/main/org/jboss/mgt/Module.java
Index: Module.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/mgt/Module.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Module.java 2001/05/16 16:54:17 1.2
+++ Module.java 2001/05/22 05:08:00 1.3
@@ -7,6 +7,7 @@
package org.jboss.mgt;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collection;
/**
@@ -24,7 +25,7 @@
private String mModuleId;
private String mDeploymentDescriptor;
- private Collection mItems;
+ private Collection mItems = new ArrayList();
// -------------------------------------------------------------------------
// Constructors
@@ -33,16 +34,13 @@
/**
* @param pModuleId Id of these module which must be unique within the
application.
* @param pDeploymentDescriptor Deployment Descriptor of this module
- * @param pItems Collection of Entities
**/
public Module(
String pModuleId,
- String pDeploymentDescriptor,
- Collection pItems
+ String pDeploymentDescriptor
) {
mModuleId = pModuleId;
setDeploymentDescriptor( pDeploymentDescriptor );
- mItems = pItems;
}
// -------------------------------------------------------------------------
1.2 +30 -2 jboss/src/main/org/jboss/mgt/ServerDataCollector.java
Index: ServerDataCollector.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/mgt/ServerDataCollector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServerDataCollector.java 2001/05/14 18:39:27 1.1
+++ ServerDataCollector.java 2001/05/22 05:08:00 1.2
@@ -99,7 +99,7 @@
}
public String getName() {
- return "JBoss Server MBean";
+ return "JBoss Server Data Collector MBean";
}
public Application getApplication(
@@ -132,7 +132,35 @@
mApplications.remove( pApplicationId );
}
}
-
+
+ public void saveModule(
+ String pApplicationId,
+ int pModuleId,
+ Module pModule
+ ) {
+ Application lApplication = getApplication( pApplicationId );
+ System.out.println( "ServerDataCollector.saveModule(), App. Id: " +
pApplicationId + ", application: " + lApplication );
+ if( lApplication != null ) {
+ lApplication.saveModule( pModuleId, pModule );
+ }
+ }
+
+ /**
+ * Removes the registered Module if found
+ *
+ * @param pApplicationId Id of the Application the Module is part of
+ * @param pModuleId Id of the Module to be removed
+ **/
+ public void removeModule(
+ String pApplicationId,
+ int pModuleId
+ ) {
+ Application lApplication = getApplication( pApplicationId );
+ if( lApplication != null ) {
+ lApplication.removeModule( pModuleId );
+ }
+ }
+
// -------------------------------------------------------------------------
// ServiceMBean - Methods
// -------------------------------------------------------------------------
1.2 +25 -2 jboss/src/main/org/jboss/mgt/ServerDataCollectorMBean.java
Index: ServerDataCollectorMBean.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/mgt/ServerDataCollectorMBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServerDataCollectorMBean.java 2001/05/14 18:39:27 1.1
+++ ServerDataCollectorMBean.java 2001/05/22 05:08:00 1.2
@@ -51,8 +51,6 @@
* or updating the registered application
*
* @param pApplication Application to be saved
- *
- * @return Saved Application which maybe contains updated values
**/
public void saveApplication(
String pApplicationId,
@@ -66,6 +64,31 @@
**/
public void removeApplication(
String pApplicationId
+ );
+
+ /**
+ * Saves the given Module either by registering as new Module
+ * or updating the registered Module
+ *
+ * @param pApplicationId Id of the Application the Module is part of
+ * @param pModuleId Id of the Module to be saved
+ * @param pModule Module to be saved
+ **/
+ public void saveModule(
+ String pApplicationId,
+ int pModuleId,
+ Module pModule
+ );
+
+ /**
+ * Removes the registered Module if found
+ *
+ * @param pApplicationId Id of the Application the Module is part of
+ * @param pModuleId Id of the Module to be removed
+ **/
+ public void removeModule(
+ String pApplicationId,
+ int pModuleId
);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development