Methods Summary |
---|
private java.lang.String | getClusterForInstance(java.lang.String instanceName)
String clusterName = null;
if ( isInstanceClustered(instanceName) )
{
Cluster
cluster = ClusterHelper.getClusterForInstance(getConfigContext(), instanceName);
clusterName = cluster.getName();
}
return clusterName;
|
private java.lang.String[] | getClusterNames(com.sun.enterprise.config.serverbeans.Cluster[] clusters)
String[] domClusters = new String[clusters.length];
for (int i = 0; i < clusters.length; i++)
{
domClusters[i] = clusters[i].getName();
}
return domClusters;
|
public java.lang.String[] | getClusterNames()Get the names of all the clsuters in the domain.
try
{
Cluster[] clusters = ClusterHelper.getClustersInDomain(getConfigContext());
return getClusterNames(clusters);
}
catch (Exception ex)
{
_logger.log(Level.WARNING, ex.getMessage(), ex);
return new String[0];
}
|
private com.sun.enterprise.config.ConfigContext | getConfigContext()
ConfigContext ctx = null;
if (isDAS())
{
if ( AdminService.getAdminService() != null )
{
ctx = AdminService.getAdminService().getAdminContext().getAdminConfigContext();
}
}
else
{
if (ApplicationServer.getServerContext() != null)
{
ctx = ApplicationServer.getServerContext().getConfigContext();
}
}
return ctx;
|
public java.lang.String | getInstanceName()Get the name of the server instance. In case this is the central administartion
server then instance name = "server".
return System.getProperty("com.sun.aas.instanceName");
|
public javax.management.MBeanServerConnection | getMBeanServerConnection(java.lang.String instanceName)Get the MBeanServerConnection for a specific instance.
// If the instance name is the same as the local instance return the
// local MBeanServer
if ( getInstanceName().equals(instanceName))
{
return getPlatformMBeanServer();
}
if ( isDAS() && !multipleServersSupported() )
{
// Developer profile
throw new Exception("Developer profile does not support multiple server instances");
}
else
{
return (MBeanServerConnection) java.security.AccessController.doPrivileged
(new java.security.PrivilegedExceptionAction() {
public java.lang.Object run() throws Exception {
return irMethod.invoke(null, new Object[] {instanceName});
}
});
}
|
private javax.management.MBeanServer | getPlatformMBeanServer()
return java.lang.management.ManagementFactory.getPlatformMBeanServer();
|
private java.lang.String[] | getServerNames(com.sun.enterprise.config.serverbeans.Server[] servers)
String[] ucServers = new String[servers.length];
for (int i = 0; i < servers.length; i++)
{
ucServers[i] = servers[i].getName();
}
return ucServers;
|
public java.lang.String[] | getServersInCluster(java.lang.String clusterName)Get the names of all the member servers in the specified cluster.
try
{
Server[] servers = ServerHelper.getServersInCluster(getConfigContext(),
clusterName);
return getServerNames(servers);
}
catch (Exception ex)
{
_logger.log(Level.WARNING, ex.getMessage(), ex);
return new String[0];
}
|
public java.lang.String[] | getStandaloneServerNames()Get the names of all the non-clustered standalone servers in the domain.
try
{
Server[] servers = ServerHelper.getUnclusteredServers(getConfigContext(), false);
return getServerNames(servers);
}
catch (Exception ex)
{
_logger.log(Level.WARNING, ex.getMessage(), ex);
return new String[0];
}
|
public java.lang.String | getTargetName(java.lang.String instanceName)Get the "target" for the specified instance.
- is the central admininistration server instance then target = "server"
- is a clustered instance then target = [cluster-name]
- is a standalone instance then target = [server-name]
String targetName = instanceName;
if ( isInstanceClustered(instanceName) )
{
// -- Target is the cluster name
targetName = getClusterForInstance(instanceName);
}
return targetName;
|
public java.lang.String | getTargetName()Get the "target" for this instance. If this instance :
- is the central admininistration server instance then target = "server"
- is a clustered instance then target = [cluster-name]
- is a standalone instance then target = [server-name]
This is equivalent to calling getTargetName(getInstanceName()).
String instanceName = getInstanceName();
return getTargetName(instanceName);
|
public boolean | isDAS()Determine if this instance is the central administration server.
AdminService adminSvc = AdminService.getAdminService();
boolean isDAS = false;
if (adminSvc != null)
{
isDAS = adminSvc.isDas();
}
return isDAS;
|
public boolean | isInstanceClustered(java.lang.String instanceName)
boolean isClustered = false;
ConfigContext ctx = getConfigContext();
if ( ctx != null )
{
isClustered = ServerHelper.isServerClustered(ctx, instanceName);
}
return isClustered;
|
public boolean | isInstanceUp(java.lang.String instanceName)Determine the runtime state of an instance.
boolean isRunning = false;
if ( isDAS() )
{
if ( SERVER.equals(instanceName))
{
// -- If DAS is running, so is the "server" instance.
isRunning = true;
}
else
{
String
instanceObjName = "amx:J2EEServer=" + instanceName + ",j2eeType=JVM,*";
ObjectName objName = null;
try
{
objName = new ObjectName(instanceObjName);
}
catch(javax.management.MalformedObjectNameException mex)
{
_logger.log(Level.SEVERE, mex.getMessage(), mex);
return false;
}
java.util.Set<ObjectName> nameSet = getPlatformMBeanServer().queryNames(objName, null);
if ( (!nameSet.isEmpty()) )
{
isRunning = true;
}
}
}
return isRunning;
|
public boolean | multipleServersSupported()Determine if the central administraion server supports multiple servers.
if ( isDAS())
{
MBeanServer mbeanServer = java.lang.management.ManagementFactory.getPlatformMBeanServer();
DomainRoot domainRoot = ProxyFactory.getInstance(mbeanServer).getDomainRoot();
return domainRoot.getSystemInfo().supportsFeature(
SystemInfo.MULTIPLE_SERVERS_FEATURE);
}
else
{
return false;
}
|