You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/03/06 14:21:52 UTC
svn commit: r634264 - in /webservices/axis2/trunk/java/modules/kernel:
conf/axis2.xml src/org/apache/axis2/deployment/AxisConfigBuilder.java
src/org/apache/axis2/deployment/DeploymentConstants.java
src/org/apache/axis2/util/ThreadContextMigratorUtil.java
Author: pradine
Date: Thu Mar 6 05:21:51 2008
New Revision: 634264
URL: http://svn.apache.org/viewvc?rev=634264&view=rev
Log:
Fix for AXIS2-3549.
Modified:
webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/ThreadContextMigratorUtil.java
Modified: webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml?rev=634264&r1=634263&r2=634264&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml Thu Mar 6 05:21:51 2008
@@ -103,6 +103,13 @@
<!-- <listener class="org.apache.axis2.ObserverIMPL">-->
<!-- <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>-->
<!-- </listener>-->
+
+ <!-- Uncomment if JAX-WS 2.1 support is needed. -->
+ <!--
+ <threadContextMigrators>
+ <threadContextMigrator listId="JAXWS-ThreadContextMigrator-List" class="org.apache.axis2.jaxws.addressing.migrator.EndpointContextMapMigrator"/>
+ </threadContextMigrators>
+ -->
<!-- ================================================= -->
<!-- Message Receivers -->
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?rev=634264&r1=634263&r2=634264&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Thu Mar 6 05:21:51 2008
@@ -53,6 +53,8 @@
import org.apache.axis2.util.JavaUtils;
import org.apache.axis2.util.Loader;
import org.apache.axis2.util.TargetResolver;
+import org.apache.axis2.util.ThreadContextMigrator;
+import org.apache.axis2.util.ThreadContextMigratorUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -128,6 +130,11 @@
config_element.getFirstChildWithName(new QName(TAG_TARGET_RESOLVERS));
processTargetResolvers(axisConfig, targetResolvers);
+ // Process ThreadContextMigrators
+ OMElement threadContextMigrators =
+ config_element.getFirstChildWithName(new QName(TAG_THREAD_CONTEXT_MIGRATORS));
+ processThreadContextMigrators(axisConfig, threadContextMigrators);
+
// Process Observers
Iterator obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
@@ -263,6 +270,32 @@
if (log.isTraceEnabled()) {
log.trace(
"processTargetResolvers: Exception thrown initialising TargetResolver: " +
+ e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ private void processThreadContextMigrators(AxisConfiguration axisConfig, OMElement targetResolvers) {
+ if (targetResolvers != null) {
+ Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_THREAD_CONTEXT_MIGRATOR));
+ while (iterator.hasNext()) {
+ OMElement threadContextMigrator = (OMElement) iterator.next();
+ OMAttribute listIdAttribute =
+ threadContextMigrator.getAttribute(new QName(TAG_LIST_ID));
+ String listId = listIdAttribute.getAttributeValue();
+ OMAttribute classNameAttribute =
+ threadContextMigrator.getAttribute(new QName(TAG_CLASS_NAME));
+ String className = classNameAttribute.getAttributeValue();
+ try {
+ Class clazz = Loader.loadClass(className);
+ ThreadContextMigrator migrator = (ThreadContextMigrator) clazz.newInstance();
+ ThreadContextMigratorUtil.addThreadContextMigrator(axisConfig, listId, migrator);
+ } catch (Exception e) {
+ if (log.isTraceEnabled()) {
+ log.trace(
+ "processThreadContextMigrators: Exception thrown initialising ThreadContextMigrator: " +
e.getMessage());
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=634264&r1=634263&r2=634264&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Thu Mar 6 05:21:51 2008
@@ -50,6 +50,8 @@
String TAG_TYPE = "type";
String TAG_TARGET_RESOLVERS = "targetResolvers";
String TAG_TARGET_RESOLVER = "targetResolver";
+ String TAG_THREAD_CONTEXT_MIGRATORS = "threadContextMigrators";
+ String TAG_THREAD_CONTEXT_MIGRATOR = "threadContextMigrator";
String TAG_TRANSPORT_SENDER = "transportSender";
String TAG_TRANSPORT_RECEIVER = "transportReceiver";
String TAG_SERVICE_GROUP = "serviceGroup";
@@ -91,6 +93,7 @@
String TAG_DISPATCHER = "dispatcher";
String TAG_DESCRIPTION = "Description";
String TAG_CLASS_NAME = "class";
+ String TAG_LIST_ID = "listId";
String TAG_EXCLUDE_PROPERTIES= "excludeProperties";
String TAG_INCLUDE_PROPERTIES= "includeProperties";
String TAG_AFTER = "after";
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/ThreadContextMigratorUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/ThreadContextMigratorUtil.java?rev=634264&r1=634263&r2=634264&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/ThreadContextMigratorUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/ThreadContextMigratorUtil.java Thu Mar 6 05:21:51 2008
@@ -22,6 +22,8 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
import java.util.LinkedList;
import java.util.List;
@@ -37,21 +39,40 @@
* Register a new ThreadContextMigrator.
*
* @param configurationContext
- * @param threadContextMigratorListID The name of the property in the
- * ConfigurationContext that contains
+ * @param threadContextMigratorListID The name of the parameter in the
+ * AxisConfiguration that contains
* the list of migrators.
* @param migrator
*/
public static void addThreadContextMigrator(ConfigurationContext configurationContext,
String threadContextMigratorListID,
- ThreadContextMigrator migrator) {
- List migratorList = (List) configurationContext.getProperty(threadContextMigratorListID);
+ ThreadContextMigrator migrator)
+ throws AxisFault {
+ AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
+ addThreadContextMigrator(axisConfiguration, threadContextMigratorListID, migrator);
+ }
- if (migratorList == null) {
- migratorList = new LinkedList();
- configurationContext.setProperty(threadContextMigratorListID, migratorList);
+ /**
+ * Register a new ThreadContextMigrator.
+ *
+ * @param axisConfiguration
+ * @param threadContextMigratorListID The name of the parameter in the
+ * AxisConfiguration that contains
+ * the list of migrators.
+ * @param migrator
+ */
+ public static void addThreadContextMigrator(AxisConfiguration axisConfiguration,
+ String threadContextMigratorListID,
+ ThreadContextMigrator migrator)
+ throws AxisFault {
+ Parameter param = axisConfiguration.getParameter(threadContextMigratorListID);
+
+ if (param == null) {
+ param = new Parameter(threadContextMigratorListID, new LinkedList());
+ axisConfiguration.addParameter(param);
}
+ List migratorList = (List) param.getValue();
migratorList.add(migrator);
}
@@ -59,23 +80,25 @@
* Activate any registered ThreadContextMigrators to move context info
* to the thread of execution.
*
- * @param threadContextMigratorListID The name of the property in the
- * ConfigurationContext that contains
+ * @param threadContextMigratorListID The name of the parameter in the
+ * AxisConfiguration that contains
* the list of migrators.
* @param msgContext
* @throws AxisFault
*/
public static void performMigrationToThread(String threadContextMigratorListID,
MessageContext msgContext)
- throws AxisFault {
+ throws AxisFault {
if (msgContext == null) {
return;
}
- List migratorList = (List) msgContext.getConfigurationContext()
- .getProperty(threadContextMigratorListID);
+ AxisConfiguration axisConfiguration =
+ msgContext.getConfigurationContext().getAxisConfiguration();
+ Parameter param = axisConfiguration.getParameter(threadContextMigratorListID);
- if (migratorList != null) {
+ if (param != null) {
+ List migratorList = (List) param.getValue();
ListIterator threadContextMigrators = migratorList.listIterator();
while (threadContextMigrators.hasNext()) {
((ThreadContextMigrator) threadContextMigrators.next())
@@ -88,8 +111,8 @@
* Activate any registered ThreadContextMigrators to remove information
* from the thread of execution if necessary.
*
- * @param threadContextMigratorListID The name of the property in the
- * ConfigurationContext that contains
+ * @param threadContextMigratorListID The name of the parameter in the
+ * AxisConfiguration that contains
* the list of migrators.
* @param msgContext
*/
@@ -99,10 +122,12 @@
return;
}
- List migratorList = (List) msgContext.getConfigurationContext()
- .getProperty(threadContextMigratorListID);
+ AxisConfiguration axisConfiguration =
+ msgContext.getConfigurationContext().getAxisConfiguration();
+ Parameter param = axisConfiguration.getParameter(threadContextMigratorListID);
- if (migratorList != null) {
+ if (param != null) {
+ List migratorList = (List) param.getValue();
ListIterator threadContextMigrators = migratorList.listIterator();
while (threadContextMigrators.hasNext()) {
((ThreadContextMigrator) threadContextMigrators.next()).cleanupThread(msgContext);
@@ -114,23 +139,25 @@
* Activate any registered ThreadContextMigrators to move info from the
* thread of execution into the context.
*
- * @param threadContextMigratorListID The name of the property in the
- * ConfigurationContext that contains
+ * @param threadContextMigratorListID The name of the parameter in the
+ * AxisConfiguration that contains
* the list of migrators.
* @param msgContext
* @throws AxisFault
*/
public static void performMigrationToContext(String threadContextMigratorListID,
MessageContext msgContext)
- throws AxisFault {
+ throws AxisFault {
if (msgContext == null) {
return;
}
- List migratorList = (List) msgContext.getConfigurationContext()
- .getProperty(threadContextMigratorListID);
+ AxisConfiguration axisConfiguration =
+ msgContext.getConfigurationContext().getAxisConfiguration();
+ Parameter param = axisConfiguration.getParameter(threadContextMigratorListID);
- if (migratorList != null) {
+ if (param != null) {
+ List migratorList = (List) param.getValue();
ListIterator threadContextMigrators = migratorList.listIterator();
while (threadContextMigrators.hasNext()) {
((ThreadContextMigrator) threadContextMigrators.next())
@@ -143,8 +170,8 @@
* Activate any registered ThreadContextMigrators to remove information from
* the context if necessary.
*
- * @param threadContextMigratorListID The name of the property in the
- * ConfigurationContext that contains
+ * @param threadContextMigratorListID The name of the parameter in the
+ * AxisConfiguration that contains
* the list of migrators.
* @param msgContext
*/
@@ -154,10 +181,12 @@
return;
}
- List migratorList = (List) msgContext.getConfigurationContext()
- .getProperty(threadContextMigratorListID);
+ AxisConfiguration axisConfiguration =
+ msgContext.getConfigurationContext().getAxisConfiguration();
+ Parameter param = axisConfiguration.getParameter(threadContextMigratorListID);
- if (migratorList != null) {
+ if (param != null) {
+ List migratorList = (List) param.getValue();
ListIterator threadContextMigrators = migratorList.listIterator();
while (threadContextMigrators.hasNext()) {
((ThreadContextMigrator) threadContextMigrators.next()).cleanupContext(msgContext);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org