You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2006/03/01 12:33:13 UTC

svn commit: r381992 [2/2] - in /webservices/axis2/trunk/archive/java/scratch/ruchith: ./ trust/ trust/src/ trust/src/org/ trust/src/org/apache/ trust/src/org/apache/axis2/ trust/src/org/apache/axis2/security/ trust/src/org/apache/axis2/security/trust/ ...

Added: webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestSecurityTokenResponse.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestSecurityTokenResponse.java?rev=381992&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestSecurityTokenResponse.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestSecurityTokenResponse.java Wed Mar  1 03:33:04 2006
@@ -0,0 +1,54 @@
+/*
+ * 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.axis2.security.trust.token;
+
+import org.apache.axis2.security.trust.TrustException;
+import org.apache.ws.commons.om.OMElement;
+
+import javax.xml.namespace.QName;
+
+public class RequestSecurityTokenResponse extends CompositeToken {
+
+	public RequestSecurityTokenResponse() {
+		super();
+	}
+
+	/**
+	 * @param elem
+	 * @throws TrustException
+	 */
+	public RequestSecurityTokenResponse(OMElement elem) throws TrustException {
+		super(elem);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.trust.token.AbstractToken#getToken()
+	 */
+	protected QName getToken() {
+		// TODO TODO
+		throw new UnsupportedOperationException("TODO");
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.trust.token.AbstractToken#deserializeChildElement(org.apache.ws.commons.om.OMElement)
+	 */
+	protected void deserializeChildElement(OMElement element)
+			throws TrustException {
+		// TODO TODO
+		throw new UnsupportedOperationException("TODO");
+	}
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestType.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestType.java?rev=381992&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestType.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/RequestType.java Wed Mar  1 03:33:04 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.axis2.security.trust.token;
+
+import org.apache.axis2.security.trust.Constants;
+import org.apache.axis2.security.trust.TrustException;
+import org.apache.ws.commons.om.OMElement;
+
+import javax.xml.namespace.QName;
+
+public class RequestType extends ValueToken {
+
+    public static final QName TOKEN = new QName(Constants.WST_NS, Constants.LN.REQUEST_TYPE, Constants.WST_PREFIX);
+    
+	public RequestType() {
+		super();
+	}
+
+	/**
+	 * @param elem
+	 * @throws TrustException
+	 */
+	public RequestType(OMElement elem) throws TrustException {
+		super(elem);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.trust.token.AbstractToken#getToken()
+	 */
+	protected QName getToken() {
+		return TOKEN;
+	}
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/TokenType.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/TokenType.java?rev=381992&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/TokenType.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/TokenType.java Wed Mar  1 03:33:04 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.axis2.security.trust.token;
+
+import org.apache.axis2.security.trust.Constants;
+import org.apache.axis2.security.trust.TrustException;
+import org.apache.ws.commons.om.OMElement;
+
+import javax.xml.namespace.QName;
+
+public class TokenType extends ValueToken {
+	
+    public static final QName TOKEN = new QName(Constants.WST_NS, Constants.LN.TOKEN_TYPE, Constants.WST_PREFIX);
+    
+	public TokenType() {
+		super();
+	}
+
+	/**
+	 * @param elem
+	 * @throws TrustException
+	 */
+	public TokenType(OMElement elem) throws TrustException {
+		super(elem);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.trust.token.AbstractToken#getToken()
+	 */
+	protected QName getToken() {
+		return TOKEN;
+	}
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/ValueToken.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/ValueToken.java?rev=381992&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/ValueToken.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/ruchith/trust/src/org/apache/axis2/security/trust/token/ValueToken.java Wed Mar  1 03:33:04 2006
@@ -0,0 +1,84 @@
+/*
+ * 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.axis2.security.trust.token;
+
+import org.apache.axis2.security.trust.TrustException;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMText;
+
+/**
+ * This is the base class for the elements that carries a
+ * value in the element.
+ * Example:
+ * 	<wsu:Created>...</wsu:Created>
+ */
+public abstract class ValueToken extends AbstractToken {
+	
+	protected OMText valueText;
+	
+	public ValueToken() {
+		super();
+	}
+	
+	public ValueToken(OMElement elem) throws TrustException {
+		super(elem);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.trust.token.AbstractToken#deserializeChildElement(org.apache.ws.commons.om.OMElement)
+	 */
+	protected void deserializeChildElement(OMElement element)
+			throws TrustException {
+		//There cannot be any children in this token
+		throw new TrustException(TrustException.INVALID_REQUEST,
+				TrustException.DESC_CHILD_IN_VALUE_ELEM,
+				new Object[] {
+				this.getToken().getNamespaceURI(),this.getToken().getLocalPart(),
+				element.getNamespace().getName(),element.getLocalName()});
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axis2.security.trust.token.AbstractToken#setElementTextValue(org.apache.ws.commons.om.OMText)
+	 */
+	protected void setElementTextValue(OMText textNode) {
+		this.valueText = textNode;
+	}
+	
+	/**
+	 * Returns the value of the token.
+	 * @return Returns String.
+	 */
+	public String getValue() {
+		if(this.valueText != null) 
+			return this.valueText.getText();
+		else
+			return null;
+	}
+	
+	/**
+	 * Sets the value of the token.
+	 * @param value
+	 */
+	public void setValue(String value) {
+    	if(this.valueText != null)
+    		this.valueText.detach();
+    	
+    	this.valueText = factory.createText(value);
+        this.tokenElement.addChild(this.valueText);
+	}
+	
+}