Author: ffang
Date: Mon Jun 3 08:26:30 2013
New Revision: 1488890
URL: http://svn.apache.org/r1488890
Log:
[CXF-5049]Support for schema compiler options in DynamicClientFactory
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Modified:
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1488890&r1=1488889&r2=1488890&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
(original)
+++
cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Mon Jun 3 08:26:30 2013
@@ -133,6 +133,7 @@ public class DynamicClientFactory {
private boolean allowRefs;
private Map<String, Object> jaxbContextProperties;
+ private String[] schemaCompilerOptions;
protected DynamicClientFactory(Bus bus) {
this.bus = bus;
@@ -150,6 +151,10 @@ public class DynamicClientFactory {
allowRefs = b;
}
+ public void setSchemaCompilerOptions(String[] options) {
+ this.schemaCompilerOptions = options;
+ }
+
/**
* Create a new instance using a specific <tt>Bus</tt>.
*
@@ -278,8 +283,6 @@ public class DynamicClientFactory {
return createClient(wsdlUrl.toString(), service, classLoader, port,
bindingFiles);
}
-
-
public Client createClient(String wsdlUrl, QName service,
ClassLoader classLoader, QName port,
List<String> bindingFiles) {
@@ -300,8 +303,7 @@ public class DynamicClientFactory {
//all SI's should have the same schemas
SchemaCollection schemas =
svc.getServiceInfos().get(0).getXmlSchemaCollection();
- SchemaCompiler compiler =
- JAXBUtils.createSchemaCompilerWithDefaultAllocator(new
HashSet<String>());
+ SchemaCompiler compiler = createSchemaCompiler();
InnerErrorListener listener = new InnerErrorListener(wsdlUrl);
Object elForRun = ReflectionInvokationHandler
@@ -416,6 +418,15 @@ public class DynamicClientFactory {
return false;
}
+ protected SchemaCompiler createSchemaCompiler() {
+ SchemaCompiler compiler =
+ JAXBUtils.createSchemaCompilerWithDefaultAllocator(new
HashSet<String>());
+ if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0)
{
+ compiler.getOptions().parseArguments(schemaCompilerOptions);
+ }
+ return compiler;
+ }
+
private void addBindingFiles(List<String> bindingFiles, SchemaCompiler
compiler) {
if (bindingFiles != null) {
for (String s : bindingFiles) {
@@ -795,8 +806,7 @@ public class DynamicClientFactory {
public void setJaxbContextProperties(Map<String, Object>
jaxbContextProperties) {
this.jaxbContextProperties = jaxbContextProperties;
}
-
-
+
private void hackInNewInternalizationLogic(SchemaCompiler schemaCompiler,
final OASISCatalogManager
catalog) {
try {