org.opensaml.xml.io.UnmarshallingException Java Examples

The following examples show how to use org.opensaml.xml.io.UnmarshallingException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PolicyTypeUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    PolicyType policy = (PolicyType) parentXMLObject;

    if (childXMLObject instanceof DescriptionType) {
        policy.setDescription((DescriptionType) childXMLObject);
    } else if (childXMLObject.getElementQName().equals(DefaultsType.POLICY_DEFAULTS_ELEMENT_NAME)) {
        policy.setPolicyDefaults((DefaultsType) childXMLObject);
    } else if (childXMLObject instanceof TargetType) {
        policy.setTarget((TargetType) childXMLObject);
    } else if (childXMLObject instanceof CombinerParametersType) {
        policy.getCombinerParameters().add((CombinerParametersType) childXMLObject);
    } else if (childXMLObject instanceof RuleCombinerParametersType) {
        policy.getRuleCombinerParameters().add((RuleCombinerParametersType) childXMLObject);
    } else if (childXMLObject instanceof VariableDefinitionType) {
        policy.getVariableDefinitions().add((VariableDefinitionType) childXMLObject);
    } else if (childXMLObject instanceof RuleType) {
        policy.getRules().add((RuleType)childXMLObject);
    } else if (childXMLObject instanceof ObligationsType) {
        policy.setObligations((ObligationsType) childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #2
Source File: RoleDescriptorUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    RoleDescriptor roleDescriptor = (RoleDescriptor) parentSAMLObject;

    if (childSAMLObject instanceof Extensions) {
        roleDescriptor.setExtensions((Extensions) childSAMLObject);
    } else if (childSAMLObject instanceof Signature) {
        roleDescriptor.setSignature((Signature) childSAMLObject);
    } else if (childSAMLObject instanceof KeyDescriptor) {
        roleDescriptor.getKeyDescriptors().add((KeyDescriptor) childSAMLObject);
    } else if (childSAMLObject instanceof Organization) {
        roleDescriptor.setOrganization((Organization) childSAMLObject);
    } else if (childSAMLObject instanceof ContactPerson) {
        roleDescriptor.getContactPersons().add((ContactPerson) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
Example #3
Source File: SubjectUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    Subject subject = (Subject) parentObject;

    if (childObject instanceof BaseID) {
        subject.setBaseID((BaseID) childObject);
    } else if (childObject instanceof NameID) {
        subject.setNameID((NameID) childObject);
    } else if (childObject instanceof EncryptedID) {
        subject.setEncryptedID((EncryptedID) childObject);
    } else if (childObject instanceof SubjectConfirmation) {
        subject.getSubjectConfirmations().add((SubjectConfirmation) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
Example #4
Source File: AttributeUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {

    Attribute attrib = (Attribute) samlObject;

    if (attribute.getLocalName().equals(Attribute.NAME_ATTTRIB_NAME)) {
        attrib.setName(attribute.getValue());
    } else if (attribute.getLocalName().equals(Attribute.NAME_FORMAT_ATTRIB_NAME)) {
        attrib.setNameFormat(attribute.getValue());
    } else if (attribute.getLocalName().equals(Attribute.FRIENDLY_NAME_ATTRIB_NAME)) {
        attrib.setFriendlyName(attribute.getValue());
    } else {
        QName attribQName = XMLHelper.getNodeQName(attribute);
        if (attribute.isId()) {
            attrib.getUnknownAttributes().registerID(attribQName);
        }
        attrib.getUnknownAttributes().put(attribQName, attribute.getValue());
    }
}
 
Example #5
Source File: StatusResponseTypeUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    StatusResponseType sr = (StatusResponseType) samlObject;

    if (attribute.getLocalName().equals(StatusResponseType.VERSION_ATTRIB_NAME)) {
        sr.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(StatusResponseType.ID_ATTRIB_NAME)) {
        sr.setID(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(StatusResponseType.IN_RESPONSE_TO_ATTRIB_NAME)) {
        sr.setInResponseTo(attribute.getValue());
    } else if (attribute.getLocalName().equals(StatusResponseType.ISSUE_INSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        sr.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(StatusResponseType.DESTINATION_ATTRIB_NAME)) {
        sr.setDestination(attribute.getValue());
    } else if (attribute.getLocalName().equals(StatusResponseType.CONSENT_ATTRIB_NAME)) {
        sr.setConsent(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
Example #6
Source File: EntityDescriptorUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    EntityDescriptor entityDescriptor = (EntityDescriptor) parentSAMLObject;

    if (childSAMLObject instanceof Extensions) {
        entityDescriptor.setExtensions((Extensions) childSAMLObject);
    } else if (childSAMLObject instanceof Signature) {
        entityDescriptor.setSignature((Signature) childSAMLObject);
    } else if (childSAMLObject instanceof RoleDescriptor) {
        entityDescriptor.getRoleDescriptors().add((RoleDescriptor) childSAMLObject);
    } else if (childSAMLObject instanceof AffiliationDescriptor) {
        entityDescriptor.setAffiliationDescriptor((AffiliationDescriptor) childSAMLObject);
    } else if (childSAMLObject instanceof Organization) {
        entityDescriptor.setOrganization((Organization) childSAMLObject);
    } else if (childSAMLObject instanceof ContactPerson) {
        entityDescriptor.getContactPersons().add((ContactPerson) childSAMLObject);
    } else if (childSAMLObject instanceof AdditionalMetadataLocation) {
        entityDescriptor.getAdditionalMetadataLocations().add((AdditionalMetadataLocation) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
Example #7
Source File: TargetTypeUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    TargetType targetType = (TargetType) parentXMLObject;
    
    if(childXMLObject.getElementQName().equals(ActionsType.DEFAULT_ELEMENT_NAME)){
        targetType.setActions((ActionsType)childXMLObject);
    } else if(childXMLObject.getElementQName().equals(EnvironmentsType.DEFAULT_ELEMENT_NAME)){
        targetType.setEnvironments((EnvironmentsType)childXMLObject);
    } else  if(childXMLObject.getElementQName().equals(ResourcesType.DEFAULT_ELEMENT_NAME)){
        targetType.setResources((ResourcesType)childXMLObject);
    } else  if(childXMLObject.getElementQName().equals(SubjectsType.DEFAULT_ELEMENT_NAME)){
        targetType.setSubjects((SubjectsType)childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #8
Source File: AttributeSelectorTypeUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AttributeSelectorType attributeSelectorType = (AttributeSelectorType) xmlObject;
    
    if (attribute.getLocalName().equals(AttributeSelectorType.REQUEST_CONTEXT_PATH_ATTRIB_NAME)){
        attributeSelectorType.setRequestContextPath(DatatypeHelper.safeTrimOrNullString(attribute.getValue()));
    } else  if (attribute.getLocalName().equals(AttributeSelectorType.DATA_TYPE_ATTRIB_NAME)){
        attributeSelectorType.setDataType(DatatypeHelper.safeTrimOrNullString(attribute.getValue()));
    } else  if (attribute.getLocalName().equals(AttributeSelectorType.MUST_BE_PRESENT_ATTRIB_NAME)){
        if (attribute.getValue().equals("True") || attribute.getValue().equals("true")) {
            attributeSelectorType.setMustBePresentXSBoolean(XSBooleanValue.valueOf("1"));
        } else {
            attributeSelectorType.setMustBePresentXSBoolean(XSBooleanValue.valueOf("0"));
        }          
    } else {
        super.processAttribute(xmlObject, attribute);
    }

}
 
Example #9
Source File: AuthnRequestUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    AuthnRequest req = (AuthnRequest) samlObject;

    if (attribute.getLocalName().equals(AuthnRequest.FORCE_AUTHN_ATTRIB_NAME)) {
        req.setForceAuthn(XSBooleanValue.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(AuthnRequest.IS_PASSIVE_ATTRIB_NAME)) {
        req.setIsPassive(XSBooleanValue.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(AuthnRequest.PROTOCOL_BINDING_ATTRIB_NAME)) {
        req.setProtocolBinding(attribute.getValue());
    } else if (attribute.getLocalName().equals(AuthnRequest.ASSERTION_CONSUMER_SERVICE_INDEX_ATTRIB_NAME)) {
        req.setAssertionConsumerServiceIndex(Integer.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(AuthnRequest.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME)) {
        req.setAssertionConsumerServiceURL(attribute.getValue());
    } else if (attribute.getLocalName().equals(AuthnRequest.ATTRIBUTE_CONSUMING_SERVICE_INDEX_ATTRIB_NAME)) {
        req.setAttributeConsumingServiceIndex(Integer.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(AuthnRequest.PROVIDER_NAME_ATTRIB_NAME)) {
        req.setProviderName(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
Example #10
Source File: LogoutRequestUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    LogoutRequest req = (LogoutRequest) parentSAMLObject;

    if (childSAMLObject instanceof BaseID) {
        req.setBaseID((BaseID) childSAMLObject);
    } else if (childSAMLObject instanceof NameID) {
        req.setNameID((NameID) childSAMLObject);
    } else if (childSAMLObject instanceof EncryptedID) {
        req.setEncryptedID((EncryptedID) childSAMLObject);
    } else if (childSAMLObject instanceof SessionIndex) {
        req.getSessionIndexes().add((SessionIndex) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
Example #11
Source File: NameIDMappingRequestUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    NameIDMappingRequest req = (NameIDMappingRequest) parentSAMLObject;

    if (childSAMLObject instanceof BaseID) {
        req.setBaseID((BaseID) childSAMLObject);
    } else if (childSAMLObject instanceof NameID) {
        req.setNameID((NameID) childSAMLObject);
    } else if (childSAMLObject instanceof EncryptedID) {
        req.setEncryptedID((EncryptedID) childSAMLObject);
    } else if (childSAMLObject instanceof NameIDPolicy) {
        req.setNameIDPolicy((NameIDPolicy) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
Example #12
Source File: DSAKeyValueUnmarshaller.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    DSAKeyValue keyValue = (DSAKeyValue) parentXMLObject;

    if (childXMLObject instanceof P) {
        keyValue.setP((P) childXMLObject);
    } else if (childXMLObject instanceof Q) {
        keyValue.setQ((Q) childXMLObject);
    } else if (childXMLObject instanceof G) {
        keyValue.setG((G) childXMLObject);
    } else if (childXMLObject instanceof Y) {
        keyValue.setY((Y) childXMLObject);
    } else if (childXMLObject instanceof J) {
        keyValue.setJ((J) childXMLObject);
    } else if (childXMLObject instanceof Seed) {
        keyValue.setSeed((Seed) childXMLObject);
    } else if (childXMLObject instanceof PgenCounter) {
        keyValue.setPgenCounter((PgenCounter) childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #13
Source File: ResourceTypeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    ResourceType resource = (ResourceType) parentObject;

    if (childObject instanceof ResourceContentType) {
        resource.setResourceContent((ResourceContentType) childObject);
    } else if (childObject instanceof AttributeType) {
        resource.getAttributes().add((AttributeType) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
Example #14
Source File: SPKIDataUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    SPKIData spkiData = (SPKIData) parentXMLObject;

    // SPKIData contains an unbounded sequence of pairs of a single SPKISexp
    // and an optional, single wildcard <any> element. Let the Validator
    // catch invalid ordering/combinations.
    spkiData.getXMLObjects().add(childXMLObject);
}
 
Example #15
Source File: AudienceRestrictionUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    AudienceRestriction audienceRestriction = (AudienceRestriction) parentObject;

    if (childObject instanceof Audience) {
        audienceRestriction.getAudiences().add((Audience) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
Example #16
Source File: AuthenticationStatementUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    AuthenticationStatement authenticationStatement = (AuthenticationStatement) samlObject;

    if (AuthenticationStatement.AUTHENTICATIONINSTANT_ATTRIB_NAME.equals(attribute.getLocalName())
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        DateTime value = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC());
        authenticationStatement.setAuthenticationInstant(value);
    } else if (AuthenticationStatement.AUTHENTICATIONMETHOD_ATTRIB_NAME.equals(attribute.getLocalName())) {
        authenticationStatement.setAuthenticationMethod(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
Example #17
Source File: SubjectTypeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    SubjectType subjectType = (SubjectType) parentXMLObject;
    
    if(childXMLObject instanceof SubjectMatchType){
        subjectType.getSubjectMatches().add((SubjectMatchType)childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #18
Source File: VariableReferenceTypeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    
    if(childXMLObject instanceof ExpressionType){
        VariableReferenceType variableReferenceType = (VariableReferenceType) parentXMLObject;
        variableReferenceType.getExpressions().add((ExpressionType)childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }

}
 
Example #19
Source File: AuthnContextDeclUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    AuthnContextDecl authnCtcDecl = (AuthnContextDecl) xmlObject;

    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());

    if (attribute.isId()) {
        authnCtcDecl.getUnknownAttributes().registerID(attribQName);
    }

    authnCtcDecl.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example #20
Source File: SubjectsTypeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    SubjectsType subjectsType = (SubjectsType) parentXMLObject;
    
    if(childXMLObject instanceof SubjectType){
        subjectsType.getSubjects().add((SubjectType)childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #21
Source File: BodyUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Body body = (Body) xmlObject;
    QName attribQName = XMLHelper.constructQName(attribute.getNamespaceURI(), attribute.getLocalName(), attribute
            .getPrefix());
    if (attribute.isId()) {
        body.getUnknownAttributes().registerID(attribQName);
    }
    body.getUnknownAttributes().put(attribQName, attribute.getValue());
}
 
Example #22
Source File: RetrievalMethodUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    RetrievalMethod rm = (RetrievalMethod) parentXMLObject;

    if (childXMLObject instanceof Transforms) {
        rm.setTransforms((Transforms) childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}
 
Example #23
Source File: TransformUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    Transform transform = (Transform) xmlObject;

    if (attribute.getLocalName().equals(Transform.ALGORITHM_ATTRIB_NAME)) {
        transform.setAlgorithm(attribute.getValue());
    } else {
        super.processAttribute(xmlObject, attribute);
    }
}
 
Example #24
Source File: AuthenticatorUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) 
        throws UnmarshallingException {
    Authenticator authenticator = (Authenticator) parentXMLObject;
    
    if (childXMLObject instanceof CombinedHash) {
        authenticator.setCombinedHash((CombinedHash) childXMLObject);
    } else {
        authenticator.getUnknownXMLObjects().add(childXMLObject);
    }
}
 
Example #25
Source File: ScopingUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    Scoping scoping = (Scoping) parentSAMLObject;
    if (childSAMLObject instanceof IDPList) {
        scoping.setIDPList((IDPList) childSAMLObject);
    } else if (childSAMLObject instanceof RequesterID) {
        scoping.getRequesterIDs().add((RequesterID) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
Example #26
Source File: DigestMethodUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject xmlObject, Attr attribute) throws UnmarshallingException {
    DigestMethod dm = (DigestMethod) xmlObject;

    if (attribute.getLocalName().equals(DigestMethod.ALGORITHM_ATTRIB_NAME)) {
        dm.setAlgorithm(attribute.getValue());
    } else {
        super.processAttribute(xmlObject, attribute);
    }
}
 
Example #27
Source File: AttributeValueTypeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
 protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
         throws UnmarshallingException {
    
     AttributeValueType attributeValue = (AttributeValueType) parentXMLObject;
     attributeValue.getUnknownXMLObjects().add(childXMLObject);  
}
 
Example #28
Source File: XMLObjectHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Unmarshall a Document from a Reader.
 * 
 * @param parserPool the ParserPool instance to use
 * @param reader the Reader to unmarshall
 * @return the unmarshalled XMLObject
 * @throws XMLParserException if there is a problem parsing the input data
 * @throws UnmarshallingException if there is a problem unmarshalling the parsed DOM
 */
public static XMLObject unmarshallFromReader(ParserPool parserPool, Reader reader)
        throws XMLParserException, UnmarshallingException {
    Logger log = getLogger();
    log.debug("Parsing Reader into DOM document");
    

    Document messageDoc = parserPool.parse(reader);
    Element messageElem = messageDoc.getDocumentElement();

    if (log.isTraceEnabled()) {
        log.trace("Resultant DOM message was:");
        log.trace(XMLHelper.nodeToString(messageElem));
    }

    log.debug("Unmarshalling DOM parsed from Reader");
    Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(messageElem);
    if (unmarshaller == null) {
        log.error("Unable to unmarshall Reader, no unmarshaller registered for element "
                + XMLHelper.getNodeQName(messageElem));
        throw new UnmarshallingException(
                "Unable to unmarshall Reader, no unmarshaller registered for element "
                        + XMLHelper.getNodeQName(messageElem));
    }

    XMLObject message = unmarshaller.unmarshall(messageElem);

    log.debug("Reader succesfully unmarshalled");
    return message;
}
 
Example #29
Source File: ScopingUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    Scoping scoping = (Scoping) samlObject;

    if (attribute.getLocalName().equals(Scoping.PROXY_COUNT_ATTRIB_NAME)) {
        scoping.setProxyCount(Integer.valueOf(attribute.getValue()));
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
Example #30
Source File: ConditionTypeUnmarshaller.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject)
        throws UnmarshallingException {
    if(childXMLObject instanceof ExpressionType){
        ConditionType conditionType = (ConditionType)parentXMLObject;
        conditionType.setExpression((ExpressionType)childXMLObject);
    } else {
        super.processChildElement(parentXMLObject, childXMLObject);
    }
}