Package com.sun.enterprise.config.serverbeans

Examples of com.sun.enterprise.config.serverbeans.Server$CreateDecorator


            String logFileName, Long fromRecord, Boolean next, Boolean forward,
            Integer requestedCount, Date fromDate, Date toDate,
            String logLevel, Boolean onlyLevel, List listOfModules,
            Properties nameValueMap, String anySearch, String instanceName) {

        Server targetServer = domain.getServerNamed(instanceName);

        File instanceLogFile = null;

        if (targetServer.isDas()) {
            return getLogRecordsUsingQuery(
                    logFileName, fromRecord, next, forward,
                    requestedCount, fromDate, toDate,
                    logLevel, onlyLevel, listOfModules,
                    nameValueMap, anySearch);
        } else {
            // for Instance it's going through this loop. This will use ssh utility to get file from instance machine(remote machine) and
            // store under glassfish/domains/domain1/logs/<instance name>/ directory which is used to get LogFile object.
            // Right now user needs to go through this URL to setup and configure ssh http://wikis.sun.com/display/GlassFish/3.1SSHSetup

            String serverNode = targetServer.getNodeRef();
            Node node = domain.getNodes().getNode(serverNode);
            String loggingDir = "";
            String instanceLogFileName = "";
            try {
                // getting lof file details for given target.
View Full Code Here


        decorate();
    }

    protected void decorate() {

        Server server = habitat.getService(Server.class, env.getInstanceName());
        if (server == null) {
            LogRecord lr = new LogRecord(Level.SEVERE,
                    badEnv);
            lr.setLoggerName(getClass().getName());
            EarlyLogHandler.earlyMessages.add(lr);
            return;
        }
        ServiceLocatorUtilities.addOneConstant(habitat, server,
                ServerEnvironment.DEFAULT_INSTANCE_NAME, Server.class);

        server.getConfig().addIndex(habitat, ServerEnvironment.DEFAULT_INSTANCE_NAME);

        Cluster c = server.getCluster();
        if (c != null) {
            ServiceLocatorUtilities.addOneConstant(habitat, c,
                    ServerEnvironment.DEFAULT_INSTANCE_NAME, Cluster.class);
        }
    }
View Full Code Here

    @Override
    public boolean isValid(final Named bean,
        final ConstraintValidatorContext constraintValidatorContext) {
        if (bean == null) return true;

        Server server = null ;
        Cluster mycluster = null;
        String configRef = null;
        String serverName = null;
        if (bean instanceof Server)  {
            server = (Server)bean;
            configRef = server.getConfigRef();
            serverName = server.getName();
        } else if (bean instanceof Cluster){
            mycluster = (Cluster)bean  ;
            configRef = mycluster.getConfigRef();
            serverName = mycluster.getName();
        }


        if (configRef == null) return true; // skip validation @NotNull is already on getConfigRef
       
        // cannot use default-config
        if (configRef.equals(SystemPropertyConstants.TEMPLATE_CONFIG_NAME)) {
            logger.warning(ConfigApiLoggerInfo.configRefDefaultconfig);
           return false;
        }
        // cannot change config-ref of DAS
        if (server != null) {
            if (server.isDas() && !configRef.equals(SystemPropertyConstants.DAS_SERVER_CONFIG)) {
                logger.warning(ConfigApiLoggerInfo.configRefDASconfig);
                return false;
            }
            // cannot use server-config if not DAS
            if (!server.isDas() && configRef.equals(SystemPropertyConstants.DAS_SERVER_CONFIG)) {
                logger.warning(ConfigApiLoggerInfo.configRefServerconfig);
                return false;
            }



            final Servers servers = server.getParent(Servers.class);
            final Domain domain = servers.getParent(Domain.class);
            final Configs configs = domain.getConfigs();

            if (servers.getServer(serverName) != null) { // validate for set, not _register-instance
                // cannot change config ref of a clustered instance
View Full Code Here

                        Configuration.disableFileLogging();
                    } else {

                       // if (dbLoggingResource == null) {
                        Domain domain = habitat.getComponent(Domain.class);
                        Server server = domain.getServerNamed(instanceName);

                        // Check if the server system property is set
                        String logdir = getTXLogDir(server);

                        // if not, check if the cluster system property is set
                        if(logdir == null) {
                            Cluster cluster = server.getCluster();
                            if (cluster != null) {
                                logdir = getTXLogDir(cluster);
                            }
                        }
View Full Code Here

        try{
        if (this.moduleName_.equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER)) {
            if (connectorRuntime.isServer()) {
                Domain domain = Globals.get(Domain.class);
                ServerContext serverContext = Globals.get(ServerContext.class);
                Server server = domain.getServerNamed(serverContext.getInstanceName());
                JmsService jmsService = server.getConfig().getExtensionByType(JmsService.class);
                initializeLazyListener(jmsService);
            }
    //System.setProperty("imq.jmsra.direct.clustered", "true");
                AccessController.doPrivileged
                        (new java.security.PrivilegedExceptionAction() {
View Full Code Here

    private void setAvailabilityProperties() throws ConnectorRuntimeException {
      if(!isClustered()) return;
        try {
          Domain domain = Globals.get(Domain.class);
          ServerContext serverContext = Globals.get(ServerContext.class);
          Server server = domain.getServerNamed(serverContext.getInstanceName());

          JmsService jmsService = server.getConfig().getExtensionByType(JmsService.class);
          if (jmsService.getType().equals(REMOTE)) {
            //If REMOTE, the broker cluster instances already have
            //been configured with the right properties.
            return;
          }

          AvailabilityService as = server.getConfig().getAvailabilityService();
          if (as == null) {
            logFine("Availability Service is null. Not setting AvailabilityProperties.");
            return;
          }

          boolean useMasterBroker = true;
          if(as.getExtensionByType(JmsAvailability.class) != null && ! MASTERBROKER.equalsIgnoreCase(as.getExtensionByType(JmsAvailability.class).getConfigStoreType()))
            useMasterBroker = false;

          //jmsService.getUseMasterBroker() != null ? Boolean.valueOf(jmsService.getUseMasterBroker()) :true;
          boolean isJmsAvailabilityEnabled = this.isJMSAvailabilityOn(as);

          logFine("Setting AvailabilityProperties .. ");
          if (!useMasterBroker || isJmsAvailabilityEnabled) {
            // For conventional cluster of peer brokers and Enhanced Broker Cluster.
            ConnectorDescriptor cd = getDescriptor();
            String clusterName = getMQClusterName();
            ConnectorConfigProperty  envProp1 = new ConnectorConfigProperty (
                        CLUSTERID , clusterName,"Cluster Id",
                        "java.lang.String");
            setProperty(cd, envProp1);

            if(brokerInstanceName == null) {
                brokerInstanceName = getBrokerInstanceName(jmsService);
            }
            ConnectorConfigProperty  envProp2 = new ConnectorConfigProperty (
                        BROKERID , brokerInstanceName,"Broker Id",
                        "java.lang.String");
            setProperty(cd, envProp2);

            //Only if JMS availability is true - Enhanced Broker Cluster only.
            if (isJmsAvailabilityEnabled) {
              //Set HARequired as true - irrespective of whether it is REMOTE or
              //LOCAL
              ConnectorConfigProperty  envProp3 = new ConnectorConfigProperty (
                          HAREQUIRED , "true","HA Required",
                          "java.lang.String");
              setProperty(cd, envProp3);
               /* The broker has a property to control whether
               * it starts in HA mode or not and that's represented on
               * the RA by BrokerEnableHA.
               * On the MQ Client connection side it is HARequired -
               * this does not control the broker, it just is a client
               * side requirement.
               * So for AS EE, if BrokerType is LOCAL or EMBEDDED,
               * and AS HA is enabled for JMS then both these must be
               * set to true. */

              ConnectorConfigProperty  envProp4 = new ConnectorConfigProperty (
                          BROKERENABLEHA , "true",
                          "BrokerEnableHA flag","java.lang.Boolean");
              setProperty(cd, envProp4);

              String nodeHostName = domain.getNodeNamed(server.getNodeRef()).getNodeHost();
              if (nodeHostName != null) {
                ConnectorConfigProperty  envProp5 = new ConnectorConfigProperty (
                            BROKERBINDADDRESS , nodeHostName,
                            "Broker Bind Address","java.lang.String");
                setProperty(cd, envProp5);
View Full Code Here

        ServerEnvironmentImpl serverenv = Globals.get(ServerEnvironmentImpl.class);
        Domain domain = Globals.get(Domain.class);
        String asInstance = serverenv.getInstanceName();
        String domainName = null;
        if (isClustered()) {
            Server server = domain.getServerNamed(asInstance);

            domainName = server.getCluster().getName();
            /*ClusterHelper.getClusterForInstance(
                            ApplicationServer.getServerContext().getConfigContext(),
                            asInstance).getName();*/
        } else {
            domainName = serverenv.getDomainName();//ServerManager.instance().getDomainName();
View Full Code Here

    }

    private boolean isDBEnabled(){
        Domain domain = Globals.get(Domain.class);
        ServerContext serverContext = Globals.get(ServerContext.class);
        Server server = domain.getServerNamed(serverContext.getInstanceName());

        AvailabilityService as = server.getConfig().getAvailabilityService();

        JmsService jmsService = server.getConfig().getExtensionByType(JmsService.class);


        //if (jmsService.getUseMasterBroker() != null && ! Boolean.parseBoolean(jmsService.getUseMasterBroker()))
          //  return true;
  if (as != null){
View Full Code Here

        ServerContext serverctx = Globals.get(ServerContext.class);
        String instanceName = serverctx.getInstanceName();

        Domain domain = Globals.get(Domain.class);
        Server server = domain.getServerNamed(instanceName);

        return server.getCluster() != null? server.getCluster().getName(): null;

                /*ClusterHelper.getClusterForInstance(this.serverContxt.
                       .getConfigContext(),
                        serverContxt.getInstanceName()).getName();*/
    }
View Full Code Here

                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                report.setMessage(msg);
                return;
            }
            // check if its applications are LB disabled.
            Server s = domain.getServerNamed(serverName);

            if (s == null ) {
                String msg = localStrings.getLocalString("ServerNotDefined",
                            "Server {0} cannot be used as target", target);
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.Server$CreateDecorator

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.