FileDocCategorySizeDatePackage
WSTrustElementFactoryImpl.javaAPI DocExample35372Tue May 29 16:56:58 BST 2007com.sun.xml.ws.security.trust.impl

WSTrustElementFactoryImpl

public class WSTrustElementFactoryImpl extends com.sun.xml.ws.security.trust.WSTrustElementFactory
A Factory for creating the WS-Trust schema elements, and marshalling/un-marshalling them.
author
Manveen Kaur

Fields Summary
private static final Logger
log
private Marshaller
marshaller
private static final String
RST
private static final String
RSTRCollection
Constructors Summary
public WSTrustElementFactoryImpl()

    
     
        try {
            marshaller = getContext().createMarshaller();
            marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new com.sun.xml.ws.security.trust.util.TrustNamespacePrefixMapper());
        } catch( PropertyException e ) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0003_ERROR_CREATING_WSTRUSTFACT(), e);
            throw new RuntimeException(
                    LogStringsMessages.WST_0003_ERROR_CREATING_WSTRUSTFACT(), e);
        } catch (JAXBException jbe) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0003_ERROR_CREATING_WSTRUSTFACT(), jbe);
            throw new RuntimeException(
                    LogStringsMessages.WST_0003_ERROR_CREATING_WSTRUSTFACT(), jbe);
        }
    
Methods Summary
public com.sun.xml.ws.security.trust.elements.BinarySecretcreateBinarySecret(byte[] rawValue, java.lang.String type)

        return new BinarySecretImpl(rawValue, type);
    
public com.sun.xml.ws.security.trust.elements.BinarySecretcreateBinarySecret(org.w3c.dom.Element elem)

        return new BinarySecretImpl(BinarySecretImpl.fromElement(elem));
    
public com.sun.xml.ws.security.trust.elements.CancelTargetcreateCancelTarget(com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference str)

        return new CancelTargetImpl(str);
    
public com.sun.xml.ws.security.trust.elements.str.DirectReferencecreateDirectReference(java.lang.String valueType, java.lang.String uri)

        return new DirectReferenceImpl(valueType, uri);
    
public com.sun.xml.ws.security.trust.elements.EntropycreateEntropy(com.sun.xml.ws.security.trust.elements.BinarySecret secret)
Create an Entropy with a BinarySecret

        return new EntropyImpl(secret);
    
public com.sun.xml.ws.security.trust.elements.EntropycreateEntropy(com.sun.xml.ws.security.EncryptedKey key)
Create an Entropy with an xenc:EncryptedKey

        return new EntropyImpl(key);
    
public com.sun.xml.ws.security.trust.elements.IssuedTokenscreateIssuedTokens(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollection issuedTokens)
Create a wst:IssuedTokens object

        return new IssuedTokensImpl(issuedTokens);
    
public com.sun.xml.ws.security.trust.elements.str.KeyIdentifiercreateKeyIdentifier(java.lang.String valueType, java.lang.String encodingType)

        return new KeyIdentifierImpl(valueType, encodingType);
    
public com.sun.xml.ws.security.trust.elements.LifetimecreateLifetime(com.sun.xml.ws.security.wsu10.AttributedDateTime created, com.sun.xml.ws.security.wsu10.AttributedDateTime expires)
Create a Lifetime.

        return new LifetimeImpl(created, expires);
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRST()
Create an Empty RST

        return new RequestSecurityTokenImpl();
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTForCancel(java.net.URI requestType, com.sun.xml.ws.security.trust.elements.CancelTarget target)
Create an RST for Token Cancellation

        return new RequestSecurityTokenImpl(null, requestType, target);
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTForIssue(java.net.URI tokenType, java.net.URI requestType, java.net.URI context, com.sun.xml.ws.policy.impl.bindings.AppliesTo scopes, com.sun.xml.ws.api.security.trust.Claims claims, com.sun.xml.ws.security.trust.elements.Entropy entropy, com.sun.xml.ws.security.trust.elements.Lifetime lifetime)
Create an RST for Issue from the given arguments Any of the arguments can be null since they are all optional, but one of tokenType and AppliesTo must be present

        
        if (tokenType==null && scopes==null) {
            log.log(Level.WARNING,
                    LogStringsMessages.WST_1003_TOKENTYPE_APPLIESTO_NULL());
        }
        return new RequestSecurityTokenImpl(tokenType, requestType, context, scopes, claims, entropy, lifetime, null);
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTForRenew(java.net.URI tokenType, java.net.URI requestType, java.net.URI context, com.sun.xml.ws.security.trust.elements.RenewTarget target, com.sun.xml.ws.security.trust.elements.AllowPostdating apd, com.sun.xml.ws.security.trust.elements.Renewing renewingInfo)
Create an RST for a Renewal Request

        return new RequestSecurityTokenImpl(tokenType, requestType, context, target, apd, renewingInfo);
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTForValidate(java.net.URI tokenType, java.net.URI requestType)
Create an RST for Token Validation

TODO: Not clear from Spec whether the Token to be validated is ever sent ? TODO: There is a mention of special case where a SOAPEnvelope may be specified as a security token if the requestor desires the envelope to be validated.

        return new RequestSecurityTokenImpl(tokenType, requestType);
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTFrom(javax.xml.transform.Source src)
create an RST from a Source

        try {
            final javax.xml.bind.Unmarshaller unmarshaller = getContext().createUnmarshaller();
            final JAXBElement<RequestSecurityTokenType> rstType = unmarshaller.unmarshal(src, RequestSecurityTokenType.class);
            final RequestSecurityTokenType type = rstType.getValue();
            return new RequestSecurityTokenImpl(type);
        } catch ( Exception ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0006_FAIL_RST_SOURCE(src.toString()), ex);
            throw new RuntimeException(LogStringsMessages.WST_0006_FAIL_RST_SOURCE(src.toString()), ex);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTFrom(org.w3c.dom.Element elem)
create an RST from DOM Element

        try {
            final javax.xml.bind.Unmarshaller unmarshaller = getContext().createUnmarshaller();
            final JAXBElement<RequestSecurityTokenType> rstType = unmarshaller.unmarshal(elem, RequestSecurityTokenType.class);
            final RequestSecurityTokenType type = rstType.getValue();
            return new RequestSecurityTokenImpl(type);
        } catch ( Exception ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0007_FAIL_RST_ELEM(elem.toString()), ex);
            throw new RuntimeException(LogStringsMessages.WST_0007_FAIL_RST_ELEM(elem.toString()), ex);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokencreateRSTFrom(javax.xml.bind.JAXBElement elem)
create an RST from JAXBElement

NOTE: an STS Implementor can call

JAXBElement<RequestSecurityTokenType> elem=
ObjectFactory.createRequestSecurityToken(<JAXBBean for RST>)
The JAXBBean for RST is the one generated from the ws-trust.xsd schema The default implementation expects the packagename of the generated JAXB Beans to be fixed.

        try {
            final RequestSecurityTokenType type = (RequestSecurityTokenType)elem.getValue();
            return new RequestSecurityTokenImpl(type);
        } catch (Exception e) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0010_FAILED_CREATION_FROM_JAXBELE(RST), e);
            throw new RuntimeException(LogStringsMessages.WST_0010_FAILED_CREATION_FROM_JAXBELE(RST), e);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTR()
Create an Empty RSTR

        return new RequestSecurityTokenResponseImpl();
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollectioncreateRSTRCollectionForIssue(java.net.URI tokenType, java.net.URI context, com.sun.xml.ws.security.trust.elements.RequestedSecurityToken token, com.sun.xml.ws.policy.impl.bindings.AppliesTo scopes, com.sun.xml.ws.security.trust.elements.RequestedAttachedReference attached, com.sun.xml.ws.security.trust.elements.RequestedUnattachedReference unattached, com.sun.xml.ws.security.trust.elements.RequestedProofToken proofToken, com.sun.xml.ws.security.trust.elements.Entropy entropy, com.sun.xml.ws.security.trust.elements.Lifetime lifetime)
Create a collection of RequestSecurityTokenResponse(s)

        final RequestSecurityTokenResponseCollection rstrCollection =
                new RequestSecurityTokenResponseCollectionImpl(tokenType, context, token, scopes, attached, unattached, proofToken, entropy, lifetime);
        return rstrCollection;
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollectioncreateRSTRCollectionFrom(javax.xml.transform.Source src)
Create RSTR Collection from Source

        throw new UnsupportedOperationException("Not yet implemented!");
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollectioncreateRSTRCollectionFrom(org.w3c.dom.Element elem)
Create RSTR Collection from Element

        throw new UnsupportedOperationException("Not yet implemented!");
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollectioncreateRSTRCollectionFrom(javax.xml.bind.JAXBElement elem)
create an RSTR Collection from JAXBElement

NOTE: an STS Implementor can call

JAXBElement<RequestSecurityTokenResponseCollectionType> elem=
ObjectFactory.createRequestSecurityTokenResponseCollection(<JAXBBean for RSTR Collection>
The <JAXBBean for RSTR Collection> is the one generated from the ws-trust.xsd schema The default implementation expects the packagename of the generated JAXB Beans to be fixed.

        try {
            final RequestSecurityTokenResponseCollectionType type = (RequestSecurityTokenResponseCollectionType)elem.getValue();
            return new RequestSecurityTokenResponseCollectionImpl(type);
        } catch (Exception e) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0010_FAILED_CREATION_FROM_JAXBELE(RSTRCollection), e);
            throw new RuntimeException(LogStringsMessages.WST_0010_FAILED_CREATION_FROM_JAXBELE(RSTRCollection), e);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTRForCancel()
Create an RSTR for a Successful Token Cancellation

        final RequestSecurityTokenResponse rstr =  new RequestSecurityTokenResponseImpl();
        rstr.setRequestedTokenCancelled(new RequestedTokenCancelledImpl());
        if(log.isLoggable(Level.FINE)) {            
            log.log(Level.FINE,
                    LogStringsMessages.WST_1008_CREATED_RSTR_CANCEL(rstr.toString()));
        }
        return rstr;
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTRForIssue(java.net.URI tokenType, java.net.URI context, com.sun.xml.ws.security.trust.elements.RequestedSecurityToken token, com.sun.xml.ws.policy.impl.bindings.AppliesTo scopes, com.sun.xml.ws.security.trust.elements.RequestedAttachedReference attachedReference, com.sun.xml.ws.security.trust.elements.RequestedUnattachedReference unattachedRef, com.sun.xml.ws.security.trust.elements.RequestedProofToken proofToken, com.sun.xml.ws.security.trust.elements.Entropy entropy, com.sun.xml.ws.security.trust.elements.Lifetime lifetime)
Create an RSTR for Issue from the given arguments. TokenType should be Issue. Any of the arguments can be null since they are all optional, but one of RequestedSecurityToken or RequestedProofToken should be returned

        final RequestSecurityTokenResponse rstr =
                new RequestSecurityTokenResponseImpl(tokenType, context, token, scopes,
                attachedReference, unattachedRef, proofToken, entropy, lifetime, null);
        return rstr;
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTRForValidate(java.net.URI tokenType, com.sun.xml.ws.security.trust.elements.RequestedSecurityToken token, com.sun.xml.ws.security.trust.elements.Status status)
create an RSTR for validate request.

        return new RequestSecurityTokenResponseImpl(tokenType, null, token, null, null, null, null, null, null, status);
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTRFrom(javax.xml.transform.Source src)
create an RSTR from a Source

        try {
            final javax.xml.bind.Unmarshaller unmarshaller = getContext().createUnmarshaller();
            final JAXBElement<RequestSecurityTokenResponseType> rstType = unmarshaller.unmarshal(src, RequestSecurityTokenResponseType.class);
            final RequestSecurityTokenResponseType type = rstType.getValue();
            return new RequestSecurityTokenResponseImpl(type);
        } catch ( Exception ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0008_FAIL_RSTR_SOURCE(src.toString()), ex);
            throw new RuntimeException(LogStringsMessages.WST_0008_FAIL_RSTR_SOURCE(src.toString()), ex);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTRFrom(org.w3c.dom.Element elem)
create an RSTR from DOM Element

        try {
            final javax.xml.bind.Unmarshaller unmarshaller = getContext().createUnmarshaller();
            final JAXBElement<RequestSecurityTokenResponseType> rstType = unmarshaller.unmarshal(elem, RequestSecurityTokenResponseType.class);
            final RequestSecurityTokenResponseType type = rstType.getValue();
            return new RequestSecurityTokenResponseImpl(type);
        } catch ( Exception ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0008_FAIL_RSTR_SOURCE(elem.toString()), ex);
            throw new RuntimeException(LogStringsMessages.WST_0008_FAIL_RSTR_SOURCE(elem.toString()), ex);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponsecreateRSTRFrom(javax.xml.bind.JAXBElement elem)
create an RSTR from JAXBElement

NOTE: an STS Implementor can call

JAXBElement<RequestSecurityTokenResponseType> elem=
ObjectFactory.createRequestSecurityTokenResponse(<JAXBBean for RSTR>);
The <JAXBBean for RSTR> is the one generated from the ws-trust.xsd schema The default implementation expects the packagename of the generated JAXB Beans to be fixed.

        try {
            final RequestSecurityTokenResponseType type = (RequestSecurityTokenResponseType)elem.getValue();
            return new RequestSecurityTokenResponseImpl(type);
        } catch (Exception e) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0009_FAIL_RSTR_ELEM(elem.toString()), e);
            throw new RuntimeException(LogStringsMessages.WST_0009_FAIL_RSTR_ELEM(elem.toString()), e);
        }
    
public com.sun.xml.ws.security.trust.elements.RequestedAttachedReferencecreateRequestedAttachedReference(com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference str)
Create a RequestedAttachedReference.

        return new RequestedAttachedReferenceImpl(str);
    
public com.sun.xml.ws.security.trust.elements.RequestedProofTokencreateRequestedProofToken()
Create a RequestedProofToken.

        return new RequestedProofTokenImpl();
    
public com.sun.xml.ws.security.trust.elements.RequestedSecurityTokencreateRequestedSecurityToken(com.sun.xml.ws.security.Token token)
Create a RequestedSecurityToken.

        return new RequestedSecurityTokenImpl(token);
    
public com.sun.xml.ws.security.trust.elements.RequestedSecurityTokencreateRequestedSecurityToken()
Create a RequestedSecurityToken.

        return new RequestedSecurityTokenImpl();
    
public com.sun.xml.ws.security.trust.elements.RequestedUnattachedReferencecreateRequestedUnattachedReference(com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference str)
Create a RequestedUnattachedReference.

        return new RequestedUnattachedReferenceImpl(str);
    
public com.sun.xml.ws.security.trust.elements.str.SecurityTokenReferencecreateSecurityTokenReference(com.sun.xml.ws.security.trust.elements.str.Reference ref)

        return new SecurityTokenReferenceImpl(ref);
    
public com.sun.xml.ws.security.trust.elements.str.SecurityTokenReferencecreateSecurityTokenReference(javax.xml.bind.JAXBElement elem)

        try {
            final SecurityTokenReferenceType type = (SecurityTokenReferenceType)elem.getValue();
            return new SecurityTokenReferenceImpl(type);
        } catch (Exception e) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0010_FAILED_CREATION_FROM_JAXBELE("STR"), e);
            throw new RuntimeException(LogStringsMessages.WST_0010_FAILED_CREATION_FROM_JAXBELE("STR"), e);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.RequestSecurityToken rst)
Marshal an RST to a DOM Element.

Note: Useful for Dispatch Client implementations

        try {
            final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            final DocumentBuilder builder = dbf.newDocumentBuilder();
            final Document doc = builder.newDocument();
            
            //javax.xml.bind.Marshaller marshaller = getContext().createMarshaller();
            final JAXBElement<RequestSecurityTokenType> rstElement =  (new ObjectFactory()).createRequestSecurityToken((RequestSecurityTokenType)rst);
            marshaller.marshal(rstElement, doc);
            return doc.getDocumentElement();
            
        } catch (javax.xml.parsers.ParserConfigurationException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), ex);
        } catch (JAXBException e) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), e);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), e);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponse rstr)
Marshal an RSTR to DOM Element

Note: Useful for STS implementations which are JAXWS Providers

        try {
            final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            final DocumentBuilder builder = dbf.newDocumentBuilder();
            final Document doc = builder.newDocument();
            
            //javax.xml.bind.Marshaller marshaller = getContext().createMarshaller();
            final JAXBElement<RequestSecurityTokenResponseType> rstrElement =  (new ObjectFactory()).createRequestSecurityTokenResponse((RequestSecurityTokenResponseType)rstr);
            marshaller.marshal(rstrElement, doc);
            return doc.getDocumentElement();
            
        } catch (Exception ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponse rstr, org.w3c.dom.Document doc)

        try {
            final JAXBElement<RequestSecurityTokenResponseType> rstrElement =  (new ObjectFactory()).createRequestSecurityTokenResponse((RequestSecurityTokenResponseType)rstr);
            marshaller.marshal(rstrElement, doc);
            return doc.getDocumentElement();
            
        } catch (JAXBException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollection rstrCollection)
Marshal an RSTR Collection to a DOM Element

Note: Useful for STS implementations which are JAXWS Providers

        try {
            final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            final DocumentBuilder builder = dbf.newDocumentBuilder();
            final Document doc = builder.newDocument();
            
            //javax.xml.bind.Marshaller marshaller = getContext().createMarshaller();
            final JAXBElement<RequestSecurityTokenResponseCollectionType> rstElement =
                    (new ObjectFactory()).createRequestSecurityTokenResponseCollection((RequestSecurityTokenResponseCollectionType)rstrCollection);
            marshaller.marshal(rstElement, doc);
            return doc.getDocumentElement();
        } catch (javax.xml.parsers.ParserConfigurationException pe) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
            throw new RuntimeException(LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
        } catch (JAXBException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.BinarySecret secret)

        try {
            final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            final DocumentBuilder builder = dbf.newDocumentBuilder();
            final Document doc = builder.newDocument();
            
            //javax.xml.bind.Marshaller marshaller = getContext().createMarshaller();
            final JAXBElement<BinarySecretType> bsElement =
                    (new ObjectFactory()).createBinarySecret((BinarySecretType)secret);
            marshaller.marshal(bsElement, doc);
            return doc.getDocumentElement();
        } catch (javax.xml.parsers.ParserConfigurationException pe) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
            throw new RuntimeException(LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
        } catch (JAXBException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference str, org.w3c.dom.Document doc)
Marshal an STR to a DOM Element.

Note: Useful for Dispatch Client implementations

        try {
            if(doc == null){
                final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                dbf.setNamespaceAware(true);
                final DocumentBuilder builder = dbf.newDocumentBuilder();
                doc = builder.newDocument();
            }
            
            //javax.xml.bind.Marshaller marshaller = getContext().createMarshaller();
            final JAXBElement<SecurityTokenReferenceType> strElement =  (new com.sun.xml.ws.security.secext10.ObjectFactory()).createSecurityTokenReference((SecurityTokenReferenceType)str);
            marshaller.marshal(strElement, doc);
            return doc.getDocumentElement();
        } catch (javax.xml.parsers.ParserConfigurationException pe) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
            throw new RuntimeException(LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
        } catch (JAXBException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
        }
    
public org.w3c.dom.ElementtoElement(com.sun.xml.ws.security.trust.elements.BinarySecret secret, org.w3c.dom.Document doc)
Marshal an BinarySecret to a DOM Element.

Note: Useful for Dispatch Client implementations

        try {
            if(doc == null){
                final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                dbf.setNamespaceAware(true);
                final DocumentBuilder builder = dbf.newDocumentBuilder();
                doc = builder.newDocument();
            }
            
            //javax.xml.bind.Marshaller marshaller = getContext().createMarshaller();
            final JAXBElement<BinarySecretType> bsElement =
                    (new ObjectFactory()).createBinarySecret((BinarySecretType)secret);
            marshaller.marshal(bsElement, doc);
            return doc.getDocumentElement();
            
        } catch (javax.xml.parsers.ParserConfigurationException pe) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
            throw new RuntimeException(LogStringsMessages.WST_0011_PARSERCONFIG_EX_TO_ELEMENT(), pe);
        } catch (JAXBException ex) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
            throw new RuntimeException(LogStringsMessages.WST_0012_JAXB_EX_TO_ELEMENT(), ex);
        }
    
public javax.xml.bind.JAXBElementtoJAXBElement(com.sun.xml.ws.security.trust.elements.str.SecurityTokenReference str)
convert an SecurityTokenReference to a JAXBElement

        final JAXBElement<SecurityTokenReferenceType> strElement =
                (new com.sun.xml.ws.security.secext10.ObjectFactory()).createSecurityTokenReference((SecurityTokenReferenceType)str);
        return strElement;
    
public javax.xml.bind.JAXBElementtoJAXBElement(com.sun.xml.ws.security.trust.elements.RequestSecurityToken rst)
convert an RST to a JAXBElement

        final JAXBElement<RequestSecurityTokenType> rstElement=
                (new ObjectFactory()).createRequestSecurityToken((RequestSecurityTokenType)rst);
        return rstElement;
    
public javax.xml.bind.JAXBElementtoJAXBElement(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponse rstr)
convert an RSTR to a JAXBElement

        final JAXBElement<RequestSecurityTokenResponseType> rstElement=
                (new ObjectFactory()).createRequestSecurityTokenResponse((RequestSecurityTokenResponseType)rstr);
        return rstElement;
    
public javax.xml.bind.JAXBElementtoJAXBElement(com.sun.xml.ws.security.trust.elements.Entropy entropy)
convert a Entropy to a JAXBElement

        final JAXBElement<EntropyType> etElement=
                (new ObjectFactory()).createEntropy((EntropyType)entropy);
        return etElement;
    
public javax.xml.bind.JAXBElementtoJAXBElement(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollection rstrCollection)
convert an RSTR Collection to a JAXBElement

        final JAXBElement<RequestSecurityTokenResponseCollectionType> rstElement=
                (new ObjectFactory()).createRequestSecurityTokenResponseCollection((RequestSecurityTokenResponseCollectionType)rstrCollection);
        return rstElement;
    
public javax.xml.transform.SourcetoSource(com.sun.xml.ws.security.trust.elements.RequestSecurityToken rst)
Marshal an RST to a Source.

Note: Useful for Dispatch Client implementations

        try{
            return new JAXBSource(marshaller, toJAXBElement(rst));
        }catch(JAXBException ex){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RST), ex);
            throw new RuntimeException(LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RST), ex);
        }
    
public javax.xml.transform.SourcetoSource(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponse rstr)
Marshal an RSTR to a Source

Note: Useful for STS implementations which are JAXWS Providers

        //return new DOMSource(toElement(rstr));
        try{
            return new JAXBSource(marshaller, toJAXBElement(rstr));
        }catch(JAXBException ex){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE("RSTR"), ex);
            throw new RuntimeException(LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE("RSTR"), ex);
        }
    
public javax.xml.transform.SourcetoSource(com.sun.xml.ws.security.trust.elements.RequestSecurityTokenResponseCollection rstrCollection)
Marshal an RSTR Collection to a Source

Note: Useful for STS implementations which are JAXWS Providers

        try{
            return new JAXBSource(marshaller, toJAXBElement(rstrCollection));
        }catch(JAXBException ex){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RSTRCollection), ex);
            throw new RuntimeException(LogStringsMessages.WST_0002_FAIL_MARSHAL_TOSOURCE(RSTRCollection), ex);
        }