FileDocCategorySizeDatePackage
RequestedProofTokenImpl.javaAPI DocExample8145Tue May 29 16:57:00 BST 2007com.sun.xml.ws.security.trust.impl.elements

RequestedProofTokenImpl

public class RequestedProofTokenImpl extends com.sun.xml.ws.security.trust.impl.bindings.RequestedProofTokenType implements com.sun.xml.ws.security.trust.elements.RequestedProofToken
author
Manveen Kaur

Fields Summary
private static final Logger
log
private String
tokenType
private URI
computedKey
private com.sun.xml.ws.security.trust.elements.BinarySecret
secret
private com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference
str
Constructors Summary
public RequestedProofTokenImpl()

    
      
        // empty constructor
    
public RequestedProofTokenImpl(String proofTokenType)

        setProofTokenType(proofTokenType);
    
public RequestedProofTokenImpl(com.sun.xml.ws.security.trust.impl.bindings.RequestedProofTokenType rptType)

        final JAXBElement obj = (JAXBElement)rptType.getAny();
        final String local = obj.getName().getLocalPart();
        if (local.equalsIgnoreCase("ComputedKey")) {
            setComputedKey(URI.create((String)obj.getValue()));
        }else if (local.equalsIgnoreCase("BinarySecret")){
            final BinarySecretType bsType = (BinarySecretType)obj.getValue();
            setBinarySecret(new BinarySecretImpl(bsType));
        } else{
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0019_INVALID_PROOF_TOKEN_TYPE(local, null));
            throw new RuntimeException(LogStringsMessages.WST_0019_INVALID_PROOF_TOKEN_TYPE(local, null));
        }
    
Methods Summary
public static com.sun.xml.ws.security.trust.impl.bindings.RequestedProofTokenTypefromElement(org.w3c.dom.Element element)

        try {
            final javax.xml.bind.Unmarshaller unmarshaller = WSTrustElementFactory.getContext().createUnmarshaller();
            return (RequestedProofTokenType)unmarshaller.unmarshal(element);
        } catch (JAXBException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0021_ERROR_UNMARSHAL_DOM_ELEMENT(), ex);
            throw new WSTrustException(LogStringsMessages.WST_0021_ERROR_UNMARSHAL_DOM_ELEMENT(), ex);
        }
    
public com.sun.xml.ws.security.trust.elements.BinarySecretgetBinarySecret()

        return secret;
    
public java.net.URIgetComputedKey()

        return computedKey;
    
public java.lang.StringgetProofTokenType()

        return tokenType;
    
public com.sun.xml.ws.security.trust.elements.str.SecurityTokenReferencegetSecurityTokenReference()

        return str;
    
public final voidsetBinarySecret(com.sun.xml.ws.security.trust.elements.BinarySecret secret)

        if (secret != null) {
            this.secret = secret;
            final JAXBElement<BinarySecretType> bsElement=
                    (new ObjectFactory()).createBinarySecret((BinarySecretType)secret);
            setAny(bsElement);
        }
        setProofTokenType(RequestedProofToken.BINARY_SECRET_TYPE);
    
public final voidsetComputedKey(java.net.URI computedKey)

        
        if (computedKey != null) {
            final String ckString = computedKey.toString();
            if (!(ckString.equalsIgnoreCase(WSTrustConstants.CK_HASH) || (ckString.equalsIgnoreCase(WSTrustConstants.CK_PSHA1)))) {
                log.log(Level.SEVERE,
                        LogStringsMessages.WST_0028_INVALID_CK(ckString));
                throw new RuntimeException(LogStringsMessages.WST_0028_INVALID_CK(ckString));
            }
            this.computedKey = computedKey;
            final JAXBElement<String> ckElement=
                    (new ObjectFactory()).createComputedKey(computedKey.toString());
            setAny(ckElement);
        }
        setProofTokenType(RequestedProofToken.COMPUTED_KEY_TYPE);
    
public final voidsetProofTokenType(java.lang.String proofTokenType)

        if (! (proofTokenType.equalsIgnoreCase(RequestedProofToken.BINARY_SECRET_TYPE)
        || proofTokenType.equalsIgnoreCase(RequestedProofToken.COMPUTED_KEY_TYPE)
        || proofTokenType.equalsIgnoreCase(RequestedProofToken.ENCRYPTED_KEY_TYPE)
        || proofTokenType.equalsIgnoreCase(RequestedProofToken.CUSTOM_TYPE)
        || proofTokenType.equalsIgnoreCase(RequestedProofToken.TOKEN_REF_TYPE)
        )) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0019_INVALID_PROOF_TOKEN_TYPE(proofTokenType, null));
            throw new RuntimeException(LogStringsMessages.WST_0019_INVALID_PROOF_TOKEN_TYPE(proofTokenType, null));
        }
        tokenType = proofTokenType;
    
public voidsetSecurityTokenReference(com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference reference)

        if (reference != null) {
            str = reference;
            final JAXBElement<SecurityTokenReferenceType> strElement=
                    (new com.sun.xml.ws.security.secext10.ObjectFactory()).createSecurityTokenReference((SecurityTokenReferenceType)reference);
            setAny(strElement);
        }
        setProofTokenType(RequestedProofToken.TOKEN_REF_TYPE);