FileDocCategorySizeDatePackage
AdminService.javaAPI DocGlassfish v2 API43323Tue Jul 03 17:31:10 BST 2007com.sun.enterprise.admin.server.core

AdminService

public class AdminService extends Object
Admin service is a singleton in every instance and acts as gateway to server administration tasks.

Fields Summary
public static final String
TYPE_DASD
Admin service type DASD. Used to identify admin service in a server instance that acts as DAS and also allows normal server operations like deployment and running of user applications.
public static final String
TYPE_DAS
Admin service type DAS. Used to identify admin service in a server instance dedicated to administration.
public static final String
TYPE_SERVER
Admin service type SERVER. Used to identify admin service in a server instance dedicated to running user applications.
public static final boolean
ENABLE_PERFORMANCE_THREAD
public static final Logger
sLogger
The logger from LogDomains
private static final com.sun.enterprise.util.i18n.StringManager
localStrings
private static AdminService
adminService
private static final String
COM_SUN_APPSERV
private static final String
ADMIN_DOMAIN_NAME_PREFIX
prefix for administrative domain name
private static final String
DEF_ADMIN_DOMAIN_NAME
default administrative domain name
private static final String
kTempDirNamePrefix
private static final String
kGUITempDirName
private static final String
kTempDirNameSuffix
private static final String
SS_MBEAN_CLASS
private volatile String
adminServiceType
private volatile com.sun.enterprise.server.ServerContext
context
private volatile com.sun.enterprise.admin.AdminContext
adminContext
private volatile com.sun.appserv.server.ServerLifecycle
adminChannel
private volatile String
mTempDirPath
private volatile String
mGUITempDirPath
public static final String
PRIVATE_MBEAN_DOMAIN_NAME
A field to denote the default name for all the config and runtime mbeans that are generated from the meta-information (descriptor, like admin-mbean-descriptor.xml)
public static final String
DAS_DIAGNOSTIC_MBEAN_CLASS_NAME
private final AutoDeployStarter
autoDeployStarter
private static final String
ADMIN_JAVAROOT
private static final String
PLUGIN_JAVAROOT
private static final String
AMX_DAS_LOADER_CLASSNAME
private static final String
AMX_NON_DAS_LOADER_CLASSNAME
public static final String
AMX_LOADER_DEFAULT_OBJECTNAME
private volatile ObjectName
mAMXLoaderObjectName
Constructors Summary
private AdminService()
private constructor. AdminService instance should be initialized through package method createAdminService().

    

                     
      
    
Methods Summary
public booleancanRunUserApps()
Is admin service running in a server instance that is primarily intended for running user applications. Admin service runs in all server instances, but sometimes there is one server instance dedicated to administration of other instances in the domain and user applications can not not be run on that instance.

return
true if user applications can be run on the server instance where this admin service is running, false otherwise.

        if (TYPE_DAS.equals(adminServiceType)) {
            return false;
        } else {
            return true;
        }
    
static com.sun.enterprise.admin.server.core.AdminServicecreateAdminService(com.sun.enterprise.server.ServerContext sc)
Create admin service. Admin Service is initialized by an internal lifecycle module (AdminServiceLifeCycle).

        System.setProperty("com.sun.aas.admin.logger.name",
                AdminConstants.kLoggerName);
        String type = TYPE_SERVER;
        if (ServerManager.ADMINSERVER_ID.equals(sc.getInstanceName())) {
            type = TYPE_DAS;
        }
        ConfigContext cc = sc.getConfigContext();
        try {
            com.sun.enterprise.config.serverbeans.AdminService as =
                    ServerBeansFactory.getConfigBean(cc).getAdminService();
            if (as != null) {
                type = as.getType();
            }
        } catch (ConfigException ce) {
            ce.printStackTrace();
            sLogger.log(Level.WARNING, "core.admin_service_default_config",
                    type);
        }
        AdminService as = instantiateAdminService(type);
        as.setContext(sc);
        AdminContext ac = sc.getPluggableFeatureFactory().getAdminContext();
        if (ac instanceof AdminContextImpl) {
            ((AdminContextImpl)ac).setServerContext((ServerContextImpl)sc);
        }
        as.setAdminContext(ac);
        setAdminService(as);
        return as;
    
private voidcreateDASDiagnosticMBean()

        try {
                final MBeanServer mbs = getMBeanServer();
                ObjectName on = new ObjectName(
                                PRIVATE_MBEAN_DOMAIN_NAME + ":" +
                "type=DomainDiagnostics,name=" + getInstanceName() + ",category=monitor");
                        Class cl = Class.forName(DAS_DIAGNOSTIC_MBEAN_CLASS_NAME);
                mbs.registerMBean(cl.newInstance(), on);
        } catch (Throwable t) {
            t.printStackTrace();
            sLogger.log(Level.INFO, "core.das_diag__mbean_not_registered", t.getMessage());
        }
    
private voidcreateTempDir()

        try {
            String domainName       = ServerManager.instance().getDomainName();
	        String localTmpDir      = System.getProperty("java.io.tmpdir");
            String asTempDirName    = kTempDirNamePrefix + domainName + 
                    context.getInstanceName() + kTempDirNameSuffix;
            /* for admin server, e.g. </tmp>/s1astempdomain1admin-server */
            File tempFolder     = new File(localTmpDir, asTempDirName);
            mTempDirPath        = tempFolder.getCanonicalPath();

            /* for GUI, e.g. </tmp>/s1astempdomain1admin-server/gui*/
            File guiTempFolder  = new File(mTempDirPath, kGUITempDirName);
            mGUITempDirPath     = guiTempFolder.getCanonicalPath();
            if (tempFolder.exists()) {
                /*
                    If it exists, the delete method during earlier admin-server
                    lifecycle was not able to delete the directory and
                    that should be OK. The intent here is to create a 
                    directory if there does not exist one.
                */
                sLogger.log(Level.FINEST, "core.tmp_folder_exists", 
                    mTempDirPath);
                return;
            }
            /* try to create admin-server's temporary directory */
            boolean couldCreate = tempFolder.mkdirs();
            if (! couldCreate) {
                sLogger.log(Level.WARNING, "core.tmp_folder_creation_failed", 
                        mTempDirPath);
            }
            else {
                sLogger.log(Level.FINEST, "core.tmp_folder_created_ok", 
                    mTempDirPath);
            }
            /* try to create temporary directory for GUI*/
            couldCreate = guiTempFolder.mkdirs();
            if (! couldCreate) {
                sLogger.log(Level.WARNING, "core.gui_tmp_folder_creation_failed", 
                        mGUITempDirPath);
            }
            else {
                sLogger.log(Level.FINEST, "core.gui_tmp_folder_created_ok", 
                    mGUITempDirPath);
            }
        }
        catch(Throwable t) {
            sLogger.log(Level.WARNING, "core.tmp_folder_creation_failed", t);
        }
    
private voidcreateTimeStampFilesForInstances()
Creates the time stamp files (if do not exist) for the instances that the admin server manages.

        String[] instanceIds = ServerManager.instance().getInstanceNames(true);
        for (int i = 0 ; i < instanceIds.length ; i ++) {
            try {
                String instanceId = instanceIds[i];
                InstanceEnvironment ie = new InstanceEnvironment(instanceId);
                ie.createTimeStampFiles();
		        sLogger.log(Level.FINE, "core.ts_files_ok", instanceId);
            }
            catch (Exception e) {
                //Log the exception for this instance, squelching is OK?
                sLogger.log(Level.WARNING, "core.ts_files_failed", e);
            }
        }
        
    
private voiddeleteTempDir()

        try {
            FileUtils.whack(new File(mTempDirPath));
            sLogger.log(Level.FINEST, "core.tmp_folder_deleted_ok", 
                mTempDirPath);
        }
        catch(Throwable t) {
            sLogger.log(Level.WARNING, "core.tmp_folder_deletion_failed", 
                    mTempDirPath);
        }
    
voiddestroy()
Destroy admin service. This is called just before JVM is destroyed.

    
public com.sun.enterprise.admin.AdminContextgetAdminContext()
Get admin context.

        return adminContext;
    
public static com.sun.enterprise.admin.server.core.AdminServicegetAdminService()
Get admin service object. Admin service is started when server starts up.

        return adminService;
    
public java.lang.StringgetAdministrativeDomainName()
Returns the administrative domain name for this server. If administrative domain name property is not defined, DEF_ADMIN_DOMAIN_NAME is returned.

return
administrative domain name


        String serverName = adminContext.getServerName();
        ConfigContext ctx = adminContext.getAdminConfigContext();
        String aDomainName = 
            ServerHelper.getAdministrativeDomainName(ctx, serverName);

        // return default administrative domain name if administrative domain
        // name property is not defined
        if ( (aDomainName == null) || ("".equals(aDomainName)) ) {
            return DEF_ADMIN_DOMAIN_NAME;
        } else {
            return ADMIN_DOMAIN_NAME_PREFIX + aDomainName;
        }
    
public com.sun.enterprise.server.ServerContextgetContext()
Get server context.

        return ((adminService == null) ? null : adminService.context);
    
public java.lang.StringgetGUITempDirPath()
Gets the name of the temporary folder where the admin-GUI would be creating some temporary data. Note that this method is not a pure accessor in the sense that it will create the folder on disk if it does not exist.

return
String representing the absolute path of temporary folder for GUI, which may be null if the file creation fails.

        if (mGUITempDirPath == null) {
        /* Give it one more try, if on the startup the
           user does not have enough space and/or the temp
           file was not created. Note that the first-time failure will
           be detected in the log at startup.
           Also note that this additional safety does not come without
           the overhead of the null check for every call to this function.
       */
            createTempDir();
        }
        else {
            final File gd = new File(mGUITempDirPath);
            if (!gd.exists()) {
                final boolean s = gd.mkdirs();
                if (!s) {
                   sLogger.log(Level.WARNING, "core.gui_tmp_folder_creation_failed", mGUITempDirPath);
                }
            }
        }
        
        return ( mGUITempDirPath );
    
public java.lang.StringgetInstanceName()
Get name of server instance.

        return ((context == null) ? null : context.getInstanceName());
    
private javax.management.ObjectNamegetLogManagerMBeanName()

        Properties props = new Properties();
        props.put("server", adminContext.getServerName());
        props.put("category", "runtime");
        props.put("name", "logmanager");
        ObjectName on = new ObjectName(adminContext.getDomainName(), props);
        return on;
    
private static javax.management.MBeanServergetMBeanServer()

        return FeatureAvailability.getInstance().getMBeanServer();
    
public com.sun.enterprise.admin.monitor.GenericMonitorMBeangetRootMonitorMBean()
Get root monitoring MBean. Monitoring MBeans within a server instance are organized in a tree. This object represents the root of the tree.

        return GenericMonitorMBean.getRoot();
    
public java.lang.StringgetTempDirPath()
Gets the name of the temporary folder where the admin-server would be creating some temporary data. Note that this method is not a pure accessor in the sense that it will create the folder on disk if it does not exist.

return
String representing the absolute path of temporary folder, which may be null if the file creation fails.

        if (mTempDirPath == null) {
        /* Give it one more try, if on the startup the
           user does not have enough space and/or the temp
           file was not created. Note that the first-time failure will
           be detected in the log at startup.
           Also note that this additional safety does not come without
           the overhead of the null check for every call to this function.
       */
            createTempDir();
        }
        
        return ( mTempDirPath );
    
public java.lang.StringgetType()
Get admin service type. Admin service type is defined in admin service configuration.

return
one of TYPE_DAS, TYPE_DASD, TYPE_SERVER

        return adminServiceType;
    
voidinit()
Initialize admin service. This is called just after creating the instance and before any public methods are called on admin service. Initializes the admin server's MBeanServer. Currently initializes the MBeanServer with default implementation in com.sun.enterprise.admin.server.core.jmx.MBeanServerImpl. Should there be multiple implementations, this method needs to be modified.

throws
LifeCycleException in case the initialzation fails.

        if (isDas()) {
            // remove restart required state file when starting up DAS
            RRStateFactory.removeStateFile();
        }
        adminChannel = new AdminChannelLifecycle();
        adminChannel.onInitialization(context);
        
        // Publish PID for this VM in the config directory
        // This publishing has to happen after the AdminService init
        publishPID();        

        final DynamicInterceptor dyn = (DynamicInterceptor)getMBeanServer();
        final MBeanServer delegateMBeanServer = dyn.getDelegateMBeanServer();
        adminContext.setMBeanServer( dyn );
        
        final SunoneInterceptor sunone =
            SunoneInterceptor.createInstance(adminContext, dyn, delegateMBeanServer);
        dyn.addHook( COM_SUN_APPSERV, sunone );
        FeatureAvailability.getInstance().registerFeature(
            FeatureAvailability.SUN_ONE_INTERCEPTOR_FEATURE, "true");
        AMXLoggingHook.enableLoggingHook();
        sunone.registerConfigMBeans();
            
        sLogger.log(Level.INFO, "core.sunone_interceptor_enabled");
        initCallFlow();

        //initialize JKS properties.
        setupJKS();
    
private voidinitCallFlow()

        try {
            final Class cl = Class.forName(
                    "com.sun.enterprise.admin.monitor.callflow.AgentImpl");
            final Method method = cl.getMethod("getInstance", null);
            final Agent agent = (Agent) method.invoke(null, null);
            Switch.getSwitch().setCallFlowAgent(agent);
        } catch (Throwable t) {
            sLogger.log(Level.SEVERE, "core.callflow_agent_init_failed", t);
            Switch.getSwitch().setCallFlowAgent(new AgentAdapter());
        }
    
private voidinitLogManagerReconfigSupport()

        registerLogManagerMBean();
        registerLogManagerEventListener();
        registerDynamicReconfigEventListener();
    
private voidinitializeAMXMBeans(boolean isDAS)
Initializes AMX MBeans Uses Class.forName() due to build-order issues.

        
                                
          
        try {
            // can't 'import' it because it's in the admin module, which
            // compiles after the module this file is in.
            final String loaderClassname    =
                isDAS ? AMX_DAS_LOADER_CLASSNAME : AMX_NON_DAS_LOADER_CLASSNAME;
                
            final Class    loaderClass = Class.forName( loaderClassname );
            final Object   loader      = loaderClass.newInstance();
            ObjectName     tempObjectName  = new ObjectName( AMX_LOADER_DEFAULT_OBJECTNAME );
            
            mAMXLoaderObjectName  =
                getMBeanServer().registerMBean( loader, tempObjectName ).getObjectName();
            
            sLogger.log(Level.INFO, "mbean.init_amx_success");
        }
        catch(Exception e) {
            // this is really a fatal error; not even the AMX loader works
            sLogger.log(Level.SEVERE, "mbean.init_amx_failed", e);
            throw new RuntimeException( e );
        }
    
private voidinitializeDottedNames()
MBeanRegistry is used to generate all dotted names available in the system. This is achived by iterating through domain.xml and generating object name and dotted name for every element (some special cases) Dotted name is generated from the descriptor entry Once these are generated, an mbean is notified about these dotted names. In short, this mbean will keep track of the dotted names and is used by cli for get/set commands

        try {
            MBeanRegistry mr = MBeanRegistryFactory.getAdminMBeanRegistry();   
            mr.generateAndRegisterAllDottedNames(context.getConfigContext(), 
                           context.getDefaultDomainName());
        } catch (Throwable t) {
             sLogger.log(Level.WARNING, "admin.dotted_names_init_exception", t);
        }
    
private voidinitializeMBeanEventListeners()

        try {
            Class c = null; //Class for listener of MBeanElementChange events
            if (this.isDas()) {
                c  = Class.forName("com.sun.enterprise.admin.mbeans.custom.InProcessMBeanElementChangeEventListenerImpl");
            }
            else {
                c = Class.forName("com.sun.enterprise.ee.admin.mbeans.RemoteMBeanElementChangeEventListenerImpl");
            }
            final Object o = c.newInstance();
            AdminEventListenerRegistry.addEventListener(MBeanElementChangeEvent.EVENT_TYPE, (MBeanElementChangeEventListener)o);            
        } catch (final Exception e) {
            e.printStackTrace(); //ok to squelch
        }
    
private voidinitializePerInstanceSystemService()
Registers the file transfer service (aka SystemServicesMBean) that will be registered in all the instances. Note that this MBean will have slightly different ObjectName depending upon where it is registered.

see
ObjectNames.getPerInstanceSystemServicesObjectName

The principal use of this MBean is in

  • download of stubs in case of DAS
  • synchronization in case of non DAS instances
  • .

        ObjectName on   = null;
        try {
            final MBeanServer mbs = getMBeanServer();
            on = ObjectNames.getPerInstanceSystemServicesObjectName(this.getInstanceName());
            final Object impl = Class.forName(SS_MBEAN_CLASS).newInstance();
            mbs.registerMBean(impl, on);
            sLogger.finer("Admin Message: System Services MBean Registered with on: " + on.toString());
        }
        catch (final Exception e) {
            sLogger.log(Level.WARNING, "core.system.service.mbean.not.registered", on.toString());
        }
    
private voidinitiateCustomMBeanLoading()

        try {
            final MBeanServer mbs = getMBeanServer();
            final ConfigContext cc = context.getConfigContext();
            new CustomMBeanRegistrationHelper(mbs, cc).registerMBeans();
        } catch (final Exception e) {
            sLogger.log(Level.WARNING, "core.custom.mbean.registration.failure");
        }
        initializeMBeanEventListeners();
    
private static com.sun.enterprise.admin.server.core.AdminServiceinstantiateAdminService(java.lang.String type)
Instantiate admin service. This method verifies that specified type is a known type and then creates an admin service object initialized for the specified type.

        AdminService as = null;
        if (TYPE_DASD.equals(type) || TYPE_DAS.equals(type)
                || TYPE_SERVER.equals(type)) {
             as = new AdminService();
             as.setType(type);
        } else {
            throw new RuntimeException(localStrings.getString(
                    "admin.server.core.unknown_admin_service_type", type));
        }
        return as;
    
public booleanisAdminInstance()
Is this admin service running within admin server instance. Admin service runs in all server instances.

return
true if the service is running in an admin server instance, false otherwise.
deprecated
Use the method isDas() instead.

        if (ServerManager.ADMINSERVER_ID.equals(context.getInstanceName())) {
            return true;
        } else {
            return false;
        }
    
private booleanisDAS()

      return ServerHelper.isDAS( 
       AdminService.getAdminService().getAdminContext().getAdminConfigContext(), 
       context.getInstanceName());
    
public booleanisDas()
Is admin service configured for administration of domain. A domain has several server instances and typically one of them is capable of administering the other server instances in the domain.

return
true if the admin service is running in an instance that can administer other instances in the domain, false otherwise.

        if (TYPE_DASD.equals(adminServiceType)
                || TYPE_DAS.equals(adminServiceType)) {
            return true;
        } else {
            return false;
        }
    
private voidnotifyAMXThatAdminServiceIsReady()
Make a [synchronous] call to AMX. Semantics are that this should be a quick call, not a long-running one.

        try {
            getMBeanServer().invoke( mAMXLoaderObjectName, "adminServiceReady", null, null );
        }
        catch( Exception e ) {
            throw new RuntimeException( e );
        }
    
private voidnotifyNodeagents()

        try { 
            if (isDAS()) {
                Class naNotifierClass = Class.forName(
                    "com.sun.enterprise.ee.nodeagent.NodeAgentNotifier");
                Class[] params = new Class[1];
                params[0] = ServerContext.class;
                Constructor c = naNotifierClass.getConstructor(params);
                Object naNotifier = c.newInstance(context);
                Thread notifyNodeAgents = new Thread((Runnable)naNotifier);
                notifyNodeAgents.setDaemon(true);
                notifyNodeAgents.start();
            }
        } catch (ConfigException ex) {
            ex.printStackTrace();
            sLogger.log(Level.WARNING, "core.could_not_determine_whether_instance_is_das");
        } catch (Exception ex) {
            ex.printStackTrace();
            sLogger.log(Level.WARNING, 
                "core.notification_for_nodeagents_could_not_be_invoked");
        }
    
private voidpublishPID()

        JvmInfoUtil jvminfo = new JvmInfoUtil();
	System.out.println(System.getProperty("com.sun.aas.instanceRoot") +
                       "/config/" + SystemPropertyConstants.PID_FILE);
        jvminfo.logPID(System.getProperty("com.sun.aas.instanceRoot") + 
                       File.separator + "config" + File.separator + 
		       SystemPropertyConstants.PID_FILE);
    
voidready()
Admin service is ready. All other services have started up successfully.

        if (adminChannel != null) {
            adminChannel.onReady(context);
        }
        initiateCustomMBeanLoading();
        registerJVMMonitoringMBeans();
        
        // would be cleaner to issue JMX Notifications for a variety
        // of events, but that would mean adding an MBean for AdminService.
        notifyAMXThatAdminServiceIsReady();
        
        // notify all node agents in this domain to know THIS DAS. This is 
        // useful when DAS has moved. Also, only the running Node Agents will
        // be notified.
        notifyNodeagents();
        
        if (isDas()) {
           // autoDeployStarter *must* run in a separate thread, or the
           // this call won't return because it will wait for the server
           // to start using the current thread, which must return in order
           // for the server to be considered to have started.
           autoDeployStarter.submit(RunnableBase.HowToRun.RUN_IN_SEPARATE_THREAD);
        }
        
        NoopClusterEventListener noop = new NoopClusterEventListener();
        if (!isDas()) {
            AdminEventListenerRegistry.addEventListener(ClusterEvent.eventType, noop);
        }
    
private voidregisterDynamicReconfigEventListener()

         AdminEventListenerRegistry.addEventListener(
                DynamicReconfigEvent.eventType, new 
                com.sun.enterprise.admin.server.core.channel.DynamicReconfigEventListenerImpl());
    
private voidregisterJVMMonitoringMBeans()

        try {
            //  Use a dummy ObjectName; the MBeans modify the supplied one
            final ObjectName dummy = new ObjectName("dummy:name=dummy");
            
            if (this.isDas()) {
                final Object jvmInfoCollector =
                    Class.forName("com.sun.enterprise.admin.mbeans.jvm.JVMInformationCollector").newInstance();
                
                // com.sun.appserv:type=JVMInformationCollector,category=monitor,server=server
                final ObjectName actualObjectName =
                    getMBeanServer().registerMBean( jvmInfoCollector, dummy).getObjectName();
            }
            
            // com.sun.appserv:type=JVMInformation,category=monitor,server=server
            final Object jvmInfo = Class.forName("com.sun.enterprise.admin.mbeans.jvm.JVMInformation").newInstance();
            final ObjectName actualObjectName = getMBeanServer().registerMBean( jvmInfo, dummy ).getObjectName();
        }
        catch ( final Exception e) {
            sLogger.log(Level.WARNING, "core.jvm.mbeans.not.registered");
        }
    
private voidregisterLogManagerEventListener()

         AdminEventListenerRegistry.addLogLevelChangeEventListener(
                new com.sun.enterprise.server.logging.LogLevelChangeEventListenerImpl());
    
private voidregisterLogManagerMBean()

        final MBeanServer mbs = FeatureAvailability.getInstance().getMBeanServer();
        try {
            Object mbean =
                    com.sun.enterprise.server.logging.LogMBean.getInstance();
            mbs.registerMBean(mbean, getLogManagerMBeanName());
        } catch (Throwable t) {
            sLogger.log(Level.WARNING, "core.logmgr_mbean_not_registered");
            sLogger.log(Level.FINE, "core.logmgr_mbean_register_error", t);
        }
    
private voidregisterTransactionsRecoveryEventListener()

        try
        {
             AdminEventListenerRegistry.addEventListener(
                TransactionsRecoveryEvent.eventType,
                (AdminEventListener)(new com.sun.enterprise.transaction.TransactionsRecoveryEventListenerImpl()));
        }
        catch (Throwable t)
        {
             sLogger.log(Level.WARNING, "admin.transactions_recovery_listener_registration_exception", t);
        }

    
private voidregisterTransactionsRecoveryEventMBean()

        try {
            MBeanRegistryFactory.getAdminMBeanRegistry().instantiateMBean(
                    "transactions-recovery", new String[]{adminContext.getDomainName()}, null, null, true );
        } catch (Throwable t) {
            sLogger.log(Level.FINE, "core.transactions_recovery_mbean_register_error", t);
        }
    
protected voidsetAdminContext(com.sun.enterprise.admin.AdminContext ctx)
Set admin context.

        adminContext = ctx;
        adminContext.setMBeanServer( getMBeanServer() );
    
private voidsetAdminInstanceProperties()
Set system properties for admin server instance. Some of the admin code relies on the property com.sun.aas.javaRoot. This method will initialize the property using the value set by JVM plugin. If the property is already set, it will not be changed.

        try {
            String adminJavaRoot = System.getProperty(ADMIN_JAVAROOT);
            String pluginJavaRoot = System.getProperty(PLUGIN_JAVAROOT);
            if (adminJavaRoot == null) {
                if (pluginJavaRoot != null) {
                    System.setProperty(ADMIN_JAVAROOT, pluginJavaRoot);
                } else {
                    sLogger.log(Level.WARNING, "core.no_java_home");
                }
            }
        } catch (Throwable t) {
            sLogger.log(Level.WARNING, "core.set_admin_property_failed");
            sLogger.log(Level.FINE, "general.unexpected_exception", t);
        }
    
private static voidsetAdminService(com.sun.enterprise.admin.server.core.AdminService srv)
Set AdminService. This method should be called by createInstance() method after instantiating the service. This enables other objects to use static method getAdminService to get access to admin service.

        adminService = srv;
    
voidsetContext(com.sun.enterprise.server.ServerContext ctx)
Set context to specified value. Typically, lifecycle manager will call this method during initialization to set appropriate context.

        context = ctx;
    
private voidsetType(java.lang.String type)
Set type of admin service.

        adminServiceType = type;
    
private voidsetupJKS()

        String configDir = System.getProperty("com.sun.aas.instanceRoot") + 
            File.separator + "config";
        java.io.File nssFile = new File(configDir, "key3.db");
        if (!nssFile.exists()) {
            if (System.getProperty("javax.net.ssl.keyStore") == null) {
                System.setProperty("javax.net.ssl.keyStore", configDir + 
                    File.separator + "keystore.jks");
                System.setProperty("javax.net.ssl.trustStore", configDir +
                    File.separator + "cacerts.jks");
            }
        }
    
voidstart()
Start admin service. This is called prior to any public method call on admin service. This should be used to prepare admin service to receive public method calls.

        com.sun.enterprise.ManagementObjectManager mgmtObjManager = com.sun.enterprise.Switch.getSwitch().getManagementObjectManager();
        if (isDas()) {
            startAdminInstance();            
            mgmtObjManager.registerJ2EEDomain();
        }
        
        initializeAMXMBeans( isDas() );
            
        // Register JVM and J2EEServer managed objects
        mgmtObjManager.registerJVM();
        mgmtObjManager.registerJ2EEServer();   
            
        if (isDas()) {
	    // das j2ee server should have been registered prior to this
	    // so
	    // mgmtObjManager.registerJ2EEServer() should run before this
            mgmtObjManager.registerDasJ2EEServers();
            mgmtObjManager.registerAllJ2EEClusters();
	}

        if (canRunUserApps()) {
            startNormalInstance();            
        }


        initializePerInstanceSystemService();
        //This code initializes dotted names by enumerating
        // all objectnames using domain.xml
        initializeDottedNames();
        registerTransactionsRecoveryEventMBean();
        mgmtObjManager.registerTransactionService();
        
        // initialize the Web Service Container services
        WsUtil.start();        
        // register DASDiagnosticMBean
        createDASDiagnosticMBean();

    
private voidstartAdminInstance()
Helper method to start admin server instance

        setAdminInstanceProperties();
        // Test code here
        // new com.sun.enterprise.admin.event.EventTester();
        // Uncomment following line to test monitoring
        // new com.sun.enterprise.admin.monitor.MonitoringTester();
        createTempDir();
    
private voidstartNormalInstance()
Helper method to start normal (non-admin) instances

        initLogManagerReconfigSupport();
        registerTransactionsRecoveryEventListener();
        // Test code here
        // new com.sun.enterprise.admin.event.EventTester("str");
    
voidstop()
Stop admin service. This is called when shutdown process starts.

        
        if (adminChannel != null) {
            adminChannel.onShutdown();
        }
        com.sun.enterprise.ManagementObjectManager mgmtObjManager = com.sun.enterprise.Switch.getSwitch().getManagementObjectManager();
        
        //FIXE ME - Prakash
        // Unregister J2EEDomain, j2eeserver and jvm managed objects.
        
        if (isDas()) {
            //stop checking for manual changes
            if(ENABLE_PERFORMANCE_THREAD) ManualChangeTracker.stop();
            stopAdminInstance();
        }
        if (canRunUserApps()) {
            //autodeploy service stoped
            autoDeployStarter.waitDone();
            autoDeployStarter.stopAutoDeployService();            
            stopNormalInstance();
        }
        // as we are killing the VM, there is no real need of shutting down MBS.
    
private voidstopAdminInstance()
Helper method to stop admin server instance.

        deleteTempDir();
    
private voidstopNormalInstance()
Helper method to stop normal (non-admin) instances