Package com.sun.enterprise.server

Examples of com.sun.enterprise.server.ServerContext


        }       
    }
   
    public static boolean doHADBTablesExist() {
        boolean result = true;
        ServerContext serverContext = ApplicationServer.getServerContext();
        SchemaUpdater updater =
            serverContext.getPluggableFeatureFactory().getSchemaUpdater();
       
        try {
            //updater.init();
            result = updater.doTablesExist();
        } catch (SQLException ex) {
View Full Code Here


     * Destroy event handler. Invoked after event processing is completed
     */
    private void destroyEventHandler(AdminEvent event) {
        AdminEventResult result = AdminEventResult.getAdminEventResult(event);
        if (AdminEventResult.SUCCESS.equals(result.getResultCode())) {
            ServerContext ctx = AdminService.getAdminService().getContext();

            if (ctx instanceof ServerContextImpl) {
                ConfigContext oldCtx = ctx.getConfigContext();
                ConfigContext newCtx = event.getConfigContext();
               
                ((ServerContextImpl) ctx).setConfigContext(newCtx);
               
                // replace the old config context with the new one from
                // ConfigFactory cache
                try {
                    ConfigFactory.replaceConfigContext(oldCtx, newCtx);
                } catch(Exception e) {
                    //ignore for now
                    logger.log(Level.WARNING, "event.replace_ctx_failed", e);
                }
               
                // persist the config changes locally for instance when the
                // event is not transient and config context was not marked
                // dirty
                if (!AdminService.getAdminService().isDas() &&
                    !event.isTransient() && !isConfigContextDirty) {
                    try {
                        AdminService.getAdminService().getContext().
                            getConfigContext().flush();
                    } catch (Exception e) {
                        logger.log(Level.WARNING, "event.flush_failed");
                    }
                }
                if (event.getConfigChangeList() != null &&
                    event.getConfigChangeList().size() > 0) {
                    // if the current event is transient and contains config
                    // changes, mark the config context dirty.
                    if (event.isTransient()) {
                        isConfigContextDirty = true;
                    } else {
                        // if the event is not transient and tries to update
                        // the already dirty config, the instance should be
                        // marked as restart needed.
                        if (isConfigContextDirty) {
                            logger.log(Level.WARNING,
                                "event.dirty_config_update",
                                event.getEventInfo());
                            result.setResultCode(
                                AdminEventResult.RESTART_NEEDED);
                        }
                    }
                }

            } else {
                logger.log(Level.SEVERE, "event.unknown_serverctx_type",
                           ctx.getClass().getName());
            }

        }
    }
View Full Code Here

            return;
        }

        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                ServerContext ctxt = ApplicationServer.getServerContext();
                if (ctxt != null ) {
                    registry_ = ctxt.getMonitoringRegistry();
                }
                return null;
            }
       });
View Full Code Here

    }

    private String getNodeAgentHostName() {
        String nodeAgentHost = null;
        try {
            ServerContext context = ApplicationServer.getServerContext();
            Server server = context.getConfigBean();
            String domainurl = context.getServerConfigURL();
            AppserverClusterViewFromCacheRepository rep = new AppserverClusterViewFromCacheRepository(domainurl);

                nodeAgentHost = rep.getNodeAgentHostName(server);
                logFine("na host" + nodeAgentHost);
            } catch (Exception e) {
View Full Code Here

    private String getPhysicalDestinationFromConfiguration(String logicalDest)
                                throws ConnectorRuntimeException{
  ElementProperty ep = null;
        try {
            ServerContext sc = ApplicationServer.getServerContext();
            ConfigContext ctx = sc.getConfigContext();
            Resources rbeans =
                           ServerBeansFactory.getDomainBean(ctx).getResources();
            AdminObjectResource res = (AdminObjectResource)
               rbeans.getAdminObjectResourceByJndiName(logicalDest);
      if (res == null) {
View Full Code Here

    private void setValuesFromConfiguration(String cfName, EjbMessageBeanDescriptor
                                     descriptor_) throws ConnectorRuntimeException{
  ElementProperty[] ep = null;
        try {
            ServerContext sc = ApplicationServer.getServerContext();
            ConfigContext ctx = sc.getConfigContext();
            Resources rbeans = ServerBeansFactory.getDomainBean(ctx).getResources();
            ConnectorResource res = (ConnectorResource)
                         rbeans.getConnectorResourceByJndiName(cfName);
      if (res == null) {
          String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
View Full Code Here

        String vsId;
        int port;
        HttpService httpService;
       
        ServerContext sc = getServerContext();
        ConfigContext cc = sc.getConfigContext();
        MonitoringRegistry mReg = sc.getMonitoringRegistry();
        try {
            httpService = ServerBeansFactory.getHttpServiceBean(cc);
        } catch(ConfigException ce) {
            _logger.log(Level.WARNING,
                        "Unable to find HttpServiceBean in config",
                        ce);
            return;
        }

        // keep-alive
        try {
            mReg.registerPWCKeepAliveStats(
                new PWCKeepAliveStatsImpl(sc.getDefaultDomainName()),
                null);
        } catch (MonitoringRegistrationException mre) {
            String msg = _logger.getResourceBundle().getString(
                                            "web.monitoringRegistrationError");
            msg = MessageFormat.format(msg,
                                       new Object[] { "PWCKeepAliveStats" });
            _logger.log(Level.WARNING, msg, mre);
        }
       
        // file-cache
        try {
            mReg.registerPWCFileCacheStats(
                new PWCFileCacheStatsImpl(sc.getDefaultDomainName()),null);
        } catch (MonitoringRegistrationException mre) {
            String msg = _logger.getResourceBundle().getString(
                                            "web.monitoringRegistrationError");
            msg = MessageFormat.format(msg,
                                       new Object[] { "PWCFileCacheStats" });
            _logger.log(Level.WARNING, msg, mre);
        }

        // pwc-thread-pool
        try {
            mReg.registerPWCThreadPoolStats(
                new PWCThreadPoolStatsImpl(sc.getDefaultDomainName()),
                null);
        } catch (MonitoringRegistrationException mre) {
            String msg = _logger.getResourceBundle().getString(
                                            "web.monitoringRegistrationError");
            msg = MessageFormat.format(msg,
                                       new Object[] { "PWCThreadPoolStats" });
            _logger.log(Level.WARNING, msg, mre);
        }

        // connection-queue
        try {
            mReg.registerPWCConnectionQueueStats(
                new PWCConnectionQueueStatsImpl(sc.getDefaultDomainName()),
                null);
        } catch (MonitoringRegistrationException mre) {
            String msg = _logger.getResourceBundle().getString(
                                            "web.monitoringRegistrationError");
            msg = MessageFormat.format(msg,
View Full Code Here

   
    /*
     * Enables monitoring of all virtual servers.
     */
    private void enableVirtualServerMonitoring(VirtualServer vs){       
        ServerContext sc = getServerContext();
        ConfigContext cc = sc.getConfigContext();
        MonitoringRegistry monitoringRegistry = sc.getMonitoringRegistry();
       
        PWCVirtualServerStatsImpl vsStats = new PWCVirtualServerStatsImpl(vs);
        try {
            monitoringRegistry.registerPWCVirtualServerStats(vsStats,
                                                             vs.getID(),
                                                             null);
        } catch (Exception e) {
            _logger.log(Level.WARNING,
                        "Unable to register PWCVirtualServerStats for "
                        + vs.getID(), e);
        }

        PWCRequestStatsImpl pwcRequestStatsImpl =
                new PWCRequestStatsImpl(sc.getDefaultDomainName())
        vs.setPWCRequestStatsImpl(pwcRequestStatsImpl);
       
        try {
            monitoringRegistry.registerPWCRequestStats(pwcRequestStatsImpl,
                        vs.getID(),
View Full Code Here

     * Gets the jsr77 state corresponding to this module
     */
    public Integer getState() throws AFException {
        try {
            MBeanServer mbs = MBeanServerFactory.getMBeanServer();
            ServerContext serverContext = ApplicationServer.getServerContext();
            ObjectName objName = new ObjectName(
                serverContext.getDefaultDomainName() + ":" +
                "j2eeType=" + ManagementObjectManager.J2EE_TYPE_EXT_MODULE + "," +
                "name=" + ((String)this.getAttribute(kName)) + "," +
    "J2EEApplication=" + "null" + "," +
    "moduleType=" + moduleType + "," +
    "category=runtime," +
    "J2EEServer=" + serverContext.getInstanceName());
            Integer intObj = (Integer) mbs.getAttribute(objName, "state");
      return intObj;
        } catch (Exception e) {
            sLogger.throwing(getClass().getName(), "stop", e);
            throw new AFException(e.getMessage());
View Full Code Here

            throw new ConfigException(ce);
        }
    }

    private void setupClusterViewFromRepository() throws ConfigException {
        ServerContext context = ApplicationServer.getServerContext();
        Server server = context.getConfigBean();
        String domainurl = context.getServerConfigURL();
        rep = new AppserverClusterViewFromCacheRepository(domainurl);
        try {
            nodeAgentHost = rep.getNodeAgentHostName(server);
            logFine("na host" + nodeAgentHost);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.sun.enterprise.server.ServerContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.