You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/06/18 20:01:35 UTC
svn commit: r956071 - in /cxf/branches/2.2.x-fixes: ./
common/common/src/main/java/org/apache/cxf/common/util/
rt/core/src/main/java/org/apache/cxf/endpoint/
rt/core/src/main/java/org/apache/cxf/service/factory/
rt/frontend/simple/src/main/java/org/apa...
Author: dkulp
Date: Fri Jun 18 18:01:35 2010
New Revision: 956071
URL: http://svn.apache.org/viewvc?rev=956071&view=rev
Log:
Merged revisions 956067 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r956067 | dkulp | 2010-06-18 13:47:10 -0400 (Fri, 18 Jun 2010) | 2 lines
[CXF-2851] Reconfigure how schemaLocations are handled
Patch from Nilup Bandara applied
........
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/WeakIdentityHashMap.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/WeakIdentityHashMap.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/WeakIdentityHashMap.java?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/WeakIdentityHashMap.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/WeakIdentityHashMap.java Fri Jun 18 18:01:35 2010
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.common.util;
+import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.Collection;
@@ -138,11 +139,10 @@ public class WeakIdentityHashMap<K, V> i
}
private synchronized void reap() {
- Object zombie = queue.poll();
+ Reference<? extends K> zombie = queue.poll();
while (zombie != null) {
- IdentityWeakReference victim = (IdentityWeakReference)zombie;
- backingStore.remove(victim);
+ backingStore.remove(zombie);
zombie = queue.poll();
}
}
Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java Fri Jun 18 18:01:35 2010
@@ -127,14 +127,14 @@ public class EndpointImpl extends Abstra
BindingFactory bf = null;
try {
bf = bus.getExtension(BindingFactoryManager.class).getBindingFactory(namespace);
+ if (null == bf) {
+ Message msg = new Message("NO_BINDING_FACTORY", BUNDLE, namespace);
+ throw new EndpointException(msg);
+ }
binding = bf.createBinding(bi);
} catch (BusException ex) {
throw new EndpointException(ex);
}
- if (null == bf) {
- Message msg = new Message("NO_BINDING_FACTORY", BUNDLE, namespace);
- throw new EndpointException(msg);
- }
}
}
Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/AbstractServiceFactoryBean.java Fri Jun 18 18:01:35 2010
@@ -19,15 +19,34 @@
package org.apache.cxf.service.factory;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+
import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.databinding.AbstractDataBinding;
import org.apache.cxf.databinding.DataBinding;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
import org.apache.cxf.interceptor.OutgoingChainInterceptor;
import org.apache.cxf.interceptor.ServiceInvokerInterceptor;
+import org.apache.cxf.resource.ResourceManager;
+import org.apache.cxf.resource.URIResolver;
import org.apache.cxf.service.Service;
public abstract class AbstractServiceFactoryBean {
+ private static final Logger LOG = LogUtils.getL7dLogger(AbstractServiceFactoryBean.class);
+
protected boolean dataBindingSet;
+ protected List<String> schemaLocations;
private Bus bus;
private DataBinding dataBinding;
@@ -42,6 +61,9 @@ public abstract class AbstractServiceFac
}
protected void initializeDataBindings() {
+ if (getDataBinding() instanceof AbstractDataBinding && schemaLocations != null) {
+ fillDataBindingSchemas();
+ }
dataBinding.initialize(getService());
service.setDataBinding(dataBinding);
@@ -80,5 +102,33 @@ public abstract class AbstractServiceFac
protected void setService(Service service) {
this.service = service;
}
+
+ private void fillDataBindingSchemas() {
+ ResourceManager rr = getBus().getExtension(ResourceManager.class);
+ List<DOMSource> schemas = new ArrayList<DOMSource>();
+ for (String l : schemaLocations) {
+ URL url = rr.resolveResource(l, URL.class);
+ if (url == null) {
+ URIResolver res;
+ try {
+ res = new URIResolver(l);
+ } catch (IOException e) {
+ throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG, l), e);
+ }
+ if (!res.isResolved()) {
+ throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG, l));
+ }
+ url = res.getURL();
+ }
+ Document d;
+ try {
+ d = DOMUtils.readXml(url.openStream());
+ } catch (Exception e) {
+ throw new ServiceConstructionException(new Message("ERROR_READING_SCHEMA", LOG, l), e);
+ }
+ schemas.add(new DOMSource(d, url.toString()));
+ }
+ ((AbstractDataBinding)getDataBinding()).setSchemas(schemas);
+ }
}
Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties (original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/service/factory/Messages.properties Fri Jun 18 18:01:35 2010
@@ -19,3 +19,5 @@
#
#
NO_METHOD_FOR_OP=No method was found for the WSDL operation {0}.
+INVALID_SCHEMA_URL=Could not load schema {0}
+ERROR_READING_SCHEMA=There was an error reading the schema {0}.
\ No newline at end of file
Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties Fri Jun 18 18:01:35 2010
@@ -19,4 +19,4 @@
#
#
COULD.NOT.RESOLVE.BINDING=Could not resolve a binding for {0}
-ERROR_READING_SCHEMA=There was an error reading the schema {0}.
\ No newline at end of file
+
Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Fri Jun 18 18:01:35 2010
@@ -19,7 +19,6 @@
package org.apache.cxf.service.factory;
-import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
@@ -53,11 +52,9 @@ import javax.xml.bind.annotation.XmlList
import javax.xml.bind.annotation.XmlMimeType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
-import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
-import org.w3c.dom.Document;
import org.apache.cxf.BusException;
import org.apache.cxf.binding.BindingFactoryManager;
@@ -70,7 +67,6 @@ import org.apache.cxf.common.util.String
import org.apache.cxf.common.xmlschema.SchemaCollection;
import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
import org.apache.cxf.common.xmlschema.XmlSchemaValidationManager;
-import org.apache.cxf.databinding.AbstractDataBinding;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.databinding.source.mime.MimeAttribute;
import org.apache.cxf.databinding.source.mime.MimeSerializer;
@@ -83,14 +79,12 @@ import org.apache.cxf.frontend.FaultInfo
import org.apache.cxf.frontend.MethodDispatcher;
import org.apache.cxf.frontend.SimpleMethodDispatcher;
import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.MethodComparator;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.FaultOutInterceptor;
import org.apache.cxf.jaxb.JAXBDataBinding;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.resource.ResourceManager;
-import org.apache.cxf.resource.URIResolver;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.ServiceImpl;
import org.apache.cxf.service.ServiceModelSchemaValidator;
@@ -119,11 +113,12 @@ import org.apache.ws.commons.schema.XmlS
import org.apache.ws.commons.schema.XmlSchemaObject;
import org.apache.ws.commons.schema.XmlSchemaObjectTable;
import org.apache.ws.commons.schema.XmlSchemaSequence;
-
import org.apache.ws.commons.schema.XmlSchemaType;
import org.apache.ws.commons.schema.constants.Constants;
import org.apache.ws.commons.schema.utils.NamespaceMap;
+
+
/**
* Introspects a class and builds a {@link Service} from it. If a WSDL URL is
* specified, a Service model will be directly from the WSDL and then metadata
@@ -180,7 +175,6 @@ public class ReflectionServiceFactoryBea
private Map<Method, Boolean> isRpcCache = new HashMap<Method, Boolean>();
private String styleCache;
private Boolean defWrappedCache;
- private List<String> schemaLocations;
public ReflectionServiceFactoryBean() {
getServiceConfigurations().add(0, new DefaultServiceConfiguration());
@@ -228,39 +222,6 @@ public class ReflectionServiceFactoryBea
}
retVal = db;
}
- if (retVal instanceof AbstractDataBinding && schemaLocations != null) {
- ResourceManager rr = getBus().getExtension(ResourceManager.class);
-
- List<DOMSource> schemas = new ArrayList<DOMSource>();
- for (String l : schemaLocations) {
- URL url = rr.resolveResource(l, URL.class);
-
- if (url == null) {
- URIResolver res;
- try {
- res = new URIResolver(l);
- } catch (IOException e) {
- throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG, l), e);
- }
-
- if (!res.isResolved()) {
- throw new ServiceConstructionException(new Message("INVALID_SCHEMA_URL", LOG, l));
- }
- url = res.getURL();
- }
-
- Document d;
- try {
- d = DOMUtils.readXml(url.openStream());
- } catch (Exception e) {
- throw new ServiceConstructionException(
- new Message("ERROR_READING_SCHEMA", LOG, l), e);
- }
- schemas.add(new DOMSource(d, url.toString()));
- }
-
- ((AbstractDataBinding)retVal).setSchemas(schemas);
- }
return retVal;
}
public void reset() {
Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties?rev=956071&r1=956070&r2=956071&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/SimpleMessages.properties Fri Jun 18 18:01:35 2010
@@ -33,4 +33,4 @@ INTRACTABLE_PART= Message part {0} of Me
JAXWS_ANNOTATION_FOUND=A JAX-WS Annotation was found on {0} while using the Simple frontend. For better results, use the JAX-WS frontend.
XSD_VALIDATION_ERROR= Error in W3C XML Schema associated with service: {0}
COULD_NOT_UNWRAP=Could not unwrap Operation {0} to match method "{1}"
-INVALID_SCHEMA_URL=Could not load schema {0}
\ No newline at end of file
+