You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/02/01 11:36:10 UTC
svn commit: r374036 [9/15] - in /webservices/commons/trunk/axiom:
src/org/apache/ws/ src/org/apache/ws/commons/
src/org/apache/ws/commons/attachments/
src/org/apache/ws/commons/attachments/utils/ src/org/apache/ws/commons/om/
src/org/apache/ws/commons/...
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultTextImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultTextImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultTextImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultTextImpl;
+
+public class SOAP11FaultTextImpl extends SOAPFaultTextImpl {
+ public SOAP11FaultTextImpl(SOAPFaultReason parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ public SOAP11FaultTextImpl(SOAPFaultReason parent,
+ OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultReasonImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP FaultReason as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultValueImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultValueImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultValueImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultValueImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultValueImpl;
+
+public class SOAP11FaultValueImpl extends SOAPFaultValueImpl {
+ public SOAP11FaultValueImpl(OMElement parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ public SOAP11FaultValueImpl(OMElement parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!((parent instanceof SOAP11FaultSubCodeImpl) ||
+ (parent instanceof SOAP11FaultCodeImpl))) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation." +
+ parent.getClass());
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderBlockImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPConstants;
+import org.apache.ws.commons.soap.SOAPHeader;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPHeaderBlockImpl;
+
+public class SOAP11HeaderBlockImpl extends SOAPHeaderBlockImpl {
+ /**
+ * @param localName
+ * @param ns
+ */
+ public SOAP11HeaderBlockImpl(String localName,
+ OMNamespace ns,
+ SOAPHeader parent) throws SOAPProcessingException {
+ super(localName, ns, parent);
+ checkParent(parent);
+ }
+
+ /**
+ * Constructor SOAPHeaderBlockImpl
+ *
+ * @param localName
+ * @param ns
+ * @param parent
+ * @param builder
+ */
+ public SOAP11HeaderBlockImpl(String localName,
+ OMNamespace ns,
+ OMElement parent,
+ OMXMLParserWrapper builder) {
+ super(localName, ns, parent, builder);
+ }
+
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11HeaderImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Body as the parent. But received some other implementation");
+ }
+ }
+
+ public void setRole(String roleURI) {
+ setAttribute(SOAP11Constants.ATTR_ACTOR,
+ roleURI,
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ }
+
+ public String getRole() {
+ return getAttribute(SOAP11Constants.ATTR_ACTOR,
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
+ public void setMustUnderstand(boolean mustUnderstand) {
+ setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ mustUnderstand ? "1" : "0",
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
+ public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {
+ if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {
+ setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ mustUnderstand,
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ } else {
+ throw new SOAPProcessingException(
+ "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");
+ }
+ }
+
+ /**
+ * Returns whether the mustUnderstand attribute for this
+ * <CODE>SOAPHeaderBlock</CODE> object is turned on.
+ *
+ * @return <CODE>true</CODE> if the mustUnderstand attribute of
+ * this <CODE>SOAPHeaderBlock</CODE> object is turned on;
+ * <CODE>false</CODE> otherwise
+ */
+ public boolean getMustUnderstand() throws SOAPProcessingException {
+ String mustUnderstand = "";
+ if ((mustUnderstand =
+ getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+ != null) {
+ if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(
+ mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(
+ mustUnderstand)) {
+ return true;
+ } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(
+ mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(
+ mustUnderstand)) {
+ return false;
+ } else {
+ throw new SOAPProcessingException(
+ "Invalid value found in mustUnderstand value of " +
+ this.getLocalName() +
+ " header block");
+ }
+ }
+ return false;
+
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11HeaderImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.OMNodeEx;
+import org.apache.ws.commons.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPHeaderBlock;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPHeaderImpl;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public class SOAP11HeaderImpl extends SOAPHeaderImpl {
+ /**
+ * @param envelope
+ */
+ public SOAP11HeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+ super(envelope);
+ }
+
+ /**
+ * Constructor SOAPHeaderImpl
+ *
+ * @param envelope
+ * @param builder
+ */
+ public SOAP11HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+ super(envelope, builder);
+ }
+
+ public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {
+ if (ns == null || ns.getName() == null || "".equals(ns.getName())) {
+ throw new OMException(
+ "All the SOAP Header blocks should be namespace qualified");
+ }
+
+ OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
+ if (namespace != null) {
+ ns = namespace;
+ }
+
+ SOAPHeaderBlock soapHeaderBlock = null;
+ try {
+ soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this);
+ } catch (SOAPProcessingException e) {
+ throw new OMException(e);
+ }
+ ((OMNodeEx)soapHeaderBlock).setComplete(true);
+ return soapHeaderBlock;
+ }
+
+ public Iterator extractHeaderBlocks(String role) {
+ return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),
+ new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP11Constants.ATTR_ACTOR),
+ role,
+ true);
+
+ }
+
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12BodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12BodyImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12BodyImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12BodyImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPBodyImpl;
+
+public class SOAP12BodyImpl extends SOAPBodyImpl {
+ /**
+ * @param envelope
+ */
+ public SOAP12BodyImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+ super(envelope);
+ }
+
+ /**
+ * Constructor SOAPBodyImpl
+ *
+ * @param envelope
+ * @param builder
+ */
+ public SOAP12BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+ super(envelope, builder);
+ }
+
+ public SOAPFault addFault(Exception e) throws OMException {
+ SOAPFault soapFault = new SOAP12FaultImpl(this, e);
+ return soapFault;
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12Factory.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12Factory.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12Factory.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12Factory.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.llom.OMNamespaceImpl;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPBody;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultDetail;
+import org.apache.ws.commons.soap.SOAPFaultNode;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultRole;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultText;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPHeader;
+import org.apache.ws.commons.soap.SOAPHeaderBlock;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPEnvelopeImpl;
+import org.apache.ws.commons.soap.impl.llom.factory.SOAPLinkedListImplFactory;
+
+public class SOAP12Factory extends SOAPLinkedListImplFactory {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public String getSoapVersionURI() {
+ return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+ }
+
+ public SOAPEnvelope createSOAPEnvelope() {
+ return new SOAPEnvelopeImpl(
+ new OMNamespaceImpl(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+ this);
+ }
+
+ public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
+ return new SOAP12HeaderImpl(envelope);
+ }
+
+ public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+ OMXMLParserWrapper builder) {
+ return new SOAP12HeaderImpl(envelope, builder);
+ }
+
+ public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+ OMNamespace ns,
+ SOAPHeader parent) throws SOAPProcessingException {
+ return new SOAP12HeaderBlockImpl(localName, ns, parent);
+ }
+
+ public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+ OMNamespace ns,
+ SOAPHeader parent,
+ OMXMLParserWrapper builder) throws SOAPProcessingException {
+ return new SOAP12HeaderBlockImpl(localName, ns, parent, builder);
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException {
+ return new SOAP12FaultImpl(parent, e);
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException {
+ return new SOAP12FaultImpl(parent);
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultImpl(parent, builder);
+ }
+
+ public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
+ return new SOAP12BodyImpl(envelope);
+ }
+
+ public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+ OMXMLParserWrapper builder) {
+ return new SOAP12BodyImpl(envelope, builder);
+ }
+
+ public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP12FaultCodeImpl(parent);
+ }
+
+ public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultCodeImpl(parent, builder);
+ }
+
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException {
+ return new SOAP12FaultValueImpl(parent);
+ }
+
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultValueImpl(parent, builder);
+ }
+
+ //added
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ return new SOAP12FaultValueImpl(parent);
+ }
+
+ //added
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultValueImpl(parent, builder);
+ }
+
+ //changed
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException {
+ return new SOAP12FaultSubCodeImpl(parent);
+ }
+
+ //changed
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultSubCodeImpl(parent, builder);
+ }
+
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ return new SOAP12FaultSubCodeImpl(parent);
+ }
+
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultSubCodeImpl(parent, builder);
+ }
+
+ public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP12FaultReasonImpl(parent);
+ }
+
+ public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultReasonImpl(parent, builder);
+ }
+
+ public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException {
+ return new SOAP12FaultTextImpl(parent);
+ }
+
+ public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultTextImpl(parent, builder);
+ }
+
+ public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP12FaultNodeImpl(parent);
+ }
+
+ public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultNodeImpl(parent, builder);
+ }
+
+ public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP12FaultRoleImpl(parent);
+ }
+
+ public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultRoleImpl(parent, builder);
+ }
+
+ public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP12FaultDetailImpl(parent);
+ }
+
+ public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP12FaultDetailImpl(parent, builder);
+ }
+
+ public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+ OMNamespace ns =
+ new OMNamespaceImpl(
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
+ SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+ createSOAPHeader(env);
+ createSOAPBody(env);
+
+ return env;
+ }
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultCodeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultCodeImpl;
+
+public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+ /**
+ * Constructor OMElementImpl
+ *
+ * @param parent
+ * @param builder
+ */
+ public SOAP12FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ /**
+ * @param parent
+ */
+ public SOAP12FaultCodeImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, true);
+ }
+
+
+ public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+ if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Sub Code. But received some other implementation");
+ }
+ super.setSubCode(subCode);
+ }
+
+ public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+ if (!(value instanceof SOAP12FaultValueImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Value. But received some other implementation");
+ }
+ super.setValue(value);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultDetailImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultDetailImpl;
+
+
+public class SOAP12FaultDetailImpl extends SOAPFaultDetailImpl {
+ public SOAP12FaultDetailImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, true);
+ }
+
+ public SOAP12FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.OMNodeEx;
+import org.apache.ws.commons.soap.SOAPBody;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultDetail;
+import org.apache.ws.commons.soap.SOAPFaultNode;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultRole;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+
+
+public class SOAP12FaultImpl extends SOAPFaultImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public SOAP12FaultImpl(SOAPBody parent, Exception e) throws SOAPProcessingException {
+ super(parent, e);
+ }
+
+ public SOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ /**
+ * This is a convenience method for the SOAP Fault Impl.
+ *
+ * @param parent
+ */
+ public SOAP12FaultImpl(SOAPBody parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) {
+ return new SOAP12FaultDetailImpl(fault);
+
+ }
+
+ public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
+ if (!(soapFaultCode instanceof SOAP12FaultCodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Code. But received some other implementation");
+ }
+ super.setCode(soapFaultCode);
+ }
+
+
+ public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+ if (!(reason instanceof SOAP12FaultReasonImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Reason. But received some other implementation");
+ }
+ super.setReason(reason);
+ }
+
+ public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+ if (!(node instanceof SOAP12FaultNodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Node. But received some other implementation");
+ }
+ super.setNode(node);
+ }
+
+ public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+ if (!(role instanceof SOAP12FaultRoleImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Role. But received some other implementation");
+ }
+ super.setRole(role);
+ }
+
+ public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+ if (!(detail instanceof SOAP12FaultDetailImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Detail. But received some other implementation");
+ }
+ super.setDetail(detail);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12BodyImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+ }
+ }
+
+ protected void serializeFaultNode(org.apache.ws.commons.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+ SOAPFaultNode faultNode = getNode();
+ if (faultNode != null) {
+ ((OMNodeEx)faultNode).serialize(omOutput);
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultNodeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultNodeImpl;
+
+
+public class SOAP12FaultNodeImpl extends SOAPFaultNodeImpl {
+ public SOAP12FaultNodeImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ public SOAP12FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultText;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultReasonImpl;
+
+public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+ public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ /**
+ * @param parent
+ */
+ public SOAP12FaultReasonImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, true);
+ }
+
+ public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
+ if (!(soapFaultText instanceof SOAP12FaultTextImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Text. But received some other implementation");
+ }
+ super.setSOAPText(soapFaultText);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultRoleImpl;
+
+public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl {
+ public SOAP12FaultRoleImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, true);
+ }
+
+ public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultSubCodeImpl;
+
+public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl {
+ //changed
+ public SOAP12FaultSubCodeImpl(SOAPFaultCode parent) throws SOAPProcessingException {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+ }
+
+ //changed
+ public SOAP12FaultSubCodeImpl(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder);
+ }
+
+ public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+ }
+
+ public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
+ (parent instanceof SOAP12FaultCodeImpl))) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCodeValue as the parent. But received some other implementation");
+ }
+ }
+
+ public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+ if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Sub Code. But received some other implementation");
+ }
+ super.setSubCode(subCode);
+ }
+
+ public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
+ if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Fault Value. But received some other implementation");
+ }
+ super.setValue(soapFaultSubCodeValue);
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultTextImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultTextImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultTextImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultTextImpl;
+
+public class SOAP12FaultTextImpl extends SOAPFaultTextImpl {
+ public SOAP12FaultTextImpl(SOAPFaultReason parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ public SOAP12FaultTextImpl(SOAPFaultReason parent,
+ OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12FaultReasonImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP FaultReason as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultValueImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultValueImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultValueImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12FaultValueImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultValueImpl;
+
+
+public class SOAP12FaultValueImpl extends SOAPFaultValueImpl {
+ public SOAP12FaultValueImpl(OMElement parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
+ (parent instanceof SOAP12FaultCodeImpl))) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPConstants;
+import org.apache.ws.commons.soap.SOAPHeader;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPHeaderBlockImpl;
+
+public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+ /**
+ * @param localName
+ * @param ns
+ */
+ public SOAP12HeaderBlockImpl(String localName,
+ OMNamespace ns,
+ SOAPHeader parent) throws SOAPProcessingException {
+ super(localName, ns, parent);
+ checkParent(parent);
+ }
+
+ /**
+ * Constructor SOAPHeaderBlockImpl
+ *
+ * @param localName
+ * @param ns
+ * @param parent
+ * @param builder
+ */
+ public SOAP12HeaderBlockImpl(String localName,
+ OMNamespace ns,
+ SOAPHeader parent,
+ OMXMLParserWrapper builder) {
+ super(localName, ns, parent, builder);
+
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP12HeaderImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+ }
+ }
+
+ public void setRole(String roleURI) {
+ setAttribute(SOAP12Constants.SOAP_ROLE,
+ roleURI,
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ }
+
+ public String getRole() {
+ return getAttribute(SOAP12Constants.SOAP_ROLE,
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ }
+
+ public void setMustUnderstand(boolean mustUnderstand) {
+ setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ mustUnderstand ? "1" : "0",
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ }
+
+ public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {
+ if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {
+ setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ mustUnderstand,
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ } else {
+ throw new SOAPProcessingException(
+ "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");
+ }
+ }
+
+ public boolean getMustUnderstand() throws SOAPProcessingException {
+ String mustUnderstand = "";
+ if ((mustUnderstand =
+ getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+ != null) {
+ if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(
+ mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(
+ mustUnderstand)) {
+ return true;
+ } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(
+ mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(
+ mustUnderstand)) {
+ return false;
+ } else {
+ throw new SOAPProcessingException(
+ "Invalid value found in mustUnderstand value of " +
+ this.getLocalName() +
+ " header block");
+ }
+ }
+ return false;
+
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap12/SOAP12HeaderImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.soap.impl.llom.soap12;
+
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.OMNodeEx;
+import org.apache.ws.commons.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPHeaderBlock;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPHeaderImpl;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public class SOAP12HeaderImpl extends SOAPHeaderImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ /**
+ * @param envelope
+ */
+ public SOAP12HeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+ super(envelope);
+ }
+
+ /**
+ * Constructor SOAPHeaderImpl
+ *
+ * @param envelope
+ * @param builder
+ */
+ public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+ super(envelope, builder);
+ }
+
+ public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {
+ if (ns == null || ns.getName() == null || "".equals(ns.getName())) {
+ throw new OMException(
+ "All the SOAP Header blocks should be namespace qualified");
+ }
+
+ OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
+ if (namespace != null) {
+ ns = namespace;
+ }
+
+ SOAPHeaderBlock soapHeaderBlock = null;
+ try {
+ soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this);
+ } catch (SOAPProcessingException e) {
+ throw new OMException(e);
+ }
+ ((OMNodeEx)soapHeaderBlock).setComplete(true);
+ return soapHeaderBlock;
+ }
+
+
+ public Iterator extractHeaderBlocks(String role) {
+ return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),
+ new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP12Constants.SOAP_ROLE),
+ role,
+ true);
+ }
+
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/Base64Test.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/Base64Test.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/Base64Test.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/Base64Test.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.attachments;
+
+import junit.framework.TestCase;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.ws.commons.om.util.Base64;
+
+public class Base64Test extends TestCase {
+
+ Object expectedObject;
+
+ ByteArrayInputStream byteStream;
+
+ /*
+ * Class under test for String encode(byte[])
+ */
+
+ public void testEncodebyteArray() throws Exception {
+ Object actualObject;
+ String expectedBase64;
+ expectedObject = new String("Lanka Software Foundation");
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ ObjectOutputStream objectOutStream = new ObjectOutputStream(byteStream);
+ objectOutStream.writeObject(expectedObject);
+ expectedBase64 = Base64.encode(byteStream.toByteArray());
+ byte[] tempa = Base64.decode(expectedBase64);
+ ObjectInputStream objectInStream = new ObjectInputStream(
+ new ByteArrayInputStream(tempa));
+ actualObject = objectInStream.readObject();
+ assertEquals("Base64 Encoding Check", expectedObject, actualObject);
+ }
+}
\ No newline at end of file
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/ImageSampleTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/ImageSampleTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/ImageSampleTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/ImageSampleTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.attachments;
+
+import org.apache.ws.commons.attachments.utils.ImageDataSource;
+import org.apache.ws.commons.attachments.utils.ImageIO;
+import org.apache.ws.commons.om.AbstractTestCase;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMOutputFormat;
+import org.apache.ws.commons.om.OMText;
+import org.apache.ws.commons.om.impl.llom.OMElementImpl;
+import org.apache.ws.commons.om.impl.llom.OMNamespaceImpl;
+import org.apache.ws.commons.om.impl.llom.OMTextImpl;
+import org.apache.ws.commons.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
+
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.awt.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class ImageSampleTest extends AbstractTestCase {
+
+ public ImageSampleTest(String testName) {
+ super(testName);
+ }
+
+ /*
+ * @see TestCase#setUp()
+ */
+ Image expectedImage;
+
+ MTOMStAXSOAPModelBuilder builder;
+
+ DataHandler expectedDH;
+
+ File outMTOMFile;
+
+ File outBase64File;
+
+ String outFileName = "target/ActualImageMTOMOut.bin";
+
+ String outBase64FileName = "target/OMSerializeBase64Out.xml";
+
+ String imageInFileName = "mtom/img/test.jpg";
+
+ String imageOutFileName = "target/testOut.jpg";
+
+ String inMimeFileName = "mtom/ImageMTOMOut.bin";
+
+ String contentTypeString = "multipart/Related; type=\"application/xop+xml\";start=\"<SOAPPart>\"; boundary=\"----=_AxIs2_Def_boundary_=42214532\"";
+
+
+
+ public void testImageSampleSerialize() throws Exception {
+
+ outMTOMFile = new File(outFileName);
+ outBase64File = new File(outBase64FileName);
+ OMOutputFormat mtomOutputFormat = new OMOutputFormat();
+ mtomOutputFormat.setDoOptimize(true);
+ OMOutputFormat baseOutputFormat = new OMOutputFormat();
+ baseOutputFormat.setDoOptimize(false);
+
+ OMNamespaceImpl soap = new OMNamespaceImpl(
+ "http://schemas.xmlsoap.org/soap/envelope/", "soap");
+ OMElement envelope = new OMElementImpl("Envelope", soap);
+ OMElement body = new OMElementImpl("Body", soap);
+
+ OMNamespaceImpl dataName = new OMNamespaceImpl(
+ "http://www.example.org/stuff", "m");
+ OMElement data = new OMElementImpl("data", dataName);
+
+ expectedImage =
+ new ImageIO().loadImage(
+ new FileInputStream(
+ getTestResourceFile(imageInFileName)));
+ ImageDataSource dataSource = new ImageDataSource("WaterLilies.jpg",
+ expectedImage);
+ expectedDH = new DataHandler(dataSource);
+ OMText binaryNode = new OMTextImpl(expectedDH, true);
+
+ envelope.addChild(body);
+ body.addChild(data);
+ data.addChild(binaryNode);
+
+ envelope.serializeAndConsume(new FileOutputStream(outBase64File), baseOutputFormat);
+ envelope.serializeAndConsume(new FileOutputStream(outMTOMFile), mtomOutputFormat);
+ }
+
+ public void testImageSampleDeserialize() throws Exception {
+ InputStream inStream = new FileInputStream(
+ getTestResourceFile(inMimeFileName));
+ MIMEHelper mimeHelper = new MIMEHelper(inStream, contentTypeString);
+ XMLStreamReader reader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(
+ new BufferedReader(
+ new InputStreamReader(
+ mimeHelper
+ .getSOAPPartInputStream())));
+ builder = new MTOMStAXSOAPModelBuilder(reader, mimeHelper, null);
+ OMElement root = builder.getDocumentElement();
+ OMElement body = (OMElement) root.getFirstOMChild();
+ OMElement data = (OMElement) body.getFirstOMChild();
+ OMText blob = (OMText) data.getFirstOMChild();
+ /*
+ * Following is the procedure the user has to follow to read objects in
+ * OBBlob User has to know the object type & whether it is serializable.
+ * If it is not he has to use a Custom Defined DataSource to get the
+ * Object.
+ */
+
+ DataHandler actualDH;
+ actualDH = (DataHandler)blob.getDataHandler();
+ Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
+ .getInputStream());
+ FileOutputStream imageOutStream = new FileOutputStream(
+ new File(imageOutFileName));
+ new ImageIO().saveImage("image/jpeg", actualObject, imageOutStream);
+
+ }
+
+}
\ No newline at end of file
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/MIMEHelperTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/MIMEHelperTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/MIMEHelperTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/attachments/MIMEHelperTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.attachments;
+
+import junit.framework.TestCase;
+
+public class MIMEHelperTest extends TestCase {
+
+
+ public void testMIMEHelper() {
+ }
+
+ public void testGetAttachmentSpecType() {
+ }
+
+ public void testGetSOAPPartInputStream() {
+ }
+
+ public void testGetDataHandler() {
+ }
+
+}
\ No newline at end of file
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractOMSerializationTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractOMSerializationTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractOMSerializationTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractOMSerializationTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.om;
+
+import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.ws.commons.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class AbstractOMSerializationTest extends XMLTestCase {
+
+ protected boolean ignoreXMLDeclaration = true;
+ protected boolean ignoreDocument = false;
+ protected Log log = LogFactory.getLog(getClass());
+
+
+ /**
+ * @param xmlString - remember this is not the file path. this is the xml string
+ */
+ public Diff getDiffForComparison(String xmlString) throws Exception {
+ return getDiffForComparison(new ByteArrayInputStream(xmlString.getBytes()));
+ }
+
+ public Diff getDiffForComparison(File xmlFile) throws Exception {
+ return getDiffForComparison(new FileInputStream(xmlFile));
+ }
+
+ public String getSerializedOM(String xmlString) throws Exception {
+ try {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xmlString.getBytes());
+ StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.
+ createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
+ factory.createXMLStreamReader(byteArrayInputStream));
+ staxOMBuilder.setDoDebug(true);
+ OMElement rootElement = staxOMBuilder.getDocumentElement();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ OMOutputFormat format = new OMOutputFormat();
+ format.setIgnoreXMLDeclaration(ignoreXMLDeclaration);
+
+ ((OMDocument) rootElement.getParent()).serialize(baos, format);
+
+ return new String(baos.toByteArray());
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ public Diff getDiffForComparison(InputStream inStream) throws Exception {
+
+ try {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+
+ StAXOMBuilder staxOMBuilder = OMXMLBuilderFactory.
+ createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
+ factory.createXMLStreamReader(inStream));
+ staxOMBuilder.setDoDebug(true);
+ OMElement rootElement = staxOMBuilder.getDocumentElement();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ if (ignoreDocument) {
+ rootElement.serialize(baos);
+ } else {
+ ((OMDocument) rootElement.getParent()).serialize(baos);
+ }
+
+ InputSource resultXML = new InputSource(new InputStreamReader(
+ new ByteArrayInputStream(baos.toByteArray())));
+
+ Document dom2 = newDocument(resultXML);
+ Document dom1 = newDocument(inStream);
+
+ return compareXML(dom1, dom2);
+ } catch (XMLStreamException e) {
+ fail(e.getMessage());
+ throw new Exception(e);
+ } catch (ParserConfigurationException e) {
+ fail(e.getMessage());
+ throw new Exception(e);
+ } catch (SAXException e) {
+ fail(e.getMessage());
+ throw new Exception(e);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ throw new Exception(e);
+ }
+ }
+
+ public Document newDocument(InputSource in)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ return db.parse(in);
+ }
+
+ public Document newDocument(InputStream in)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ return db.parse(in);
+ }
+
+ public Document newDocument(String xml)
+ throws ParserConfigurationException, SAXException, IOException {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ return db.parse(new ByteArrayInputStream(xml.getBytes()));
+ }
+
+ public String writeXmlFile(Document doc) {
+ try {
+ // Prepare the DOM document for writing
+ Source source = new DOMSource(doc);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Result result = new StreamResult(baos);
+
+ // Write the DOM document to the file
+ Transformer xformer = TransformerFactory.newInstance().newTransformer();
+ xformer.transform(source, result);
+ return new String(baos.toByteArray());
+ } catch (TransformerConfigurationException e) {
+ log.error(e.getMessage(), e);
+ } catch (TransformerException e) {
+ log.error(e.getMessage(), e);
+ }
+ return null;
+
+ }
+
+}
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractTestCase.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractTestCase.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AbstractTestCase.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.om;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+/**
+ * Abstract base class for test cases.
+ */
+public abstract class AbstractTestCase
+ extends TestCase {
+ protected String testDir = "test" + File.separator;
+ protected String sampleDir = "samples" + File.separator;
+ protected String outDir = "target" + File.separator + "generated" +
+ File.separator +
+ "samples" +
+ File.separator;
+ protected String tempDir = "target" + File.separator + "generated" +
+ File.separator +
+ "temp";
+ protected String testResourceDir = "test-resources";
+
+ /**
+ * Basedir for all file I/O. Important when running tests from
+ * the reactor.
+ */
+ public String basedir = System.getProperty("basedir");
+
+ /**
+ * @param testName
+ */
+ public AbstractTestCase(String testName) {
+ super(testName);
+ if (basedir == null) {
+ basedir = new File(".").getAbsolutePath();
+ }
+ testDir = new File(basedir, testDir).getAbsolutePath();
+ sampleDir = new File(basedir, sampleDir).getAbsolutePath();
+ outDir = new File(basedir, outDir).getAbsolutePath();
+ tempDir = new File(basedir, tempDir).getAbsolutePath();
+ }
+
+ public File getTestResourceFile(String relativePath) {
+ return new File(testResourceDir, relativePath);
+ }
+
+ public File getTempOutputFile(String filename) {
+ File f = new File(tempDir);
+ if(!f.exists()) {
+ f.mkdirs();
+ }
+ return new File(f, filename);
+ }
+}
+
Added: webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AttrNsTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AttrNsTest.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AttrNsTest.java (added)
+++ webservices/commons/trunk/axiom/test/org/apache/ws/commons/om/AttrNsTest.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.commons.om;
+
+import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
+import org.custommonkey.xmlunit.Diff;
+import org.w3c.dom.Document;
+
+import javax.xml.namespace.QName;
+import java.io.ByteArrayInputStream;
+
+public class AttrNsTest extends AbstractOMSerializationTest {
+
+ private String attrNamespaceTestXML = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<foo xmlns:a=\"http://opensource.lk\">" +
+ " <bar1 b:attr=\"test attr value1\" xmlns:b=\"http://opensource.lk/ns1\">test1</bar1>" +
+ " <bar2 b:attr=\"test attr value2\" xmlns:b=\"http://opensource.lk/ns1\">test2</bar2>" +
+ "</foo>";
+
+ public void testAttributeNamespaces() throws Exception {
+ ignoreXMLDeclaration = true;
+ ignoreDocument = true;
+
+ Document document1 = newDocument(attrNamespaceTestXML);
+ String serializedOM = getSerializedOM(attrNamespaceTestXML);
+ Document document2 = newDocument(serializedOM);
+
+ Diff diff = compareXML(document1, document2);
+ assertXMLEqual(diff, true);
+ }
+
+
+ /**
+ * Test method to test the XML namespace
+ * @throws Exception
+ */
+ public void testAttr() throws Exception{
+ String xml = "<wsp:Policy xml:base=\"uri:thisBase\" " +
+ "xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">" +
+ "</wsp:Policy>";
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
+ StAXOMBuilder builder = new StAXOMBuilder(bais);
+ OMElement elem = builder.getDocumentElement();
+ elem.build();
+ assertEquals("Attribute value mismatch", "uri:thisBase", elem.getAttributeValue(new QName(OMConstants.XMLNS_URI,"base")));
+
+ OMAttribute attr = elem.getAttribute(new QName(OMConstants.XMLNS_URI,"base"));
+
+ assertEquals("Attribute namespace mismatch", OMConstants.XMLNS_URI, attr.getNamespace().getName());
+ }
+
+ /**
+ * Test method to test the XML namespace of an attr without
+ * any other ns declarations in the element
+ * @throws Exception
+ */
+ public void testAttrWithoutElementNS() throws Exception{
+ String xml = "<Policy xml:base=\"uri:thisBase\"></Policy>";
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
+ StAXOMBuilder builder = new StAXOMBuilder(bais);
+ OMElement elem = builder.getDocumentElement();
+ elem.build();
+ assertEquals("Attribute value mismatch", "uri:thisBase", elem.getAttributeValue(new QName(OMConstants.XMLNS_URI,"base")));
+
+ OMAttribute attr = elem.getAttribute(new QName(OMConstants.XMLNS_URI,"base"));
+
+ assertEquals("Attribute namespace mismatch", OMConstants.XMLNS_URI, attr.getNamespace().getName());
+ }
+
+}