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

BinarySecretImpl

public class BinarySecretImpl extends com.sun.xml.ws.security.trust.impl.bindings.BinarySecretType implements com.sun.xml.ws.security.trust.elements.BinarySecret
author
WS-Trust Implementation Team

Fields Summary
private static final Logger
log
Constructors Summary
public BinarySecretImpl(byte[] rawValue, String type)


                   
        setRawValue(rawValue);
        setType(type);
        
    
public BinarySecretImpl(com.sun.xml.ws.security.trust.impl.bindings.BinarySecretType bsType)

        this(bsType.getValue(), bsType.getType());
        
    
Methods Summary
public static com.sun.xml.ws.security.trust.impl.bindings.BinarySecretTypefromElement(org.w3c.dom.Element element)
Constructs a BinarySecret element from an existing XML block.

param
lifetimeElement A org.w3c.dom.Element representing DOM tree for BinarySecret object.
exception
WSTrustException if it could not process the org.w3c.dom.Element properly, implying that there is an error in the sender or in the element definition.

        try {
            final javax.xml.bind.Unmarshaller u = WSTrustElementFactory.getContext().createUnmarshaller();
            return (BinarySecretType)((JAXBElement)u.unmarshal(element)).getValue();
        } 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 byte[]getRawValue()

        return super.getValue();
     
public java.lang.StringgetTextValue()

        return Base64.encode(getRawValue());         
     
public final voidsetRawValue(byte[] rawText)

        setValue(rawText);
     
public voidsetTextValue(java.lang.String encodedText)

         try {
             setValue(Base64.decode(encodedText));
         } catch (Base64DecodingException de) {
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0020_ERROR_DECODING(encodedText), de);
             throw new RuntimeException(LogStringsMessages.WST_0020_ERROR_DECODING(encodedText), de); 
         }