X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2Fimpl%2FMetadataImpl.cpp;h=f6503ec99ab720e201a5effc16634d301fffde29;hb=932cfaae2176c2eba1a9938dc420591a9551a7f3;hp=372a34af2407049b2fb78e3bd729522152474ccf;hpb=0703fa970c8d1f15600ce3fd1b350bdb90930bb9;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index 372a34a..f6503ec 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +23,9 @@ #include "internal.h" #include "exceptions.h" #include "saml2/metadata/Metadata.h" +#include "saml2/metadata/MetadataKeyInfoIterator.h" #include -#include #include #include #include @@ -238,7 +238,7 @@ namespace opensaml { }; class SAML_DLLLOCAL ExtensionsImpl : public virtual Extensions, - public AbstractElementProxy, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -251,22 +251,21 @@ namespace opensaml { } ExtensionsImpl(const ExtensionsImpl& src) - : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) { - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - getXMLObjects().push_back((*i)->clone()); - } - } + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { + VectorOf(XMLObject) v=getUnknownXMLObjects(); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) + v.push_back((*i)->clone()); } IMPL_XMLOBJECT_CLONE(Extensions); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); protected: void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { // Unknown child. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) { - getXMLObjects().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } @@ -556,8 +555,8 @@ namespace opensaml { }; class SAML_DLLLOCAL EndpointTypeImpl : public virtual EndpointType, - public AbstractElementProxy, public AbstractAttributeExtensibleXMLObject, + public AbstractComplexElement, public AbstractDOMCachingXMLObject, public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller @@ -583,22 +582,23 @@ namespace opensaml { } EndpointTypeImpl(const EndpointTypeImpl& src) - : AbstractXMLObject(src), AbstractElementProxy(src), - AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), + AbstractAttributeExtensibleXMLObject(src), + AbstractComplexElement(src), + AbstractDOMCachingXMLObject(src) { setBinding(src.getBinding()); setLocation(src.getLocation()); setResponseLocation(src.getResponseLocation()); - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { - if (*i) { - getXMLObjects().push_back((*i)->clone()); - } - } + VectorOf(XMLObject) v=getUnknownXMLObjects(); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) + v.push_back((*i)->clone()); } IMPL_XMLOBJECT_CLONE(EndpointType); IMPL_STRING_ATTRIB(Binding); IMPL_STRING_ATTRIB(Location); IMPL_STRING_ATTRIB(ResponseLocation); + IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject,m_children.end()); void setAttribute(const QName& qualifiedName, const XMLCh* value, bool ID=false) { if (!qualifiedName.hasNamespaceURI()) { @@ -629,7 +629,7 @@ namespace opensaml { // Unknown child. const XMLCh* nsURI=root->getNamespaceURI(); if (!XMLString::equals(nsURI,SAML20MD_NS) && nsURI && *nsURI) { - getXMLObjects().push_back(childXMLObject); + getUnknownXMLObjects().push_back(childXMLObject); return; } AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root); @@ -956,6 +956,23 @@ namespace opensaml { m_Signature->setContentReference(new opensaml::ContentReference(*this)); } + KeyInfoIterator* getKeyInfoIterator() const { + return new MetadataKeyInfoIterator(*this); + } + + std::string getName() const { + const EntityDescriptor* parent = dynamic_cast(getParent()); + if (parent) { + char* ch = toUTF8(parent->getEntityID()); + if (ch) { + string s(ch); + delete[] ch; + return s; + } + } + return ""; + } + IMPL_ID_ATTRIB(ID); IMPL_STRING_ATTRIB(ProtocolSupportEnumeration); IMPL_STRING_ATTRIB(ErrorURL);