Package org.glassfish.api.admin

Examples of org.glassfish.api.admin.ParameterMap


                        }
                    }
                }
                if (destExists) {
                    ActionReport deleteReport = report.addSubActionsReport();
                    ParameterMap parameters = new ParameterMap();
                    parameters.set("DEFAULT", destName);
                    parameters.set("destType", destType);
                    parameters.set("target", target);
                    commandRunner.getCommandInvocation("delete-jmsdest", deleteReport, subject).parameters(parameters).execute();
                    if (ActionReport.ExitCode.FAILURE.equals(deleteReport.getActionExitCode())) {
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        return;
                    }
View Full Code Here


          boolean createdPool = false;
           // If pool is already existing, do not try to create it again
          if (cpool == null || ! filterForTarget (jndiName)) {
                // Add connector-connection-pool.
              ParameterMap parameters = populateConnectionPoolParameters();
            commandRunner.getCommandInvocation("create-connector-connection-pool", subReport).parameters(parameters).execute();
              createdPool= true;
              if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())){
                    report.setMessage(localStrings.getLocalString("create.jms.resource.cannotCreateConnectionPool",
                            "Unable to create connection pool."));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
              }
          }
              ParameterMap params = populateConnectionResourceParameters();
            commandRunner.getCommandInvocation("create-connector-resource", subReport).parameters(params).execute();

              if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())){
                    report.setMessage(localStrings.getLocalString("create.jms.resource.cannotCreateConnectorResource",
                            "Unable to create connection resource."));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);

                //rollback the connection pool ONLY if we created it...
                  if (createdPool)
                    commandRunner.getCommandInvocation("delete-connector-connection-pool", subReport).parameters(populateConnectionPoolParameters()).execute();


                    return;
              }
      } else if (resourceType.equals(TOPIC) ||
                    resourceType.equals(QUEUE))
            {
                ParameterMap aoAttrList = new ParameterMap();
                try{
                 //validate the provided properties and modify it if required.
                    Properties properties =  validateDestinationResourceProps(props, jndiName);
                    //aoAttrList.put("property", properties);
                    String propString = "";
                    for (java.util.Map.Entry<Object, Object>prop : properties.entrySet()) {
                            propString += prop.getKey() + "=" + prop.getValue() + ":";
                    }
                    propString = propString.substring(0, propString.length());
                    aoAttrList.set("property", propString);
                }catch (Exception e)
                {
                    if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())){
                    report.setMessage(localStrings.getLocalString("create.jms.resource.cannotCreateConnectorResource",
                            "Unable to create connector resource."));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
                 }
                }
                // create admin object
                aoAttrList.set(DEFAULT_OPERAND,  jndiName);
                aoAttrList.set("restype",  resourceType);
                aoAttrList.set("raname",  DEFAULT_JMS_ADAPTER);
                aoAttrList.set("target", target);
                if(enabled!=null)
                    aoAttrList.set("enabled", Boolean.toString(enabled));

              commandRunner.getCommandInvocation("create-admin-object", subReport).parameters(aoAttrList).execute();

                if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())){
                    report.setMessage(localStrings.getLocalString("create.jms.resource.cannotCreateAdminObject",
View Full Code Here

            String poolResizeQuantity = null;
            String idleTimeoutInSecs = null;
            String maxWaitTimeInMillis = null;
          String failAllConnections = null;
          String transactionSupport = null;
            ParameterMap parameters = new ParameterMap();

            if(props != null){
            Enumeration keys =  props.keys();
            Properties tmpProps = new Properties();

            while(keys.hasMoreElements())
            {
                String propKey = (String) keys.nextElement();

                if ("steady-pool-size".equals(propKey))
                    steadyPoolSize = props.getProperty(propKey);
                else if ("max-pool-size".equals(propKey))
                    maxPoolSize = props.getProperty(propKey);
                else if ("pool-resize-quantity".equals(propKey))
                    poolResizeQuantity = props.getProperty(propKey);
                else if ("idle-timeout-in-seconds".equals(propKey))
                    idleTimeoutInSecs = props.getProperty(propKey);
                else if ("max-wait-time-in-millis".equals(propKey))
                    maxWaitTimeInMillis = props.getProperty(propKey);
            else if ("transaction-support".equals(propKey))
                transactionSupport = props.getProperty(propKey);
            else if("fail-all-connections".equals(propKey))
                failAllConnections = props.getProperty(propKey);
                else{
                    if ("AddressList".equals(propKey)){
                        String addressListProp = props.getProperty(propKey);
                        props.setProperty(propKey, "\""+ addressListProp + "\"");
                    }

                    else if ("Password".equals(propKey)){
                        String password = props.getProperty(propKey);
                        if (isPasswordAlias(password))
                            //If the string is a password alias, it needs to be escapted with another pair of quotes...
                            props.setProperty(propKey, "\"" + password + "\"");
                    }

                    tmpProps.setProperty(propKey, props.getProperty(propKey));
                }
            }
               if (tmpProps.size() >0)
               {
               String propString = "";
                for (java.util.Map.Entry<Object, Object>prop : tmpProps.entrySet()) {
                        propString += prop.getKey() + "=" + prop.getValue() + ":";
                }
                propString = propString.substring(0, propString.length());

                parameters.set("property", propString);

               }
         }
        //parameters.set("restype", resourceType);
    parameters.set(DEFAULT_OPERAND, jndiName);
        parameters.set("poolname", jndiName);

        if(description != null)
            parameters.set("description", description);

        // Get the default res adapter name from Connector-runtime
        String raName = DEFAULT_JMS_ADAPTER;
        parameters.set("raname", raName);

        parameters.set("connectiondefinition", resourceType);
        parameters.set("maxpoolsize"(maxPoolSize == null) ? "250" : maxPoolSize);
        parameters.set("steadypoolsize", (steadyPoolSize == null) ? "1" : steadyPoolSize);
        if (poolResizeQuantity != null) {
             parameters.set("poolresize", poolResizeQuantity);
        }
         if (idleTimeoutInSecs != null) {
             parameters.set("idletimeout", idleTimeoutInSecs);
        }

        if (maxWaitTimeInMillis != null) {
             parameters.set("maxwait", maxWaitTimeInMillis);
        }

        if (failAllConnections != null) {
            parameters.set("failconnection",failAllConnections);
        }
        if (transactionSupport != null) {
            parameters.set("transactionsupport", transactionSupport);
        }

        return parameters;
    }
View Full Code Here

        return false;
    }

    private ParameterMap populateConnectionResourceParameters()
    {
        ParameterMap parameters = new ParameterMap();
        parameters.set("jndi_name", jndiName);
        parameters.set(DEFAULT_OPERAND, jndiName);
        parameters.set("enabled", Boolean.toString(enabled));
        parameters.set("poolname", jndiName);
        parameters.set("target", target);
        if(description != null)
            parameters.set("description", description);

        return parameters;
    }
View Full Code Here

        if(host == null)
             host = defaultJmsHost.getHost();
        if(port == null)
            port = defaultJmsHost.getPort();

        ParameterMap aoAttrList = new ParameterMap();

        Properties properties = new Properties();
        properties.put("imqDefaultUsername",userName);
         if (isPasswordAlias(password)){
                       //If the string is a password alias, it needs to be escapted with another pair of quotes...
                       properties.put("imqDefaultPassword", "\"" + password + "\"");
         }else
             properties.put("imqDefaultPassword",password);

       //need to escape the addresslist property so that they get passed on correctly to the create-connector-connection-pool command
        properties.put("AddressList", "\"mq://"+host + ":"+ port +"\"");

        String propString = "";
        for (java.util.Map.Entry<Object, Object>prop : properties.entrySet()) {
                propString += prop.getKey() + "=" + prop.getValue() + ":";
        }
        propString = propString.substring(0, propString.length());
        aoAttrList.set("property", propString);

        aoAttrList.set("restype""javax.jms.QueueConnectionFactory");
        aoAttrList.set("DEFAULT",  tmpJMSResource);
        //aoAttrList.set("target", target);
        commandRunner.getCommandInvocation("create-jms-resource", subReport).parameters(aoAttrList).execute();

    }
View Full Code Here

        return connectorRuntime.pingConnectionPool(poolInfo);
    }
   
    void deleteJMSResource(ActionReport subReport, String tmpJMSResource)
    {
        ParameterMap aoAttrList = new ParameterMap();
        aoAttrList.set("DEFAULT",  tmpJMSResource);
        //aoAttrList.set("target", target);

        commandRunner.getCommandInvocation("delete-jms-resource", subReport).parameters(aoAttrList).execute();
    }
View Full Code Here

     * @return true/false depending on the outcome of the operation
     * @throws org.glassfish.deployment.autodeploy.AutoDeploymentException
     */
    final AutodeploymentStatus run() throws AutoDeploymentException {
        try {
            ParameterMap p = new ParameterMap();
            for (Map.Entry<Object,Object> entry : props.entrySet())
                p.set((String)entry.getKey(), (String)entry.getValue());
            ActionReport report = commandRunner.getActionReport("hk2-agent");
            CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation(commandName, report, internalSystemAdministrator.getSubject());
            inv.parameters(p).execute(command);
            AutodeploymentStatus ds = AutodeploymentStatus.forExitCode(report.getActionExitCode());
            if (ds.status) {
View Full Code Here

                                PoolInfo poolInfo = ResourceUtil.getPoolInfo(pool);
                                CommandRunner commandRunner = commandRunnerProvider.get();
                                ActionReport report = actionReportProvider.get();
                                CommandRunner.CommandInvocation invocation =
                                        commandRunner.getCommandInvocation("ping-connection-pool", report);
                                ParameterMap params = new ParameterMap();
                                params.add("appname",poolInfo.getApplicationName());
                                params.add("modulename",poolInfo.getModuleName());
                                params.add("DEFAULT", poolInfo.getName());
                                invocation.parameters(params).execute();
                                if(report.getActionExitCode() == ActionReport.ExitCode.SUCCESS){
                                    logger.log(Level.INFO, "app-scoped.ping.connection.pool.success", poolInfo);
                                }else{
                                    Object args[] = new Object[]{poolInfo, report.getFailureCause()};
View Full Code Here

     * @return true/false depending on the outcome of the operation
     * @throws org.glassfish.deployment.autodeploy.AutoDeploymentException
     */
    final AutodeploymentStatus run() throws AutoDeploymentException {
        try {
            ParameterMap p = new ParameterMap();
            for (Map.Entry<Object,Object> entry : props.entrySet())
                p.set((String)entry.getKey(), (String)entry.getValue());
            ActionReport report = commandRunner.getActionReport("hk2-agent");
            CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation(commandName, report, internalSystemAdministrator.getSubject());
            inv.parameters(p).execute(command);
            AutodeploymentStatus ds = AutodeploymentStatus.forExitCode(report.getActionExitCode());
            if (ds.status) {
View Full Code Here

            //then undeploy the application first.

            // Use ParameterMap till we have a better way
            // to invoke a command on both DAS and instance with the
            // replication framework
            final ParameterMap parameters = new ParameterMap();
            parameters.add("DEFAULT", name);
            parameters.add(DeploymentProperties.TARGET, target);
            parameters.add(DeploymentProperties.KEEP_REPOSITORY_DIRECTORY, keepreposdir.toString());
            parameters.add(DeploymentProperties.IS_REDEPLOY, isredeploy.toString());
            if (dropandcreatetables != null) {
                parameters.add(DeploymentProperties.DROP_TABLES, dropandcreatetables.toString());
            }
            parameters.add(DeploymentProperties.IGNORE_CASCADE, force.toString());
            if (keepstate != null) {
                parameters.add(DeploymentProperties.KEEP_STATE, keepstate.toString());
            }

            ActionReport subReport = report.addSubActionsReport();
            subReport.setExtraProperties(new Properties());
View Full Code Here

TOP

Related Classes of org.glassfish.api.admin.ParameterMap

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.