org.ow2.jonas.lib.management.extensions.base
Class AdminHelper

java.lang.Object
  extended by org.ow2.jonas.lib.management.extensions.base.AdminHelper
Direct Known Subclasses:
WhereAreYou

public class AdminHelper
extends Object

Helper class providing basic info about the current server. Used by management tools.

Author:
Adriana Danes

Field Summary
protected  String adminJonasServerConfDir
           
protected  String adminJonasServerName
           
protected  String applicationContextPath
           
protected  int applicationServerPort
           
protected  boolean catalinaServer
           
protected  Hashtable<String,Hashtable<String,Integer>> clusterdGraphAttributes
          Hashtable to store cluster daemons attributes.
protected  Hashtable<String,ServerItem> configuredServerForClusterDaemonList
          List of servers that are already configured for cluster daemon affactation that means they have jonasBase, JavaHome...(cf clusterd.xml)
protected  String currentCatalinaDefaultHostName
           
protected  String currentCatalinaDomainName
           
protected  String currentCatalinaEngineName
           
protected  String currentCatalinaServiceName
           
protected  ObjectName currentClusterDaemon
           
protected  String currentClusterDaemonName
           
protected  ObjectName currentDomain
           
protected  String currentDomainName
           
protected  int currentJonasDeploymentType
          Type of deployment in progress : JAR, EAR, WAR, RAR, DATASOURCE.
protected  ObjectName currentJonasServer
           
protected  String currentJonasServerName
           
protected  String currentSrvToConfigure
           
static int DEPLOYMENT
           
static int DEPLOYMENT_DATASOURCE
           
static int DEPLOYMENT_EAR
           
static int DEPLOYMENT_JAR
           
static int DEPLOYMENT_JMS
           
static int DEPLOYMENT_MAIL
           
static int DEPLOYMENT_RAR
           
static String DEPLOYMENT_STRING
           
static String DEPLOYMENT_STRING_DATASOURCE
           
static String DEPLOYMENT_STRING_EAR
           
static String DEPLOYMENT_STRING_JAR
           
static String DEPLOYMENT_STRING_JMS
           
static String DEPLOYMENT_STRING_MAILFACTORY
           
static String DEPLOYMENT_STRING_RAR
           
static String DEPLOYMENT_STRING_WAR
           
static int DEPLOYMENT_WAR
           
static int DOMAIN_DEPLOYMENT
           
static int DOMAIN_DEPLOYMENT_EAR
           
static int DOMAIN_DEPLOYMENT_JAR
           
static int DOMAIN_DEPLOYMENT_RAR
           
static String DOMAIN_DEPLOYMENT_STRING
           
static String DOMAIN_DEPLOYMENT_STRING_EAR
           
static String DOMAIN_DEPLOYMENT_STRING_JAR
           
static String DOMAIN_DEPLOYMENT_STRING_RAR
           
static String DOMAIN_DEPLOYMENT_STRING_WAR
           
static int DOMAIN_DEPLOYMENT_WAR
           
protected  boolean jettyServer
           
protected  MBeanServerConnection newCmiMbeanServerConnection
          new cmi Mbeanserver TODO: Remove this before integfrating newCmi to jons.
protected  Hashtable<String,ArrayList<String>> removedServersPerClusterd
          Removed servers for each clusterd used if user did not choose to save server remove operation in clusted.xml
protected  boolean theCurrentJonasServer
           
protected  Hashtable<String,String> variables
           
 
Constructor Summary
AdminHelper()
           
 
Method Summary
 void addRemovedServer(String clusterdName, String srvName)
          Called when substracting a server to clusterd supervision
 void addSrvConfiguredForClusterd(ServerItem srv)
          The given server has been configuered to be affected to a clusterd.
 void addVar(String key, String value)
          Add a value for the given key
 void clearConfigureForClusterList()
          clears the configuredServerForClusterDaemonList list
 String getAdminJonasServerConfDir()
           
 String getAdminJonasServerName()
           
 String getApplicationContextPath()
           
 int getApplicationServerPort()
           
 int getClusterdGraphAttribute(String clusterd, String attKey)
          Get a value of given attribute for given cluster daemon
 Hashtable<String,?> getClusterdGraphAttributes()
           
 String getCurrentCatalinaDefaultHostName()
           
 String getCurrentCatalinaDomainName()
           
 String getCurrentCatalinaEngineName()
           
 String getCurrentCatalinaServiceName()
           
 ObjectName getCurrentClusterDaemon()
           
 String getCurrentClusterDaemonName()
           
 ObjectName getCurrentDomain()
          Return the current J2EE domain ObjectName.
 String getCurrentDomainName()
          Return the current J2EE domain name.
 int getCurrentJonasDeploymentType()
           
 ObjectName getCurrentJonasServer()
          Return the ObjectName of the MBean associated to the current Jonas server.
 String getCurrentJonasServerName()
          Return the current Jonas server name.
 String getCurrentSrvToConfigure()
           
protected  String getServletServerName(String domainName)
          Return the name of the servlet server.
 ServerItem getSrvConfiguredForClusterd(String key)
          Gets a server item for the given key.
 String getVar(String key)
          Remove a variable
 boolean isCatalinaServer()
           
 boolean isConfiguredForClusterd(String srvName)
          Checks if the given server is already configured for being affected to a cluster daemon.
 boolean isCurrentJonasServer()
           
 boolean isJettyServer()
           
 boolean isSrvRemovedFromClusterd(String clusterdName, String srvName)
          Checks if the given server has been removed from clusterd affectation
 void removeVar(String key)
          Remove a variable
protected  void resetCatalina()
          Reset the Catalina server properties.
protected  void resetDomain()
          Reset the domain properties.
protected  void resetJetty()
          Reset the Jetty server properties.
protected  void resetJonas()
          Reset the JOnAS server properties.
 void rmvFromClusterdRemovedList(String clusterdName, String srvName)
          Called when substracting a server to clusterd supervision
 void setClusterdGraphAttribute(String clusterd, String attKey, Integer val)
          Set given value of given attribute for given cluster daemon
 void setClusterdGraphAttributes(Hashtable<String,Hashtable<String,Integer>> clusterdGraphAttribute)
           
 void setCurrentClusterDaemon(ObjectName currentClusterDaemon)
           
 void setCurrentClusterDaemonName(String currentClusterDaemonName)
           
 void setCurrentJonasDeploymentType(int currentJonasDeploymentType)
           
 void setCurrentSrvToConfigure(String currentSrvToConfigure)
           
 void setNewCmiMbeanServerConnection(MBeanServerConnection newCmiMbeanServerConnection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEPLOYMENT

public static final int DEPLOYMENT
See Also:
Constant Field Values

DEPLOYMENT_EAR

public static final int DEPLOYMENT_EAR
See Also:
Constant Field Values

DEPLOYMENT_JAR

public static final int DEPLOYMENT_JAR
See Also:
Constant Field Values

DEPLOYMENT_WAR

public static final int DEPLOYMENT_WAR
See Also:
Constant Field Values

DEPLOYMENT_RAR

public static final int DEPLOYMENT_RAR
See Also:
Constant Field Values

DEPLOYMENT_DATASOURCE

public static final int DEPLOYMENT_DATASOURCE
See Also:
Constant Field Values

DEPLOYMENT_JMS

public static final int DEPLOYMENT_JMS
See Also:
Constant Field Values

DEPLOYMENT_MAIL

public static final int DEPLOYMENT_MAIL
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_EAR

public static final int DOMAIN_DEPLOYMENT_EAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_JAR

public static final int DOMAIN_DEPLOYMENT_JAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_WAR

public static final int DOMAIN_DEPLOYMENT_WAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_RAR

public static final int DOMAIN_DEPLOYMENT_RAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT

public static final int DOMAIN_DEPLOYMENT
See Also:
Constant Field Values

DEPLOYMENT_STRING_EAR

public static final String DEPLOYMENT_STRING_EAR
See Also:
Constant Field Values

DEPLOYMENT_STRING_JAR

public static final String DEPLOYMENT_STRING_JAR
See Also:
Constant Field Values

DEPLOYMENT_STRING_WAR

public static final String DEPLOYMENT_STRING_WAR
See Also:
Constant Field Values

DEPLOYMENT_STRING_RAR

public static final String DEPLOYMENT_STRING_RAR
See Also:
Constant Field Values

DEPLOYMENT_STRING

public static final String DEPLOYMENT_STRING
See Also:
Constant Field Values

DEPLOYMENT_STRING_DATASOURCE

public static final String DEPLOYMENT_STRING_DATASOURCE
See Also:
Constant Field Values

DEPLOYMENT_STRING_JMS

public static final String DEPLOYMENT_STRING_JMS
See Also:
Constant Field Values

DEPLOYMENT_STRING_MAILFACTORY

public static final String DEPLOYMENT_STRING_MAILFACTORY
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_STRING_EAR

public static final String DOMAIN_DEPLOYMENT_STRING_EAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_STRING_JAR

public static final String DOMAIN_DEPLOYMENT_STRING_JAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_STRING_WAR

public static final String DOMAIN_DEPLOYMENT_STRING_WAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_STRING_RAR

public static final String DOMAIN_DEPLOYMENT_STRING_RAR
See Also:
Constant Field Values

DOMAIN_DEPLOYMENT_STRING

public static final String DOMAIN_DEPLOYMENT_STRING
See Also:
Constant Field Values

applicationServerPort

protected int applicationServerPort

applicationContextPath

protected String applicationContextPath

catalinaServer

protected boolean catalinaServer

currentCatalinaDomainName

protected String currentCatalinaDomainName

currentCatalinaServiceName

protected String currentCatalinaServiceName

currentCatalinaEngineName

protected String currentCatalinaEngineName

currentCatalinaDefaultHostName

protected String currentCatalinaDefaultHostName

jettyServer

protected boolean jettyServer

currentDomain

protected ObjectName currentDomain

currentJonasServer

protected ObjectName currentJonasServer

currentClusterDaemon

protected ObjectName currentClusterDaemon

currentSrvToConfigure

protected String currentSrvToConfigure

currentDomainName

protected String currentDomainName

currentJonasServerName

protected String currentJonasServerName

currentClusterDaemonName

protected String currentClusterDaemonName

adminJonasServerName

protected String adminJonasServerName

adminJonasServerConfDir

protected String adminJonasServerConfDir

theCurrentJonasServer

protected boolean theCurrentJonasServer

currentJonasDeploymentType

protected int currentJonasDeploymentType
Type of deployment in progress : JAR, EAR, WAR, RAR, DATASOURCE.


clusterdGraphAttributes

protected Hashtable<String,Hashtable<String,Integer>> clusterdGraphAttributes
Hashtable to store cluster daemons attributes. key: clusterd name, value: an attribute


configuredServerForClusterDaemonList

protected Hashtable<String,ServerItem> configuredServerForClusterDaemonList
List of servers that are already configured for cluster daemon affactation that means they have jonasBase, JavaHome...(cf clusterd.xml)


newCmiMbeanServerConnection

protected MBeanServerConnection newCmiMbeanServerConnection
new cmi Mbeanserver TODO: Remove this before integfrating newCmi to jons.


removedServersPerClusterd

protected Hashtable<String,ArrayList<String>> removedServersPerClusterd
Removed servers for each clusterd used if user did not choose to save server remove operation in clusted.xml


variables

protected Hashtable<String,String> variables
Constructor Detail

AdminHelper

public AdminHelper()
Method Detail

getCurrentJonasServerName

public String getCurrentJonasServerName()
Return the current Jonas server name.

Returns:
The name

getCurrentJonasServer

public ObjectName getCurrentJonasServer()
Return the ObjectName of the MBean associated to the current Jonas server.

Returns:
The ObjectName

getCurrentDomain

public ObjectName getCurrentDomain()
Return the current J2EE domain ObjectName.

Returns:
The ObjectName

getCurrentDomainName

public String getCurrentDomainName()
Return the current J2EE domain name.

Returns:
The name

getServletServerName

protected String getServletServerName(String domainName)
                               throws ManagementException
Return the name of the servlet server.

Returns:
The name of the servlet server.
Throws:
ManagementException

resetCatalina

protected void resetCatalina()
Reset the Catalina server properties.


resetJetty

protected void resetJetty()
Reset the Jetty server properties.


resetJonas

protected void resetJonas()
Reset the JOnAS server properties.


resetDomain

protected void resetDomain()
Reset the domain properties.


isCatalinaServer

public boolean isCatalinaServer()

getCurrentCatalinaServiceName

public String getCurrentCatalinaServiceName()

isCurrentJonasServer

public boolean isCurrentJonasServer()

getCurrentJonasDeploymentType

public int getCurrentJonasDeploymentType()

setCurrentJonasDeploymentType

public void setCurrentJonasDeploymentType(int currentJonasDeploymentType)

getApplicationServerPort

public int getApplicationServerPort()

getApplicationContextPath

public String getApplicationContextPath()

getCurrentCatalinaDefaultHostName

public String getCurrentCatalinaDefaultHostName()

getCurrentCatalinaEngineName

public String getCurrentCatalinaEngineName()

getCurrentCatalinaDomainName

public String getCurrentCatalinaDomainName()

isJettyServer

public boolean isJettyServer()

getAdminJonasServerName

public String getAdminJonasServerName()
Returns:
Returns the adminJonasServerName.

getAdminJonasServerConfDir

public String getAdminJonasServerConfDir()

getCurrentClusterDaemon

public ObjectName getCurrentClusterDaemon()
Returns:

setCurrentClusterDaemon

public void setCurrentClusterDaemon(ObjectName currentClusterDaemon)
Parameters:
currentClusterDaemon -

getCurrentClusterDaemonName

public String getCurrentClusterDaemonName()
Returns:

setCurrentClusterDaemonName

public void setCurrentClusterDaemonName(String currentClusterDaemonName)
Parameters:
currentClusterDaemonName -

getClusterdGraphAttributes

public Hashtable<String,?> getClusterdGraphAttributes()
Returns:
hashtable containing cluster daemons attributes for graphs

setClusterdGraphAttributes

public void setClusterdGraphAttributes(Hashtable<String,Hashtable<String,Integer>> clusterdGraphAttribute)

getClusterdGraphAttribute

public int getClusterdGraphAttribute(String clusterd,
                                     String attKey)
                              throws Exception
Get a value of given attribute for given cluster daemon

Parameters:
clusterd - the cluster daemon name
attKey - get value of this attribute
Returns:
Value of the given attribute for the given cluster daemon -1 else
Throws:
Exception

setClusterdGraphAttribute

public void setClusterdGraphAttribute(String clusterd,
                                      String attKey,
                                      Integer val)
                               throws Exception
Set given value of given attribute for given cluster daemon

Parameters:
clusterd - the cluster daemon name
attKey - set value of this attribute
Val - the value to set
Throws:
Exception

getCurrentSrvToConfigure

public String getCurrentSrvToConfigure()
Returns:
the currentSrvToConfigure

setCurrentSrvToConfigure

public void setCurrentSrvToConfigure(String currentSrvToConfigure)
Parameters:
currentSrvToConfigure - the currentSrvToConfigure to set

addSrvConfiguredForClusterd

public void addSrvConfiguredForClusterd(ServerItem srv)
                                 throws Exception
The given server has been configuered to be affected to a clusterd.

Parameters:
srv -
Throws:
Exception - if the ServerItem parameter is null

getSrvConfiguredForClusterd

public ServerItem getSrvConfiguredForClusterd(String key)
                                       throws Exception
Gets a server item for the given key. this server has been configured for clusterd affectation.

Parameters:
key -
Returns:
ServerItem corresponding to the given key. null if not found
Throws:
Exception - if the ServerItem parameter is null

isConfiguredForClusterd

public boolean isConfiguredForClusterd(String srvName)
                                throws Exception
Checks if the given server is already configured for being affected to a cluster daemon.

Parameters:
srvName - the server to find
Returns:
true if the server is already configured for clusterd affectation.
Throws:
Exception

clearConfigureForClusterList

public void clearConfigureForClusterList()
clears the configuredServerForClusterDaemonList list


setNewCmiMbeanServerConnection

public void setNewCmiMbeanServerConnection(MBeanServerConnection newCmiMbeanServerConnection)
Parameters:
newCmiMbeanServerConnection - the newCmiMbeanServerConnection to set

addRemovedServer

public void addRemovedServer(String clusterdName,
                             String srvName)
Called when substracting a server to clusterd supervision

Parameters:
clusterdName - the cluster daemon name
srvName - the server to remove

isSrvRemovedFromClusterd

public boolean isSrvRemovedFromClusterd(String clusterdName,
                                        String srvName)
Checks if the given server has been removed from clusterd affectation

Parameters:
clusterdName -
srvName -
Returns:

rmvFromClusterdRemovedList

public void rmvFromClusterdRemovedList(String clusterdName,
                                       String srvName)
Called when substracting a server to clusterd supervision

Parameters:
clusterdName - the cluster daemon name
srvName - the server to remove

addVar

public void addVar(String key,
                   String value)
Add a value for the given key

Parameters:
key - the key to add
value - to add

removeVar

public void removeVar(String key)
Remove a variable

Parameters:
key - the variable key

getVar

public String getVar(String key)
Remove a variable

Parameters:
key - the variable key


Copyright © 2010 OW2 Consortium. All Rights Reserved.