use of com.sun.enterprise.admin.commands.CreateSsl in project Payara by payara.
the class WebSslConfigHandler method create.
@Override
public void create(final CreateSsl command, ActionReport report) {
NetworkConfig netConfig = command.config.getNetworkConfig();
// ensure we have the specified listener
NetworkListener listener = netConfig.getNetworkListener(command.listenerId);
Protocol httpProtocol;
try {
if (listener == null) {
report.setMessage(MessageFormat.format(rb.getString(LogFacade.CREATE_SSL_HTTP_NOT_FOUND), command.listenerId));
httpProtocol = command.findOrCreateProtocol(command.listenerId);
} else {
httpProtocol = listener.findHttpProtocol();
Ssl ssl = httpProtocol.getSsl();
if (ssl != null) {
report.setMessage(MessageFormat.format(rb.getString(LogFacade.CREATE_SSL_HTTP_ALREADY_EXISTS), command.listenerId));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
}
ConfigSupport.apply(new SingleConfigCode<Protocol>() {
public Object run(Protocol param) throws TransactionFailure {
Ssl newSsl = param.createChild(Ssl.class);
command.populateSslElement(newSsl);
param.setSsl(newSsl);
return newSsl;
}
}, httpProtocol);
} catch (TransactionFailure e) {
command.reportError(report, e);
}
command.reportSuccess(report);
}
use of com.sun.enterprise.admin.commands.CreateSsl 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 com.sun.enterprise.admin.commands.CreateSsl 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);
}
Aggregations