org.objectweb.jonas.adm
Class Adm

java.lang.Object
  extended by javax.rmi.PortableRemoteObject
      extended by org.objectweb.jonas.adm.Adm
All Implemented Interfaces:
java.rmi.Remote, AdmInterface

public class Adm
extends javax.rmi.PortableRemoteObject
implements AdmInterface

This class implements a remote interface used for administering the server.

Author:
Philippe Coq, Philippe Durieux, Marc Dutoo, JOnAS 2.4, Murad Meghani (Murad.Meghani@compuware.com) killServer and stopServer, Florent Benoit & Ludovic Bert : Methods for wars and ear files JOnAS 2.5 2002.06, Dean Jennings : add deployFile

Field Summary
static java.lang.String ADMNAME_SUFFIX
           
static int NOT_READY
           
static int READY
           
static int SLEEP_DELAY
          Sleep before exit of JVM
static int STOPPED
           
 
Fields inherited from interface org.objectweb.jonas.adm.AdmInterface
STATUS_ALL, STATUS_RUNNING, STATUS_STOPPED, TYPE_CAR, TYPE_EAR, TYPE_EJB, TYPE_RAR, TYPE_WAR
 
Constructor Summary
Adm(JProp jp)
          Adm constructor
 
Method Summary
 void addBeans(java.lang.String fileName)
          Create a container and load beans in it
 void addEar(java.lang.String fileName)
          Deploy a given ear file with the help of the ear service.
 void addRar(java.lang.String fileName)
          Deploy a given rar file with the help of the resource service.
 void addWar(java.lang.String fileName)
          Deploy a given war file with the help of the web container service.
 java.lang.String deployFile(int type, byte[] bfile, java.lang.String filename)
          Deploy file (GenIC), needed for Ishmael to work.
 void deployFileOn(java.lang.String filename, java.lang.String[] target)
          Deploy file on another server or a cluster.
 java.lang.String dumpCustom()
           
 int getServerState()
          To test if the server is ready
 java.lang.String getTopicLevel(java.lang.String topic)
          get Topic Level
 java.lang.String[] getTopics()
          get Topics.
 boolean isEarLoaded(java.lang.String fileName)
          Test if the specified filename is already deployed or not
 boolean isEJBContainer()
          To test if the server is an EJB container
 boolean isLoaded(java.lang.String fileName)
          returns true if beans are already loaded in server.
 boolean isRarLoaded(java.lang.String fileName)
          Test if the specified filename is already deployed or not
 boolean isWarLoaded(java.lang.String fileName)
          Test if the specified filename is already deployed or not
 void killServer()
          Stop the Server and stop the JVM
 java.lang.String[] listBeans()
          List beans of all JOnAS containers
 java.util.Vector listContext()
          List JNDI context
 java.util.Properties listEnv()
          List Environment (configuration properties provided by the configuration file).
 java.util.List listModules(int type, int state)
          List modules, needed for Ishmael to work.
 void removeBeans(java.lang.String fileName)
          Remove the container identified by fileName and remove all beans in it
 void removeEar(java.lang.String fileName)
          UnDeploy a given ear file with the help of the ear service.
 void removeRar(java.lang.String fileName)
          UnDeploy a given rar file with the help of the resource service.
 void removeWar(java.lang.String fileName)
          UnDeploy a given war file with the help of the web container service.
 void runGC()
          run the garbage collector
 void serverReady(boolean isEJB)
          server is ready
 void setTopicLevel(java.lang.String topic, java.lang.String l)
          set Topic Level
 void setTransactionTimeout(int timeout)
          set the default value for transaction timeout
 void startRemoteServers(java.lang.String[] target)
          Start remote servers or clusters
 void stopRemoteServers(java.lang.String[] target)
          Stop remote servers or clusters
 void stopServer()
          Stop the Server without stopping the JVM
 void syncAllEntities(boolean passivate)
          sync all entity instances outside transactions
 void undeployFile(java.lang.String filename)
          Physically remove the module from the server
 
Methods inherited from class javax.rmi.PortableRemoteObject
connect, exportObject, narrow, toStub, unexportObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADMNAME_SUFFIX

public static final java.lang.String ADMNAME_SUFFIX
See Also:
Constant Field Values

NOT_READY

public static final int NOT_READY
See Also:
Constant Field Values

READY

public static final int READY
See Also:
Constant Field Values

STOPPED

public static final int STOPPED
See Also:
Constant Field Values

SLEEP_DELAY

public static final int SLEEP_DELAY
Sleep before exit of JVM

See Also:
Constant Field Values
Constructor Detail

Adm

public Adm(JProp jp)
    throws java.rmi.RemoteException,
           javax.naming.NamingException,
           ServiceException,
           java.lang.Exception
Adm constructor

Throws:
java.rmi.RemoteException - if problem
javax.naming.NamingException
ServiceException
java.lang.Exception
Method Detail

getTopics

public java.lang.String[] getTopics()
                             throws java.rmi.RemoteException
get Topics. Assumes that all Loggers are TopicalLoggers.

Specified by:
getTopics in interface AdmInterface
Throws:
java.rmi.RemoteException

getTopicLevel

public java.lang.String getTopicLevel(java.lang.String topic)
                               throws java.rmi.RemoteException
get Topic Level

Specified by:
getTopicLevel in interface AdmInterface
Throws:
java.rmi.RemoteException

setTopicLevel

public void setTopicLevel(java.lang.String topic,
                          java.lang.String l)
                   throws java.rmi.RemoteException
set Topic Level

Specified by:
setTopicLevel in interface AdmInterface
Throws:
java.rmi.RemoteException

addBeans

public void addBeans(java.lang.String fileName)
              throws java.rmi.RemoteException
Create a container and load beans in it

Specified by:
addBeans in interface AdmInterface
Parameters:
fileName - name of the ejb-jar or xml file
Throws:
java.rmi.RemoteException

addEar

public void addEar(java.lang.String fileName)
            throws java.rmi.RemoteException,
                   EarServiceException
Deploy a given ear file with the help of the ear service.

Specified by:
addEar in interface AdmInterface
Parameters:
fileName - the name of the ear file.
Throws:
java.rmi.RemoteException - if rmi call failed.
EarServiceException - if the deployment failed.

isEarLoaded

public boolean isEarLoaded(java.lang.String fileName)
                    throws java.rmi.RemoteException,
                           EarServiceException
Test if the specified filename is already deployed or not

Specified by:
isEarLoaded in interface AdmInterface
Parameters:
fileName - the name of the ear file.
Returns:
true if the ear is deployed, else false.
Throws:
java.rmi.RemoteException - if rmi call failed.
EarServiceException

addRar

public void addRar(java.lang.String fileName)
            throws java.rmi.RemoteException,
                   ResourceServiceException
Deploy a given rar file with the help of the resource service.

Specified by:
addRar in interface AdmInterface
Parameters:
fileName - the name of the rar file.
Throws:
java.rmi.RemoteException - if rmi call failed.
ResourceServiceException - if the deployment failed.

isRarLoaded

public boolean isRarLoaded(java.lang.String fileName)
                    throws java.rmi.RemoteException,
                           ResourceServiceException
Test if the specified filename is already deployed or not

Specified by:
isRarLoaded in interface AdmInterface
Parameters:
fileName - the name of the rar file.
Returns:
true if the rar is deployed, else false.
Throws:
java.rmi.RemoteException - if rmi call failed.
ResourceServiceException - if unable to get resource service

addWar

public void addWar(java.lang.String fileName)
            throws java.rmi.RemoteException,
                   JWebContainerServiceException
Deploy a given war file with the help of the web container service.

Specified by:
addWar in interface AdmInterface
Parameters:
fileName - the name of the war file.
Throws:
java.rmi.RemoteException - if rmi call failed.
JWebContainerServiceException - if the deployment failed.

isWarLoaded

public boolean isWarLoaded(java.lang.String fileName)
                    throws java.rmi.RemoteException,
                           JWebContainerServiceException
Test if the specified filename is already deployed or not

Specified by:
isWarLoaded in interface AdmInterface
Parameters:
fileName - the name of the war file.
Returns:
true if the war is deployed, else false.
Throws:
java.rmi.RemoteException - if rmi call failed.
JWebContainerServiceException

removeEar

public void removeEar(java.lang.String fileName)
               throws java.rmi.RemoteException,
                      EarServiceException
UnDeploy a given ear file with the help of the ear service.

Specified by:
removeEar in interface AdmInterface
Parameters:
fileName - the name of the ear file.
Throws:
java.rmi.RemoteException - if rmi call failed.
EarServiceException - if the undeployment failed.

removeRar

public void removeRar(java.lang.String fileName)
               throws java.rmi.RemoteException,
                      ResourceServiceException
UnDeploy a given rar file with the help of the resource service.

Specified by:
removeRar in interface AdmInterface
Parameters:
fileName - the name of the rar file.
Throws:
java.rmi.RemoteException - if rmi call failed.
ResourceServiceException - if the undeployment failed.

removeWar

public void removeWar(java.lang.String fileName)
               throws java.rmi.RemoteException,
                      JWebContainerServiceException
UnDeploy a given war file with the help of the web container service.

Specified by:
removeWar in interface AdmInterface
Parameters:
fileName - the name of the war file.
Throws:
java.rmi.RemoteException - if rmi call failed.
JWebContainerServiceException - if the undeployment failed.

removeBeans

public void removeBeans(java.lang.String fileName)
                 throws java.rmi.RemoteException
Remove the container identified by fileName and remove all beans in it

Specified by:
removeBeans in interface AdmInterface
Parameters:
fileName - name of the ejb-jar or xml file
Throws:
java.rmi.RemoteException

isLoaded

public boolean isLoaded(java.lang.String fileName)
                 throws java.rmi.RemoteException
returns true if beans are already loaded in server.

Specified by:
isLoaded in interface AdmInterface
Parameters:
fileName - name of the ejb-jar or xml file
Throws:
java.rmi.RemoteException

dumpCustom

public java.lang.String dumpCustom()
                            throws java.rmi.RemoteException
Specified by:
dumpCustom in interface AdmInterface
Throws:
java.rmi.RemoteException

listBeans

public java.lang.String[] listBeans()
                             throws java.rmi.RemoteException
List beans of all JOnAS containers

Specified by:
listBeans in interface AdmInterface
Throws:
java.rmi.RemoteException

listContext

public java.util.Vector listContext()
                             throws java.rmi.RemoteException
List JNDI context

Specified by:
listContext in interface AdmInterface
Throws:
java.rmi.RemoteException

listEnv

public java.util.Properties listEnv()
List Environment (configuration properties provided by the configuration file).

Specified by:
listEnv in interface AdmInterface

stopServer

public void stopServer()
                throws java.rmi.RemoteException
Stop the Server without stopping the JVM

Specified by:
stopServer in interface AdmInterface
Throws:
java.rmi.RemoteException

killServer

public void killServer()
                throws java.rmi.RemoteException
Stop the Server and stop the JVM

Specified by:
killServer in interface AdmInterface
Throws:
java.rmi.RemoteException

getServerState

public int getServerState()
                   throws java.rmi.RemoteException
To test if the server is ready

Specified by:
getServerState in interface AdmInterface
Returns:
int 0=not ready, 1=ready, 2=stopped
Throws:
java.rmi.RemoteException

isEJBContainer

public boolean isEJBContainer()
                       throws java.rmi.RemoteException
To test if the server is an EJB container

Specified by:
isEJBContainer in interface AdmInterface
Throws:
java.rmi.RemoteException

setTransactionTimeout

public void setTransactionTimeout(int timeout)
                           throws java.rmi.RemoteException
set the default value for transaction timeout

Specified by:
setTransactionTimeout in interface AdmInterface
Throws:
java.rmi.RemoteException

runGC

public void runGC()
           throws java.rmi.RemoteException
run the garbage collector

Specified by:
runGC in interface AdmInterface
Throws:
java.rmi.RemoteException

syncAllEntities

public void syncAllEntities(boolean passivate)
                     throws java.rmi.RemoteException
sync all entity instances outside transactions

Specified by:
syncAllEntities in interface AdmInterface
Parameters:
passivate - passivate instances after synchronization.
Throws:
java.rmi.RemoteException

serverReady

public void serverReady(boolean isEJB)
server is ready


deployFile

public java.lang.String deployFile(int type,
                                   byte[] bfile,
                                   java.lang.String filename)
                            throws java.rmi.RemoteException,
                                   EarServiceException,
                                   JWebContainerServiceException
Deploy file (GenIC), needed for Ishmael to work. The file is in the directory specified by the property "jonas.service.deployment.directory"

Specified by:
deployFile in interface AdmInterface
Parameters:
type - type of the file (EJB, WAR, EAR, RAR, CAR)
bfile -
filename - basename of the file to be deployed
Throws:
java.rmi.RemoteException
EarServiceException
ResourceServiceException
JWebContainerServiceException

listModules

public java.util.List listModules(int type,
                                  int state)
                           throws java.rmi.RemoteException
List modules, needed for Ishmael to work. Currently only lists top level modules. It does need to do sub elements of ears in the future.

Specified by:
listModules in interface AdmInterface
Parameters:
type - type of the file (EJB, WAR, EAR, RAR, CAR)
state - status of the modules to be returned (RUNNING, STOPPED, ALL)
Throws:
java.rmi.RemoteException

undeployFile

public void undeployFile(java.lang.String filename)
                  throws java.rmi.RemoteException
Physically remove the module from the server

Specified by:
undeployFile in interface AdmInterface
Parameters:
filename - the filename of the module to be removed
Throws:
java.rmi.RemoteException

startRemoteServers

public void startRemoteServers(java.lang.String[] target)
                        throws java.rmi.RemoteException
Start remote servers or clusters

Specified by:
startRemoteServers in interface AdmInterface
Parameters:
target - List of clusters or servers to start
Throws:
java.rmi.RemoteException

stopRemoteServers

public void stopRemoteServers(java.lang.String[] target)
                       throws java.rmi.RemoteException
Stop remote servers or clusters

Specified by:
stopRemoteServers in interface AdmInterface
Parameters:
target - List of clusters or servers to stop
Throws:
java.rmi.RemoteException

deployFileOn

public void deployFileOn(java.lang.String filename,
                         java.lang.String[] target)
                  throws java.rmi.RemoteException
Deploy file on another server or a cluster.

Specified by:
deployFileOn in interface AdmInterface
Parameters:
filename - Name of the file
target - List of clusters or servers where to deploy the file.
Throws:
java.rmi.RemoteException