Methods Summary |
---|
private com.sun.enterprise.admin.server.core.mbean.config.ManagedAdminServerInstance | createAdminServerInstance()
return new ManagedAdminServerInstance();
|
private java.lang.Object | createGenericConfigMBean(javax.management.ObjectName objectName)
ConfigMBeanNamingInfo mbeanInfo = new ConfigMBeanNamingInfo(objectName);
mbeanInfo.setAdminContext(mAdminContext);
return mbeanInfo.constructConfigMBean();
|
public java.lang.Object | createMBeanInstance()Returns an instance of proper MBean. This is required, when somebody
wants to create the MBean for the first time in MBean Repository.
The necessary parameters for MBean construction are derived from the
configBean passed during consruction of this class.\
Object mbeanInstance = null;
String instanceName = ApplicationServer.getServerContext().getInstanceName();
//8.0 first
if(mConfigBean instanceof MBeanRegistryEntry)
{
ConfigContext configContext;
try
{
if (mAdminContext != null) {
configContext = mAdminContext.getAdminConfigContext();
} else {
InstanceEnvironment instanceEnvironment = new InstanceEnvironment(instanceName);
//String fileUrl = instanceEnvironment.getConfigFilePath();
/*Everything should be set in the backup file*/
String fileUrl = instanceEnvironment.getBackupConfigFilePath();
configContext = ConfigFactory.createConfigContext(fileUrl);
}
return ((MBeanRegistryEntry)mConfigBean).instantiateMBean(mObjectName,null, configContext);
}
catch(Exception e)
{
return null;
}
}
String type = ObjectNameHelper.getType(mObjectName);
//String instanceName = ObjectNameHelper.getServerInstanceName(mObjectName);
Level logLevel = Level.SEVERE;
try
{
if (type.equals(ObjectNames.kController))
{
mbeanInstance = new ServerController(mAdminContext);
}
else if (type.equals(ObjectNames.kGenericConfigurator))
{
mbeanInstance = new GenericConfigurator();
}
else if (type.equals(ObjectNames.kServerInstance))
{
mbeanInstance = createServerInstanceMBean(instanceName);
/* *************** **
if (instanceName.equals(ServerManager.ADMINSERVER_ID))
{
mbeanInstance = createAdminServerInstance();
}
else
{
mbeanInstance = createServerInstanceMBean(instanceName);
}
** *************** */
}
else
{
logLevel = Level.FINE;
mbeanInstance = createGenericConfigMBean(mObjectName);
}
}
catch(Exception e)
{
_logger.log(logLevel, "mbean.config.admin.create_mbean_instance_failed", e );
}
return ( mbeanInstance );
|
private com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance | createServerInstanceMBean(java.lang.String instanceName)
Server server = (Server)mConfigBean;
//patch for ms1
ConfigContext ctx = server.getConfigContext();
Config config = (Config) ConfigBeansFactory.getConfigBeanByXPath(ctx, ServerXPathHelper.XPATH_CONFIG);
HttpService https = config.getHttpService();
HttpListener[] hlArray = https.getHttpListener();
//check not needed since there should always be atleast 1 httplistener
//if you don't find one, use first one.
HttpListener ls = hlArray[0];
//default is the first one that is enabled.
for(int i = 0;i<hlArray.length;i++) {
if(hlArray[i].isEnabled()) {
ls = hlArray[i];
break;
}
}
String port = new PropertyResolver(ctx, instanceName).
resolve(ls.getPort());
int intPort = Integer.parseInt (port);
HostAndPort hp = new HostAndPort("localhost", intPort);
return new ManagedServerInstance(instanceName, hp, false, mAdminContext);
|
public void | setAdminContext(com.sun.enterprise.admin.AdminContext ctx)
mAdminContext = ctx;
|