package org.activemq.ws.notification.impl;
import org.activemq.ws.resource.ResourceProperties;
import org.activemq.ws.xmlbeans.addressing.v2003_03.EndpointReferenceType;
import org.activemq.ws.xmlbeans.resource.properties.GetResourcePropertyDocument;
import org.activemq.ws.xmlbeans.resource.properties.GetResourcePropertyResponseDocument;
import org.activemq.ws.xmlbeans.resource.properties.GetResourcePropertyResponseDocument.GetResourcePropertyResponse;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
public class XmlObjectResourceProperties implements ResourceProperties {
private final XmlObject resourceProperties;
public XmlObjectResourceProperties(XmlObject resourceProperties) {
this.resourceProperties = resourceProperties;
}
public XmlObject getResourceProperties() {
return resourceProperties;
}
public GetResourcePropertyResponseDocument getResourceProperty(EndpointReferenceType resource, GetResourcePropertyDocument request) {
GetResourcePropertyResponseDocument responseDoc = GetResourcePropertyResponseDocument.Factory.newInstance();
GetResourcePropertyResponse response = responseDoc.addNewGetResourcePropertyResponse();
XmlCursor cursor = response.newCursor();
cursor.toFirstContentToken();
XmlObject[] objects = resourceProperties.selectChildren(request.getGetResourceProperty());
for (int i = 0; i < objects.length; i++) {
objects[i].newCursor().copyXml(cursor);
}
return responseDoc;
}
}