use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.
the class DynamicConfigListener method changed.
@Override
public synchronized UnprocessedChangeEvents changed(final PropertyChangeEvent[] events) {
return ConfigSupport.sortAndDispatch(events, new Changed() {
@Override
public <T extends ConfigBeanProxy> NotProcessed changed(TYPE type, Class<T> tClass, T t) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "NetworkConfig changed {0} {1} {2}", new Object[] { type, tClass, t });
}
if (tClass == NetworkListener.class && t instanceof NetworkListener) {
return processNetworkListener(type, (NetworkListener) t, events);
} else if (tClass == Http.class && t instanceof Http) {
return processProtocol(type, (Protocol) t.getParent(), events);
} else if (tClass == FileCache.class && t instanceof FileCache) {
return processProtocol(type, (Protocol) t.getParent().getParent(), null);
} else if (tClass == Ssl.class && t instanceof Ssl) {
/*
* Make sure the SSL parent is in fact a protocol. It could
* be a jmx-connector.
*/
final ConfigBeanProxy parent = t.getParent();
if (parent instanceof Protocol) {
return processProtocol(type, (Protocol) parent, null);
}
} else if (tClass == Protocol.class && t instanceof Protocol) {
return processProtocol(type, (Protocol) t, null);
} else if (tClass == ThreadPool.class && t instanceof ThreadPool) {
NotProcessed notProcessed = null;
ThreadPool threadPool = (ThreadPool) t;
for (NetworkListener listener : threadPool.findNetworkListeners()) {
notProcessed = processNetworkListener(type, listener, null);
}
// Throw an unprocessed event change if one hasn't already if HTTP or ThreadPool monitoring is enabled.
MonitoringService ms = config.getMonitoringService();
String threadPoolLevel = ms.getModuleMonitoringLevels().getThreadPool();
String httpServiceLevel = ms.getModuleMonitoringLevels().getHttpService();
if (((threadPoolLevel != null && !threadPoolLevel.equals(OFF)) || (httpServiceLevel != null && !httpServiceLevel.equals(OFF))) && notProcessed == null) {
notProcessed = new NotProcessed("Monitoring statistics will be incorrect for " + threadPool.getName() + " until restart due to changed attribute(s).");
}
return notProcessed;
} else if (tClass == Transport.class && t instanceof Transport) {
NotProcessed notProcessed = null;
for (NetworkListener listener : ((Transport) t).findNetworkListeners()) {
notProcessed = processNetworkListener(type, listener, null);
}
return notProcessed;
} else if (tClass == VirtualServer.class && t instanceof VirtualServer && !grizzlyService.hasMapperUpdateListener()) {
return processVirtualServer(type, (VirtualServer) t);
} else if (tClass == SystemProperty.class && t instanceof SystemProperty) {
NetworkConfig networkConfig = config.getNetworkConfig();
if ((networkConfig != null) && ((SystemProperty) t).getName().endsWith("LISTENER_PORT")) {
for (NetworkListener listener : networkConfig.getNetworkListeners().getNetworkListener()) {
if (listener.getPort().equals(((SystemProperty) t).getValue())) {
return processNetworkListener(Changed.TYPE.CHANGE, listener, events);
}
}
}
return null;
}
return null;
}
}, logger);
}
use of org.glassfish.grizzly.config.dom.Ssl in project Payara by payara.
the class PEORBConfigurator method createORBListeners.
private void createORBListeners(IIOPUtils iiopUtils, IiopListener[] iiopListenerBeans, org.omg.CORBA.ORB orb) {
if (iiopListenerBeans != null) {
int lazyCount = 0;
for (IiopListener ilb : iiopListenerBeans) {
boolean securityEnabled = Boolean.valueOf(ilb.getSecurityEnabled());
boolean isLazy = Boolean.valueOf(ilb.getLazyInit());
if (isLazy) {
lazyCount++;
}
if (lazyCount > 1) {
throw new IllegalStateException("Invalid iiop-listener " + ilb.getId() + ". Only one iiop-listener can be configured " + "with lazy-init=true");
}
int port = Integer.parseInt(ilb.getPort());
String host = handleAddrAny(ilb.getAddress());
if (!securityEnabled || ilb.getSsl() == null) {
Acceptor acceptor = addAcceptor(orb, isLazy, host, IIOP_CLEAR_TEXT_CONNECTION, port);
if (isLazy) {
lazyAcceptor = acceptor;
}
} else {
if (isLazy) {
throw new IllegalStateException("Invalid iiop-listener " + ilb.getId() + ". Lazy-init not supported for SSL iiop-listeners");
}
Ssl sslBean = ilb.getSsl();
assert sslBean != null;
boolean clientAuth = Boolean.valueOf(sslBean.getClientAuthEnabled());
String type = clientAuth ? SSL_MUTUALAUTH : SSL;
addAcceptor(orb, isLazy, host, type, port);
}
}
if (lazyCount == 1) {
getHelper().setSelectableChannelDelegate(new AcceptorDelegateImpl(lazyAcceptor));
}
}
}
use of org.glassfish.grizzly.config.dom.Ssl 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.grizzly.config.dom.Ssl 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.grizzly.config.dom.Ssl in project Payara by payara.
the class SecureAdminConfigUpgrade method isOriginalAdminSecured.
private boolean isOriginalAdminSecured() {
/*
* The Grizzly conversion has already occurred. So look for
*
* <server-config>
* <network-config>
* <protocols>
* <protocol name="admin-listener">
* <ssl ...>
*
*/
final Config serverConfig;
final NetworkConfig nc;
final Protocol p;
final Ssl ssl;
if ((serverConfig = configs.getConfigByName(SecureAdminUpgradeHelper.DAS_CONFIG_NAME)) == null) {
return false;
}
if ((nc = serverConfig.getNetworkConfig()) == null) {
return false;
}
if ((p = nc.findProtocol(ADMIN_LISTENER_NAME)) == null) {
return false;
}
if ((ssl = p.getSsl()) == null) {
return false;
}
return true;
}
Aggregations