Author: asoldano
Date: 2013-12-04 16:33:50 -0500 (Wed, 04 Dec 2013)
New Revision: 18134
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ClientConfigAdd.java
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ListInjector.java
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/PropertyAdd.java
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/ConfigService.java
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/PropertyService.java
Log:
[JBWS-3708] Enforce client/endpoint config immutability at runtime; use new
CommonConfigStore concept for updating client config
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/config/ServerConfigImpl.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -29,6 +29,7 @@
import org.jboss.msc.value.InjectedValue;
import org.jboss.ws.common.management.AbstractServerConfig;
import org.jboss.ws.common.management.AbstractServerConfigMBean;
+import org.jboss.wsf.spi.metadata.config.ClientConfig;
/**
* AS specific ServerConfig.
@@ -84,4 +85,7 @@
return new ServerConfigImpl();
}
+ public void setClientConfigWrapper(ClientConfig config, boolean reload) {
+ clientConfigStore.setWrapperConfig(config, reload);
+ }
}
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ClientConfigAdd.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ClientConfigAdd.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ClientConfigAdd.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -32,6 +32,7 @@
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.ServiceVerificationHandler;
import org.jboss.as.webservices.service.ConfigService;
+import org.jboss.as.webservices.service.PropertyService;
import org.jboss.as.webservices.util.ASHelper;
import org.jboss.as.webservices.util.WSServices;
import org.jboss.dmr.ModelNode;
@@ -79,9 +80,10 @@
final ConfigService clientConfigService = new ConfigService(serverConfig, name,
true);
final ServiceTarget target = context.getServiceTarget();
final ServiceBuilder<?> clientServiceBuilder =
target.addService(serviceName, clientConfigService);
- setDependency(context, clientServiceBuilder,
clientConfigService.getPreHandlerChainsInjector(), serviceName, address,
Constants.PRE_HANDLER_CHAIN);
+ setDependency(context, clientServiceBuilder,
clientConfigService.getPropertiesInjector(), PropertyService.class, serviceName, address,
Constants.PROPERTY);
+ setDependency(context, clientServiceBuilder,
clientConfigService.getPreHandlerChainsInjector(), UnifiedHandlerChainMetaData.class,
serviceName, address, Constants.PRE_HANDLER_CHAIN);
final Injector<UnifiedHandlerChainMetaData> postInjector =
clientConfigService.getPostHandlerChainsInjector();
- setDependency(context, clientServiceBuilder, postInjector, serviceName, address,
Constants.POST_HANDLER_CHAIN);
+ setDependency(context, clientServiceBuilder, postInjector,
UnifiedHandlerChainMetaData.class, serviceName, address, Constants.POST_HANDLER_CHAIN);
ServiceController<?> controller =
clientServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
if (newControllers != null) {
newControllers.add(controller);
@@ -91,10 +93,10 @@
}
}
- private void setDependency(final OperationContext context, final
ServiceBuilder<?> builder, final Injector<UnifiedHandlerChainMetaData>
injector,
- final ServiceName serviceName, final PathAddress address, final String
handlerChainType) {
+ private <T> void setDependency(final OperationContext context, final
ServiceBuilder<?> builder, final Injector<T> injector,
+ final Class<T> injectedClass, final ServiceName serviceName, final
PathAddress address, final String handlerChainType) {
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context,
serviceName, address, handlerChainType)) {
- builder.addDependency(sn, UnifiedHandlerChainMetaData.class, injector);
+ builder.addDependency(sn, injectedClass, injector);
}
}
}
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ListInjector.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ListInjector.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/ListInjector.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -17,7 +17,9 @@
/** {@inheritDoc} */
public void inject(final T value) throws InjectionException {
synchronized (list) {
- list.add(value);
+ if (value != null) {
+ list.add(value);
+ }
super.inject(value);
}
}
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/PropertyAdd.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/PropertyAdd.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/PropertyAdd.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -41,7 +41,6 @@
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
-import org.jboss.wsf.spi.metadata.config.AbstractCommonConfig;
/**
* @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
@@ -74,7 +73,7 @@
final String configName = confElem.getValue();
final String propertyValue = operation.has(VALUE) ?
Attributes.VALUE.resolveModelAttribute(context,operation).asString() : null;
- final PropertyService<AbstractCommonConfig> service = new
PropertyService<AbstractCommonConfig>(propertyName, propertyValue);
+ final PropertyService service = new PropertyService(propertyName,
propertyValue);
final ServiceTarget target = context.getServiceTarget();
final ServiceName configServiceName = getConfigServiceName(configType,
configName);
if (context.getServiceRegistry(false).getService(configServiceName) == null)
{
@@ -83,7 +82,6 @@
final ServiceName propertyServiceName =
getPropertyServiceName(configServiceName, propertyName);
final ServiceBuilder<?> propertyServiceBuilder =
target.addService(propertyServiceName, service);
- propertyServiceBuilder.addDependency(configServiceName,
AbstractCommonConfig.class, service.getAbstractCommonConfig());
ServiceController<?> controller =
propertyServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
if (newControllers != null) {
newControllers.add(controller);
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/dmr/WSExtension.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -39,7 +39,6 @@
import org.jboss.as.controller.ResourceBuilder;
import org.jboss.as.controller.ResourceDefinition;
import org.jboss.as.controller.SubsystemRegistration;
-import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/ConfigService.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/ConfigService.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/ConfigService.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -22,8 +22,9 @@
package org.jboss.as.webservices.service;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.Map;
import org.jboss.as.webservices.dmr.ListInjector;
import org.jboss.msc.inject.Injector;
@@ -50,6 +51,7 @@
private final boolean client;
private final List<UnifiedHandlerChainMetaData> preHandlerChains = new
ArrayList<UnifiedHandlerChainMetaData>(1);
private final List<UnifiedHandlerChainMetaData> postHandlerChains = new
ArrayList<UnifiedHandlerChainMetaData>(1);
+ private final List<PropertyService> properties = new
ArrayList<PropertyService>(1);
private volatile AbstractCommonConfig config;
public ConfigService(ServerConfig serverConfig, String configName, boolean client) {
@@ -65,19 +67,20 @@
@Override
public void start(final StartContext context) throws StartException {
+ Map<String, String> props = null;
+ if (!properties.isEmpty()) {
+ props = new HashMap<String, String>(properties.size(), 1);
+ for (PropertyService ps : properties) {
+ props.put(ps.getPropName(), ps.getPropValue());
+ }
+ }
if (client) {
- ClientConfig clientConfig = new ClientConfig();
- clientConfig.setConfigName(configName);
- clientConfig.setPreHandlerChains(new
CopyOnWriteArrayList<UnifiedHandlerChainMetaData>(preHandlerChains));
- clientConfig.setPostHandlerChains(new
CopyOnWriteArrayList<UnifiedHandlerChainMetaData>(postHandlerChains));
- serverConfig.addClientConfig(clientConfig);
+ ClientConfig clientConfig = new ClientConfig(configName, preHandlerChains,
postHandlerChains, props, null);
+ serverConfig.registerClientConfig(clientConfig);
config = clientConfig;
} else {
- EndpointConfig endpointConfig = new EndpointConfig();
- endpointConfig.setConfigName(configName);
- endpointConfig.setPreHandlerChains(new
CopyOnWriteArrayList<UnifiedHandlerChainMetaData>(preHandlerChains));
- endpointConfig.setPostHandlerChains(new
CopyOnWriteArrayList<UnifiedHandlerChainMetaData>(postHandlerChains));
- serverConfig.addEndpointConfig(endpointConfig);
+ EndpointConfig endpointConfig = new EndpointConfig(configName, preHandlerChains,
postHandlerChains, props, null);
+ serverConfig.registerEndpointConfig(endpointConfig);
config = endpointConfig;
}
}
@@ -85,9 +88,9 @@
@Override
public void stop(final StopContext context) {
if (client) {
- serverConfig.getClientConfigs().remove(config);
+ serverConfig.unregisterClientConfig((ClientConfig)config);
} else {
- serverConfig.getEndpointConfigs().remove(config);
+ serverConfig.unregisterEndpointConfig((EndpointConfig)config);
}
}
@@ -99,4 +102,8 @@
return new ListInjector<UnifiedHandlerChainMetaData>(postHandlerChains);
}
+ public Injector<PropertyService> getPropertiesInjector() {
+ return new ListInjector<PropertyService>(properties);
+ }
+
}
Modified:
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/PropertyService.java
===================================================================
---
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/PropertyService.java 2013-12-04
21:32:22 UTC (rev 18133)
+++
container/jboss72/branches/jbossws-jboss720-JBWS-3739/server-integration/src/main/java/org/jboss/as/webservices/service/PropertyService.java 2013-12-04
21:33:50 UTC (rev 18134)
@@ -25,19 +25,16 @@
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
-import org.jboss.msc.value.InjectedValue;
-import org.jboss.wsf.spi.metadata.config.AbstractCommonConfig;
/**
- * A service for setting a property into an endpoint / client config.
+ * A service for getting a property to be stored in endpoint / client config.
*
* @author <a href="mailto:alessio.soldano@jboss.com">Alessio
Soldano</a>
*/
-public final class PropertyService<T extends AbstractCommonConfig> implements
Service<String> {
+public final class PropertyService implements Service<PropertyService> {
- private InjectedValue<T> abstractCommonConfig = new InjectedValue<T>();
- private final String propValue;
private final String propName;
+ private final String propValue;
public PropertyService(String propName, String propValue) {
this.propValue = propValue;
@@ -45,29 +42,25 @@
}
@Override
- public String getValue() {
+ public PropertyService getValue() {
+ return this;
+ }
+
+ public String getPropName() {
+ return propName;
+ }
+
+ public String getPropValue() {
return propValue;
}
@Override
public void start(final StartContext context) throws StartException {
- final AbstractCommonConfig commonConfig = abstractCommonConfig.getValue();
- synchronized (commonConfig) { //JBWS-3707
- commonConfig.setProperty(propName, propValue);
- }
+ //NOOP
}
@Override
public void stop(final StopContext context) {
- final AbstractCommonConfig commonConfig = abstractCommonConfig.getValue();
- synchronized (commonConfig) { //JBWS-3707
- if (commonConfig.getProperties().containsKey(propName)) {
- commonConfig.getProperties().remove(propName);
- }
- }
+ //NOOP
}
-
- public InjectedValue<T> getAbstractCommonConfig() {
- return abstractCommonConfig;
- }
}