Author: asoldano
Date: 2013-11-06 12:10:16 -0500 (Wed, 06 Nov 2013)
New Revision: 18065
Modified:
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
Log:
[JBWS-3728] Adding callback handler mechanism to setters
Modified:
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2013-11-06
14:00:26 UTC (rev 18064)
+++
common/trunk/src/main/java/org/jboss/ws/common/management/AbstractServerConfig.java 2013-11-06
17:10:16 UTC (rev 18065)
@@ -47,7 +47,13 @@
import org.jboss.wsf.spi.metadata.config.EndpointConfig;
/**
- * Basic implementation of a ServerConfig
+ * Basic implementation of a ServerConfig.
+ *
+ * Instances of AbstractServerConfig allow concurrent read and write access to their
+ * member attributes using getter and setter methods.
+ * A DisabledOperationException is thrown if attribute updates are temporarly or
+ * permanentely disabled. The isModifiable() method can be overwridden to enable /
disable
+ * the attribute update.
*
* @author Thomas.Diesler(a)jboss.org
* @author darran.lofthouse(a)jboss.com
@@ -64,16 +70,23 @@
// The MBeanServer
private volatile MBeanServer mbeanServer;
+
// The webservice host name that will be used when updating the wsdl
private volatile String webServiceHost = UNDEFINED_HOSTNAME;
+ private final Object webServiceHostLock = new Object();
+
// The webservice port that will be used when updating the wsdl
private int webServicePort;
private final Object webServicePortLock = new Object();
+
// The webservice port that will be used when updating the wsdl
private int webServiceSecurePort;
private final Object webServiceSecurePortLock = new Object();
+
// Whether we should always modify the soap address to the deployed endpoint location
private volatile boolean modifySOAPAddress;
+ private final Object modifySOAPAddressLock = new Object();
+
//The stack config
protected StackConfig stackConfig;
// The default endpoint configs, if any
@@ -83,7 +96,7 @@
// The server integration classloader' ServerConfig instance reference
private static ServerConfig serverConfig;
-
+
public MBeanServer getMbeanServer()
{
return mbeanServer;
@@ -101,6 +114,11 @@
public void setWebServiceHost(String host) throws UnknownHostException
{
+ setWebServiceHost(host, null);
+ }
+
+ protected void setWebServiceHost(String host, UpdateCallbackHandler uch) throws
UnknownHostException
+ {
if (host == null || host.trim().length() == 0)
{
MANAGEMENT_LOGGER.usingUndefinedWebServicesHost(UNDEFINED_HOSTNAME);
@@ -112,7 +130,14 @@
if (MANAGEMENT_LOGGER.isDebugEnabled())
MANAGEMENT_LOGGER.usingLocalHostWebServicesHost(localHost.getHostName());
host = localHost.getHostName();
}
- this.webServiceHost = toIPv6URLFormat("127.0.0.1".equals(host) ?
"localhost" : host); // TCK workaround
+ final String wsh = toIPv6URLFormat("127.0.0.1".equals(host) ?
"localhost" : host); // TCK workaround
+ synchronized (webServiceHostLock)
+ {
+ if (uch != null) {
+ uch.onBeforeUpdate();
+ }
+ this.webServiceHost = wsh;
+ }
}
private String toIPv6URLFormat(final String host)
@@ -138,16 +163,32 @@
public void setWebServicePort(int port)
{
+ setWebServicePort(port, null);
+ }
+
+ protected void setWebServicePort(int port, UpdateCallbackHandler uch)
+ {
synchronized (webServicePortLock)
{
+ if (uch != null) {
+ uch.onBeforeUpdate();
+ }
this.webServicePort = port;
}
}
public void setWebServiceSecurePort(int port)
{
+ setWebServiceSecurePort(port, null);
+ }
+
+ protected void setWebServiceSecurePort(int port, UpdateCallbackHandler uch)
+ {
synchronized (webServiceSecurePortLock)
{
+ if (uch != null) {
+ uch.onBeforeUpdate();
+ }
this.webServiceSecurePort = port;
}
}
@@ -161,6 +202,17 @@
{
this.modifySOAPAddress = modify;
}
+
+ protected void setModifySOAPAddress(boolean modify, UpdateCallbackHandler uch)
+ {
+ synchronized (modifySOAPAddressLock)
+ {
+ if (uch != null) {
+ uch.onBeforeUpdate();
+ }
+ this.modifySOAPAddress = modify;
+ }
+ }
public int getWebServicePort()
{
@@ -283,4 +335,8 @@
{
return this.clientConfigs;
}
+
+ public interface UpdateCallbackHandler {
+ public void onBeforeUpdate();
+ }
}
\ No newline at end of file
Show replies by date