org.jboss.jbossas.servermanager
Class Server

java.lang.Object
  extended by org.jboss.jbossas.servermanager.Server

public class Server
extends Object

A Server.

Version:
$Revision: 86806 $
Author:
Ryan Campbell

Field Summary
static String DEPLOYER_NAME
          ObjectName of the Main Deployer
static String JBOSS_SERVER_CONFIG_DIR_NAME
          the directory where server config instances live
static String JBOSS_SERVER_DEPLOY_DIR_NAME
          the hot deployment directory
 
Constructor Summary
Server()
           
 
Method Summary
 void addArg(Argument arg)
          Add an argument.
 void addJvmArg(Argument arg)
          Add a jvm arg.
 void addSysProperty(Property property)
          Add a system property.
 void deploy(File file)
          Deploy a package with the main deployer.
 void doShutdown()
          Send server shutdown command.
 String getArgs()
          Get the arguments as a string for the command line.
protected  File getConfDir()
          The server's directory (ie, all, default)
 String getConfig()
          Get the config.
 File getDumpFile()
          Where should the servers's trace dump go?
 File getErrorLog()
          Where should the server's std err log go?
 PrintWriter getErrorWriter()
          The error log's writer.
 String getHost()
          Get the host.
 Integer getHttpPort()
          Get the httpPort.
 URL getHttpUrl()
          Where is the HTTP service listening?
 String getInitialContextFactoryClassName()
          Get the InitialContext factory class name
 String getJvmArgs()
          Get the JVM args for the command line.
 File getLogDir()
          The server's log directory
 String getLoggingProperty()
          Get the logging property to pass to the server JBAS-6630 - default to DEBUG
 String getLogThreshold()
          Get the Log Level
 String getName()
          Get the name.
 Context getNamingContext()
          Get the Naming Context.
 File getOutputLog()
          Where should the servers's std out go?
 PrintWriter getOutWriter()
          The writer for the output log.
 String getPartition()
          Get the HA partition name of the Server
 String getPassword()
          Get password to pass to org.jboss.Shutdown using the -p option.
 Process getProcess()
          Get the process.
 Integer getRmiPort()
          Get the rmiPort
 String getRmiUrl()
          The URl for the RMI listener.
 MBeanServerConnection getServerConnection()
          Get server connection.
 String getServerUrl()
          Get the URL to connect server
 String getSysProperties()
          Get the system properties for the command line.
 String getSysProperty(String key)
          Get a single system property.
 String getUsername()
          Get username to pass to org.jboss.Shutdown using the -u option.
 boolean hasWebServer()
          Get the hasWebServer.
 Object invoke(MBeanServerConnection server, ObjectName name, String method, Object[] args, String[] sig)
           
 Object invoke(ObjectName name, String method, Object[] args, String[] sig)
          invoke wraps an invoke call to the mbean server in a lot of exception unwrapping.
 boolean isRunning()
          Is the server actually running?
 boolean isStopped()
          Has the server been intentionally stopped?
 String listThreadDump()
          Get server thread dump.
 void redeploy(File file)
           
 void setConfig(String config)
          Set the config.
 void setErrorWriter(PrintWriter errorlog)
          Set the error writer.
 void setHasWebServer(boolean hasWebServer)
          Set the hasWebServer.
 void setHost(String host)
          Set the host.
 void setHttpPort(Integer httpPort)
          Set the httpPort.
 void setInitialContextFactoryClassName(String initialContextFactoryClassName)
          Set the InitialContext factory class name
 void setLogThreshold(String logThreshold)
          Set the Log Level
protected  void setManager(ServerManager manager)
          Set the manager.
 void setName(String name)
          Set the name.
 void setNamingContext(Context namingContext)
          Set the NamingContext
 void setOutWriter(PrintWriter outlog)
          Set the output log's writer
 void setPartition(String partition)
          Set the HA partition name of the Server same as -g in run.sh so set before start-up
 void setPassword(String password)
          Set password to pass to org.jboss.Shutdown using the -p option.
 void setProcess(Process process)
          The running process of this server.
 void setRmiPort(Integer rmiPort)
          Set the rmiPort.
 void setServerConnection(MBeanServerConnection serverConnection)
          Set server connection.
 void setServerUrl(String serverUrl)
          Set the URL to connect server
 void setUsername(String username)
          Set username to pass to org.jboss.Shutdown using the -u option.
 void undeploy(File file)
          Undeploy a package with the main deployer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JBOSS_SERVER_CONFIG_DIR_NAME

public static final String JBOSS_SERVER_CONFIG_DIR_NAME
the directory where server config instances live

See Also:
Constant Field Values

JBOSS_SERVER_DEPLOY_DIR_NAME

public static final String JBOSS_SERVER_DEPLOY_DIR_NAME
the hot deployment directory

See Also:
Constant Field Values

DEPLOYER_NAME

public static final String DEPLOYER_NAME
ObjectName of the Main Deployer

See Also:
Constant Field Values
Constructor Detail

Server

public Server()
Method Detail

getName

public String getName()
Get the name.

Returns:
the name.

setName

public void setName(String name)
Set the name.

Parameters:
name - The name to set.

getUsername

public String getUsername()
Get username to pass to org.jboss.Shutdown using the -u option.

Returns:
the server jmx username

setUsername

public void setUsername(String username)
Set username to pass to org.jboss.Shutdown using the -u option.

Parameters:
username - the server jmx username

getPassword

public String getPassword()
Get password to pass to org.jboss.Shutdown using the -p option.

Returns:
the server jmx password

setPassword

public void setPassword(String password)
Set password to pass to org.jboss.Shutdown using the -p option.

Parameters:
password - the server jmx password

getPartition

public String getPartition()
Get the HA partition name of the Server

Returns:
the server's HA partition name

setPartition

public void setPartition(String partition)
Set the HA partition name of the Server same as -g in run.sh so set before start-up

Parameters:
partition - the HA partition name to use

setManager

protected void setManager(ServerManager manager)
Set the manager.

Parameters:
manager -

addArg

public void addArg(Argument arg)
Add an argument.

Parameters:
arg -

getArgs

public String getArgs()
Get the arguments as a string for the command line.

Returns:
the arguments as a string

addJvmArg

public void addJvmArg(Argument arg)
Add a jvm arg.

Parameters:
arg -

getJvmArgs

public String getJvmArgs()
Get the JVM args for the command line.

Returns:
the arguments as a string

addSysProperty

public void addSysProperty(Property property)
Add a system property.

Parameters:
property -

getSysProperty

public String getSysProperty(String key)
Get a single system property.

Returns:
a System property

getSysProperties

public String getSysProperties()
Get the system properties for the command line.

Returns:
the properties as a string

getLoggingProperty

public String getLoggingProperty()
Get the logging property to pass to the server JBAS-6630 - default to DEBUG

Returns:
the log threshold property

setProcess

public void setProcess(Process process)
The running process of this server.

Parameters:
process -

isRunning

public boolean isRunning()
Is the server actually running?

Returns:
whether the server is running

isStopped

public boolean isStopped()
Has the server been intentionally stopped?

Returns:
whether the server is stopped

getProcess

public Process getProcess()
Get the process.

Returns:
the process

getHttpUrl

public URL getHttpUrl()
               throws MalformedURLException
Where is the HTTP service listening?

Returns:
whether the service is listening
Throws:
MalformedURLException - for a malformed url

getRmiUrl

public String getRmiUrl()
The URl for the RMI listener.

Returns:
the rmi url

getConfig

public String getConfig()
Get the config. Defaults to the server name.

Returns:
the config.

setConfig

public void setConfig(String config)
Set the config.

Parameters:
config - The config to set.

getHost

public String getHost()
Get the host.

Returns:
the host.

setHost

public void setHost(String host)
Set the host.

Parameters:
host - The host to set.

getHttpPort

public Integer getHttpPort()
Get the httpPort.

Returns:
the http port

setHttpPort

public void setHttpPort(Integer httpPort)
Set the httpPort.

Parameters:
httpPort - The httpPort to set.

setRmiPort

public void setRmiPort(Integer rmiPort)
Set the rmiPort.

Parameters:
rmiPort - The rmiPort to set.

getRmiPort

public Integer getRmiPort()
Get the rmiPort

Returns:
the rmi port

getErrorLog

public File getErrorLog()
Where should the server's std err log go?

Returns:
the error log file

getOutputLog

public File getOutputLog()
Where should the servers's std out go?

Returns:
the output log file

getDumpFile

public File getDumpFile()
Where should the servers's trace dump go?

Returns:
the thread dump file

getLogDir

public File getLogDir()
The server's log directory

Returns:
the log directory

getConfDir

protected File getConfDir()
The server's directory (ie, all, default)

Returns:
the configuration directory

setOutWriter

public void setOutWriter(PrintWriter outlog)
Set the output log's writer

Parameters:
outlog - the log writer

getOutWriter

public PrintWriter getOutWriter()
The writer for the output log.

Returns:
the output writer

getErrorWriter

public PrintWriter getErrorWriter()
The error log's writer.

Returns:
the log writer

setErrorWriter

public void setErrorWriter(PrintWriter errorlog)
Set the error writer.

Parameters:
errorlog -

hasWebServer

public boolean hasWebServer()
Get the hasWebServer.

Returns:
the hasWebServer.

setHasWebServer

public void setHasWebServer(boolean hasWebServer)
Set the hasWebServer.

Parameters:
hasWebServer - The hasWebServer to set.

getNamingContext

public Context getNamingContext()
                         throws NamingException
Get the Naming Context.

Returns:
the namingContext.
Throws:
NamingException

setNamingContext

public void setNamingContext(Context namingContext)
Set the NamingContext

Parameters:
namingContext -

getServerConnection

public MBeanServerConnection getServerConnection()
                                          throws NamingException
Get server connection.

Returns:
the serverConnection
Throws:
NamingException

setServerConnection

public void setServerConnection(MBeanServerConnection serverConnection)
Set server connection.

Parameters:
serverConnection -

listThreadDump

public String listThreadDump()
                      throws NamingException,
                             InstanceNotFoundException,
                             MBeanException,
                             ReflectionException,
                             IOException
Get server thread dump.

Returns:
the thread dump
Throws:
NamingException - for contect lookup
InstanceNotFoundException - MBeanServerConnection method invoke()
MBeanException - MBeanServerConnection method invoke()
ReflectionException - MBeanServerConnection method invoke()
IOException - MBeanServerConnection method invoke()

doShutdown

public void doShutdown()
                throws NamingException,
                       InstanceNotFoundException,
                       MBeanException,
                       ReflectionException,
                       IOException
Send server shutdown command.

Throws:
NamingException - for context lookup
InstanceNotFoundException - MBeanServerConnection method invoke()
MBeanException - MBeanServerConnection method invoke()
ReflectionException - MBeanServerConnection method invoke()
IOException - MBeanServerConnection method invoke()

getServerUrl

public String getServerUrl()
Get the URL to connect server


setServerUrl

public void setServerUrl(String serverUrl)
Set the URL to connect server

Parameters:
serverUrl -

getInitialContextFactoryClassName

public String getInitialContextFactoryClassName()
Get the InitialContext factory class name


setInitialContextFactoryClassName

public void setInitialContextFactoryClassName(String initialContextFactoryClassName)
Set the InitialContext factory class name

Parameters:
initialContextFactoryClassName -

getLogThreshold

public String getLogThreshold()
Get the Log Level

Returns:
the logThreshold

setLogThreshold

public void setLogThreshold(String logThreshold)
Set the Log Level

Parameters:
logThreshold - log level

deploy

public void deploy(File file)
            throws Exception
Deploy a package with the main deployer. The supplied name is interpreted as a url, or as a filename in jbosstest.deploy.lib or output/lib.

Parameters:
name - filename/url of package to deploy.
Throws:
Exception - Description of Exception

redeploy

public void redeploy(File file)
              throws Exception
Throws:
Exception

undeploy

public void undeploy(File file)
              throws Exception
Undeploy a package with the main deployer. The supplied name is interpreted as a url, or as a filename in jbosstest.deploy.lib or output/lib.

Parameters:
name - filename/url of package to undeploy.
Throws:
Exception - Description of Exception

invoke

public Object invoke(ObjectName name,
                     String method,
                     Object[] args,
                     String[] sig)
              throws Exception
invoke wraps an invoke call to the mbean server in a lot of exception unwrapping.

Parameters:
name - ObjectName of the mbean to be called
method - mbean method to be called
args - Object[] of arguments for the mbean method.
sig - String[] of types for the mbean methods parameters.
Returns:
Object returned by mbean method invocation.
Throws:
Exception - Description of Exception

invoke

public Object invoke(MBeanServerConnection server,
                     ObjectName name,
                     String method,
                     Object[] args,
                     String[] sig)
              throws Exception
Throws:
Exception


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.