org.ow2.jonas.lib.jmbeans
Class J2EEServer

java.lang.Object
  extended by org.ow2.jonas.lib.jmbeans.J2EEManagedObject
      extended by org.ow2.jonas.lib.jmbeans.J2EEServer
All Implemented Interfaces:
EventListener, MBeanRegistration, NotificationListener

public class J2EEServer
extends J2EEManagedObject
implements NotificationListener, MBeanRegistration

The JSR77 J2EEServer MBean implementation. Implement the StateManagement and Events specified in the JSR77.

Author:
Adriana.Danes@bull.net

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.jmbeans.J2EEManagedObject
J2EE_TYPE_APPLICATION, J2EE_TYPE_SERVER, NAME
 
Constructor Summary
J2EEServer(String objectName)
          MBean constructor.
J2EEServer(String objectName, boolean stateManageable, boolean statisticsProvider, boolean eventProvider, org.osgi.framework.BundleContext bc)
          MBean constructor.
 
Method Summary
 void addJavaVM(String objectName)
          Add an object name to the javaVMs list.
 void deploy(String fileName)
          Deploy a file to a local deployer.
 String distribute(String fileName, byte[] fileContent)
          Dump the given bytes to a local file and then return the path to this file.
 Properties getConfigFileEnv()
           
 long getCurrentTotalMemory()
           
 long getCurrentUsedMemory()
           
protected  org.ow2.util.ee.deploy.api.deployable.IDeployable getDeployable(String fileName)
          Convert a ready to deploy file to a deployable object.
 ArrayList<String> getDeployableEars()
           
 ArrayList<String> getDeployableFiles()
           
 ArrayList<String> getDeployableJars()
           
 ArrayList<String> getDeployableRars()
           
 ArrayList<String> getDeployableWars()
           
 ArrayList<String> getDeployedEars()
           
 ArrayList<String> getDeployedFiles()
           
 ArrayList<String> getDeployedJars()
           
 ArrayList<String> getDeployedObjects()
           
 ArrayList<String> getDeployedRars()
           
 ArrayList<String> getDeployedWars()
           
 String getDomainName()
           
 String[] getEventTypes()
           
 String[] getJavaVMs()
           
 String getJonasBase()
           
 String getJonasRoot()
           
 String getJvmInfos()
           
 String getProtocols()
           
 int getRange()
           
 ArrayList<String> getResources()
           
 String getServerName()
           
 String getServerVendor()
           
 String getServerVersion()
           
 String getServiceDescription(String service)
           
 String[] getServices()
           
 String getServiceState(String service)
           
 int getSizeTableMeasures()
           
 long getStartTime()
           
 org.ow2.jonas.lib.management.javaee.J2EEState getState()
           
 Long[] getTableMeasures()
           
 org.ow2.jonas.lib.timer.TimerManager getTimerManager()
           
 org.ow2.jonas.versioning.VersioningService getVersioningService()
           
 String getVersions()
           
 void halt()
          Halt the server.
 void handleNotification(Notification notification, Object handback)
          Treat JMX notifications.
 void initRepositoryDirs()
          The repositoryDirs must contain at least the 'deploy' directory.
 boolean isActivated()
           
 boolean isDeployed(String fileName)
           
 boolean isFailed()
           
 boolean isRunning()
           
 boolean isStarting()
           
 boolean isStopped()
           
 boolean isStopping()
           
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
          After registering, add myself as listener to notifications emitted by: - the MBeanServerDelegate (to receive JMX registration/un-registration notifications).
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
 boolean removeModuleFile(String fileName)
          Remove a specified J2EE module
 void runGC()
           
 String sendFile(byte[] fileContent, String fileName, boolean replaceExisting)
           
 void setActivated(boolean activated)
          Set memory monitoring activation.
 void setAllProperties(org.ow2.jonas.properties.ServerProperties allProperties)
           
 void setArchiveManager(org.ow2.util.archive.api.IArchiveManager archiveManager)
           
 void setConfigManager(org.ow2.jonas.configuration.ConfigurationManager configManager)
           
 void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
           
protected  void setDepmonitoringRunning(org.osgi.framework.ServiceReference reference)
           
 void setDirectories(String dirs)
           
 void setDomainName(String domainName)
          Set the domain name.
protected  void setFailed()
           
 void setJonasBase(String jonasBase)
          Used by the J2EEServer creator (MBeansRegistration).
 void setJonasRoot(String jonasRoot)
          Used by the J2EEServer creator (MBeansRegistration).
 void setProtocols(String protocols)
           
 void setRange(int range)
           
protected  void setRunning()
           
 void setServerName(String serverName)
           
 void setServerVendor(String serverVendor)
           
 void setServerVersion(String serverVersion)
           
 void setServiceManager(ServiceManager serviceManager)
           
protected  void setServicesRunning()
           
 void setSizeTableMeasures(int sizeTableMeasures)
           
protected  void setStarting()
           
protected  void setStopped()
           
protected  void setStopping()
           
 void setTimerManager(org.ow2.jonas.lib.timer.TimerManager timerManager)
           
 void setVersioningService(org.ow2.jonas.versioning.VersioningService versioningService)
           
 void setVersions(String versions)
           
 void start()
          Start the server by starting all the non-mandatory services.
 void startRecursive()
           
 void stop()
          Stop the server by stopping all the non-mandatory services.
 void undeploy(String fileName)
          Undeploy a file from a local deployer.
 void unsetVersioningService()
          Sets the versioning service to null.
 String wsgenLocalFile(String pathname, Boolean unpacked)
          Apply WsGen on a local file and generate webservices artifacts
 
Methods inherited from class org.ow2.jonas.lib.jmbeans.J2EEManagedObject
getObjectName, isEventProvider, isStateManageable, isStatisticsProvider, sendNotification, sendReconfigNotification, sendSaveNotification, setModelMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2EEServer

public J2EEServer(String objectName)
MBean constructor.

Parameters:
objectName - object name of the managed object

J2EEServer

public J2EEServer(String objectName,
                  boolean stateManageable,
                  boolean statisticsProvider,
                  boolean eventProvider,
                  org.osgi.framework.BundleContext bc)
MBean constructor.

Parameters:
objectName - object name of the managed object
stateManageable - if true, this managed object implements J2EE State Management Model
statisticsProvider - if true, this managed object implements the J2EE StatisticProvide Model
eventProvider - if true, this managed object implements the J2EE EventProvider Model
Method Detail

getEventTypes

public String[] getEventTypes()

getState

public org.ow2.jonas.lib.management.javaee.J2EEState getState()

isStarting

public boolean isStarting()

isRunning

public boolean isRunning()

isFailed

public boolean isFailed()

isStopping

public boolean isStopping()

isStopped

public boolean isStopped()

getStartTime

public long getStartTime()

getServerVendor

public String getServerVendor()

setServerVendor

public void setServerVendor(String serverVendor)

getServerVersion

public String getServerVersion()

setServerVersion

public void setServerVersion(String serverVersion)

getServerName

public String getServerName()

setServerName

public void setServerName(String serverName)

getJonasBase

public String getJonasBase()
Returns:
jonas.base

setJonasBase

public void setJonasBase(String jonasBase)
Used by the J2EEServer creator (MBeansRegistration).

Parameters:
jonasBase - JONAS_BASE to be set

getJonasRoot

public String getJonasRoot()
Returns:
jonas.base

setJonasRoot

public void setJonasRoot(String jonasRoot)
Used by the J2EEServer creator (MBeansRegistration).

Parameters:
jonasRoot - JONAS_ROOT to be set

getProtocols

public String getProtocols()

setProtocols

public void setProtocols(String protocols)

getVersions

public String getVersions()

setVersions

public void setVersions(String versions)

isActivated

public boolean isActivated()

setActivated

public void setActivated(boolean activated)
Set memory monitoring activation.

Parameters:
activated -

getCurrentUsedMemory

public long getCurrentUsedMemory()

getCurrentTotalMemory

public long getCurrentTotalMemory()

getRange

public int getRange()

setRange

public void setRange(int range)

getSizeTableMeasures

public int getSizeTableMeasures()

setSizeTableMeasures

public void setSizeTableMeasures(int sizeTableMeasures)

getTableMeasures

public Long[] getTableMeasures()

getResources

public ArrayList<String> getResources()
Returns:
The resources list.

getDeployedObjects

public ArrayList<String> getDeployedObjects()
Returns:
The deployed list.

getDomainName

public String getDomainName()
Returns:
The current domain name.

setDomainName

public void setDomainName(String domainName)
Set the domain name.

Parameters:
domainName - The current domain name

getJavaVMs

public String[] getJavaVMs()
Returns:
the list of MBean names corresponding to the JVMs on which this server has running threads

addJavaVM

public void addJavaVM(String objectName)
Add an object name to the javaVMs list.

Parameters:
objectName - Object name corresponding to a JVM MBean

setVersioningService

public void setVersioningService(org.ow2.jonas.versioning.VersioningService versioningService)
Parameters:
versioningService - The versioning service to set.

unsetVersioningService

public void unsetVersioningService()
Sets the versioning service to null.


getVersioningService

public org.ow2.jonas.versioning.VersioningService getVersioningService()
Returns:
The versioning service.

start

public void start()
           throws Exception
Start the server by starting all the non-mandatory services.

Throws:
Exception

startRecursive

public void startRecursive()
                    throws Exception
Throws:
Exception

stop

public void stop()
          throws Exception
Stop the server by stopping all the non-mandatory services.

Throws:
Exception

halt

public void halt()
          throws Exception
Halt the server.

Throws:
Exception

handleNotification

public void handleNotification(Notification notification,
                               Object handback)
Treat JMX notifications.

Specified by:
handleNotification in interface NotificationListener
Parameters:
notification - received notification
handback - hand back object

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration

postRegister

public void postRegister(Boolean registrationDone)
After registering, add myself as listener to notifications emitted by: - the MBeanServerDelegate (to receive JMX registration/un-registration notifications).

Specified by:
postRegister in interface MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception

setServicesRunning

protected void setServicesRunning()

setDepmonitoringRunning

protected void setDepmonitoringRunning(org.osgi.framework.ServiceReference reference)

setStarting

protected void setStarting()

setRunning

protected void setRunning()

setStopping

protected void setStopping()

setStopped

protected void setStopped()

setFailed

protected void setFailed()

setDeployerManager

public void setDeployerManager(org.ow2.util.ee.deploy.api.deployer.IDeployerManager deployerManager)
Parameters:
deployerManager - reference to the deployerManager

setArchiveManager

public void setArchiveManager(org.ow2.util.archive.api.IArchiveManager archiveManager)
Parameters:
archiveManager - reference to the archiveManager

deploy

public void deploy(String fileName)
Deploy a file to a local deployer.

Parameters:
fileName - the name of the file to deploy

undeploy

public void undeploy(String fileName)
Undeploy a file from a local deployer.

Parameters:
fileName - the name of the file to undeploy

getDeployable

protected org.ow2.util.ee.deploy.api.deployable.IDeployable getDeployable(String fileName)
Convert a ready to deploy file to a deployable object.

Parameters:
fileName - the name of the file
Returns:
the deployable object

isDeployed

public boolean isDeployed(String fileName)
                   throws Exception
Throws:
Exception

getJvmInfos

public String getJvmInfos()

runGC

public void runGC()
           throws RemoteException
Throws:
RemoteException

getConfigFileEnv

public Properties getConfigFileEnv()

setConfigManager

public void setConfigManager(org.ow2.jonas.configuration.ConfigurationManager configManager)

getTimerManager

public org.ow2.jonas.lib.timer.TimerManager getTimerManager()

setTimerManager

public void setTimerManager(org.ow2.jonas.lib.timer.TimerManager timerManager)

setAllProperties

public void setAllProperties(org.ow2.jonas.properties.ServerProperties allProperties)

initRepositoryDirs

public void initRepositoryDirs()
The repositoryDirs must contain at least the 'deploy' directory. TODO replace deployDir with value from DeployableMonitor.DEFAULT_DIRECTORY


setDirectories

public void setDirectories(String dirs)

getDeployableFiles

public ArrayList<String> getDeployableFiles()

getDeployableJars

public ArrayList<String> getDeployableJars()

getDeployableEars

public ArrayList<String> getDeployableEars()

getDeployableWars

public ArrayList<String> getDeployableWars()

getDeployableRars

public ArrayList<String> getDeployableRars()

getDeployedWars

public ArrayList<String> getDeployedWars()
                                  throws Exception
Returns:
List of deployed WAR files.
Throws:
NullPointerException
MalformedObjectNameException
ReflectionException
MBeanException
InstanceNotFoundException
AttributeNotFoundException
Exception

getDeployedJars

public ArrayList<String> getDeployedJars()
                                  throws Exception
Returns:
List of deployed JAR files.
Throws:
Exception

getDeployedRars

public ArrayList<String> getDeployedRars()
                                  throws Exception
Returns:
List of deployed RAR files.
Throws:
Exception

getDeployedEars

public ArrayList<String> getDeployedEars()
                                  throws Exception
Returns:
List of deployed EAR files.
Throws:
Exception

getDeployedFiles

public ArrayList<String> getDeployedFiles()
                                   throws Exception
Throws:
Exception

sendFile

public String sendFile(byte[] fileContent,
                       String fileName,
                       boolean replaceExisting)
                throws Exception
Throws:
Exception

distribute

public String distribute(String fileName,
                         byte[] fileContent)
                  throws Exception
Dump the given bytes to a local file and then return the path to this file.

Parameters:
fileName - the name of the file to distribute
fileContent - the content of the given file
Returns:
the path of the distributed file
Throws:
Exception

removeModuleFile

public boolean removeModuleFile(String fileName)
                         throws Exception
Remove a specified J2EE module

Parameters:
fileName - Name of file to remove
Returns:
true if file has been removed
Throws:
Exception - if remove fails

wsgenLocalFile

public String wsgenLocalFile(String pathname,
                             Boolean unpacked)
Apply WsGen on a local file and generate webservices artifacts

Parameters:
pathname - : local path name to the component
unpacked - true if we want to have an unpacked directory as result
Returns:
Returns the path to the modified archive

setServiceManager

public void setServiceManager(ServiceManager serviceManager)

getServices

public String[] getServices()

getServiceDescription

public String getServiceDescription(String service)

getServiceState

public String getServiceState(String service)


Copyright © 2008 OW2 Consortium. All Rights Reserved.