Author: asoldano
Date: 2013-12-04 09:51:10 -0500 (Wed, 04 Dec 2013)
New Revision: 18127
Added:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java
Modified:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java
Log:
[JBWS-3708] Adding CommonConfigStore facility for dealing with collections of
client/endpoint configs and their modifications
Added:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java
===================================================================
---
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java
(rev 0)
+++
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java 2013-12-04
14:51:10 UTC (rev 18127)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.spi.management;
+
+import java.util.Collection;
+
+import org.jboss.wsf.spi.metadata.config.AbstractCommonConfig;
+
+
+/**
+ * A store of client/endpoint config
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 04-Dec-2013
+ */
+public interface CommonConfigStore<T extends AbstractCommonConfig>
+{
+ /**
+ * Registers a config in the store; the new config will affect runtime the first time
the store is reloaded.
+ *
+ * @param config
+ */
+ void register(T config);
+
+ /**
+ * Unregisters a config in the store; the runtime will be affected the first time the
store is reloaded.
+ *
+ * @param config
+ */
+ void unregister(T config);
+
+ /**
+ * Reloads the store, which involves iterating over the registered configs and
creating a collection that is
+ * returned when calling getConfig(..) / getConfigs().
+ */
+ void reload();
+
+ /**
+ * Unloads the store, cleaning up the loaded collection.
+ */
+ void unload();
+
+ /**
+ * Sets a wrapper config, to be merged with any registered config.
+ *
+ * @param config
+ * @param reload Whether to reload the store after having set the wrapper or not
+ */
+ void setWrapperConfig(T config, boolean reload);
+
+ /**
+ * Returns current wrapper config
+ *
+ * @return
+ */
+ T getWrapperConfig();
+
+ /**
+ * Retrieves a config by name from the loaded collection
+ *
+ * @param name
+ * @return
+ */
+ T getConfig(String name);
+
+ /**
+ * Returns the loaded config collection
+ *
+ * @return
+ */
+ Collection<T> getConfigs();
+}
Property changes on:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/CommonConfigStore.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java
===================================================================
---
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java 2013-12-04
13:12:24 UTC (rev 18126)
+++
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/management/ServerConfig.java 2013-12-04
14:51:10 UTC (rev 18127)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,7 +23,6 @@
import java.io.File;
import java.net.UnknownHostException;
-import java.util.List;
import org.jboss.wsf.spi.metadata.config.ClientConfig;
import org.jboss.wsf.spi.metadata.config.EndpointConfig;
@@ -67,16 +66,58 @@
void setModifySOAPAddress(boolean flag);
/**
- * Adds a provided endpoint config to the server configuration; the provided
EndpoinConfig instance
- * is cloned into a new instance which is actually stored in the server configuration.
+ * Register a client config in the server configuration; the new config will apply to
runtime when the server config is started
+ * or after a client config store reload.
*
* @param config
*/
- void addEndpointConfig(EndpointConfig config);
+ void registerClientConfig(ClientConfig config);
- List<EndpointConfig> getEndpointConfigs();
+ /**
+ * Unregister a client config from the server configuration; the new config will be
removed from
+ * the collection returned to callers after next endpoint store reload.
+ *
+ * @param config
+ */
+ void unregisterClientConfig(ClientConfig config);
- void addClientConfig(ClientConfig config);
+ /**
+ * Reloads the client config store
+ */
+ void reloadClientConfigs();
- List<ClientConfig> getClientConfigs();
+ /**
+ * Get a client config by name
+ *
+ * @return
+ */
+ ClientConfig getClientConfig(String name);
+
+ /**
+ * Register an endpoint config in the server configuration; the new config will apply
to runtime when the server config is started
+ * or after an endpoint config store reload.
+ *
+ * @param config
+ */
+ void registerEndpointConfig(EndpointConfig config);
+
+ /**
+ * Unregister an endpoint config from the server configuration; the new config will be
removed from
+ * the collection returned to callers after next endpoint store reload.
+ *
+ * @param config
+ */
+ void unregisterEndpointConfig(EndpointConfig config);
+
+ /**
+ * Reloads the endpoint config store
+ */
+ void reloadEndpointConfigs();
+
+ /**
+ * Get an endpoint config by name
+ *
+ * @return
+ */
+ EndpointConfig getEndpointConfig(String name);
}
Modified:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java
===================================================================
---
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java 2013-12-04
13:12:24 UTC (rev 18126)
+++
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/AbstractCommonConfig.java 2013-12-04
14:51:10 UTC (rev 18127)
@@ -21,7 +21,9 @@
*/
package org.jboss.wsf.spi.metadata.config;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -72,6 +74,84 @@
this.postHandlerChains = Collections.emptyList();
}
}
+
+ protected AbstractCommonConfig(AbstractCommonConfig base, AbstractCommonConfig conf)
+ {
+ super();
+ this.configName = base.getConfigName();
+ if (conf.features != null && !conf.features.isEmpty())
+ {
+ Map<String, Feature> map;
+ if (base.features.isEmpty())
+ {
+ map = conf.features;
+ }
+ else
+ {
+ map = new HashMap<String, Feature>(base.features);
+ map.putAll(conf.features);
+ }
+ this.features = Collections.unmodifiableMap(map);
+ }
+ else
+ {
+ this.features = Collections.emptyMap();
+ }
+ if (conf.properties != null && !conf.properties.isEmpty())
+ {
+ Map<String, String> map;
+ if (base.properties.isEmpty())
+ {
+ map = conf.properties;
+ }
+ else
+ {
+ map = new HashMap<String, String>(base.properties);
+ map.putAll(conf.properties);
+ }
+ this.properties = Collections.unmodifiableMap(map);
+ }
+ else
+ {
+ this.properties = Collections.emptyMap();
+ }
+ if (conf.preHandlerChains != null && !conf.preHandlerChains.isEmpty())
+ {
+ List<UnifiedHandlerChainMetaData> list;
+ if (base.preHandlerChains.isEmpty())
+ {
+ list = conf.preHandlerChains;
+ }
+ else
+ {
+ list = new
ArrayList<UnifiedHandlerChainMetaData>(base.preHandlerChains);
+ list.addAll(conf.preHandlerChains);
+ }
+ this.preHandlerChains = Collections.unmodifiableList(list);
+ }
+ else
+ {
+ this.preHandlerChains = Collections.emptyList();
+ }
+ if (conf.postHandlerChains != null && !conf.postHandlerChains.isEmpty())
+ {
+ List<UnifiedHandlerChainMetaData> list;
+ if (base.postHandlerChains.isEmpty())
+ {
+ list = conf.postHandlerChains;
+ }
+ else
+ {
+ list = new
ArrayList<UnifiedHandlerChainMetaData>(base.postHandlerChains);
+ list.addAll(preHandlerChains);
+ }
+ this.postHandlerChains = Collections.unmodifiableList(list);
+ }
+ else
+ {
+ this.postHandlerChains = Collections.emptyList();
+ }
+ }
public List<UnifiedHandlerChainMetaData> getPostHandlerChains()
{
Modified:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java
===================================================================
---
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java 2013-12-04
13:12:24 UTC (rev 18126)
+++
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/ClientConfig.java 2013-12-04
14:51:10 UTC (rev 18127)
@@ -42,4 +42,8 @@
{
super(configName, preHandlerChains, postHandlerChains, properties, features);
}
+
+ public ClientConfig(ClientConfig base, ClientConfig conf) {
+ super(base, conf);
+ }
}
Modified:
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java
===================================================================
---
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java 2013-12-04
13:12:24 UTC (rev 18126)
+++
spi/branches/JBWS-3739/src/main/java/org/jboss/wsf/spi/metadata/config/EndpointConfig.java 2013-12-04
14:51:10 UTC (rev 18127)
@@ -42,4 +42,8 @@
{
super(configName, preHandlerChains, postHandlerChains, properties, features);
}
+
+ public EndpointConfig(EndpointConfig base, EndpointConfig conf) {
+ super(base, conf);
+ }
}