[idwsfconsumer] 10/25: Add Extensions impl to SASL package.

Scott Cantor cantor.2 at osu.edu
Wed Nov 18 14:41:14 EST 2015


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository idwsfconsumer.

commit 607d61104729c88b6f1dde471ce258fa3f4296fc
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Wed Apr 1 19:29:27 2015 -0400

    Add Extensions impl to SASL package.
---
 .../openliberty/xmltooling/sasl/Extensions.java    | 51 ++++++++++++++++++
 .../xmltooling/sasl/ExtensionsBuilder.java         | 37 +++++++++++++
 .../xmltooling/sasl/ExtensionsMarshaller.java      | 47 +++++++++++++++++
 .../xmltooling/sasl/ExtensionsUnmarshaller.java    | 60 ++++++++++++++++++++++
 src/main/resources/sasl-xmltooling-config.xml      |  6 +++
 5 files changed, 201 insertions(+)

diff --git a/src/main/java/org/openliberty/xmltooling/sasl/Extensions.java b/src/main/java/org/openliberty/xmltooling/sasl/Extensions.java
new file mode 100644
index 0000000..68ec222
--- /dev/null
+++ b/src/main/java/org/openliberty/xmltooling/sasl/Extensions.java
@@ -0,0 +1,51 @@
+package org.openliberty.xmltooling.sasl;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.opensaml.core.xml.AbstractXMLObject;
+import org.opensaml.core.xml.ElementExtensibleXMLObject;
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.util.IndexedXMLObjectChildrenList;
+
+public class Extensions extends AbstractXMLObject implements ElementExtensibleXMLObject {
+    
+    public static String DEFAULT_ELEMENT_LOCAL_NAME = "Extensions";
+    
+    /** Default element name. */
+    public static final QName DEFAULT_ELEMENT_NAME = new QName(SASLConstants.NAMESPACE, DEFAULT_ELEMENT_LOCAL_NAME, SASLConstants.NAMESPACE_PREFIX);
+
+    /** "any" children. */
+    private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
+
+    /**
+     * Constructor.
+     * 
+     * @param namespaceURI namespace URI
+     * @param elementLocalName local name
+     * @param namespacePrefix prefix
+     */
+    protected Extensions(String namespaceURI, String elementLocalName, String namespacePrefix) {
+        super(namespaceURI, elementLocalName, namespacePrefix);
+        unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public List<XMLObject> getUnknownXMLObjects() {
+        return unknownChildren;
+    }
+    
+    /** {@inheritDoc} */
+    public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
+        return (List<XMLObject>) unknownChildren.subList(typeOrName);
+    }
+
+    /** {@inheritDoc} */
+    public List<XMLObject> getOrderedChildren() {
+        return Collections.unmodifiableList(unknownChildren);
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsBuilder.java b/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsBuilder.java
new file mode 100644
index 0000000..ec10d82
--- /dev/null
+++ b/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsBuilder.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development, 
+ * Inc. (UCAID) under one or more contributor license agreements.  See the 
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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.openliberty.xmltooling.sasl;
+
+import org.opensaml.core.xml.AbstractXMLObjectBuilder;
+
+public class ExtensionsBuilder extends AbstractXMLObjectBuilder<Extensions> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public Extensions buildObject() {
+        return buildObject(SASLConstants.NAMESPACE, Extensions.DEFAULT_ELEMENT_LOCAL_NAME, SASLConstants.NAMESPACE_PREFIX);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Extensions buildObject(String namespaceURI, String localName, String namespacePrefix) {
+        return new Extensions(namespaceURI, localName, namespacePrefix);
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsMarshaller.java b/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsMarshaller.java
new file mode 100644
index 0000000..44a27f5
--- /dev/null
+++ b/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsMarshaller.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development, 
+ * Inc. (UCAID) under one or more contributor license agreements.  See the 
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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.openliberty.xmltooling.sasl;
+
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.io.AbstractXMLObjectMarshaller;
+import org.opensaml.core.xml.io.MarshallingException;
+import org.w3c.dom.Element;
+
+public class ExtensionsMarshaller extends AbstractXMLObjectMarshaller {
+
+    /**
+     * Constructor.
+     */
+    public ExtensionsMarshaller() {
+        super();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
+        // no attributes
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
+        // no content
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsUnmarshaller.java b/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsUnmarshaller.java
new file mode 100644
index 0000000..ff2fd81
--- /dev/null
+++ b/src/main/java/org/openliberty/xmltooling/sasl/ExtensionsUnmarshaller.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development, 
+ * Inc. (UCAID) under one or more contributor license agreements.  See the 
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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.openliberty.xmltooling.sasl;
+
+import org.opensaml.core.xml.XMLObject;
+import org.opensaml.core.xml.io.AbstractXMLObjectUnmarshaller;
+import org.opensaml.core.xml.io.UnmarshallingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Attr;
+
+public class ExtensionsUnmarshaller extends AbstractXMLObjectUnmarshaller {
+
+    /** Logger. */
+    private final Logger log = LoggerFactory.getLogger(ExtensionsUnmarshaller.class);
+
+    /** Constructor. */
+    public ExtensionsUnmarshaller() {
+        super();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
+            throws UnmarshallingException {
+        Extensions extensions = (Extensions) parentXMLObject;
+
+        extensions.getUnknownXMLObjects().add(childXMLObject);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
+        log.debug("Ignorning unknown attribute {}", attribute.getLocalName());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void processElementContent(XMLObject xmlObject, String elementContent) {
+        log.debug("Ignoring element content {}", elementContent);
+    }
+}
\ No newline at end of file
diff --git a/src/main/resources/sasl-xmltooling-config.xml b/src/main/resources/sasl-xmltooling-config.xml
index b65804f..5da2f01 100644
--- a/src/main/resources/sasl-xmltooling-config.xml
+++ b/src/main/resources/sasl-xmltooling-config.xml
@@ -17,6 +17,12 @@
             <MarshallingClass className="org.openliberty.xmltooling.sasl.DataMarshaller" />
             <UnmarshallingClass className="org.openliberty.xmltooling.sasl.DataUnmarshaller" />
         </ObjectProvider>
+        
+        <ObjectProvider qualifiedName="sa:Extensions">
+            <BuilderClass className="org.openliberty.xmltooling.sasl.ExtensionsBuilder" />
+            <MarshallingClass className="org.openliberty.xmltooling.sasl.ExtensionsMarshaller" />
+            <UnmarshallingClass className="org.openliberty.xmltooling.sasl.ExtensionsUnmarshaller" />
+        </ObjectProvider>
 
         <ObjectProvider qualifiedName="sa:SASLResponse">
             <BuilderClass className="org.openliberty.xmltooling.sasl.SASLResponseBuilder" />

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list