本文整理汇总了Java中org.opensaml.xml.XMLObject.getElementQName方法的典型用法代码示例。如果您正苦于以下问题:Java XMLObject.getElementQName方法的具体用法?Java XMLObject.getElementQName怎么用?Java XMLObject.getElementQName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.xml.XMLObject
的用法示例。
在下文中一共展示了XMLObject.getElementQName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshallMessage
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Helper method that marshalls the given message.
*
* @param message message the marshall and serialize
*
* @return marshalled message
*
* @throws MessageEncodingException thrown if the give message can not be marshalled into its DOM representation
*/
protected Element marshallMessage(XMLObject message) throws MessageEncodingException {
log.debug("Marshalling message");
try {
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(message);
if (marshaller == null) {
log.error("Unable to marshall message, no marshaller registered for message object: "
+ message.getElementQName());
throw new MessageEncodingException(
"Unable to marshall message, no marshaller registered for message object: "
+ message.getElementQName());
}
Element messageElem = marshaller.marshall(message);
if (log.isTraceEnabled()) {
log.trace("Marshalled message into DOM:\n{}", XMLHelper.nodeToString(messageElem));
}
return messageElem;
} catch (MarshallingException e) {
log.error("Encountered error marshalling message to its DOM representation", e);
throw new MessageEncodingException("Encountered error marshalling message into its DOM representation", e);
}
}
示例2: checkAndMarshall
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Ensure that the XMLObject is marshalled.
*
* @param xmlObject the object to check and marshall
* @throws DecryptionException thrown if there is an error when marshalling the XMLObject
*/
protected void checkAndMarshall(XMLObject xmlObject) throws DecryptionException {
Element targetElement = xmlObject.getDOM();
if (targetElement == null) {
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
if (marshaller == null) {
marshaller =
Configuration.getMarshallerFactory().getMarshaller(Configuration.getDefaultProviderQName());
if (marshaller == null) {
String errorMsg = "No marshaller available for " + xmlObject.getElementQName();
log.error(errorMsg);
throw new DecryptionException(errorMsg);
}
}
try {
targetElement = marshaller.marshall(xmlObject);
} catch (MarshallingException e) {
log.error("Error marshalling target XMLObject", e);
throw new DecryptionException("Error marshalling target XMLObject", e);
}
}
}
示例3: checkXMLObjectIsTarget
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Checks to make sure the given XMLObject's schema type or element QName matches the target parameters given at
* marshaller construction time.
*
* @param xmlObject the XMLObject to marshall
*
* @throws MarshallingException thrown if the given object is not or the required type
*/
protected void checkXMLObjectIsTarget(XMLObject xmlObject) throws MarshallingException {
if (targetQName == null) {
log.trace("Targeted QName checking is not available for this marshaller, XMLObject {} was not verified",
xmlObject.getElementQName());
return;
}
log.trace("Checking that {} meets target criteria", xmlObject.getElementQName());
QName type = xmlObject.getSchemaType();
if (type != null && type.equals(targetQName)) {
log.trace("{} schema type matches target", xmlObject.getElementQName());
return;
} else {
QName elementQName = xmlObject.getElementQName();
if (elementQName.equals(targetQName)) {
log.trace("{} element QName matches target", xmlObject.getElementQName());
return;
}
}
String errorMsg =
"This marshaller only operations on " + targetQName + " elements not " + xmlObject.getElementQName();
log.error(errorMsg);
throw new MarshallingException(errorMsg);
}
示例4: prepareForAdoption
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Prepares the given DOM caching XMLObject for adoption into another document. If the XMLObject has a parent then
* all visible namespaces used by the given XMLObject and its descendants are declared within that subtree and the
* parent's DOM is invalidated.
*
* @param domCachingObject the XMLObject to prepare for adoption
*
* @throws MarshallingException thrown if a namespace within the XMLObject's DOM subtree can not be resolved.
*/
private void prepareForAdoption(XMLObject domCachingObject) throws MarshallingException {
if (domCachingObject.getParent() != null) {
log.trace("Rooting all visible namespaces of XMLObject {} before adding it to new parent Element",
domCachingObject.getElementQName());
try {
XMLHelper.rootNamespaces(domCachingObject.getDOM());
} catch (XMLParserException e) {
String errorMsg =
"Unable to root namespaces of cached DOM element, " + domCachingObject.getElementQName();
log.error(errorMsg, e);
throw new MarshallingException(errorMsg, e);
}
log.trace("Release DOM of XMLObject parent");
domCachingObject.releaseParentDOM(true);
}
}
示例5: validateChildrenNamespaces
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(PGPData xmlObject) throws ValidationException {
// Validate that any unknown children are from another namespace.
for (XMLObject child : xmlObject.getUnknownXMLObjects()) {
QName childName = child.getElementQName();
if (! getValidDSChildNames().contains(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("PGPData contains an illegal child extension element: " + childName);
}
}
}
示例6: validateChildrenNamespaces
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(KeyInfoType xmlObject) throws ValidationException {
// Validate that any children are either the ones from the dsig schema,
// or are from another namespace.
for (XMLObject child : xmlObject.getXMLObjects()) {
QName childName = child.getElementQName();
if (! getValidDSChildNames().contains(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("KeyInfoType contains an illegal child extension element: " + childName);
}
}
}
示例7: validateChildrenNamespaces
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(SPKIData xmlObject) throws ValidationException {
// Validate that any children are either the ones from the dsig schema,
// or are from another namespace.
for (XMLObject child : xmlObject.getXMLObjects()) {
QName childName = child.getElementQName();
if (! SPKISexp.DEFAULT_ELEMENT_NAME.equals(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("PGPData contains an illegal child extension element: " + childName);
}
}
}
示例8: validateExtensionChildNamespace
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that the extension child, if present, is from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateExtensionChildNamespace(KeyValue xmlObject) throws ValidationException {
// Validate that the unknown child is not from the dsig namespace
// or are from another namespace.
XMLObject unknownChild = xmlObject.getUnknownXMLObject();
if (unknownChild == null) {
return;
}
QName childName = unknownChild.getElementQName();
if (XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("KeyValue contains an illegal child extension element: " + childName);
}
}
示例9: validateChildrenNamespaces
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that all children are either ones defined within the XML Signature schema,
* or are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(X509Data xmlObject) throws ValidationException {
// Validate that any children are either the ones from the dsig schema,
// or are from another namespace.
for (XMLObject child : xmlObject.getXMLObjects()) {
QName childName = child.getElementQName();
if (! getValidDSChildNames().contains(childName)
&& XMLConstants.XMLSIG_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("X509Data contains an illegal child extension element: " + childName);
}
}
}
示例10: validateChildrenNamespaces
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that all children are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(ReferenceType xmlObject) throws ValidationException {
// Validate that any children are from another namespace.
for (XMLObject child : xmlObject.getUnknownXMLObjects()) {
QName childName = child.getElementQName();
if (XMLConstants.XMLENC_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("ReferenceType contains an illegal child extension element: " + childName);
}
}
}
示例11: validateChildrenNamespaces
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Validate that all children are from another namespace.
*
* @param xmlObject the object to validate
* @throws ValidationException thrown if the object is invalid
*/
protected void validateChildrenNamespaces(EncryptionProperty xmlObject) throws ValidationException {
// Validate that any children are from another namespace.
for (XMLObject child : xmlObject.getUnknownXMLObjects()) {
QName childName = child.getElementQName();
if (XMLConstants.XMLENC_NS.equals(childName.getNamespaceURI())) {
throw new ValidationException("EncryptionProperty contains an illegal child extension element: " + childName);
}
}
}
示例12: unmarshallChildElement
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Unmarshalls given Element's children. For each child an unmarshaller is retrieved using
* {@link UnmarshallerFactory#getUnmarshaller(Element)}. The unmarshaller is then used to unmarshall the child
* element and the resultant XMLObject is passed to {@link #processChildElement(XMLObject, XMLObject)} for further
* processing.
*
* @param xmlObject the parent object of the unmarshalled children
* @param childElement the child element to be unmarshalled
*
* @throws UnmarshallingException thrown if an error occurs unmarshalling the chilren elements
*/
protected void unmarshallChildElement(XMLObject xmlObject, Element childElement) throws UnmarshallingException {
log.trace("Unmarshalling child elements of XMLObject {}", xmlObject.getElementQName());
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(childElement);
if (unmarshaller == null) {
unmarshaller = unmarshallerFactory.getUnmarshaller(Configuration.getDefaultProviderQName());
if (unmarshaller == null) {
String errorMsg = "No unmarshaller available for " + XMLHelper.getNodeQName(childElement)
+ ", child of " + xmlObject.getElementQName();
log.error(errorMsg);
throw new UnmarshallingException(errorMsg);
} else {
if (log.isTraceEnabled()) {
log.trace("No unmarshaller was registered for {}, child of {}. Using default unmarshaller.",
XMLHelper.getNodeQName(childElement), xmlObject.getElementQName());
}
}
}
if (log.isTraceEnabled()) {
log.trace("Unmarshalling child element {}with unmarshaller {}", XMLHelper.getNodeQName(childElement),
unmarshaller.getClass().getName());
}
processChildElement(xmlObject, unmarshaller.unmarshall(childElement));
}
示例13: marshallChildElements
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/**
* Marshalls the child elements of the given XMLObject.
*
* @param xmlObject the XMLObject whose children will be marshalled
* @param domElement the DOM element that will recieved the marshalled children
*
* @throws MarshallingException thrown if there is a problem marshalling a child element
*/
protected void marshallChildElements(XMLObject xmlObject, Element domElement) throws MarshallingException {
log.trace("Marshalling child elements for XMLObject {}", xmlObject.getElementQName());
List<XMLObject> childXMLObjects = xmlObject.getOrderedChildren();
if (childXMLObjects != null && childXMLObjects.size() > 0) {
for (XMLObject childXMLObject : childXMLObjects) {
if (childXMLObject == null) {
continue;
}
log.trace("Getting marshaller for child XMLObject {}", childXMLObject.getElementQName());
Marshaller marshaller = marshallerFactory.getMarshaller(childXMLObject);
if (marshaller == null) {
marshaller = marshallerFactory.getMarshaller(Configuration.getDefaultProviderQName());
if (marshaller == null) {
String errorMsg =
"No marshaller available for " + childXMLObject.getElementQName() + ", child of "
+ xmlObject.getElementQName();
log.error(errorMsg);
throw new MarshallingException(errorMsg);
} else {
log.trace("No marshaller was registered for {}, child of {}. Using default marshaller",
childXMLObject.getElementQName(), xmlObject.getElementQName());
}
}
log.trace("Marshalling {} and adding it to DOM", childXMLObject.getElementQName());
marshaller.marshall(childXMLObject, domElement);
}
} else {
log.trace("No child elements to marshall for XMLObject {}", xmlObject.getElementQName());
}
}
示例14: processChildElement
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
Attribute attribute = (Attribute) parentSAMLObject;
QName childQName = childSAMLObject.getElementQName();
if (childQName.getLocalPart().equals("AttributeValue")
&& childQName.getNamespaceURI().equals(SAMLConstants.SAML1_NS)) {
attribute.getAttributeValues().add(childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例15: processChildElement
import org.opensaml.xml.XMLObject; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
Attribute attribute = (Attribute) parentSAMLObject;
QName childQName = childSAMLObject.getElementQName();
if (childQName.getLocalPart().equals("AttributeValue")
&& childQName.getNamespaceURI().equals(SAMLConstants.SAML20_NS)) {
attribute.getAttributeValues().add(childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}