Package com.sun.enterprise.v3.common

Examples of com.sun.enterprise.v3.common.ActionReporter


    @Param(optional=true, defaultValue=SystemPropertyConstants.DAS_SERVER_NAME)
    String target = SystemPropertyConstants.DAS_SERVER_NAME;

    @Override
    public void execute(AdminCommandContext context) {
        ActionReporter report = (ActionReporter) context.getActionReport();
        PropertyResolver resolver = new PropertyResolver(domain, target);
       
        String sep = "";
        String eol = System.getProperty("line.separator");
        StringBuilder output = new StringBuilder();
        Map<String, String> values = new TreeMap<String, String>();
        Properties properties = new Properties();
        properties.put("tokens", values);
       
        for (String token : tokens) {
            String value = resolver.getPropertyValue(token);
            if ((value == null) && (checkSystemProperties)) {
                value = System.getProperty(token);
            }
            output.append(sep).append(token).append(" = ").append(value);
            sep = eol;
            values.put(token, value);
        }

        report.setMessage(output.toString());
        report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
        report.setExtraProperties(properties);
       
        return;
    }
View Full Code Here


            if (cluster != null) {
                config = domain.getConfigNamed(cluster.getConfigRef());
            }
        }

        ActionReporter report = (ActionReporter) context.getActionReport();
        try {
            String[] list = getGroupNames(realmName, userName);
            List<String> ret = Arrays.asList(list);
            report.setActionExitCode(ExitCode.SUCCESS);
            Properties props = new Properties();
            props.put("groups", ret);
            report.setExtraProperties(props);
            report.setMessage("" + ret);
        } catch (NoSuchRealmException ex) {
            report.setFailureCause(ex);
            report.setActionExitCode(ExitCode.FAILURE);
        } catch (BadRealmException ex) {
            report.setFailureCause(ex);
            report.setActionExitCode(ExitCode.FAILURE);
        } catch (InvalidOperationException ex) {
            report.setFailureCause(ex);
            report.setActionExitCode(ExitCode.FAILURE);
        } catch (NoSuchUserException ex) {
            report.setFailureCause(ex);
            report.setActionExitCode(ExitCode.FAILURE);
        }
      
    }
View Full Code Here

    @Inject
    protected ConnectorConnectionPool[] ccPools;

    @Override
    public void execute(AdminCommandContext context) {
        ActionReporter report = (ActionReporter) context.getActionReport();

        SecurityMap map = CreatePrincipalCommand.getSpecifiedSecurityMapForPool(ccPools, poolName, mapName);

        if (map == null) {
            report.setMessage(localStrings.getLocalString("create.principal.invalid.map",
                    "A security map named {0} could not be found for connector connection pool {1}. Please check the" +
                    " map and pool names.", mapName, poolName));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        try {
            ConfigSupport.apply(new SingleConfigCode<SecurityMap>() {
                @Override
                public Object run(SecurityMap map) throws PropertyVetoException, TransactionFailure {
                    if (groups != null) {
                        for (String g : groups) {
                            map.getUserGroup().add(g);
                        }
                    }

                    return "";
                }
            }, map);
        } catch (TransactionFailure tfe) {
            Object params[] = {mapName, poolName};
            report.setMessage(localStrings.getLocalString("create.connector.security.map.fail",
                    "Unable to create connector security map {0} for connector connection pool {1} ", params) +
                    " " + tfe.getLocalizedMessage());
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setFailureCause(tfe);
            return;
        }

        report.setActionExitCode(ExitCode.SUCCESS);
    }
View Full Code Here

    @Inject
    protected ConnectorConnectionPool[] ccPools;

    @Override
    public void execute(AdminCommandContext context) {
        ActionReporter report = (ActionReporter) context.getActionReport();

        SecurityMap map = getSpecifiedSecurityMapForPool(ccPools, poolName, mapName);

        if (map == null) {
            report.setMessage(localStrings.getLocalString("create.principal.invalid.map",
                    "A security map named {0} could not be found for connector connection pool {1}. Please check the" +
                    " map and pool names.", mapName, poolName));
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            return;
        }

        try {
            ConfigSupport.apply(new SingleConfigCode<SecurityMap>() {
                @Override
                public Object run(SecurityMap map) throws PropertyVetoException, TransactionFailure {
                    if (principals != null) {
                        for (String p : principals) {
                            map.getPrincipal().add(p);
                        }
                    }

                    return "";
                }
            }, map);
        } catch (TransactionFailure tfe) {
            Object params[] = {mapName, poolName};
            report.setMessage(localStrings.getLocalString("create.connector.security.map.fail",
                    "Unable to create connector security map {0} for connector connection pool {1} ", params) +
                    " " + tfe.getLocalizedMessage());
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setFailureCause(tfe);
            return;
        }

        report.setActionExitCode(ExitCode.SUCCESS);
    }
View Full Code Here

        super(ActionReportResult.class, MediaType.APPLICATION_XML_TYPE);
    }

    @Override
    public String getContent(ActionReportResult proxy) {
        ActionReporter ar = (ActionReporter)proxy.getActionReport();
        XmlObject result = processReport(ar);
        return result.toString(getFormattingIndentLevel());
    }
View Full Code Here

        }
        //Check command model
        CommandModel model = getCommandModel(commandName);
        checkCommandModelETag(model, modelETag);
        //Execute it
        ActionReporter ar = new PropsFileActionReporter(); //new RestActionReporter(); //Must use PropsFileActionReporter because some commands react diferently on it :-(
        final RestPayloadImpl.Outbound outbound = new RestPayloadImpl.Outbound(false);
        final CommandRunner.CommandInvocation commandInvocation =
                getCommandRunner().getCommandInvocation(commandName.getScope(), commandName.getName(), ar);
        if (inbound != null) {
            commandInvocation.inbound(inbound);
        }
        commandInvocation
                .outbound(outbound)
                .parameters(params)
                .subject(getSubject())
                .execute();
        ar = (ActionReporter) commandInvocation.report();
        fixActionReporterSpecialCases(ar);
        ActionReport.ExitCode exitCode = ar.getActionExitCode();
        int status = HttpURLConnection.HTTP_OK; /*200 - ok*/
        if (exitCode == ActionReport.ExitCode.FAILURE) {
            status = HttpURLConnection.HTTP_INTERNAL_ERROR;
        }
        ResponseBuilder rb = Response.status(status);
View Full Code Here

        }
        //Check command model
        CommandModel model = getCommandModel(commandName);
        checkCommandModelETag(model, modelETag);
        //Execute it
        ActionReporter ar = new PropsFileActionReporter(); //new RestActionReporter(); //Must use PropsFileActionReporter because some commands react diferently on it :-(
        final RestPayloadImpl.Outbound outbound = new RestPayloadImpl.Outbound(false);
        final CommandRunner.CommandInvocation commandInvocation =
                getCommandRunner().getCommandInvocation(commandName.getScope(), commandName.getName(), ar);
        if (inbound != null) {
            commandInvocation.inbound(inbound);
        }
        commandInvocation
                .outbound(outbound)
                .parameters(params)
                .subject(getSubject())
                .execute();
        ar = (ActionReporter) commandInvocation.report();
        fixActionReporterSpecialCases(ar);
        ActionReport.ExitCode exitCode = ar.getActionExitCode();
        int status = HttpURLConnection.HTTP_OK; /*200 - ok*/
        if (exitCode == ActionReport.ExitCode.FAILURE) {
            status = HttpURLConnection.HTTP_INTERNAL_ERROR;
        }
        ResponseBuilder rb = Response.status(status);
View Full Code Here

        }
        //Check command model
        CommandModel model = getCommandModel(commandName);
        checkCommandModelETag(model, modelETag);
        //Execute it
        ActionReporter ar = new PropsFileActionReporter(); //new RestActionReporter(); //Must use PropsFileActionReporter because some commands react diferently on it :-(
        final RestPayloadImpl.Outbound outbound = new RestPayloadImpl.Outbound(false);
        final CommandRunner.CommandInvocation commandInvocation =
                getCommandRunner().getCommandInvocation(commandName.getScope(), commandName.getName(), ar, getSubject());
        if (inbound != null) {
            commandInvocation.inbound(inbound);
        }
        commandInvocation
                .outbound(outbound)
                .parameters(params)
                .execute();
        ar = (ActionReporter) commandInvocation.report();
        fixActionReporterSpecialCases(ar);
        ActionReport.ExitCode exitCode = ar.getActionExitCode();
        int status = HttpURLConnection.HTTP_OK; /*200 - ok*/
        if (exitCode == ActionReport.ExitCode.FAILURE) {
            status = HttpURLConnection.HTTP_INTERNAL_ERROR;
        }
        ResponseBuilder rb = Response.status(status);
View Full Code Here

    public JSONObject processState(AdminCommandState state) throws JSONException {
        JSONObject result = new JSONObject();
        result.put("state", state.getState().name());
        result.put("id", state.getId());
        result.put("empty-payload", state.isOutboundPayloadEmpty());
        ActionReporter ar = (ActionReporter) state.getActionReport();
        if (ar != null) {
            result.put("action-report", actionReportJsonProvider.processReport((ActionReporter) state.getActionReport()));
        }
        return result;
    }
View Full Code Here

        }
        //Check command model
        CommandModel model = getCommandModel(commandName);
        checkCommandModelETag(model, modelETag);
        //Execute it
        ActionReporter ar = new PropsFileActionReporter(); //new RestActionReporter(); //Must use PropsFileActionReporter because some commands react diferently on it :-(
        final RestPayloadImpl.Outbound outbound = new RestPayloadImpl.Outbound(false);
        final CommandRunner.CommandInvocation commandInvocation =
                getCommandRunner().getCommandInvocation(commandName.getScope(), commandName.getName(), ar);
        if (inbound != null) {
            commandInvocation.inbound(inbound);
        }
        commandInvocation
                .outbound(outbound)
                .parameters(params)
                .subject(getSubject())
                .execute();
        ar = (ActionReporter) commandInvocation.report();
        fixActionReporterSpecialCases(ar);
        ActionReport.ExitCode exitCode = ar.getActionExitCode();
        int status = HttpURLConnection.HTTP_OK; /*200 - ok*/
        if (exitCode == ActionReport.ExitCode.FAILURE) {
            status = HttpURLConnection.HTTP_INTERNAL_ERROR;
        }
        ResponseBuilder rb = Response.status(status);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.v3.common.ActionReporter

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.