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);
}
}
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);
}
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);
}
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);
}
}
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);
}
Aggregations