You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Richard Sitze <rs...@us.ibm.com> on 2002/09/26 23:14:10 UTC
SUBMIT REQUEST FOR INCLUSION TO R 1.0: EngineConfigurationFactoryFinder.java
corrections (13005)
Let me try again... with a more appropriate subject line. Diffs follow.
I've corrected 13005, which enables the system property
axis.EngineConfigFactory override.
My +1 to put this in 1.0...
FYI, I can live without it, but there will be some users upset with me
(since I knocked it out in the first place) if it's not in 1.0. In
particular, 13005 documents that BEA's WebLogic has problems with the new
service mechanism (and I don't understand that).
<ras>
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
rsitze 2002/09/26 12:40:54
Modified: java/src/org/apache/axis/configuration
EngineConfigurationFactoryFinder.java
Added: java/src/org/apache/axis/discovery
DiscoverOldNamesInManagedProperties.java
Log:
Re-introduce lost axis.EngineConfigFactory property support.
Revision Changes Path
1.1
xml-axis/java/src/org/apache/axis/discovery/DiscoverOldNamesInManagedProperties.java
Index: DiscoverOldNamesInManagedProperties.java
===================================================================
/*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software
itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products
derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.axis.discovery;
import java.util.HashMap;
import org.apache.axis.EngineConfigurationFactory;
import org.apache.commons.discovery.ResourceNameDiscover;
import org.apache.commons.discovery.ResourceNameIterator;
import org.apache.commons.discovery.log.DiscoveryLogFactory;
import
org.apache.commons.discovery.resource.names.ResourceNameDiscoverImpl;
import org.apache.commons.discovery.tools.ManagedProperties;
import org.apache.commons.logging.Log;
/**
* Recover resource name from Managed Properties,
* using OLD property names.
*
* This class maintains a mapping between old names and
* (new) the class names they represent. The discovery
* mechanism uses the class names as property names.
*
* @see org.apache.commons.discovery.tools.ManagedProperties
*
* @author Richard A. Sitze
*/
public class DiscoverOldNamesInManagedProperties
extends ResourceNameDiscoverImpl
implements ResourceNameDiscover
{
private static Log log =
DiscoveryLogFactory.newLog(DiscoverOldNamesInManagedProperties.class);
public static void setLog(Log _log) {
log = _log;
}
static HashMap mapping = new HashMap();
static {
// mapping.put("new.class.Name", "oldName");
mapping.put(EngineConfigurationFactory.class.getName(),
EngineConfigurationFactory.SYSTEM_PROPERTY_NAME);
}
/** Construct a new resource discoverer
*/
public DiscoverOldNamesInManagedProperties() {
}
/**
* @return Enumeration of ResourceInfo
*/
public ResourceNameIterator findResourceNames(final String
resourceName) {
final String mappedName = (String)mapping.get(resourceName);
if (log.isDebugEnabled()) {
if (mappedName == null) {
log.debug("find: resourceName='" + resourceName + "', no
mapping");
} else {
log.debug("find: resourceName='" + resourceName + "',
lookup property '" + mappedName + "'");
}
}
return new ResourceNameIterator() {
private String resource =
(mappedName == null) ? null :
ManagedProperties.getProperty(mappedName);
public boolean hasNext() {
return resource != null;
}
public String nextResourceName() {
String element = resource;
resource = null;
return element;
}
};
}
}
1.13 +10 -2
xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryFinder.java
Index: EngineConfigurationFactoryFinder.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryFinder.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- EngineConfigurationFactoryFinder.java 18 Sep 2002
16:10:30 -0000 1.12
+++ EngineConfigurationFactoryFinder.java 26 Sep 2002
19:40:53 -0000 1.13
@@ -61,12 +61,15 @@
import org.apache.axis.EngineConfigurationFactory;
import org.apache.axis.components.logger.LogFactory;
+import org.apache.axis.discovery.DiscoverOldNamesInManagedProperties;
import org.apache.axis.utils.Messages;
import org.apache.commons.discovery.ResourceClassIterator;
import org.apache.commons.discovery.ResourceNameIterator;
import org.apache.commons.discovery.resource.ClassLoaders;
import org.apache.commons.discovery.resource.classes.DiscoverClasses;
+import
org.apache.commons.discovery.resource.names.DiscoverNamesInManagedProperties;
import
org.apache.commons.discovery.resource.names.DiscoverServiceNames;
+import org.apache.commons.discovery.resource.names.NameDiscoverers;
import org.apache.commons.discovery.tools.ClassUtils;
import org.apache.commons.logging.Log;
@@ -146,13 +149,18 @@
ClassLoaders loaders =
ClassLoaders.getAppLoaders(mySpi,
myFactory, true);
- ResourceNameIterator it =
- new
DiscoverServiceNames(loaders).findResourceNames(mySpi.getName());
+ NameDiscoverers nameDiscoverers = new
NameDiscoverers();
+ nameDiscoverers.addResourceNameDiscover(new
DiscoverServiceNames(loaders));
+ nameDiscoverers.addResourceNameDiscover(new
DiscoverNamesInManagedProperties());
+ nameDiscoverers.addResourceNameDiscover(new
DiscoverOldNamesInManagedProperties());
+
+ ResourceNameIterator it =
nameDiscoverers.findResourceNames(mySpi.getName());
ResourceClassIterator services =
new
DiscoverClasses(loaders).findResourceClasses(it);
EngineConfigurationFactory factory = null;
+
while (factory == null && services.hasNext())
{
Class service =
services.nextResourceClass().loadClass();