This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 40fb1f6 Remove deprecated code.
40fb1f6 is described below
commit 40fb1f69b12f8c416d26b848a197cf5f5bc48a83
Author: JamesBognar <[email protected]>
AuthorDate: Tue Oct 13 13:59:33 2020 -0400
Remove deprecated code.
---
.../org/apache/juneau/html/HtmlSerializer.java | 6 +-
.../java/org/apache/juneau/xml/XmlSerializer.java | 67 --
.../apache/juneau/xml/XmlSerializerBuilder.java | 44 --
.../apache/juneau/xml/XmlSerializerSession.java | 13 -
.../apache/juneau/xml/annotation/XmlConfig.java | 21 -
.../juneau/xml/annotation/XmlConfigApply.java | 3 -
.../juneau/xmlschema/XmlSchemaDocSerializer.java | 77 ---
.../xmlschema/XmlSchemaDocSerializerSession.java | 57 --
.../juneau/xmlschema/XmlSchemaSerializer.java | 79 ---
.../xmlschema/XmlSchemaSerializerBuilder.java | 672 ---------------------
.../xmlschema/XmlSchemaSerializerSession.java | 593 ------------------
.../org/apache/juneau/xmlschema/package-info.java | 18 -
.../apache/juneau/rest/jaxrs/BasicProvider.java | 3 -
.../org/apache/juneau/rest/BasicRestConfig.java | 2 -
14 files changed, 5 insertions(+), 1650 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
index 996661e..dafa52c 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/html/HtmlSerializer.java
@@ -754,7 +754,11 @@ public class HtmlSerializer extends XmlSerializer
implements HtmlMetaProvider, H
return new HtmlSerializerSession(this, args);
}
- @Override /* XmlSerializer */
+ /**
+ * Returns the schema serializer.
+ *
+ * @return The schema serializer.
+ */
public HtmlSerializer getSchemaSerializer() {
if (schemaSerializer == null)
schemaSerializer =
builder().build(HtmlSchemaSerializer.class);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
index f40e680..27b7865 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializer.java
@@ -20,7 +20,6 @@ import org.apache.juneau.annotation.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.json.*;
import org.apache.juneau.serializer.*;
-import org.apache.juneau.xmlschema.*;
/**
* Serializes POJO models to XML.
@@ -338,41 +337,6 @@ public class XmlSerializer extends WriterSerializer
implements XmlMetaProvider,
*/
public static final String XML_namespaces = PREFIX + ".namespaces.ls";
- /**
- * Configuration property: XMLSchema namespace.
- *
- * <h5 class='section'>Property:</h5>
- * <ul class='spaced-list'>
- * <li><b>ID:</b> {@link
org.apache.juneau.xml.XmlSerializer#XML_xsNamespace XML_xsNamespace}
- * <li><b>Name:</b> <js>"XmlSerializer.xsNamespace.s"</js>
- * <li><b>Data type:</b> <c>String</c> ({@link
org.apache.juneau.xml.Namespace})
- * <li><b>System property:</b> <c>XmlSerializer.xsNamespace</c>
- * <li><b>Environment variable:</b>
<c>XMLSERIALIZER_XSNAMESPACE</c>
- * <li><b>Default:</b> <js>"xs:
http://www.w3.org/2001/XMLSchema"</js>
- * <li><b>Session property:</b> <jk>false</jk>
- * <li><b>Annotations:</b>
- * <ul>
- * <li class='ja'>{@link
org.apache.juneau.xml.annotation.XmlConfig#xsNamespace()}
- * </ul>
- * <li><b>Methods:</b>
- * <ul>
- * <li class='jm'>{@link
org.apache.juneau.xml.XmlSerializerBuilder#xsNamespace(Namespace)}
- * </ul>
- * </ul>
- *
- * <h5 class='section'>Description:</h5>
- * <p>
- * Specifies the namespace for the <c>XMLSchema</c> namespace, used by
the schema generated by the
- * {@link XmlSchemaSerializer} class.
- *
- * <ul class='seealso'>
- * <li class='link'>{@doc XmlNamespaces}
- * </ul>
- */
- @Deprecated
- public static final String XML_xsNamespace = PREFIX + ".xsNamespace.s";
-
-
//-------------------------------------------------------------------------------------------------------------------
// Predefined instances
//-------------------------------------------------------------------------------------------------------------------
@@ -506,16 +470,11 @@ public class XmlSerializer extends WriterSerializer
implements XmlMetaProvider,
addNamespaceUrlsToRoot,
addBeanTypes;
private final Namespace defaultNamespace;
- private final Namespace
- xsNamespace;
private final Namespace[] namespaces;
private final Map<ClassMeta<?>,XmlClassMeta> xmlClassMetas = new
ConcurrentHashMap<>();
private final Map<BeanMeta<?>,XmlBeanMeta> xmlBeanMetas = new
ConcurrentHashMap<>();
private final Map<BeanPropertyMeta,XmlBeanPropertyMeta>
xmlBeanPropertyMetas = new ConcurrentHashMap<>();
- @Deprecated
- private volatile XmlSchemaSerializer schemaSerializer;
-
/**
* Constructor.
*
@@ -559,7 +518,6 @@ public class XmlSerializer extends WriterSerializer
implements XmlMetaProvider,
addNamespaceUrlsToRoot =
getBooleanProperty(XML_addNamespaceUrisToRoot, false);
defaultNamespace = getInstanceProperty(XML_defaultNamespace,
Namespace.class, DEFAULT_JUNEAU_NAMESPACE);
addBeanTypes = getBooleanProperty(XML_addBeanTypes,
getBooleanProperty(SERIALIZER_addBeanTypes, false));
- xsNamespace = getInstanceProperty(XML_xsNamespace,
Namespace.class, DEFAULT_XS_NAMESPACE);
namespaces = getInstanceArrayProperty(XML_namespaces,
Namespace.class, new Namespace[0]);
}
@@ -584,17 +542,6 @@ public class XmlSerializer extends WriterSerializer
implements XmlMetaProvider,
return new XmlSerializerBuilder();
}
- /**
- * Returns the schema serializer based on the settings of this
serializer.
- * @return The schema serializer.
- */
- @Deprecated
- public XmlSerializer getSchemaSerializer() {
- if (schemaSerializer == null)
- schemaSerializer =
builder().build(XmlSchemaSerializer.class);
- return schemaSerializer;
- }
-
@Override /* Serializer */
public XmlSerializerSession createSession() {
return createSession(createDefaultSessionArgs());
@@ -711,19 +658,6 @@ public class XmlSerializer extends WriterSerializer
implements XmlMetaProvider,
return namespaces;
}
- /**
- * XMLSchema namespace.
- *
- * @see #XML_xsNamespace
- * @return
- * The namespace for the <c>XMLSchema</c> namespace, used by the
schema generated by the
- * {@link XmlSchemaSerializer} class.
- */
- @Deprecated
- protected final Namespace getXsNamespace() {
- return xsNamespace;
- }
-
//-----------------------------------------------------------------------------------------------------------------
// Other methods
//-----------------------------------------------------------------------------------------------------------------
@@ -736,7 +670,6 @@ public class XmlSerializer extends WriterSerializer
implements XmlMetaProvider,
.a("enableNamespaces", enableNamespaces)
.a("addNamespaceUrlsToRoot",
addNamespaceUrlsToRoot)
.a("defaultNamespace", defaultNamespace)
- .a("xsNamespace", xsNamespace)
.a("namespaces", namespaces)
.a("addBeanTypes", addBeanTypes)
);
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
index 6a7bc79..4aef669 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerBuilder.java
@@ -222,50 +222,6 @@ public class XmlSerializerBuilder extends
WriterSerializerBuilder {
return set(XML_namespaces, Namespace.createArray(values));
}
- /**
- * <i><l>XmlSerializer</l> configuration property: </i> XMLSchema
namespace.
- *
- * <p>
- * Specifies the namespace for the <c>XMLSchema</c> namespace, used by
the schema generated by the
- * {@link org.apache.juneau.xmlschema.XmlSchemaSerializer} class.
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link XmlSerializer#XML_xsNamespace}
- * </ul>
- *
- * @param value
- * The new value for this property.
- * <br>The default is <js>"xs:
http://www.w3.org/2001/XMLSchema"</js>.
- * @return This object (for method chaining).
- */
- @FluentSetter
- @Deprecated
- public XmlSerializerBuilder xsNamespace(Namespace value) {
- return set(XML_xsNamespace, value);
- }
-
- /**
- * <i><l>XmlSerializer</l> configuration property: </i> XMLSchema
namespace.
- *
- * <p>
- * Specifies the namespace for the <c>XMLSchema</c> namespace, used by
the schema generated by the
- * {@link org.apache.juneau.xmlschema.XmlSchemaSerializer} class.
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link XmlSerializer#XML_xsNamespace}
- * </ul>
- *
- * @param value
- * The new value for this property.
- * <br>The default is <js>"xs:
http://www.w3.org/2001/XMLSchema"</js>.
- * @return This object (for method chaining).
- */
- @FluentSetter
- @Deprecated
- public XmlSerializerBuilder xsNamespace(String value) {
- return set(XML_xsNamespace, Namespace.create(value));
- }
-
// <FluentSetters>
@Override /* GENERATED - ContextBuilder */
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
index 636c16c..af0e5b0 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/XmlSerializerSession.java
@@ -811,19 +811,6 @@ public class XmlSerializerSession extends
WriterSerializerSession {
return namespaces;
}
- /**
- * Configuration property: XMLSchema namespace.
- *
- * @see XmlSerializer#XML_xsNamespace
- * @return
- * The namespace for the <c>XMLSchema</c> namespace, used by the
schema generated by the
- * {@link org.apache.juneau.xmlschema.XmlSchemaSerializer} class.
- */
- @Deprecated
- protected final Namespace getXsNamespace() {
- return ctx.getXsNamespace();
- }
-
//-----------------------------------------------------------------------------------------------------------------
// Extended metadata
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
index 13f6554..6d14dff 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfig.java
@@ -24,7 +24,6 @@ import org.apache.juneau.annotation.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.serializer.*;
import org.apache.juneau.xml.*;
-import org.apache.juneau.xmlschema.*;
/**
* Annotation for specifying config properties defined in {@link
XmlSerializer}, {@link XmlDocSerializer}, and {@link XmlParser}.
@@ -315,24 +314,4 @@ public @interface XmlConfig {
* </ul>
*/
String[] namespaces() default {};
-
- /**
- * Configuration property: XMLSchema namespace.
- *
- * <p>
- * Specifies the namespace for the <c>XMLSchema</c> namespace, used by
the schema generated by the
- * {@link XmlSchemaSerializer} class.
- *
- * <ul class='notes'>
- * <li>
- * Supports {@doc DefaultVarResolver} (e.g.
<js>"$C{myConfigVar}"</js>).
- * </ul>
- *
- * <ul class='seealso'>
- * <li class='jf'>{@link XmlSerializer#XML_xsNamespace}
- * <li class='link'>{@doc XmlNamespaces}
- * </ul>
- */
- @Deprecated
- String xsNamespace() default "";
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
index 79c340d..42122f8 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xml/annotation/XmlConfigApply.java
@@ -34,7 +34,6 @@ public class XmlConfigApply extends ConfigApply<XmlConfig> {
super(c, r);
}
- @SuppressWarnings("deprecation")
@Override
public void apply(AnnotationInfo<XmlConfig> ai, PropertyStoreBuilder
psb) {
XmlConfig a = ai.getAnnotation();
@@ -50,8 +49,6 @@ public class XmlConfigApply extends ConfigApply<XmlConfig> {
psb.set(XML_enableNamespaces,
bool(a.enableNamespaces()));
if (a.namespaces().length > 0)
psb.set(XML_namespaces,
Namespace.createArray(strings(a.namespaces())));
- if (! a.xsNamespace().isEmpty())
- psb.set(XML_xsNamespace, string(a.xsNamespace()));
if (a.eventAllocator() != XmlEventAllocator.Null.class)
psb.set(XML_eventAllocator, a.eventAllocator());
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializer.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializer.java
deleted file mode 100644
index 73ea489..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.xmlschema;
-
-import org.apache.juneau.*;
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.collections.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * Serializes POJO metadata to HTTP responses as XML.
- *
- * <h5 class='topic'>Media types</h5>
- *
- * Handles <c>Accept</c> types: <bc>text/xml+schema</bc>
- * <p>
- * Produces <c>Content-Type</c> types: <bc>text/xml</bc>
- *
- * <h5 class='topic'>Description</h5>
- *
- * Same as {@link XmlSchemaSerializer}, except prepends
<code><xt><?xml</xt> <xa>version</xa>=<xs>'1.0'</xs>
- * <xa>encoding</xa>=<xs>'UTF-8'</xs><xt>?></xt></code> to the response to
make it a valid XML document.
- */
-@ConfigurableContext
-@Deprecated
-public class XmlSchemaDocSerializer extends XmlSchemaSerializer {
-
-
//-------------------------------------------------------------------------------------------------------------------
- // Configurable properties
-
//-------------------------------------------------------------------------------------------------------------------
-
- static final String PREFIX = "XmlSchemaDocSerializer";
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Overridden methods
-
//-----------------------------------------------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @param ps The property store containing all the settings for this
object.
- */
- public XmlSchemaDocSerializer(PropertyStore ps) {
- super(ps);
- }
-
- @Override /* Serializer */
- public XmlSchemaSerializerSession createSession() {
- return createSession(createDefaultSessionArgs());
- }
-
- @Override /* Serializer */
- public XmlSchemaSerializerSession createSession(SerializerSessionArgs
args) {
- return new XmlSchemaSerializerSession(this, args);
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Other methods
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Override /* Context */
- public OMap toMap() {
- return super.toMap()
- .a("XmlSchemaDocSerializer", new DefaultFilteringOMap()
- );
- }
-}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java
deleted file mode 100644
index c445d19..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaDocSerializerSession.java
+++ /dev/null
@@ -1,57 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.xmlschema;
-
-import java.io.IOException;
-
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.xml.*;
-
-/**
- * Session object that lives for the duration of a single use of {@link
XmlSchemaDocSerializer}.
- *
- * <p>
- * This class is NOT thread safe.
- * It is typically discarded after one-time use although it can be reused
within the same thread.
- */
-@Deprecated
-public class XmlSchemaDocSerializerSession extends XmlSchemaSerializerSession {
-
- /**
- * Create a new session using properties specified in the context.
- *
- * @param ctx
- * The context creating this session object.
- * The context contains all the configuration settings for this
object.
- * @param args
- * Runtime arguments.
- * These specify session-level information such as locale and URI
context.
- * It also include session-level properties that override the
properties defined on the bean and
- * serializer contexts.
- */
- protected XmlSchemaDocSerializerSession(XmlSchemaDocSerializer ctx,
SerializerSessionArgs args) {
- super(ctx, args);
- }
-
- @Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws
IOException, SerializeException {
- try (XmlWriter w = getXmlWriter(out)) {
- w.append("<?xml")
- .attr("version", "1.0")
- .attr("encoding", "UTF-8")
- .appendln("?>");
- w.flush();
- super.doSerialize(out, o);
- }
- }
-}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializer.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializer.java
deleted file mode 100644
index 194aced..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.xmlschema;
-
-import org.apache.juneau.*;
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.collections.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.xml.*;
-
-/**
- * Serializes POJO metadata to HTTP responses as XML.
- *
- * <h5 class='topic'>Media types</h5>
- *
- * Handles <c>Accept</c> types: <bc>text/xml+schema</bc>
- * <p>
- * Produces <c>Content-Type</c> types: <bc>text/xml</bc>
- *
- * <h5 class='topic'>Description</h5>
- *
- * Produces the XML-schema representation of the XML produced by the {@link
XmlSerializer} class with the same properties.
- */
-@ConfigurableContext
-@Deprecated
-public class XmlSchemaSerializer extends XmlSerializer {
-
-
//-------------------------------------------------------------------------------------------------------------------
- // Configurable properties
-
//-------------------------------------------------------------------------------------------------------------------
-
- static final String PREFIX = "XmlSchemaSerializer";
-
- /**
- * Constructor.
- *
- * @param ps Initialize with the specified config property store.
- */
- public XmlSchemaSerializer(PropertyStore ps) {
- super(
- ps.builder()
- .setDefault(XML_enableNamespaces, true)
- .build(),
- "text/xml",
- "text/xml+schema"
- );
- }
-
- @Override /* Serializer */
- public XmlSchemaSerializerSession createSession() {
- return createSession(createDefaultSessionArgs());
- }
-
- @Override /* Serializer */
- public XmlSchemaSerializerSession createSession(SerializerSessionArgs
args) {
- return new XmlSchemaSerializerSession(this, args);
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Other methods
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Override /* Context */
- public OMap toMap() {
- return super.toMap()
- .a("XmlSchemaSerializer", new DefaultFilteringOMap()
- );
- }
-}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java
deleted file mode 100644
index 3a7a912..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerBuilder.java
+++ /dev/null
@@ -1,672 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.xmlschema;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.nio.charset.*;
-import java.util.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.http.*;
-import org.apache.juneau.reflect.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.svl.*;
-import org.apache.juneau.xml.*;
-
-/**
- * Builder class for building instances of XML Schema serializers.
- */
-@Deprecated
-public class XmlSchemaSerializerBuilder extends XmlSerializerBuilder {
-
- /**
- * Constructor, default settings.
- */
- public XmlSchemaSerializerBuilder() {
- super();
- }
-
- /**
- * Constructor.
- *
- * @param ps The initial configuration settings for this builder.
- */
- public XmlSchemaSerializerBuilder(PropertyStore ps) {
- super(ps);
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializer build() {
- return build(XmlSchemaSerializer.class);
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Properties
-
//-----------------------------------------------------------------------------------------------------------------
-
- // <FluentSetters>
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder addNamespaceUrisToRoot(boolean value)
{
- super.addNamespaceUrisToRoot(value);
- return this;
- }
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder addNamespaceUrisToRoot() {
- super.addNamespaceUrisToRoot();
- return this;
- }
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder autoDetectNamespaces(boolean value) {
- super.autoDetectNamespaces(value);
- return this;
- }
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder defaultNamespace(String value) {
- super.defaultNamespace(value);
- return this;
- }
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder enableNamespaces(boolean value) {
- super.enableNamespaces(value);
- return this;
- }
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder namespaces(Namespace...values) {
- super.namespaces(values);
- return this;
- }
-
- @Override /* XmlSerializerBuilder */
- public XmlSchemaSerializerBuilder xsNamespace(Namespace value) {
- super.xsNamespace(value);
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder fileCharset(Charset value) {
- super.fileCharset(value);
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder maxIndent(int value) {
- super.maxIndent(value);
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder quoteChar(char value) {
- super.quoteChar(value);
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder sq() {
- super.sq();
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder streamCharset(Charset value) {
- super.streamCharset(value);
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder useWhitespace() {
- super.useWhitespace();
- return this;
- }
-
- @Override /* WriterSerializerBuilder */
- public XmlSchemaSerializerBuilder ws() {
- super.ws();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder addBeanTypes() {
- super.addBeanTypes();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder addRootType() {
- super.addRootType();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder detectRecursions(boolean value) {
- super.detectRecursions(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder detectRecursions() {
- super.detectRecursions();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder ignoreRecursions(boolean value) {
- super.ignoreRecursions(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder ignoreRecursions() {
- super.ignoreRecursions();
- return this;
- }
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder initialDepth(int value) {
- super.initialDepth(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder listener(Class<? extends
SerializerListener> value) {
- super.listener(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder maxDepth(int value) {
- super.maxDepth(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder sortCollections() {
- super.sortCollections();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder sortMaps() {
- super.sortMaps();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder trimEmptyCollections() {
- super.trimEmptyCollections();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder trimEmptyMaps() {
- super.trimEmptyMaps();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder trimStrings() {
- super.trimStrings();
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder uriContext(UriContext value) {
- super.uriContext(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder uriRelativity(UriRelativity value) {
- super.uriRelativity(value);
- return this;
- }
-
- @Override /* SerializerBuilder */
- public XmlSchemaSerializerBuilder uriResolution(UriResolution value) {
- super.uriResolution(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder annotations(Annotation...values) {
- super.annotations(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanClassVisibility(Visibility value)
{
- super.beanClassVisibility(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanConstructorVisibility(Visibility
value) {
- super.beanConstructorVisibility(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- @Deprecated
- public XmlSchemaSerializerBuilder beanDictionary(Class<?>...values) {
- super.beanDictionary(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- @Deprecated
- public XmlSchemaSerializerBuilder beanDictionary(Object...values) {
- super.beanDictionary(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- @Deprecated
- public XmlSchemaSerializerBuilder
beanDictionaryReplace(Class<?>...values) {
- super.beanDictionaryReplace(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- @Deprecated
- public XmlSchemaSerializerBuilder
beanDictionaryReplace(Object...values) {
- super.beanDictionaryReplace(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- @Deprecated
- public XmlSchemaSerializerBuilder
beanDictionaryRemove(Class<?>...values) {
- super.beanDictionaryRemove(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- @Deprecated
- public XmlSchemaSerializerBuilder beanDictionaryRemove(Object...values)
{
- super.beanDictionaryRemove(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanFieldVisibility(Visibility value)
{
- super.beanFieldVisibility(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanFilters(Object...values) {
- super.beanFilters(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanFiltersReplace(Object...values) {
- super.beanFiltersReplace(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanFiltersRemove(Object...values) {
- super.beanFiltersRemove(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanMapPutReturnsOldValue(boolean
value) {
- super.beanMapPutReturnsOldValue(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanMapPutReturnsOldValue() {
- super.beanMapPutReturnsOldValue();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beanMethodVisibility(Visibility
value) {
- super.beanMethodVisibility(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder
beansRequireDefaultConstructor(boolean value) {
- super.beansRequireDefaultConstructor(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beansRequireDefaultConstructor() {
- super.beansRequireDefaultConstructor();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beansRequireSerializable(boolean
value) {
- super.beansRequireSerializable(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beansRequireSerializable() {
- super.beansRequireSerializable();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beansRequireSettersForGetters(boolean
value) {
- super.beansRequireSettersForGetters(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beansRequireSettersForGetters() {
- super.beansRequireSettersForGetters();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder beansRequireSomeProperties(boolean
value) {
- super.beansRequireSomeProperties(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpi(Class<?> beanClass, String value)
{
- super.bpi(beanClass, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpi(Map<String,Object> values) {
- super.bpi(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpi(String beanClassName, String
value) {
- super.bpi(beanClassName, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpx(Class<?> beanClass, String
properties) {
- super.bpx(beanClass, properties);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpx(Map<String,Object> values) {
- super.bpx(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpx(String beanClassName, String
value) {
- super.bpx(beanClassName, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpro(Class<?> beanClass, String
value) {
- super.bpro(beanClass, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpro(Map<String,Object> values) {
- super.bpro(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpro(String beanClassName, String
value) {
- super.bpro(beanClassName, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpwo(Class<?> beanClass, String
properties) {
- super.bpwo(beanClass, properties);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpwo(Map<String,Object> values) {
- super.bpwo(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder bpwo(String beanClassName, String
value) {
- super.bpwo(beanClassName, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder debug() {
- super.debug();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder dictionary(Object...values) {
- super.dictionary(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public <T> XmlSchemaSerializerBuilder example(Class<T> c, T o) {
- super.example(c, o);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public <T> XmlSchemaSerializerBuilder exampleJson(Class<T> c, String
value) {
- super.exampleJson(c, value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder
ignoreInvocationExceptionsOnGetters(boolean value) {
- super.ignoreInvocationExceptionsOnGetters(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder ignoreInvocationExceptionsOnGetters()
{
- super.ignoreInvocationExceptionsOnGetters();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder
ignoreInvocationExceptionsOnSetters(boolean value) {
- super.ignoreInvocationExceptionsOnSetters(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder ignoreInvocationExceptionsOnSetters()
{
- super.ignoreInvocationExceptionsOnSetters();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder
ignorePropertiesWithoutSetters(boolean value) {
- super.ignorePropertiesWithoutSetters(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder ignoreUnknownBeanProperties(boolean
value) {
- super.ignoreUnknownBeanProperties(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder ignoreUnknownBeanProperties() {
- super.ignoreUnknownBeanProperties();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder
ignoreUnknownNullBeanProperties(boolean value) {
- super.ignoreUnknownNullBeanProperties(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder implClass(Class<?> interfaceClass,
Class<?> implClass) {
- super.implClass(interfaceClass, implClass);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder implClasses(Map<Class<?>,Class<?>>
values) {
- super.implClasses(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder locale(Locale value) {
- super.locale(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder mediaType(MediaType value) {
- super.mediaType(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder notBeanClasses(Object...values) {
- super.notBeanClasses(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder notBeanPackages(Object...values) {
- super.notBeanPackages(values);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder sortProperties(boolean value) {
- super.sortProperties(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder sortProperties() {
- super.sortProperties();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder timeZone(TimeZone value) {
- super.timeZone(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder useEnumNames(boolean value) {
- super.useEnumNames(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder useEnumNames() {
- super.useEnumNames();
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder useInterfaceProxies(boolean value) {
- super.useInterfaceProxies(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder useJavaBeanIntrospector(boolean
value) {
- super.useJavaBeanIntrospector(value);
- return this;
- }
-
- @Override /* BeanContextBuilder */
- public XmlSchemaSerializerBuilder useJavaBeanIntrospector() {
- super.useJavaBeanIntrospector();
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder set(String name, Object value) {
- super.set(name, value);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder set(Map<String,Object> properties) {
- super.set(properties);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder add(Map<String,Object> properties) {
- super.add(properties);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder addTo(String name, Object value) {
- super.addTo(name, value);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder removeFrom(String name, Object value)
{
- super.removeFrom(name, value);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder apply(PropertyStore copyFrom) {
- super.apply(copyFrom);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder applyAnnotations(AnnotationList al,
VarResolverSession vrs) {
- super.applyAnnotations(al, vrs);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder
applyAnnotations(Class<?>...fromClasses) {
- super.applyAnnotations(fromClasses);
- return this;
- }
-
- @Override /* ContextBuilder */
- public XmlSchemaSerializerBuilder
applyAnnotations(Method...fromMethods) {
- super.applyAnnotations(fromMethods);
- return this;
- }
-
- // </FluentSetters>
-}
\ No newline at end of file
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java
deleted file mode 100644
index f4fb9f3..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/XmlSchemaSerializerSession.java
+++ /dev/null
@@ -1,593 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.xmlschema;
-
-import static org.apache.juneau.internal.ArrayUtils.*;
-import static org.apache.juneau.xml.annotation.XmlFormat.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
-
-import javax.xml.*;
-import javax.xml.transform.stream.*;
-import javax.xml.validation.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.collections.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.xml.*;
-import org.apache.juneau.xml.annotation.*;
-import org.w3c.dom.bootstrap.*;
-import org.w3c.dom.ls.*;
-
-/**
- * Session object that lives for the duration of a single use of {@link
XmlSchemaSerializer}.
- *
- * <p>
- * This class is NOT thread safe.
- * It is typically discarded after one-time use although it can be reused
within the same thread.
- */
-@Deprecated
-public class XmlSchemaSerializerSession extends XmlSerializerSession {
-
- /**
- * Create a new session using properties specified in the context.
- *
- * @param ctx
- * The context creating this session object.
- * The context contains all the configuration settings for this
object.
- * @param args
- * Runtime arguments.
- * These specify session-level information such as locale and URI
context.
- * It also include session-level properties that override the
properties defined on the bean and
- * serializer contexts.
- */
- protected XmlSchemaSerializerSession(XmlSerializer ctx,
SerializerSessionArgs args) {
- super(ctx, args);
- }
-
- @Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws
IOException, SerializeException {
- if (isEnableNamespaces() && isAutoDetectNamespaces())
- findNsfMappings(o);
-
- Namespace xs = getXsNamespace();
- Namespace[] allNs = append(new
Namespace[]{getDefaultNamespace()}, getNamespaces());
-
- Schemas schemas = new Schemas(this, xs, getDefaultNamespace(),
allNs);
- schemas.process(o);
- schemas.serializeTo(out.getWriter());
- }
-
- /**
- * Returns an XML-Schema validator based on the output returned by
{@link #doSerialize(SerializerPipe, Object)};
- *
- * @param out The target writer.
- * @param o The object to serialize.
- * @return The new validator.
- * @throws Exception If a problem was detected in the XML-Schema output
produced by this serializer.
- */
- public Validator getValidator(SerializerPipe out, Object o) throws
Exception {
- doSerialize(out, o);
- String xmlSchema = out.getWriter().toString();
-
- // create a SchemaFactory capable of understanding WXS schemas
- SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-
- if (xmlSchema.indexOf('\u0000') != -1) {
-
- // Break it up into a map of namespaceURI->schema
document
- final Map<String,String> schemas = new HashMap<>();
- String[] ss = xmlSchema.split("\u0000");
- xmlSchema = ss[0];
- for (String s : ss) {
- Matcher m = pTargetNs.matcher(s);
- if (m.find())
- schemas.put(m.group(1), s);
- }
-
- // Create a custom resolver
- factory.setResourceResolver(
- new LSResourceResolver() {
-
- @Override /* LSResourceResolver */
- public LSInput resolveResource(String
type, String namespaceURI, String publicId, String systemId, String baseURI) {
-
- String schema =
schemas.get(namespaceURI);
- if (schema == null)
- throw new
BasicRuntimeException("No schema found for namespaceURI ''{0}''", namespaceURI);
-
- try {
-
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
- DOMImplementationLS
domImplementationLS = (DOMImplementationLS)registry.getDOMImplementation("LS
3.0");
- LSInput in =
domImplementationLS.createLSInput();
-
in.setCharacterStream(new StringReader(schema));
-
in.setSystemId(systemId);
- return in;
-
- } catch (Exception e) {
- throw new
RuntimeException(e);
- }
- }
- }
- );
- }
- return factory.newSchema(new StreamSource(new
StringReader(xmlSchema))).newValidator();
- }
-
- private static Pattern pTargetNs =
Pattern.compile("targetNamespace=['\"]([^'\"]+)['\"]");
-
-
- /* An instance of a global element, global attribute, or XML type to be
serialized. */
- private static class QueueEntry {
- Namespace ns;
- String name;
- ClassMeta<?> cm;
- QueueEntry(Namespace ns, String name, ClassMeta<?> cm) {
- this.ns = ns;
- this.name = name;
- this.cm = cm;
- }
- }
-
- /* An encapsulation of all schemas present in the metamodel of the
serialized object. */
- final class Schemas extends LinkedHashMap<Namespace,Schema> {
-
- private static final long serialVersionUID = 1L;
-
- private Namespace defaultNs;
- BeanSession session;
- private LinkedList<QueueEntry>
- elementQueue = new LinkedList<>(),
- attributeQueue = new LinkedList<>(),
- typeQueue = new LinkedList<>();
-
- Schemas(BeanSession session, Namespace xs, Namespace defaultNs,
Namespace[] allNs) throws IOException {
- this.session = session;
- this.defaultNs = defaultNs;
- for (Namespace ns : allNs)
- put(ns, new Schema(this, xs, ns, defaultNs,
allNs));
- }
-
- Schema getSchema(Namespace ns) {
- if (ns == null)
- ns = defaultNs;
- Schema s = get(ns);
- if (s == null)
- throw new BasicRuntimeException("No schema
defined for namespace ''{0}''", ns);
- return s;
- }
-
- void process(Object o) throws IOException {
- ClassMeta<?> cm = getClassMetaForObject(o);
- if (cm != null && cm.isOptional())
- cm =
getClassMetaForObject(((Optional<?>)o).orElse(null));
- Namespace ns = defaultNs;
- if (cm == null)
- queueElement(ns, "null", object());
- else {
- XmlClassMeta xmlMeta = getXmlClassMeta(cm);
- if (cm.getDictionaryName() != null &&
xmlMeta.getNamespace() != null)
- ns = xmlMeta.getNamespace();
- queueElement(ns, cm.getDictionaryName(), cm);
- }
- processQueue();
- }
-
- void processQueue() throws IOException {
- boolean b;
- do {
- b = false;
- while (! elementQueue.isEmpty()) {
- QueueEntry q =
elementQueue.removeFirst();
- b |=
getSchema(q.ns).processElement(q.name, q.cm);
- }
- while (! typeQueue.isEmpty()) {
- QueueEntry q = typeQueue.removeFirst();
- b |=
getSchema(q.ns).processType(q.name, q.cm);
- }
- while (! attributeQueue.isEmpty()) {
- QueueEntry q =
attributeQueue.removeFirst();
- b |=
getSchema(q.ns).processAttribute(q.name, q.cm);
- }
- } while (b);
- }
-
- void queueElement(Namespace ns, String name, ClassMeta<?> cm) {
- elementQueue.add(new QueueEntry(ns, name, cm));
- }
-
- void queueType(Namespace ns, String name, ClassMeta<?> cm) {
- if (name == null)
- name = XmlUtils.encodeElementName(cm);
- typeQueue.add(new QueueEntry(ns, name, cm));
- }
-
- void queueAttribute(Namespace ns, String name, ClassMeta<?> cm)
{
- attributeQueue.add(new QueueEntry(ns, name, cm));
- }
-
- void serializeTo(Writer w) throws IOException {
- boolean b = false;
- for (Schema s : values()) {
- if (b)
- w.append('\u0000');
- w.append(s.toString());
- b = true;
- }
- }
- }
-
- @Override /* SerializerSession */
- protected boolean isTrimStrings() {
- return super.isTrimStrings();
- }
-
- /* An encapsulation of a single schema. */
- private final class Schema {
- private StringWriter sw = new StringWriter();
- private XmlWriter w;
- private Namespace defaultNs, targetNs;
- private Schemas schemas;
- private Set<String>
- processedTypes = new HashSet<>(),
- processedAttributes = new HashSet<>(),
- processedElements = new HashSet<>();
-
- @SuppressWarnings("synthetic-access")
- public Schema(Schemas schemas, Namespace xs, Namespace
targetNs, Namespace defaultNs, Namespace[] allNs) throws IOException {
- this.schemas = schemas;
- this.defaultNs = defaultNs;
- this.targetNs = targetNs;
- w = new XmlWriter(sw, isUseWhitespace(),
getMaxIndent(), isTrimStrings(), getQuoteChar(), null, true, null);
- int i = indent;
- w.oTag(i, "schema");
- w.attr("xmlns", xs.getUri());
- w.attr("targetNamespace", targetNs.getUri());
- w.attr("elementFormDefault", "qualified");
- if (targetNs != defaultNs)
- w.attr("attributeFormDefault", "qualified");
- for (Namespace ns2 : allNs)
- w.attr("xmlns", ns2.getName(), ns2.getUri());
- w.append('>').nl(i);
- for (Namespace ns : allNs) {
- if (ns != targetNs) {
- w.oTag(i+1, "import")
- .attr("namespace", ns.getUri())
- .attr("schemaLocation",
ns.getName()+".xsd")
- .append("/>").nl(i+1);
- }
- }
- }
-
- boolean processElement(String name, ClassMeta<?> cm) throws
IOException {
- if (processedElements.contains(name))
- return false;
- processedElements.add(name);
-
- ClassMeta<?> ft =
cm.getSerializedClassMeta(schemas.session);
- if (name == null)
- name = getElementName(ft);
- Namespace ns =
first(getXmlClassMeta(ft).getNamespace(), defaultNs);
- String type = getXmlType(ns, ft);
-
- w.oTag(indent+1, "element")
- .attr("name", XmlUtils.encodeElementName(name))
- .attr("type", type)
- .append('/').append('>').nl(indent+1);
-
- schemas.queueType(ns, null, ft);
- schemas.processQueue();
- return true;
- }
-
- boolean processAttribute(String name, ClassMeta<?> cm) throws
IOException {
- if (processedAttributes.contains(name))
- return false;
- processedAttributes.add(name);
-
- String type = getXmlAttrType(cm);
-
- w.oTag(indent+1, "attribute")
- .attr("name", name)
- .attr("type", type)
- .append('/').append('>').nl(indent+1);
-
- return true;
- }
-
- boolean processType(String name, ClassMeta<?> cm) throws
IOException {
- if (processedTypes.contains(name))
- return false;
- processedTypes.add(name);
-
- int i = indent + 1;
-
- cm = cm.getSerializedClassMeta(schemas.session);
- while (cm.isOptional())
- cm = cm.getElementType();
-
- XmlBeanMeta xbm = cm.isBean() ?
getXmlBeanMeta(cm.getBeanMeta()) : null;
-
- w.oTag(i, "complexType")
- .attr("name", name);
-
- // This element can have mixed content if:
- // 1) It's a generic Object (so it can
theoretically be anything)
- // 2) The bean has a property defined with
@XmlFormat.CONTENT.
- if ((xbm != null && (xbm.getContentFormat() != null &&
xbm.getContentFormat().isOneOf(TEXT,TEXT_PWS,MIXED,MIXED_PWS,XMLTEXT))) || !
cm.isMapOrBean())
- w.attr("mixed", "true");
-
- w.cTag().nl(i);
-
- boolean hasAnyAttrs = false;
-
- if (! (cm.isMapOrBean() || cm.isCollectionOrArray() ||
(cm.isAbstract() && ! cm.isNumber()) || cm.isObject())) {
- w.oTag(i+1, "attribute").attr("name",
getBeanTypePropertyName(cm)).attr("type", "string").ceTag().nl(i+1);
- w.oTag(i+1, "attribute").attr("name",
getNamePropertyName()).attr("type", "string").ceTag().nl(i+1);
-
- } else {
-
- //----- Bean -----
- if (cm.isBean()) {
- BeanMeta<?> bm = cm.getBeanMeta();
-
- boolean hasChildElements = false;
-
- for (BeanPropertyMeta pMeta :
bm.getPropertyMetas()) {
- if (pMeta.canRead()) {
- XmlFormat bpXml =
getXmlBeanPropertyMeta(pMeta).getXmlFormat();
- if (bpXml == ATTRS)
- hasAnyAttrs =
true;
- else if (bpXml !=
XmlFormat.ATTR)
-
hasChildElements = true;
- }
- }
-
- XmlBeanMeta xbm2 = getXmlBeanMeta(bm);
- if (xbm2.getContentProperty() != null
&& xbm2.getContentFormat() == ELEMENTS) {
- w.sTag(i+1, "sequence").nl(i+1);
- w.oTag(i+2, "any")
-
.attr("processContents", "skip")
- .attr("minOccurs", 0)
- .ceTag().nl(i+2);
- w.eTag(i+1, "sequence").nl(i+1);
-
- } else if (hasChildElements) {
-
- boolean hasOtherNsElement =
false;
- boolean hasCollapsed = false;
-
- for (BeanPropertyMeta pMeta :
bm.getPropertyMetas()) {
- if (pMeta.canRead()) {
-
XmlBeanPropertyMeta xmlMeta = getXmlBeanPropertyMeta(pMeta);
- if
(xmlMeta.getXmlFormat() != ATTR) {
- if
(xmlMeta.getNamespace() != null) {
-
ClassMeta<?> ct2 = pMeta.getClassMeta();
-
Namespace cNs = first(xmlMeta.getNamespace(),
getXmlClassMeta(ct2).getNamespace(), getXmlClassMeta(cm).getNamespace(),
defaultNs);
-
// Child element is in another namespace.
-
schemas.queueElement(cNs, pMeta.getName(), ct2);
-
hasOtherNsElement = true;
- }
- if
(xmlMeta.getXmlFormat() == COLLAPSED)
-
hasCollapsed = true;
- }
- }
- }
-
- if (hasAnyAttrs) {
- w.oTag(i+1,
"anyAttribute").attr("processContents", "skip").ceTag().nl(i+1);
- } else if (hasOtherNsElement ||
hasCollapsed) {
- // If this bean has any
child elements in another namespace,
- // we need to add an
<any> element.
- w.oTag(i+1,
"choice").attr("maxOccurs", "unbounded").cTag().nl(i+1);
- w.oTag(i+2, "any")
-
.attr("processContents", "skip")
-
.attr("minOccurs", 0)
-
.ceTag().nl(i+2);
- w.eTag(i+1,
"choice").nl(i+1);
-
- } else {
- w.sTag(i+1,
"all").nl(i+1);
- for (BeanPropertyMeta
pMeta : bm.getPropertyMetas()) {
- if
(pMeta.canRead()) {
-
XmlBeanPropertyMeta xmlMeta = getXmlBeanPropertyMeta(pMeta);
- if
(xmlMeta.getXmlFormat() != ATTR) {
-
boolean isCollapsed = xmlMeta.getXmlFormat() == COLLAPSED;
-
ClassMeta<?> ct2 = pMeta.getClassMeta();
-
String childName = pMeta.getName();
-
if (isCollapsed) {
-
if (xmlMeta.getChildName() != null)
-
childName = xmlMeta.getChildName();
-
ct2 = pMeta.getClassMeta().getElementType();
-
}
-
Namespace cNs = first(xmlMeta.getNamespace(),
getXmlClassMeta(ct2).getNamespace(), getXmlClassMeta(cm).getNamespace(),
defaultNs);
-
if (xmlMeta.getNamespace() == null) {
-
w.oTag(i+2, "element")
-
.attr("name", XmlUtils.encodeElementName(childName), false)
-
.attr("type", getXmlType(cNs, ct2))
-
.attr("minOccurs", 0);
-
-
w.ceTag().nl(i+2);
-
} else {
-
// Child element is in another namespace.
-
schemas.queueElement(cNs, pMeta.getName(), ct2);
-
hasOtherNsElement = true;
-
}
- }
- }
- }
- w.eTag(i+1,
"all").nl(i+1);
- }
-
- }
-
- for (BeanPropertyMeta pMeta :
getXmlBeanMeta(bm).getAttrProperties().values()) {
- if (pMeta.canRead()) {
- Namespace pNs =
getXmlBeanPropertyMeta(pMeta).getNamespace();
- if (pNs == null)
- pNs = defaultNs;
-
- // If the bean
attribute has a different namespace than the bean, then it needs to
- // be added as a
top-level entry in the appropriate schema file.
- if (pNs != targetNs) {
-
schemas.queueAttribute(pNs, pMeta.getName(), pMeta.getClassMeta());
- w.oTag(i+1,
"attribute")
-
//.attr("name", pMeta.getName(), true)
-
.attr("ref", pNs.getName() + ':' + pMeta.getName())
-
.ceTag().nl(i+1);
- }
-
- // Otherwise, it's just
a plain attribute of this bean.
- else {
- if (!
hasAnyAttrs) {
-
w.oTag(i+1, "attribute")
-
.attr("name", pMeta.getName(), true)
-
.attr("type", getXmlAttrType(pMeta.getClassMeta()))
-
.ceTag().nl(i+1);
- }
- }
- }
- }
-
- //----- Collection -----
- } else if (cm.isCollectionOrArray()) {
- ClassMeta<?> elementType =
cm.getElementType();
- if (elementType.isObject()) {
- w.sTag(i+1, "sequence").nl(i+1);
- w.oTag(i+2, "any")
-
.attr("processContents", "skip")
- .attr("maxOccurs",
"unbounded")
- .attr("minOccurs", "0")
- .ceTag().nl(i+2);
- w.eTag(i+1, "sequence").nl(i+1);
- } else {
- Namespace cNs =
first(getXmlClassMeta(elementType).getNamespace(),
getXmlClassMeta(cm).getNamespace(), defaultNs);
- schemas.queueType(cNs, null,
elementType);
- w.sTag(i+1, "sequence").nl(i+1);
- w.oTag(i+2, "any")
-
.attr("processContents", "skip")
- .attr("maxOccurs",
"unbounded")
- .attr("minOccurs", "0")
- .ceTag().nl(i+2);
- w.eTag(i+1, "sequence").nl(i+1);
- }
-
- //----- Map -----
- } else if (cm.isMap() || cm.isAbstract() ||
cm.isObject()) {
- w.sTag(i+1, "sequence").nl(i+1);
- w.oTag(i+2, "any")
- .attr("processContents", "skip")
- .attr("maxOccurs", "unbounded")
- .attr("minOccurs", "0")
- .ceTag().nl(i+2);
- w.eTag(i+1, "sequence").nl(i+1);
- }
-
- if (! hasAnyAttrs) {
- w.oTag(i+1, "attribute").attr("name",
getBeanTypePropertyName(null)).attr("type", "string").ceTag().nl(i+1);
- w.oTag(i+1, "attribute").attr("name",
getNamePropertyName()).attr("type", "string").ceTag().nl(i+1);
- }
- }
-
- w.eTag(i, "complexType").nl(i);
- schemas.processQueue();
-
- return true;
- }
-
- private String getElementName(ClassMeta<?> cm) {
- cm = cm.getSerializedClassMeta(schemas.session);
- String name = cm.getDictionaryName();
-
- if (name == null) {
- if (cm.isBoolean())
- name = "boolean";
- else if (cm.isNumber())
- name = "number";
- else if (cm.isCollectionOrArray())
- name = "array";
- else if (! (cm.isMapOrBean() ||
cm.isCollectionOrArray() || cm.isObject() || cm.isAbstract()))
- name = "string";
- else
- name = "object";
- }
- return name;
- }
-
- @Override /* Object */
- public String toString() {
- try {
- w.eTag(indent, "schema").nl(indent);
- } catch (IOException e) {
- throw new RuntimeException(e); // Shouldn't
happen.
- }
- return sw.toString();
- }
-
- private String getXmlType(Namespace currentNs, ClassMeta<?> cm)
{
- String name = null;
- cm = cm.getSerializedClassMeta(schemas.session);
- if (currentNs == targetNs) {
- if (cm.isPrimitive()) {
- if (cm.isBoolean())
- name = "boolean";
- else if (cm.isNumber()) {
- if (cm.isDecimal())
- name = "decimal";
- else
- name = "integer";
- }
- }
- }
- if (name == null) {
- name = XmlUtils.encodeElementName(cm);
- schemas.queueType(currentNs, name, cm);
- return currentNs.getName() + ":" + name;
- }
-
- return name;
- }
- }
-
- @SafeVarargs
- static <T> T first(T...tt) {
- for (T t : tt)
- if (t != null)
- return t;
- return null;
- }
-
- static String getXmlAttrType(ClassMeta<?> cm) {
- if (cm.isBoolean())
- return "boolean";
- if (cm.isNumber()) {
- if (cm.isDecimal())
- return "decimal";
- return "integer";
- }
- return "string";
- }
-
-
//-----------------------------------------------------------------------------------------------------------------
- // Other methods
-
//-----------------------------------------------------------------------------------------------------------------
-
- @Override /* Session */
- public OMap toMap() {
- return super.toMap()
- .a("XmlSchemaSerializerSession", new
DefaultFilteringOMap()
- );
- }
-}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/package-info.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/package-info.java
deleted file mode 100755
index e9a0bbf..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/xmlschema/package-info.java
+++ /dev/null
@@ -1,18 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-
-/**
- * XML-Schema Marshalling Support
- */
-package org.apache.juneau.xmlschema;
-
diff --git
a/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BasicProvider.java
b/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BasicProvider.java
index b736078..50be05b 100644
---
a/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BasicProvider.java
+++
b/juneau-rest/juneau-rest-server-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BasicProvider.java
@@ -24,7 +24,6 @@ import org.apache.juneau.uon.UonParser;
import org.apache.juneau.uon.UonSerializer;
import org.apache.juneau.urlencoding.*;
import org.apache.juneau.xml.*;
-import org.apache.juneau.xmlschema.XmlSchemaDocSerializer;
/**
* JAX-RS provider for the same serialize/parse support provided by the {@link
BasicRestServlet} class.
@@ -60,7 +59,6 @@ import org.apache.juneau.xmlschema.XmlSchemaDocSerializer;
JsonSchemaSerializer.class,
XmlDocSerializer.Ns.class,
XmlDocSerializer.class,
- XmlSchemaDocSerializer.class,
HtmlDocSerializer.class,
UrlEncodingSerializer.class,
SoapXmlSerializer.class,
@@ -76,6 +74,5 @@ import org.apache.juneau.xmlschema.XmlSchemaDocSerializer;
UrlEncodingParser.class,
}
)
-@SuppressWarnings("deprecation")
public final class BasicProvider extends BaseProvider {}
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java
index 84cfde2..b269c46 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/BasicRestConfig.java
@@ -26,7 +26,6 @@ import org.apache.juneau.soap.*;
import org.apache.juneau.uon.*;
import org.apache.juneau.urlencoding.*;
import org.apache.juneau.xml.*;
-import org.apache.juneau.xmlschema.XmlSchemaDocSerializer;
/**
* Basic configuration for a REST resource that supports all languages.
@@ -48,7 +47,6 @@ import org.apache.juneau.xmlschema.XmlSchemaDocSerializer;
SimpleJsonSerializer.class,
JsonSchemaSerializer.class,
XmlDocSerializer.class,
- XmlSchemaDocSerializer.class,
UonSerializer.class,
UrlEncodingSerializer.class,
OpenApiSerializer.class,