Package org.glassfish.config.support

Examples of org.glassfish.config.support.TargetType


                        fp = FailurePolicy.Error;
                    } else {
                        fp = clAnnotation.ifFailure();
                    }
                }
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);

                //@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
                //@TargetType since we do not want to replicate the command
                if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                   if (tgtTypeAnnotation != null) {

                       report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                       report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
                               "Target type is not allowed on single instance command {0}  ,"
                                       , model.getCommandName()));
                       return;
                   }
                   //Do not replicate the command when there is
                   //@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                   doReplication = false;
                }

                String targetName = parameters.getOne("target");
                if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
                    if (command instanceof DeploymentTargetResolver) {
                        targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
                    } else {
                        targetName = "server";
                    }
                }

                logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
                        "@ExecuteOn parsing and default settings done; Current target is {0}", targetName));

                if (serverEnv.isDas()) {

                    //Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                    //and the user is authorized to execute on DAS
                    // TODO add authorization check
                    /*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                        //If authorization fails
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
                                "Not authorized to execute command {0} on DAS"
                                        , model.getCommandName()));
                        progressHelper.complete(context);
                        return;
                    }*/

                    // Check if the command allows this target type; first read the annotation
                    //TODO : See is @TargetType can also be moved to the CommandModel

                    if (tgtTypeAnnotation != null) {
                        targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
                    }
                    //If not @TargetType, default it
                    if (targetTypesAllowed.isEmpty()) {
                        targetTypesAllowed.add(CommandTarget.DAS);
                        targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
View Full Code Here


                        fp = FailurePolicy.Error;
                    } else {
                        fp = clAnnotation.ifFailure();
                    }
                }
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);

                //@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
                //@TargetType since we do not want to replicate the command
                if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                   if (tgtTypeAnnotation != null) {

                       report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                       report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
                               "Target type is not allowed on single instance command {0}  ,"
                                       , model.getCommandName()));
                       return;
                   }
                   //Do not replicate the command when there is
                   //@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                   doReplication = false;
                }

                String targetName = parameters.getOne("target");
                if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
                    if (command instanceof DeploymentTargetResolver) {
                        targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
                    } else {
                        targetName = "server";
                    }
                }

                logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
                        "@ExecuteOn parsing and default settings done; Current target is {0}", targetName));

                if (serverEnv.isDas()) {

                    //Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                    //and the user is authorized to execute on DAS
                    // TODO add authorization check
                    /*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                        //If authorization fails
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
                                "Not authorized to execute command {0} on DAS"
                                        , model.getCommandName()));
                        progressHelper.complete(context);
                        return;
                    }*/

                    // Check if the command allows this target type; first read the annotation
                    //TODO : See is @TargetType can also be moved to the CommandModel

                    if (tgtTypeAnnotation != null) {
                        targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
                    }
                    //If not @TargetType, default it
                    if (targetTypesAllowed.isEmpty()) {
                        targetTypesAllowed.add(CommandTarget.DAS);
                        targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
View Full Code Here

                        fp = FailurePolicy.Error;
                    } else {
                        fp = clAnnotation.ifFailure();
                    }
                }
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);

                //@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
                //@TargetType since we do not want to replicate the command
                if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                   if (tgtTypeAnnotation != null) {

                       report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                       report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
                               "Target type is not allowed on single instance command {0}  ,"
                                       , model.getCommandName()));
                       return;
                   }
                   //Do not replicate the command when there is
                   //@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                   doReplication = false;
                }

                String targetName = parameters.getOne("target");
                if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
                    if (command instanceof DeploymentTargetResolver) {
                        targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
                    } else {
                        targetName = "server";
                    }
                }

                logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
                        "@ExecuteOn parsing and default settings done; Current target is {0}", targetName));

                if (serverEnv.isDas()) {

                    //Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                    //and the user is authorized to execute on DAS
                    // TODO add authorization check
                    /*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                        //If authorization fails
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
                                "Not authorized to execute command {0} on DAS"
                                        , model.getCommandName()));
                        progressHelper.complete(context);
                        return;
                    }*/

                    // Check if the command allows this target type; first read the annotation
                    //TODO : See is @TargetType can also be moved to the CommandModel

                    if (tgtTypeAnnotation != null) {
                        targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
                    }
                    //If not @TargetType, default it
                    if (targetTypesAllowed.isEmpty()) {
                        targetTypesAllowed.add(CommandTarget.DAS);
                        targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
View Full Code Here

                        fp = FailurePolicy.Error;
                    } else {
                        fp = clAnnotation.ifFailure();
                    }
                }
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);

                //@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
                //@TargetType since we do not want to replicate the command
                if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                   if (tgtTypeAnnotation != null) {

                       report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                       report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
                               "Target type is not allowed on single instance command {0}  ,"
                                       , model.getCommandName()));
                       return;
                   }
                   //Do not replicate the command when there is
                   //@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                   doReplication = false;
                }

                String targetName = parameters.getOne("target");
                if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
                    if (command instanceof DeploymentTargetResolver) {
                        targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
                    } else {
                        targetName = "server";
                    }
                }

                logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
                        "@ExecuteOn parsing and default settings done; Current target is {0}", targetName));

                if (serverEnv.isDas()) {

                    //Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                    //and the user is authorized to execute on DAS
                    // TODO add authorization check
                    /*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                        //If authorization fails
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
                                "Not authorized to execute command {0} on DAS"
                                        , model.getCommandName()));
                        progressHelper.complete(context);
                        return;
                    }*/

                    // Check if the command allows this target type; first read the annotation
                    //TODO : See is @TargetType can also be moved to the CommandModel

                    if (tgtTypeAnnotation != null) {
                        targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
                    }
                    //If not @TargetType, default it
                    if (targetTypesAllowed.isEmpty()) {
                        targetTypesAllowed.add(CommandTarget.DAS);
                        targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
View Full Code Here

                        fp = FailurePolicy.Error;
                    } else {
                        fp = clAnnotation.ifFailure();
                    }
                }
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);

                //@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
                //@TargetType since we do not want to replicate the command
                if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                   if (tgtTypeAnnotation != null) {

                       report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                       report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
                               "Target type is not allowed on single instance command {0}  ,"
                                       , model.getCommandName()));
                       return;
                   }
                   //Do not replicate the command when there is
                   //@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                   doReplication = false;
                }

                String targetName = parameters.getOne("target");
                if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
                    if (command instanceof DeploymentTargetResolver) {
                        targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
                    } else {
                        targetName = "server";
                    }
                }

                logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
                        "@ExecuteOn parsing and default settings done; Current target is {0}", targetName));

                if (serverEnv.isDas()) {

                    //Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                    //and the user is authorized to execute on DAS
                    // TODO add authorization check
                    /*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                        //If authorization fails
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
                                "Not authorized to execute command {0} on DAS"
                                        , model.getCommandName()));
                        progressHelper.complete(context);
                        return;
                    }*/

                    // Check if the command allows this target type; first read the annotation
                    //TODO : See is @TargetType can also be moved to the CommandModel

                    if (tgtTypeAnnotation != null) {
                        targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
                    }
                    //If not @TargetType, default it
                    if (targetTypesAllowed.isEmpty()) {
                        targetTypesAllowed.add(CommandTarget.DAS);
                        targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
View Full Code Here

                        fp = FailurePolicy.Error;
                    } else {
                        fp = clAnnotation.ifFailure();
                    }
                }
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);

                //@ExecuteOn(RuntimeType.SINGLE_INSTANCE) cannot be combined with
                //@TargetType since we do not want to replicate the command
                if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                   if (tgtTypeAnnotation != null) {

                       report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                       report.setMessage(adminStrings.getLocalString("commandrunner.executor.targettype.unallowed",
                               "Target type is not allowed on single instance command {0}  ,"
                                       , model.getCommandName()));
                       return;
                   }
                   //Do not replicate the command when there is
                   //@ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                   doReplication = false;
                }

                String targetName = parameters.getOne("target");
                if (targetName == null || model.getModelFor("target").getParam().obsolete()) {
                    if (command instanceof DeploymentTargetResolver) {
                        targetName = ((DeploymentTargetResolver) command).getTarget(parameters);
                    } else {
                        targetName = "server";
                    }
                }

                logger.fine(adminStrings.getLocalString("dynamicreconfiguration.diagnostics.target",
                        "@ExecuteOn parsing and default settings done; Current target is {0}", targetName));

                if (serverEnv.isDas()) {

                    //Do not replicate this command if it has @ExecuteOn(RuntimeType.SINGLE_INSTANCE)
                    //and the user is authorized to execute on DAS
                    // TODO add authorization check
                    /*if (runtimeTypes.contains(RuntimeType.SINGLE_INSTANCE)) {
                        //If authorization fails
                        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                        report.setMessage(adminStrings.getLocalString("commandrunner.executor.das.unallowed",
                                "Not authorized to execute command {0} on DAS"
                                        , model.getCommandName()));
                        progressHelper.complete(context);
                        return;
                    }*/

                    // Check if the command allows this target type; first read the annotation
                    //TODO : See is @TargetType can also be moved to the CommandModel

                    if (tgtTypeAnnotation != null) {
                        targetTypesAllowed.addAll(Arrays.asList(tgtTypeAnnotation.value()));
                    }
                    //If not @TargetType, default it
                    if (targetTypesAllowed.isEmpty()) {
                        targetTypesAllowed.add(CommandTarget.DAS);
                        targetTypesAllowed.add(CommandTarget.STANDALONE_INSTANCE);
View Full Code Here

            if(serverEnv.isDas()) {

                // Check if the command allows this target type; first read the annotation
                //TODO : See is @TargetType can also be moved to the CommandModel
                TargetType tgtTypeAnnotation = command.getClass().getAnnotation(TargetType.class);
                if(tgtTypeAnnotation != null) {
                    for(CommandTarget c : tgtTypeAnnotation.value()) {
                        targetTypesAllowed.add(c);
                    }
                };
                //If not @TargetType, default it
                if(targetTypesAllowed.size() == 0) {
View Full Code Here

            for (ServiceHandle<?> handle : serviceHandles) {
                ActiveDescriptor<?> descriptor = handle.getActiveDescriptor();
                if (descriptor.getName().equals(commandName)) {
                    AdminCommand service = locator.<AdminCommand>getService(descriptor.getImplementationClass());
                    if (service != null) {
                        TargetType targetType = descriptor.getImplementationClass().getAnnotation(TargetType.class);
                        targets = targetType.value();
                        break;
                    }
                }
            }
View Full Code Here

            for (ServiceHandle<?> handle : serviceHandles) {
                ActiveDescriptor<?> descriptor = handle.getActiveDescriptor();
                if (descriptor.getName().equals(commandName)) {
                    AdminCommand service = locator.getService(descriptor.getImplementationClass());
                    if (service != null) {
                        TargetType targetType = descriptor.getImplementationClass().getAnnotation(TargetType.class);
                        targets = targetType.value();
                        break;
                    }
                }
            }
View Full Code Here

                    if ( ! descriptor.isReified()) {
                        locator.reifyDescriptor(descriptor);
                    }
                    AdminCommand service = locator.<AdminCommand>getService(descriptor.getImplementationClass());
                    if (service != null) {
                        TargetType targetType = descriptor.getImplementationClass().getAnnotation(TargetType.class);
                        targets = targetType.value();
                        break;
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.glassfish.config.support.TargetType

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.