Search in sources :

Example 6 with IiopService

use of org.glassfish.orb.admin.config.IiopService in project Payara by payara.

the class ListIiopListeners method execute.

/**
 * Executes the command
 *
 * @param context information
 */
@Override
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    final Target targetUtil = services.getService(Target.class);
    final Config config = targetUtil.getConfig(target);
    final IiopService iiopService = config.getExtensionByType(IiopService.class);
    try {
        List<IiopListener> listenerList = iiopService.getIiopListener();
        for (IiopListener listener : listenerList) {
            final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
            part.setMessage(listener.getId());
        }
        report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
    } catch (Exception e) {
        report.setMessage(localStrings.getLocalString("list.iiop.listener" + ".fail", "List IIOP listeners failed."));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        report.setFailureCause(e);
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) Target(org.glassfish.internal.api.Target) CommandTarget(org.glassfish.config.support.CommandTarget) Config(com.sun.enterprise.config.serverbeans.Config) IiopService(org.glassfish.orb.admin.config.IiopService) ActionReport(org.glassfish.api.ActionReport)

Example 7 with IiopService

use of org.glassfish.orb.admin.config.IiopService in project Payara by payara.

the class IiopServiceSslConfigHandler method create.

@Override
public void create(final CreateSsl command, ActionReport report) {
    IiopService iiopSvc = command.config.getExtensionByType(IiopService.class);
    if (iiopSvc.getSslClientConfig() != null) {
        report.setMessage(localStrings.getLocalString("create.ssl.iiopsvc.alreadyExists", "IIOP Service " + "already has been configured with SSL configuration."));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    try {
        ConfigSupport.apply(new SingleConfigCode<IiopService>() {

            public Object run(IiopService param) throws PropertyVetoException, TransactionFailure {
                SslClientConfig newSslClientCfg = param.createChild(SslClientConfig.class);
                Ssl newSsl = newSslClientCfg.createChild(Ssl.class);
                command.populateSslElement(newSsl);
                newSslClientCfg.setSsl(newSsl);
                param.setSslClientConfig(newSslClientCfg);
                return newSsl;
            }
        }, iiopSvc);
    } catch (TransactionFailure e) {
        command.reportError(report, e);
    }
    command.reportSuccess(report);
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) SslClientConfig(com.sun.enterprise.config.serverbeans.SslClientConfig) IiopService(org.glassfish.orb.admin.config.IiopService) CreateSsl(com.sun.enterprise.admin.commands.CreateSsl) DeleteSsl(com.sun.enterprise.admin.commands.DeleteSsl) Ssl(org.glassfish.grizzly.config.dom.Ssl)

Example 8 with IiopService

use of org.glassfish.orb.admin.config.IiopService in project Payara by payara.

the class IiopSslConfigHandler method create.

@Override
public void create(final CreateSsl command, ActionReport report) {
    IiopService iiopService = command.config.getExtensionByType(IiopService.class);
    // ensure we have the specified listener
    IiopListener iiopListener = null;
    for (IiopListener listener : iiopService.getIiopListener()) {
        if (listener.getId().equals(command.listenerId)) {
            iiopListener = listener;
        }
    }
    if (iiopListener == null) {
        report.setMessage(localStrings.getLocalString("create.ssl.iiop.notfound", "IIOP Listener named {0} to which this ssl element is " + "being added does not exist.", command.listenerId));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (iiopListener.getSsl() != null) {
        report.setMessage(localStrings.getLocalString("create.ssl.iiop.alreadyExists", "IIOP Listener named {0} to which this ssl element is " + "being added already has an ssl element.", command.listenerId));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    try {
        ConfigSupport.apply(new SingleConfigCode<IiopListener>() {

            public Object run(IiopListener param) throws PropertyVetoException, TransactionFailure {
                Ssl newSsl = param.createChild(Ssl.class);
                command.populateSslElement(newSsl);
                param.setSsl(newSsl);
                return newSsl;
            }
        }, iiopListener);
    } catch (TransactionFailure e) {
        command.reportError(report, e);
    }
    command.reportSuccess(report);
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) IiopService(org.glassfish.orb.admin.config.IiopService) CreateSsl(com.sun.enterprise.admin.commands.CreateSsl) DeleteSsl(com.sun.enterprise.admin.commands.DeleteSsl) Ssl(org.glassfish.grizzly.config.dom.Ssl)

Example 9 with IiopService

use of org.glassfish.orb.admin.config.IiopService in project Payara by payara.

the class IiopSslConfigHandler method delete.

@Override
public void delete(DeleteSsl command, ActionReport report) {
    IiopService iiopService = command.config.getExtensionByType(IiopService.class);
    IiopListener iiopListener = null;
    for (IiopListener listener : iiopService.getIiopListener()) {
        if (listener.getId().equals(command.listenerId)) {
            iiopListener = listener;
        }
    }
    if (iiopListener == null) {
        report.setMessage(localStrings.getLocalString("delete.ssl.iiop.listener.notfound", "Iiop Listener named {0} not found", command.listenerId));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    if (iiopListener.getSsl() == null) {
        report.setMessage(localStrings.getLocalString("delete.ssl.element.doesnotexist", "Ssl element does " + "not exist for Listener named {0}", command.listenerId));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    try {
        ConfigSupport.apply(new SingleConfigCode<IiopListener>() {

            public Object run(IiopListener param) throws PropertyVetoException {
                param.setSsl(null);
                return null;
            }
        }, iiopListener);
    } catch (TransactionFailure e) {
        command.reportError(report, e);
    }
}
Also used : IiopListener(org.glassfish.orb.admin.config.IiopListener) PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) IiopService(org.glassfish.orb.admin.config.IiopService)

Example 10 with IiopService

use of org.glassfish.orb.admin.config.IiopService in project Payara by payara.

the class CreateIiopListenerTest method setUp.

@Before
public void setUp() {
    services = getHabitat();
    iiopService = services.getService(IiopService.class);
    parameters = new ParameterMap();
    context = new AdminCommandContextImpl(LogDomains.getLogger(CreateIiopListenerTest.class, LogDomains.ADMIN_LOGGER), new PropsFileActionReporter());
    cr = services.getService(CommandRunner.class);
}
Also used : AdminCommandContextImpl(org.glassfish.api.admin.AdminCommandContextImpl) IiopService(org.glassfish.orb.admin.config.IiopService) ParameterMap(org.glassfish.api.admin.ParameterMap) PropsFileActionReporter(com.sun.enterprise.v3.common.PropsFileActionReporter) CommandRunner(org.glassfish.api.admin.CommandRunner) Before(org.junit.Before)

Aggregations

IiopService (org.glassfish.orb.admin.config.IiopService)14 IiopListener (org.glassfish.orb.admin.config.IiopListener)9 PropertyVetoException (java.beans.PropertyVetoException)6 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)6 Config (com.sun.enterprise.config.serverbeans.Config)4 ParameterMap (org.glassfish.api.admin.ParameterMap)4 PropsFileActionReporter (com.sun.enterprise.v3.common.PropsFileActionReporter)3 ActionReport (org.glassfish.api.ActionReport)3 AdminCommandContextImpl (org.glassfish.api.admin.AdminCommandContextImpl)3 CommandRunner (org.glassfish.api.admin.CommandRunner)3 CommandTarget (org.glassfish.config.support.CommandTarget)3 Target (org.glassfish.internal.api.Target)3 Before (org.junit.Before)3 CreateSsl (com.sun.enterprise.admin.commands.CreateSsl)2 DeleteSsl (com.sun.enterprise.admin.commands.DeleteSsl)2 List (java.util.List)2 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)2 Ssl (org.glassfish.grizzly.config.dom.Ssl)2 ClusterInstanceInfo (com.sun.corba.ee.spi.folb.ClusterInstanceInfo)1 SocketInfo (com.sun.corba.ee.spi.folb.SocketInfo)1