From ec5d9a187792278d58012def6cd4fa204008a422 Mon Sep 17 00:00:00 2001 From: Andrea Gazzarini Date: Tue, 27 Jan 2009 10:11:10 +0000 Subject: QPID-1606 : QMan WS-DM examples git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@738045 13f79535-47bb-0310-9956-ffa450edef68 --- java/management/client/README | 42 + java/management/client/build.xml | 87 +- java/management/client/etc/jetty.xml | 2 +- .../example/GetMultipleResourceProperties.out.ok | 262 +++ .../src/example/GetQManResourceMembers.out.ko | 54 + .../src/example/GetQManResourceMembers.out.ok | 55 + .../example/GetResourceMetadataDescriptor.out.ok | 188 ++ .../src/example/GetResourcePropertyDocument.out.ok | 138 ++ .../src/example/GetResourcePropertyRequest.out.ok | 588 +++++ .../example/GetWsdlMetadata.out.ko.no.resources | 58 + .../client/src/example/GetWsdlMetadata.out.ok | 1968 +++++++++++++++++ java/management/client/src/example/README | 69 + .../example/SetResourcePropertiesRequest.out.ok | 2316 ++++++++++++++++++++ .../management/example/AbstractQManExample.java | 140 ++ .../GetMultipleResourcePropertiesExample.java | 189 ++ .../example/GetQManResourceMembersExample.java | 93 + .../GetResourceMetadataDescriptorExample.java | 156 ++ .../GetResourcePropertyDocumentExample.java | 112 + .../example/GetResourcePropertyExample.java | 172 ++ .../management/example/GetWSDLMetadataExample.java | 156 ++ .../example/SetResourcePropertyExample.java | 306 +++ .../domain/handler/impl/QpidDomainObject.java | 9 +- .../domain/handler/impl/QpidDomainObjectMBean.java | 7 + .../wsdm/capabilities/MBeanCapabilityBuilder.java | 18 +- .../wsdm/capabilities/QManAdapterCapability.java | 44 +- .../wsdm/capabilities/QManMessageHandler.java | 1 + .../management/wsdm/capabilities/WsdlBuilder.java | 3 +- .../wsdm/muse/engine/WSDMAdapterEnvironment.java | 2 - .../wsdm/muse/resources/QManWsResource.java | 2 +- .../client/src/main/java/wsdl/QManAdapter.wsdl | 3 + java/management/client/src/test/java/log4j.xml | 8 +- .../capabilities/MBeanCapabilityBuilderTest.java | 4 +- 32 files changed, 7215 insertions(+), 37 deletions(-) create mode 100644 java/management/client/README create mode 100644 java/management/client/src/example/GetMultipleResourceProperties.out.ok create mode 100644 java/management/client/src/example/GetQManResourceMembers.out.ko create mode 100644 java/management/client/src/example/GetQManResourceMembers.out.ok create mode 100644 java/management/client/src/example/GetResourceMetadataDescriptor.out.ok create mode 100644 java/management/client/src/example/GetResourcePropertyDocument.out.ok create mode 100644 java/management/client/src/example/GetResourcePropertyRequest.out.ok create mode 100644 java/management/client/src/example/GetWsdlMetadata.out.ko.no.resources create mode 100644 java/management/client/src/example/GetWsdlMetadata.out.ok create mode 100644 java/management/client/src/example/README create mode 100644 java/management/client/src/example/SetResourcePropertiesRequest.out.ok create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/AbstractQManExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/GetMultipleResourcePropertiesExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/GetQManResourceMembersExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/GetResourceMetadataDescriptorExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyDocumentExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/GetWSDLMetadataExample.java create mode 100644 java/management/client/src/example/org/apache/qpid/management/example/SetResourcePropertyExample.java (limited to 'java/management/client') diff --git a/java/management/client/README b/java/management/client/README new file mode 100644 index 0000000000..34a48f1f50 --- /dev/null +++ b/java/management/client/README @@ -0,0 +1,42 @@ +QMan - Qpid JMX & WS-DM Management Bridge +--------------------------------------------------------- + +Documentation +-------------- +All of our user documentation for QMan module can be accessed on our wiki at: + +http://cwiki.apache.org/qpid/qman-qpid-management-bridge.html + +This includes a Getting Started and User Guide as well as detailed developer documentation. +However, here's a VERY quick guide to running QMan, once you have installed it somewhere ! + +Running +------------------ + +Once you installed QMan, under the root folder you should have the following structure + +- bin (folder) : contains startup & shutdown scripts; +- app (folder) : contains the web application module; +- etc (folder) : contains configuration files; +- examples (folder) : contains examples (and a nested README as well) +- lib (folder) : contains dependency libraries; +- log (folder) : this is the default log folder. + +To run QMan, + +1) edit the $QMAN_HOME/etc/qman-config.xml file and configure broker connection data (host,port, username, etc...) +2) under the $QMAN_HOME/bin directory run : + +> ./qman-wsdm-start.sh + +now, under $QMAN_HOME/log directory you should see two files : + +1) server.log : contains web server log messages; +2) qman.log : contains qman log messages; + +Administration +----------------------- + +After QMan has been started successfully you can browse its administration console pointing your browser to : + +http://:/qman/admin.jsp \ No newline at end of file diff --git a/java/management/client/build.xml b/java/management/client/build.xml index 4e595c69bf..f1600cad70 100644 --- a/java/management/client/build.xml +++ b/java/management/client/build.xml @@ -27,14 +27,29 @@ - + + + + + + + + + + + + + + + + @@ -50,7 +65,14 @@ - + + + + + + + + @@ -101,20 +123,53 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/management/client/etc/jetty.xml b/java/management/client/etc/jetty.xml index 11153d0d6f..38a4775641 100644 --- a/java/management/client/etc/jetty.xml +++ b/java/management/client/etc/jetty.xml @@ -20,7 +20,7 @@ /qman - /lib/qman.war + /app/qman \ No newline at end of file diff --git a/java/management/client/src/example/GetMultipleResourceProperties.out.ok b/java/management/client/src/example/GetMultipleResourceProperties.out.ok new file mode 100644 index 0000000000..005841488d --- /dev/null +++ b/java/management/client/src/example/GetMultipleResourceProperties.out.ok @@ -0,0 +1,262 @@ + GetMultipleResourcePropertiesExample +------------------------------------------------------------------- + +This example shows how to get properties from a +WS-Resource using one request. +First of all a request is send to WS-DM in order to get +all registered WS-Resources. +If the returned list is not empty then a GetMetadataRequest +to the first child. +The result metadata descriptor contains all property names of +the target WS-Resource. +Those names are then used for retrieving the corresponding values +using the GetMultipleResourceProperties request. + +------------------------------------------------------------------- + +Type enter to proceed... + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:1a72feb1-7d76-1014-66d7-cd03aeff3525 + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:783956b1-4de7-f4b6-5421-536f5f310b9a + uuid:1a72feb1-7d76-1014-66d7-cd03aeff3525 + + http://localhost:8080/qman/services/adapter + + + + + + + http://localhost:8080/qman/services/ServiceGroupEntry + + uuid:b220e2bd-0370-da4e-fc71-5e283954d319 + + + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata + uuid:588288c9-8bb7-04e9-e7bf-7be1e2fe41fb + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + http://docs.oasis-open.org/wsrf/rmd-1 + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadataResponse + uuid:77c5520b-d450-5a8a-7e2b-22a1079392f2 + uuid:588288c9-8bb7-04e9-e7bf-7be1e2fe41fb + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetMultipleResourceProperties/GetMultipleResourcePropertiesRequest + uuid:783fc044-58a9-e780-a2ba-5b2ac0454985 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + qman:MgmtPubInterval + qman:Name + qman:MsgTotalEnqueues + qman:Arguments + qman:VhostRef + qman:ExpireTime + qman:Durable + qman:ConsumerCount + qman:Type + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetMultipleResourceProperties/GetMultipleResourcePropertiesResponse + uuid:9a2d76dd-52ba-ac7c-74cf-4acd99708529 + uuid:783fc044-58a9-e780-a2ba-5b2ac0454985 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + 32767 + Initial Name + 9223372036854775797 + + + Key3 + 2147483647 + + + Key4 + 3.4028235E38 + + + Key1 + aStringValue + + + Key2 + -9223372036854775808 + + + 2deef1b3-d2c6-49f3-a8de-51f6a75a1a6b + 9223372036854775807 + true + -2147483638 + + + \ No newline at end of file diff --git a/java/management/client/src/example/GetQManResourceMembers.out.ko b/java/management/client/src/example/GetQManResourceMembers.out.ko new file mode 100644 index 0000000000..d6b733e430 --- /dev/null +++ b/java/management/client/src/example/GetQManResourceMembers.out.ko @@ -0,0 +1,54 @@ + GetQManResourceMembersExample Example +------------------------------------------------------------------- + +This example shows the usage of WS-DM +GetResourcePropertyRequest / Response on a +Group service. +The target resource is the WS-DM Adapter itself +and the requested property is "ws-rp:Entry". +WS-DM Adapter is a special WS-Resource (is a Group) +that acts as the main entry point for retrieving +all other managed resources. +So clients that want to deal with QMan WS-Resources +must first get resource identifiers sending +a GetResourcePropertyRequest to WS-DM Adapter +with "ws-rp:Entry" as target target property. + +------------------------------------------------------------------- + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://192.38.73.2:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:796bab33-ed59-3432-4e2c-1fadde465a25 + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +-----------------------EXAMPLE FAILURE---------------------- +org.apache.muse.ws.addressing.soap.SoapFault: No route to host: connect + at org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:298) + at org.apache.muse.core.AbstractResourceClient.invoke(AbstractResourceClient.java:254) + at org.apache.muse.ws.resource.remote.WsResourceClient.getResourceProperty(WsResourceClient.java:138) + at org.apache.muse.ws.resource.sg.remote.ServiceGroupClient.getMembers(ServiceGroupClient.java:110) + at org.apache.qpid.management.example.GetQManResourceMembersExample.execute(GetQManResourceMembersExample.java:61) + at org.apache.qpid.management.example.GetQManResourceMembersExample.main(GetQManResourceMembersExample.java:133) + + +######################################################################################### + +WARNING! Unable to run this sample : port number must be a number. +------------------------------------------------------------- +Expected command line args for this sample are : + +1) host : ip or host name where QMan is running. +2) port : port number where QMan is running. +------------------------------------------------------------ \ No newline at end of file diff --git a/java/management/client/src/example/GetQManResourceMembers.out.ok b/java/management/client/src/example/GetQManResourceMembers.out.ok new file mode 100644 index 0000000000..dd75e1e490 --- /dev/null +++ b/java/management/client/src/example/GetQManResourceMembers.out.ok @@ -0,0 +1,55 @@ + GetQManResourceMembersExample Example +------------------------------------------------------------------- + +This example shows the usage of WS-DM +GetResourcePropertyRequest / Response on a +Group service. +The target resource is the WS-DM Adapter itself +and the requested property is "ws-rp:Entry". +WS-DM Adapter is a special WS-Resource (is a Group) +that acts as the main entry point for retrieving +all other managed resources. +So clients that want to deal with QMan WS-Resources +must first get resource identifiers sending +a GetResourcePropertyRequest to WS-DM Adapter +with "ws-rp:Entry" as target target property. + +------------------------------------------------------------------- + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://romagazzarini:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:024c678b-1fab-cb6a-0992-30027817fb92 + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:90b0e421-6467-a72e-a8f4-cdedb80460b6 + uuid:024c678b-1fab-cb6a-0992-30027817fb92 + + http://romagazzarini:8080/qman/services/adapter + + + + + + + +-------------------------------------------------------------------------- +QMan has at the moment 0 registered resources. +-------------------------------------------------------------------------- \ No newline at end of file diff --git a/java/management/client/src/example/GetResourceMetadataDescriptor.out.ok b/java/management/client/src/example/GetResourceMetadataDescriptor.out.ok new file mode 100644 index 0000000000..a259259228 --- /dev/null +++ b/java/management/client/src/example/GetResourceMetadataDescriptor.out.ok @@ -0,0 +1,188 @@ + GetResourceMetadataDescriptorExample +------------------------------------------------------------------- + +The example shows how to get metadata from a +WS-Resource. +A QMan WS-Resource has different kinds of metadata. +(see below) +User who wants to receive metadata of a WS-Resource +must send a GetMetadataRequesta specifying the +associated dialect. +Supported metadata that could be requested are : + +- WSDL : in this case dialect is "http://schemas.xmlsoap.org/wsdl/"; +- RDM (Resource Metadata Descriptor) : in this case dialect is "http://docs.oasis-open.org/wsrf/rmd-1 ". + +Note that this examples focuses on RDM Metadata only; +another one is dedicated to WSDL. +------------------------------------------------------------------- + +Type enter to proceed... + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:cdcf747a-e5fc-3762-1748-87cc2eefb18b + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:1d0d091b-8867-d765-7cc8-4898851cd783 + uuid:cdcf747a-e5fc-3762-1748-87cc2eefb18b + + http://localhost:8080/qman/services/adapter + + + + + + + http://localhost:8080/qman/services/ServiceGroupEntry + + uuid:3a2ee31e-49ed-e30a-c985-0fe49c182a75 + + + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=cbe0cada-e8ee-424c-945b-f6c42df7b011,class=queue,name=1232952196269,objectId=e2857418-b873-47b7-ab30-441ae9376529,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata + uuid:ba2435fc-9172-69d8-f4be-34f7f45b26ff + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=cbe0cada-e8ee-424c-945b-f6c42df7b011,class=queue,name=1232952196269,objectId=e2857418-b873-47b7-ab30-441ae9376529,package=org.apache.qpid + + + + http://docs.oasis-open.org/wsrf/rmd-1 + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadataResponse + uuid:ceb6eb90-4910-01a9-c138-6029e6bb0836 + uuid:ba2435fc-9172-69d8-f4be-34f7f45b26ff + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=cbe0cada-e8ee-424c-945b-f6c42df7b011,class=queue,name=1232952196269,objectId=e2857418-b873-47b7-ab30-441ae9376529,package=org.apache.qpid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/management/client/src/example/GetResourcePropertyDocument.out.ok b/java/management/client/src/example/GetResourcePropertyDocument.out.ok new file mode 100644 index 0000000000..9d6312f2f3 --- /dev/null +++ b/java/management/client/src/example/GetResourcePropertyDocument.out.ok @@ -0,0 +1,138 @@ + GetResourcePropertyDocument +------------------------------------------------------------------- + +This example shows how to get the whole property +document from a WS-Resource. +Resource property document represents a particular +composed structural view of the resource properties +of the WS-Resource. +First of all a request is send to WS-DM in order to get +all registered WS-Resources. +the target WS-Resource. +If the returned list is not empty then a +GetResourcePropertyDocumentRequest is sent to the first child. + +------------------------------------------------------------------- + +Type enter to proceed... + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:50aa09f5-44e7-8bd3-7f24-49b8f0b9bf0d + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:f71342ad-2185-fdb3-393a-e9a98305effd + uuid:50aa09f5-44e7-8bd3-7f24-49b8f0b9bf0d + + http://localhost:8080/qman/services/adapter + + + + + + + http://localhost:8080/qman/services/ServiceGroupEntry + + uuid:b220e2bd-0370-da4e-fc71-5e283954d319 + + + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest + uuid:e035946b-c3f5-1b24-e94a-61c674ce07b9 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourcePropertyDocument/GetResourcePropertyDocumentResponse + uuid:dafe12e4-c0a9-f872-cf1e-2a41bc291b2e + uuid:e035946b-c3f5-1b24-e94a-61c674ce07b9 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + 32767 + http://www.w3.org/TR/1999/REC-xpath-19991116 + Initial Name + + 9223372036854775797 + + + Key3 + 2147483647 + + + Key4 + 3.4028235E38 + + + Key1 + aStringValue + + + Key2 + -9223372036854775808 + + + 2deef1b3-d2c6-49f3-a8de-51f6a75a1a6b + 1232956293823 + 9223372036854775807 + true + -2147483638 + + + + \ No newline at end of file diff --git a/java/management/client/src/example/GetResourcePropertyRequest.out.ok b/java/management/client/src/example/GetResourcePropertyRequest.out.ok new file mode 100644 index 0000000000..4fa0ab3b8d --- /dev/null +++ b/java/management/client/src/example/GetResourcePropertyRequest.out.ok @@ -0,0 +1,588 @@ + GetResourcePropertyExample +------------------------------------------------------------------- + +This example shows how to get the property value +from a WS-Resource. +First of all a request is send to WS-DM in order to get +all registered WS-Resources. +If the returned list is not empty then a GetMetadataRequest +to the first child. +The result metadata descriptor contains all properties of +the target WS-Resource. +For each of them a GetResourcePropertyRequest is sent + in order to get its value. + +------------------------------------------------------------------- + +Type enter to proceed... + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:e581b9cb-04a9-a87f-7763-dcf227ed7f8b + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:27bab9a7-89aa-16a1-966b-c0aa19d3b352 + uuid:e581b9cb-04a9-a87f-7763-dcf227ed7f8b + + http://localhost:8080/qman/services/adapter + + + + + + + http://localhost:8080/qman/services/ServiceGroupEntry + + uuid:b220e2bd-0370-da4e-fc71-5e283954d319 + + + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata + uuid:c5efae22-bc2f-ccdd-477c-621d4e49cd77 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + http://docs.oasis-open.org/wsrf/rmd-1 + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadataResponse + uuid:4d933676-fb60-3fae-d7b9-39324a8661fc + uuid:c5efae22-bc2f-ccdd-477c-621d4e49cd77 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:83c13239-3e37-853d-776d-3dac2729117b + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:MgmtPubInterval + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:0beb3927-6420-9877-f163-4288ea1560da + uuid:83c13239-3e37-853d-776d-3dac2729117b + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + 32767 + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:30b678da-f1fa-8120-7660-9eb86ebb76b7 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:Name + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:8343b104-1a82-212a-c84a-460cbc223327 + uuid:30b678da-f1fa-8120-7660-9eb86ebb76b7 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + Initial Name + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:795eaebd-dd48-75b0-18b3-a7e3c1fd4d5a + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:MsgTotalEnqueues + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:b6b91fd1-762b-3ae4-76c3-fe206c93b76d + uuid:795eaebd-dd48-75b0-18b3-a7e3c1fd4d5a + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + 9223372036854775797 + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:f57f0179-a31b-8607-668b-c2602838c363 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:Arguments + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:fc07cbe4-a19a-6374-c985-49fa525d3e90 + uuid:f57f0179-a31b-8607-668b-c2602838c363 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + + Key3 + 2147483647 + + + Key4 + 3.4028235E38 + + + Key1 + aStringValue + + + Key2 + -9223372036854775808 + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:5d735040-95d1-7c87-7ac9-b4a5700e0ab9 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:VhostRef + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:cdfe639c-357b-d55b-fe7d-4a203d46465c + uuid:5d735040-95d1-7c87-7ac9-b4a5700e0ab9 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + 2deef1b3-d2c6-49f3-a8de-51f6a75a1a6b + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:e3fde856-57f5-a96f-a382-5e0f4206a6fe + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:ExpireTime + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:fa290c54-bac1-62d6-701e-3b8ec2eaf817 + uuid:e3fde856-57f5-a96f-a382-5e0f4206a6fe + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + 9223372036854775807 + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:092dd5d9-c443-428c-813c-13428058b08c + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:Durable + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:1053800e-345c-abed-e352-f524c1d24afa + uuid:092dd5d9-c443-428c-813c-13428058b08c + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + true + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:bc291be9-b1d1-f668-f3c5-29647e78d6bf + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:ConsumerCount + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:7467dddf-033e-f540-241f-76ce81c0ebeb + uuid:bc291be9-b1d1-f668-f3c5-29647e78d6bf + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + -2147483638 + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:92783239-777c-27fa-cec2-ee3afecf5c32 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + qman:Type + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:af8168b4-6c13-c736-b521-f2b410541dd0 + uuid:92783239-777c-27fa-cec2-ee3afecf5c32 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=8e069b14-40ba-4d48-a2cb-b9f2bef2d404,class=queue,name=1232953394537,objectId=781f4ad7-4c96-4caa-b69d-291461cdb1fc,package=org.apache.qpid + + + + + + + \ No newline at end of file diff --git a/java/management/client/src/example/GetWsdlMetadata.out.ko.no.resources b/java/management/client/src/example/GetWsdlMetadata.out.ko.no.resources new file mode 100644 index 0000000000..6e727261f9 --- /dev/null +++ b/java/management/client/src/example/GetWsdlMetadata.out.ko.no.resources @@ -0,0 +1,58 @@ + GetWSDLMetadataExample +------------------------------------------------------------------- + +This example shows the usage of WS-DM +GetResourcePropertyRequest / Response on a +Group service. +The target resource is the WS-DM Adapter itself +and the requested property is "ws-rp:Entry". +WS-DM Adapter is a special WS-Resource (is a Group) +that acts as the main entry point for retrieving +all other managed resources. +So clients that want to deal with QMan WS-Resources +must first get resource identifiers sending +a GetResourcePropertyRequest to WS-DM Adapter +with "ws-rp:Entry" as target target property. + +------------------------------------------------------------------- + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:7f801eff-c528-91e8-33eb-3d1dd164bce7 + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:86a34968-38aa-83e8-47dd-8e86ffd8ac06 + uuid:7f801eff-c528-91e8-33eb-3d1dd164bce7 + + http://localhost:8080/qman/services/adapter + + + + + + + +----------------------------WARNING--------------------------- +Cannot proceed with the example... it seems +that there are no managed WS-Resources on QMan. +Please check QMan in order to see that it is really +connected with a broker. +------------------------------------------------------------------- diff --git a/java/management/client/src/example/GetWsdlMetadata.out.ok b/java/management/client/src/example/GetWsdlMetadata.out.ok new file mode 100644 index 0000000000..16a4c1e07e --- /dev/null +++ b/java/management/client/src/example/GetWsdlMetadata.out.ok @@ -0,0 +1,1968 @@ + GetWSDLMetadataExample +------------------------------------------------------------------- + +This example shows the usage of WS-DM +GetResourcePropertyRequest / Response on a +Group service. +The target resource is the WS-DM Adapter itself +and the requested property is "ws-rp:Entry". +WS-DM Adapter is a special WS-Resource (is a Group) +that acts as the main entry point for retrieving +all other managed resources. +So clients that want to deal with QMan WS-Resources +must first get resource identifiers sending +a GetResourcePropertyRequest to WS-DM Adapter +with "ws-rp:Entry" as target target property. + +------------------------------------------------------------------- + +Type enter to proceed. + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/adapter + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:ec4d0c03-3174-e39d-4a36-8f109056865b + + http://www.w3.org/2005/08/addressing/role/anonymous + + + + wsrf-sg:Entry + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:0f47d614-565e-5360-8dcc-ea8e4771e4dd + uuid:ec4d0c03-3174-e39d-4a36-8f109056865b + + http://localhost:8080/qman/services/adapter + + + + + + + http://localhost:8080/qman/services/ServiceGroupEntry + + uuid:1d01b4ee-7d23-3a30-342e-62fc49984fe6 + + + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=d5b32f44-5164-4e59-8f1d-a6f8c0a8a748,class=queue,name=1232872843214,objectId=a3759467-bede-476d-8dde-169f1a652191,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata + uuid:0cdb5112-09e0-ac39-06ba-393843f06e42 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=d5b32f44-5164-4e59-8f1d-a6f8c0a8a748,class=queue,name=1232872843214,objectId=a3759467-bede-476d-8dde-169f1a652191,package=org.apache.qpid + + + + http://schemas.xmlsoap.org/wsdl/ + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadataResponse + uuid:980617c8-e3a0-ebf1-8f5a-2b43d3d6d416 + uuid:0cdb5112-09e0-ac39-06ba-393843f06e42 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=d5b32f44-5164-4e59-8f1d-a6f8c0a8a748,class=queue,name=1232872843214,objectId=a3759467-bede-476d-8dde-169f1a652191,package=org.apache.qpid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To form a QName, the name of any MetadataDescriptor must be + unique within a Definitions element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get access to the xml: attribute groups for xml:lang as declared on 'schema' + and 'documentation' below + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/management/client/src/example/README b/java/management/client/src/example/README new file mode 100644 index 0000000000..5365a416e5 --- /dev/null +++ b/java/management/client/src/example/README @@ -0,0 +1,69 @@ +*** QMan WS-DM examples *** + +1) DESCRIPTION +This set of examples shows QMan WS-DM interface capabilities. +Each example is articulated in the following way. +First the name of the example class with a brief description about that is printed out. For example : + + GetWSDLMetadataExample +------------------------------------------------------------------- + +This example shows the usage of WS-DM +GetResourcePropertyRequest / Response on a +Group service. +The target resource is the WS-DM Adapter itself +and the requested property is "ws-rp:Entry". +WS-DM Adapter is a special WS-Resource (is a Group) +that acts as the main entry point for retrieving +all other managed resources. +So clients that want to deal with QMan WS-Resources +must first get resource identifiers sending +a GetResourcePropertyRequest to WS-DM Adapter +with "ws-rp:Entry" as target target property. + +------------------------------------------------------------------- + +Type enter to proceed. + +When you're ready type enter to proceed. Now the example runs and all the exchanged +SOAP messages are printed out on the screen. +If you want, we shipped (under sample_messages folder) several files containing those messages. + +A general note concerning examples...they are all written using java language so what you see is the +"java" usage of WS-DM client API. +The most important thing that you should keep in mind is that what is expected (on QMan side) is a SOAP WS-DM +compliant message so on top of that you don't need to use those java API but feel free to produce those messages +in your preferred way (by hand or using another programming language). + +Another thing : the examples contain a lot of code duplication because each of them is took as independent as possible. +The general idea is that you open an example source file and in the executeExample(...) method you should have a quick +idea of how things are working. +Also, as mentioned before, we provided, under the sample_messages folder, the messages that are part of each example conversation. +Remember : these messages are important, not the way / language you use to produce them. + +2) HOW TO RUN + +2.1) Java +You need JDK 1.5 or higher in order to run and / or compile the examples. + +2.2) Dependencies +You need to set / update the CLASSPATH environment variable with libraries found under $QMAN_HOME/app/qman/WEB-INF/lib. +After that you should be able to run one the shipped examples: + +> java org.apache.qpid.management.example.GetMultipleResourcePropertiesExample +> java org.apache.qpid.management.example.GetQManResourceMembersExample +> java org.apache.qpid.management.example.GetResourceMetadataDescriptorExample +> java org.apache.qpid.management.example.GetResourcePropertyDocumentExample +> java org.apache.qpid.management.example.GetResourcePropertyExample +> java org.apache.qpid.management.example.GetWSDLMetadataExample +> java org.apache.qpid.management.example.SetResourcePropertyExample + +Where + is the host (ip or hostname) where QMan is running; + is the port number where QMan is running; + +2.3) Qpid +You must have a running C++ broker with management enabled. + +2.4) QMan +You must have QMan WS-DM up, running and connected with the broker above. \ No newline at end of file diff --git a/java/management/client/src/example/SetResourcePropertiesRequest.out.ok b/java/management/client/src/example/SetResourcePropertiesRequest.out.ok new file mode 100644 index 0000000000..1f346afa4e --- /dev/null +++ b/java/management/client/src/example/SetResourcePropertiesRequest.out.ok @@ -0,0 +1,2316 @@ + SetResourcePropertyExample +------------------------------------------------------------------- + +This example shows how to change the state of a WS-Resource. +That means a SetResourcePropertyRequest is sent to that +WS-Resource. +First of all a request is send to WS-DM in order to get all +registered WS-Resources. +If the returned list is not empty then two GetMetadataRequests +(one for WSDL and one for RDM) are sent to the first child. +The result metadata descriptors are used for determine : + +1) WS-Resource property names; +2) Modifiability (read-only, read-write +3) Datatype; +------------------------------------------------------------------- + +So a SetResourcePropertyRequest can be sent in order +to change the WS-Resource state. +The example is looking for a property that has one of the +following datatype : + +1) String (xsd:string) +2) Long (xsd:long) +3) Integer (xsd:integer or xsd:int) +4) Double (xsd:double) +5) Float (xsd:float) +6) Short (xsd:short) + +After the update / insert request has been sent, a +GetResourcePropertiesRequest is made again +in order to see if the state has changed correctly. + +Type enter to proceed... + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata + uuid:d026718c-2724-d3bf-fd5b-3c6bf4cd5a8c + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + http://docs.oasis-open.org/wsrf/rmd-1 + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadataResponse + uuid:dba8d7ab-83a6-16e1-03cc-48edc672a325 + uuid:d026718c-2724-d3bf-fd5b-3c6bf4cd5a8c + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata + uuid:11581af1-04af-05cd-7215-103cad6a316c + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + http://schemas.xmlsoap.org/wsdl/ + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadataResponse + uuid:785964d4-9a81-784f-d68a-60de63223094 + uuid:11581af1-04af-05cd-7215-103cad6a316c + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To form a QName, the name of any MetadataDescriptor must be + unique within a Definitions element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Get access to the xml: attribute groups for xml:lang as declared on 'schema' + and 'documentation' below + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:103f564f-7008-8456-042f-095a092444f9 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + qman:MgmtPubInterval + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:b78625a8-af2f-b542-8001-d7e81d3de1c9 + uuid:103f564f-7008-8456-042f-095a092444f9 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + 32767 + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResourcePropertiesRequest + uuid:0b80a9ca-9e02-1d6b-c0e0-8ceb8560ee6e + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + 12 + + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResourcePropertiesResponse + uuid:ae67ff51-e1c1-f2c3-5243-d54905f3907b + uuid:0b80a9ca-9e02-1d6b-c0e0-8ceb8560ee6e + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:0dca61e4-072f-3091-0f38-9a967f14666a + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + qman:MgmtPubInterval + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:84399474-c5b1-8738-f410-fd86face1599 + uuid:0dca61e4-072f-3091-0f38-9a967f14666a + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + 12 + + + + +---------------------------------------------------------------------------------- +Resource has been correctly updated. +---------------------------------------------------------------------------------- +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:8be37e48-b3a5-0e4a-aea3-eda3aad58418 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + qman:Type + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:b92c8851-d071-204f-6506-3706694cf32e + uuid:8be37e48-b3a5-0e4a-aea3-eda3aad58418 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResourcePropertiesRequest + uuid:7917abf6-5c85-7e25-4515-b7f60cd32c39 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + This is a string. + + + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/SetResourceProperties/SetResourcePropertiesResponse + uuid:0b895a1f-39e5-8739-d9d7-390c5f2eb445 + uuid:7917abf6-5c85-7e25-4515-b7f60cd32c39 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + + + +[CLIENT TRACE] SOAP envelope contents (outgoing): + + + + http://localhost:8080/qman/services/QManWsResource + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest + uuid:930f39a4-0114-03bd-9921-105579fb4213 + + http://www.w3.org/2005/08/addressing/role/anonymous + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + qman:Type + + + +[CLIENT TRACE] SOAP envelope contents (incoming): + + + + http://www.w3.org/2005/08/addressing/role/anonymous + http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyResponse + uuid:3d3f04ab-3171-da69-08b5-2e74927ee981 + uuid:930f39a4-0114-03bd-9921-105579fb4213 + + http://localhost:8080/qman/services/QManWsResource + + Q-MAN: brokerID=0ef67394-e34a-4bff-b0bf-88cf359ba1a0,class=queue,name=1232966356552,objectId=894cddd3-b893-4e2f-94d2-2489f72cbdd6,package=org.apache.qpid + + + + + + This is a string. + + + + +---------------------------------------------------------------------------------- +Resource has been correctly updated. +---------------------------------------------------------------------------------- diff --git a/java/management/client/src/example/org/apache/qpid/management/example/AbstractQManExample.java b/java/management/client/src/example/org/apache/qpid/management/example/AbstractQManExample.java new file mode 100644 index 0000000000..ad05548f12 --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/AbstractQManExample.java @@ -0,0 +1,140 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import java.io.IOException; +import java.net.URI; + +import org.apache.muse.ws.addressing.EndpointReference; + +/** + * Common interface for all QMan related examples. + * + * @author Andrea Gazzarini + */ +public abstract class AbstractQManExample +{ + private final static String LINE_SEPARATOR = System.getProperty("line.separator","\n"); + protected final static String PREFIX = "qman"; + + /** + * Prints out the expected command line of this sample and after that exits. + */ + static void printUsageAndExit(String reason) + { + StringBuilder builder = new StringBuilder(); + builder.append("WARNING! Unable to run this sample : ") + .append(reason) + .append(LINE_SEPARATOR) + .append("-------------------------------------------------------------") + .append(LINE_SEPARATOR) + .append("Expected command line args for this sample are :") + .append(LINE_SEPARATOR) + .append(LINE_SEPARATOR) + .append("1) host : ip or host name where QMan is running.") + .append(LINE_SEPARATOR) + .append("2) port : port number where QMan is running.") + .append(LINE_SEPARATOR) + .append("------------------------------------------------------------"); + System.out.println(builder); + System.exit(1); + } + + /** + * Prints out a description of this example. + */ + abstract void printOutExampleDescription(); + + /** + * Executes this example. + * Note that this is just a template method used to avoid code duplication + * (printOutExampleDescription() line) so in order to see how the example + * works you should have a look at the concrete implementation of + * executeExample(String host, int port). + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + */ + void execute(String [] arguments) + { + if (arguments.length != 2){ + printUsageAndExit("invalid command line was given."); + } + + try + { + // 1) Parses command line arguments... + String host = arguments[0]; + int port = Integer.parseInt(arguments[1]); + + printOutExampleDescription(); + + waitForUserInput("Type enter to proceed..."); + + executeExample(host, port); + + } catch(NumberFormatException exception) + { + printUsageAndExit("port number must be a number."); + } catch(Exception exception) + { + System.out.println("-----------------------EXAMPLE FAILURE-----------"); + System.out.println("Not well-defined exception was detected while"); + System.out.println("running the example."); + exception.printStackTrace(System.out); + System.out.println("--------------------------------------------------------"); + } + } + + private void waitForUserInput(String message) throws IOException { + System.out.println(message); + System.in.read(); + } + + /** + * Each concrete implementor must define here how the example works. + * So, on top of that, user who wants to see how to use a specific feature + * should have a look at the concrete implementation of this method.. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + abstract void executeExample(String host, int port) throws Exception; + + /** + * Returns the endpoint reference of the adapter service. + * + * @param host ip or host name where the service is running. + * @param port the port number of the server where the service is running. + * @return the endpoint reference of the adapter service. + */ + EndpointReference getAdapterEndpointReference(String host, int port) + { + URI address = URI.create( + "http://"+ + host+ + ":"+ + port+ + "/qman/services/adapter"); + return new EndpointReference(address); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/GetMultipleResourcePropertiesExample.java b/java/management/client/src/example/org/apache/qpid/management/example/GetMultipleResourcePropertiesExample.java new file mode 100644 index 0000000000..607ae32cab --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/GetMultipleResourcePropertiesExample.java @@ -0,0 +1,189 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.apache.muse.core.proxy.ProxyHandler; +import org.apache.muse.core.proxy.ReflectionProxyHandler; +import org.apache.muse.util.xml.XmlUtils; +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; +import org.w3c.dom.Element; + +/** + * This example shows how to get properties from a WS-Resource using one request. + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then a GetMetadataRequest is sent to the + * first child. + * The result metadata descriptor contains all properties names of the target WS-Resource. + * Those names are then used for retrieving the corresponding values. + * + * @author Andrea Gazzarini + */ +public class GetMultipleResourcePropertiesExample extends AbstractQManExample +{ + + /** + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then a GetMetadataRequest is sent to the + * first child. + * The result metadata descriptor contains all properties names of the target WS-Resource. + * Those names are then used for retrieving the corresponding values. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + + // 1) Creates an endpoint reference of the adapter service... + EndpointReference adapterEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Adapter service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(adapterEndpointReference); + adapterClient.setTrace(true); + + // 3) Retrieves the all registered members (QMan WS-Resources) + WsResourceClient [] resources = adapterClient.getMembers(); + + // Sanity check : we cannot proceed if there are no WS-Resources. + if (resources.length == 0) + { + System.out.println("----------------------------WARNING---------------------------"); + System.out.println("Cannot proceed with the example... it seems"); + System.out.println("that there are no managed WS-Resources on QMan."); + System.out.println("Please check QMan in order to see that it is really"); + System.out.println("connected with a broker."); + System.out.println("-------------------------------------------------------------------"); + System.exit(0); + } + + // 4) Creates a proxy handler for service invocation. + ProxyHandler metadataProxyHandler = createProxyHandler(); + + // 5) ..and invokes the GetMetadata on the first member. + WsResourceClient wsResourceClient = resources[0]; + wsResourceClient.setTrace(true); + + // Dialect is RDM for this example + String dialect = "http://docs.oasis-open.org/wsrf/rmd-1"; + Object [] inputParameters = {dialect}; + + // RDM is the first element of the returned array. + // The first element is a wsx:Metadata containing all resource properties. + Element [] metadata = (Element[]) wsResourceClient.invoke(metadataProxyHandler, inputParameters); + Element resourceMetadataDescriptor = metadata[0]; + + // 6) using XPath navigates xml in order to get the list of all properties. + Element [] properties = XmlUtils.findInSubTree( + resourceMetadataDescriptor, + new QName("http://docs.oasis-open.org/wsrf/rmd-1","Property","wsrmd")); + List names = new ArrayList(); + + for (Element property : properties) + { + + String attributeName = property.getAttribute("name"); // = qman: + + // For this example we are only interested on qman namespace related properties... + if (attributeName.startsWith("qman")) + { + String attributeNameWithoutPrefix = attributeName.replaceFirst("qman:", ""); // = + + names.add(new QName( + "http://amqp.apache.org/qpid/management/qman", + attributeNameWithoutPrefix, + "qman")); + } + } + + QName [] qnames = names.toArray(new QName[names.size()]); + + // 7) Send a GetMultipleResourcePropertiesRequest. + // We do nothing with the returned value(s) because it / they + // has / have already printed out (wsResourceClient.setTrace(true)) + @SuppressWarnings("unused") + Element [] values = wsResourceClient.getMultipleResourceProperties(qnames); + } + + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + /* + * * This example shows how to get properties from a WS-Resource using one request. + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then a GetMetadataRequest is sent to the + * first child. + * The result metadata descriptor contains all properties names of the target WS-Resource. + * Those names are then used for retrieving the corresponding values. + * + */ + + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("This example shows how to get properties from a"); + System.out.println("WS-Resource using one request. "); + System.out.println("First of all a request is send to WS-DM in order to get"); + System.out.println("all registered WS-Resources."); + System.out.println("If the returned list is not empty then a GetMetadataRequest"); + System.out.println("to the first child."); + System.out.println("The result metadata descriptor contains all property names of"); + System.out.println("the target WS-Resource."); + System.out.println("Those names are then used for retrieving the corresponding values"); + System.out.println("using the GetMultipleResourceProperties request."); + System.out.println(); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + } + + /** + * A proxy handler is a module needed in order to make a capability + * service invocation. + * It contains logic to serialize and deserialize request, response, input and + * output parameters during a web service invocation. + * + * @return a proxy handler. + */ + private ProxyHandler createProxyHandler() + { + ProxyHandler handler = new ReflectionProxyHandler(); + handler.setAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata"); + handler.setRequestName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "GetMetadata", PREFIX)); + handler.setRequestParameterNames(new QName[]{new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Dialect", PREFIX)}); + handler.setResponseName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Metadata", PREFIX)); + handler.setReturnType(Element[].class); + return handler; + } + + public static void main(String[] arguments) + { + new GetMultipleResourcePropertiesExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/GetQManResourceMembersExample.java b/java/management/client/src/example/org/apache/qpid/management/example/GetQManResourceMembersExample.java new file mode 100644 index 0000000000..f74a44ab57 --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/GetQManResourceMembersExample.java @@ -0,0 +1,93 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; + +/** + * An example demonstrating the usage of GetResourcePropertyRequest/Response on + * the WS-DM Adapter. + * + * @author Andrea Gazzarini + */ +public class GetQManResourceMembersExample extends AbstractQManExample +{ + /** + * Looks for memebers of QMan group requesting ws-rp:Entry property to + * WS-DM Adapter resource service. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + // 1) Creates an endpoint reference of the adapter service... + EndpointReference serviceEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(serviceEndpointReference); + adapterClient.setTrace(true); + + // 3) Invokes the service. + WsResourceClient [] resources = adapterClient.getMembers(); + + String result = (resources.length != 0) + ? ("QMan has at the moment "+resources.length+" registered resources.") + : "It seems that there are no managed resource on QMan side..."; + + System.out.println("--------------------------------------------------------------------------"); + System.out.println(result); + System.out.println("--------------------------------------------------------------------------"); + } + + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("This example shows the usage of WS-DM "); + System.out.println("GetResourcePropertyRequest / Response on a "); + System.out.println("Group service."); + System.out.println("The target resource is the WS-DM Adapter itself "); + System.out.println("and the requested property is \"wsrf-sg:Entry\"."); + System.out.println("WS-DM Adapter is a special WS-Resource (is a Group)"); + System.out.println("that acts as the main entry point for retrieving"); + System.out.println("all other managed resources."); + System.out.println("So clients that want to deal with QMan WS-Resources"); + System.out.println("must first get resource identifiers sending"); + System.out.println("a GetResourcePropertyRequest to WS-DM Adapter "); + System.out.println("with \"wsrf-sg:Entry\" as target target property."); + System.out.println(); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + } + + public static void main(String[] arguments) + { + new GetQManResourceMembersExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/GetResourceMetadataDescriptorExample.java b/java/management/client/src/example/org/apache/qpid/management/example/GetResourceMetadataDescriptorExample.java new file mode 100644 index 0000000000..84befc01e4 --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/GetResourceMetadataDescriptorExample.java @@ -0,0 +1,156 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import javax.xml.namespace.QName; + +import org.apache.muse.core.proxy.ProxyHandler; +import org.apache.muse.core.proxy.ReflectionProxyHandler; +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; +import org.w3c.dom.Element; + +/** + * This example shows how to get metadata from a WS-Resource. + * The service supports different kinds of metadata. + * User who wants to receive metadata of a WS-Resource must + * send a GetMetadataRequesta specifying the requested dialect. + * + * Supported metadata that could be requested are + * + *
    + *
  • + * WSDL : requested using "http://schemas.xmlsoap.org/wsdl/" as dialect.. + *
  • + *
  • + * RDM (Resource Metadata Descriptor) : requested using "http://docs.oasis-open.org/wsrf/rmd-1 "as dialect. + *
  • + *
+ * + * Note that this example focuses on RDM Metadata only; another example is dedicated to WSDL. + * + * @author Andrea Gazzarini + */ +public class GetResourceMetadataDescriptorExample extends AbstractQManExample +{ + + /** + * First, sends a request to WS-DM Adapter in order to get the list of managed resources. + * If the list is not empty, then takes the first member and sends it a GetMetadataRequest + * in order to get its RDM. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + + // 1) Creates an endpoint reference of the adapter service... + EndpointReference adapterEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Adapter service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(adapterEndpointReference); + adapterClient.setTrace(true); + + // 3) Retrieves the all registered members (QMan WS-Resources) + WsResourceClient [] resources = adapterClient.getMembers(); + + // Sanity check : we cannot proceed if there are no WS-Resources. + if (resources.length == 0) + { + System.out.println("----------------------------WARNING---------------------------"); + System.out.println("Cannot proceed with the example... it seems"); + System.out.println("that there are no managed WS-Resources on QMan."); + System.out.println("Please check QMan in order to see that it is really"); + System.out.println("connected with a broker."); + System.out.println("-------------------------------------------------------------------"); + System.exit(0); + } + + // 4) Creates a proxy handler for service invocation. + ProxyHandler metadataProxyHandler = createProxyHandler(); + + // 5) ..and invokes the GetMetadata on the first member. + WsResourceClient firstMember = resources[0]; + firstMember.setTrace(true); + + // Dialect is RDM for this example + String dialect = "http://docs.oasis-open.org/wsrf/rmd-1"; + Object [] inputParameters = {dialect}; + + // WSDL is the first element of the returned array. We don't need to print out it here + // because at this point it should have been already printed out (line 96 : firstMember.setTrace(true)) + @SuppressWarnings("unused") + Element [] metadata = (Element[]) firstMember.invoke(metadataProxyHandler, inputParameters); + } + + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("The example shows how to get metadata from a"); + System.out.println("WS-Resource."); + System.out.println("A QMan WS-Resource has different kinds of metadata."); + System.out.println("(see below)"); + System.out.println("User who wants to receive metadata of a WS-Resource"); + System.out.println("must send a GetMetadataRequesta specifying the"); + System.out.println("associated dialect."); + System.out.println("Supported metadata that could be requested are : "); + System.out.println(); + System.out.println("- WSDL : in this case dialect is \"http://schemas.xmlsoap.org/wsdl/\";"); + System.out.println("- RDM (Resource Metadata Descriptor) : in this case dialect is \"http://docs.oasis-open.org/wsrf/rmd-1 \"."); + System.out.println(); + System.out.println("Note that this examples focuses on RDM Metadata only;"); + System.out.println("another one is dedicated to WSDL."); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + } + + /** + * A proxy handler is a module needed in order to make a capability + * service invocation. + * It contains logic to serialize and deserialize request, response, input and + * output parameters during a web service invocation. + * + * @return a proxy handler. + */ + private ProxyHandler createProxyHandler() + { + ProxyHandler handler = new ReflectionProxyHandler(); + handler.setAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata"); + handler.setRequestName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "GetMetadata", PREFIX)); + handler.setRequestParameterNames(new QName[]{new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Dialect", PREFIX)}); + handler.setResponseName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Metadata", PREFIX)); + handler.setReturnType(Element[].class); + return handler; + } + + public static void main(String[] arguments) + { + new GetResourceMetadataDescriptorExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyDocumentExample.java b/java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyDocumentExample.java new file mode 100644 index 0000000000..838ca2ced7 --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyDocumentExample.java @@ -0,0 +1,112 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; +import org.w3c.dom.Element; + +/** + * This example shows how to get the whole property document from a WS-Resource. + * Resource property document represents a particular composed structural view of + * the resource properties of the WS-Resource. + * Let's say that It is a way to get all-in-once the state of the WS-Resource. + * + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then a GetResourcePropertyDocumentRequest is + * sent to the first child. + * + * @author Andrea Gazzarini + */ +public class GetResourcePropertyDocumentExample extends AbstractQManExample +{ + + /** + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then a GetResourcePropertyDocumentRequest is + * sent to the first child. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + + // 1) Creates an endpoint reference of the adapter service... + EndpointReference adapterEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Adapter service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(adapterEndpointReference); + adapterClient.setTrace(true); + + // 3) Retrieves the all registered members (QMan WS-Resources) + WsResourceClient [] resources = adapterClient.getMembers(); + + // Sanity check : we cannot proceed if there are no WS-Resources. + if (resources.length == 0) + { + System.out.println("----------------------------WARNING---------------------------"); + System.out.println("Cannot proceed with the example... it seems"); + System.out.println("that there are no managed WS-Resources on QMan."); + System.out.println("Please check QMan in order to see that it is really"); + System.out.println("connected with a broker."); + System.out.println("-------------------------------------------------------------------"); + System.exit(0); + } + + // 4) ..and invokes the GetMetadata on the first member. + WsResourceClient wsResourceClient = resources[0]; + wsResourceClient.setTrace(true); + + @SuppressWarnings("unused") + Element resourcePropertyDocument = wsResourceClient.getResourcePropertyDocument(); + + } + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("This example shows how to get the whole property"); + System.out.println("document from a WS-Resource."); + System.out.println("Resource property document represents a particular "); + System.out.println("composed structural view of the resource properties"); + System.out.println("of the WS-Resource."); + System.out.println("First of all a request is send to WS-DM in order to get"); + System.out.println("all registered WS-Resources."); + System.out.println("the target WS-Resource."); + System.out.println("If the returned list is not empty then a"); + System.out.println("GetResourcePropertyDocumentRequest is sent to the first child."); + System.out.println(); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + } + + public static void main(String[] arguments) + { + new GetResourcePropertyDocumentExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyExample.java b/java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyExample.java new file mode 100644 index 0000000000..28ed1c7925 --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/GetResourcePropertyExample.java @@ -0,0 +1,172 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import javax.xml.namespace.QName; + +import org.apache.muse.core.proxy.ProxyHandler; +import org.apache.muse.core.proxy.ReflectionProxyHandler; +import org.apache.muse.util.xml.XmlUtils; +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; +import org.w3c.dom.Element; + +/** + * This example shows how to get the property value from a WS-Resource. + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then a GetMetadataRequest is sent to the + * first child. + * The result metadata descriptor contains all properties of the target WS-Resource. + * For each of them a GetResourcePropertyRequest is sent in order to get its value. + * + * @author Andrea Gazzarini + */ +public class GetResourcePropertyExample extends AbstractQManExample +{ + + /** + * First, sends a request to WS-DM Adapter in order to get the list of managed resources. + * If the list is not empty, then takes the first member and sends it a GetMetadataRequest + * in order to get its WSDL. + * After that, for each property contained in ResourceMetadataDescriptorm (RDM) a + * GetResourcePropertyRequest is sent in order to get its value. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + + // 1) Creates an endpoint reference of the adapter service... + EndpointReference adapterEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Adapter service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(adapterEndpointReference); + adapterClient.setTrace(true); + + // 3) Retrieves the all registered members (QMan WS-Resources) + WsResourceClient [] resources = adapterClient.getMembers(); + + // Sanity check : we cannot proceed if there are no WS-Resources. + if (resources.length == 0) + { + System.out.println("----------------------------WARNING---------------------------"); + System.out.println("Cannot proceed with the example... it seems"); + System.out.println("that there are no managed WS-Resources on QMan."); + System.out.println("Please check QMan in order to see that it is really"); + System.out.println("connected with a broker."); + System.out.println("-------------------------------------------------------------------"); + System.exit(0); + } + + // 4) Creates a proxy handler for service invocation. + ProxyHandler metadataProxyHandler = createProxyHandler(); + + // 5) ..and invokes the GetMetadata on the first member. + WsResourceClient wsResourceClient = resources[0]; + wsResourceClient.setTrace(true); + + // Dialect is RDM for this example + String dialect = "http://docs.oasis-open.org/wsrf/rmd-1"; + Object [] inputParameters = {dialect}; + + // RDM is the first element of the returned array. + // The first element is a wsx:Metadata containing all resource properties. + Element [] metadata = (Element[]) wsResourceClient.invoke(metadataProxyHandler, inputParameters); + Element resourceMetadataDescriptor = metadata[0]; + + // 6) using XPath navigates xml in order to get the list of all properties. + Element [] properties = XmlUtils.findInSubTree( + resourceMetadataDescriptor, + new QName("http://docs.oasis-open.org/wsrf/rmd-1","Property","wsrmd")); + + for (Element property : properties) + { + + String attributeName = property.getAttribute("name"); // = qman: + + // For this example we are only interested on qman namespace related properties... + if (attributeName.startsWith("qman")) + { + String attributeNameWithoutPrefix = attributeName.replaceFirst("qman:", ""); // = + + // 7) Send a GetResourcePropertyRequest for the given attribute. + // We do nothing with the returned value(s) because it / they + // has / have already printed out (wsResourceClient.setTrace(true)) + @SuppressWarnings("unused") + Element [] values = wsResourceClient.getResourceProperty( + new QName( + "http://amqp.apache.org/qpid/management/qman", + attributeNameWithoutPrefix, + "qman")); + } + } + } + + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("This example shows how to get the property value"); + System.out.println("from a WS-Resource."); + System.out.println("First of all a request is send to WS-DM in order to get"); + System.out.println("all registered WS-Resources."); + System.out.println("If the returned list is not empty then a GetMetadataRequest"); + System.out.println("to the first child."); + System.out.println("The result metadata descriptor contains all properties of"); + System.out.println("the target WS-Resource."); + System.out.println("For each of them a GetResourcePropertyRequest is sent"); + System.out.println(" in order to get its value."); + System.out.println(); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + } + + /** + * A proxy handler is a module needed in order to make a capability + * service invocation. + * It contains logic to serialize and deserialize request, response, input and + * output parameters during a web service invocation. + * + * @return a proxy handler. + */ + private ProxyHandler createProxyHandler() + { + ProxyHandler handler = new ReflectionProxyHandler(); + handler.setAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata"); + handler.setRequestName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "GetMetadata", PREFIX)); + handler.setRequestParameterNames(new QName[]{new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Dialect", PREFIX)}); + handler.setResponseName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Metadata", PREFIX)); + handler.setReturnType(Element[].class); + return handler; + } + + public static void main(String[] arguments) + { + new GetResourcePropertyExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/GetWSDLMetadataExample.java b/java/management/client/src/example/org/apache/qpid/management/example/GetWSDLMetadataExample.java new file mode 100644 index 0000000000..ecda6e8fb1 --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/GetWSDLMetadataExample.java @@ -0,0 +1,156 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import javax.xml.namespace.QName; + +import org.apache.muse.core.proxy.ProxyHandler; +import org.apache.muse.core.proxy.ReflectionProxyHandler; +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; +import org.w3c.dom.Element; + +/** + * This example shows how to get metadata from a WS-Resource. + * The service supports different kinds of metadata. + * User who wants to receive metadata of a WS-Resource must + * send a GetMetadataRequesta specifying the requested dialect. + * + * Supported metadata that could be requested are + * + *
    + *
  • + * WSDL : requested using "http://schemas.xmlsoap.org/wsdl/" as dialect.. + *
  • + *
  • + * RDM (Resource Metadata Descriptor) : requested using "http://docs.oasis-open.org/wsrf/rmd-1 "as dialect. + *
  • + *
+ * + * Note that this example focuses on WSDL Metadata only; another example is dedicated to RDM. + * + * @author Andrea Gazzarini + */ +public class GetWSDLMetadataExample extends AbstractQManExample +{ + + /** + * First, sends a request to WS-DM Adapter in order to get the list of managed resources. + * If the list is not empty, then takes the first member and sends it a GetMetadataRequest + * in order to get its WSDL. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + + // 1) Creates an endpoint reference of the adapter service... + EndpointReference adapterEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Adapter service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(adapterEndpointReference); + adapterClient.setTrace(true); + + // 3) Retrieves the all registered members (QMan WS-Resources) + WsResourceClient [] resources = adapterClient.getMembers(); + + // Sanity check : we cannot proceed if there are no WS-Resources. + if (resources.length == 0) + { + System.out.println("----------------------------WARNING---------------------------"); + System.out.println("Cannot proceed with the example... it seems"); + System.out.println("that there are no managed WS-Resources on QMan."); + System.out.println("Please check QMan in order to see that it is really"); + System.out.println("connected with a broker."); + System.out.println("-------------------------------------------------------------------"); + System.exit(0); + } + + // 4) Creates a proxy handler for service invocation. + ProxyHandler metadataProxyHandler = createProxyHandler(); + + // 5) ..and invokes the GetMetadata on the first member. + WsResourceClient firstMember = resources[0]; + firstMember.setTrace(true); + + // Dialect is WSDL for this example + String dialect = "http://schemas.xmlsoap.org/wsdl/"; + Object [] inputParameters = {dialect}; + + // WSDL is the first element of the returned array. We don't need to print out it here + // because at this point it should have been already printed out (line 96 : firstMember.setTrace(true)) + @SuppressWarnings("unused") + Element [] metadata = (Element[]) firstMember.invoke(metadataProxyHandler, inputParameters); + } + + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("The example shows how to get metadata from a"); + System.out.println("WS-Resource."); + System.out.println("A QMan WS-Resource has different kinds of metadata."); + System.out.println("(see below)"); + System.out.println("User who wants to receive metadata of a WS-Resource"); + System.out.println("must send a GetMetadataRequesta specifying the"); + System.out.println("associated dialect."); + System.out.println("Supported metadata that could be requested are : "); + System.out.println(); + System.out.println("- WSDL : in this case dialect is \"http://schemas.xmlsoap.org/wsdl/\";"); + System.out.println("- RDM (Resource Metadata Descriptor) : in this case dialect is \"http://docs.oasis-open.org/wsrf/rmd-1 \"."); + System.out.println(); + System.out.println("Note that this examples focuses on WSDL Metadata only;"); + System.out.println("another one is dedicated to RDM."); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + } + + /** + * A proxy handler is a module needed in order to make a capability + * service invocation. + * It contains logic to serialize and deserialize request, response, input and + * output parameters during a web service invocation. + * + * @return a proxy handler. + */ + private ProxyHandler createProxyHandler() + { + ProxyHandler handler = new ReflectionProxyHandler(); + handler.setAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata"); + handler.setRequestName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "GetMetadata", PREFIX)); + handler.setRequestParameterNames(new QName[]{new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Dialect", PREFIX)}); + handler.setResponseName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Metadata", PREFIX)); + handler.setReturnType(Element[].class); + return handler; + } + + public static void main(String[] arguments) + { + new GetWSDLMetadataExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/example/org/apache/qpid/management/example/SetResourcePropertyExample.java b/java/management/client/src/example/org/apache/qpid/management/example/SetResourcePropertyExample.java new file mode 100644 index 0000000000..8aed3101ff --- /dev/null +++ b/java/management/client/src/example/org/apache/qpid/management/example/SetResourcePropertyExample.java @@ -0,0 +1,306 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.example; + +import java.lang.reflect.Array; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.muse.core.proxy.ProxyHandler; +import org.apache.muse.core.proxy.ReflectionProxyHandler; +import org.apache.muse.util.xml.XmlUtils; +import org.apache.muse.ws.addressing.EndpointReference; +import org.apache.muse.ws.resource.remote.WsResourceClient; +import org.apache.muse.ws.resource.sg.remote.ServiceGroupClient; +import org.w3c.dom.Element; + +/** + * This example shows how to change the state of a WS-Resource. That means + * a SetResourcePropertyRequest is sent to that WS-Resource. + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then two GetMetadataRequests are sent to the + * first child (one for WSDL and one for RDM). + * The result metadata descriptors are the used to determine : + * + *
What are names of WS-Resouce properties + *
Their modifiability (read-only or read-write) + *
Their type + * + * So a SetResourcePropertyRequest can be sent in order to change the WS-Resource state. + * The example is looking for a property that has one of the following datatype : + * + *
    + *
  • String
  • + *
  • Long
  • + *
  • Integer
  • + *
  • Short
  • + *
  • Double
  • + *
  • Float
  • + *
+ * + * After the update / insert request has been sent, a GetResourcePropertiesRequest is made + * again in order to see if the state has changed correctly. + * + * @author Andrea Gazzarini + */ +public class SetResourcePropertyExample extends AbstractQManExample +{ + /** + * First of all a request is send to WS-DM in order to get all registered WS-Resources. + * If the returned list is not empty then two GetMetadataRequests are sent to the + * first child (one for WSDL and one for RDM). + * The result metadata descriptors are the used to determine : + * + *
What are names of WS-Resouce properties + *
Their modifiability (read-only or read-write) + *
Their type + * + * So a SetResourcePropertyRequest can be sent in order to change the WS-Resource state. + * The example is looking for a property that has one of the following datatype : + * + *
    + *
  • String
  • + *
  • Long
  • + *
  • Integer
  • + *
  • Short
  • + *
  • Double
  • + *
  • Float
  • + *
+ * + * After the update / insert request has been sent, a GetResourcePropertiesRequest is made + * again in order to see if the state has changed correctly. + * + * @param host the host where QMan is running. + * @param port the port where QMan is running. + * @throws Exception when the example fails (not at application level). + */ + void executeExample(String host, int port) throws Exception + { + // 1) Creates an endpoint reference of the adapter service... + EndpointReference adapterEndpointReference = getAdapterEndpointReference(host, port); + + // 2) Creates the Adapter service client... + ServiceGroupClient adapterClient = new ServiceGroupClient(adapterEndpointReference); + adapterClient.setTrace(false); + + // 3) Retrieves the all registered members (QMan WS-Resources) + WsResourceClient [] resources = adapterClient.getMembers(); + + // Sanity check : we cannot proceed if there are no WS-Resources. + if (resources.length == 0) + { + System.out.println("----------------------------WARNING---------------------------"); + System.out.println("Cannot proceed with the example... it seems"); + System.out.println("that there are no managed WS-Resources on QMan."); + System.out.println("Please check QMan in order to see that it is really"); + System.out.println("connected with a broker."); + System.out.println("-------------------------------------------------------------------"); + System.exit(0); + } + + // 4) Creates a proxy handler for service invocation. + ProxyHandler metadataProxyHandler = createProxyHandler(); + + // 5) ..and invokes the GetMetadata on the first member. + WsResourceClient wsResourceClient = resources[0]; + wsResourceClient.setTrace(true); + + // Resource Metadata Descriptor + String dialect = "http://docs.oasis-open.org/wsrf/rmd-1"; + Object [] inputParameters = {dialect}; + + // RDM is the first element of the returned array. + // The first element is a wsx:Metadata containing all resource properties. + Element [] metadata = (Element[]) wsResourceClient.invoke(metadataProxyHandler, inputParameters); + Element resourceMetadataDescriptor = metadata[0]; + + // 6) Now we need WSDL in order to catch datatypes + dialect = "http://schemas.xmlsoap.org/wsdl/"; + inputParameters = new Object[]{dialect}; + metadata = (Element[]) wsResourceClient.invoke(metadataProxyHandler, inputParameters); + Element wsdl = metadata[0]; + + //7) Defines sample values used for update property. + Map sampleValues = new HashMap(); + sampleValues.put("xsd:string","This is a string."); + sampleValues.put("xsd:integer",new Integer(12345)); + sampleValues.put("xsd:int",new Integer(54321)); + sampleValues.put("xsd:long",new Integer(12345)); + sampleValues.put("xsd:double",new Double(12345.6d)); + sampleValues.put("xsd:float",new Float(123.4f)); + sampleValues.put("xsd:short",new Short((short)12)); + + // 8) using XPath navigates xml in order to get the list of all properties. + Element [] properties = XmlUtils.findInSubTree( + resourceMetadataDescriptor, + new QName("http://docs.oasis-open.org/wsrf/rmd-1","Property","wsrmd")); + + Element [] wsdlElements = XmlUtils.findInSubTree( + wsdl, + new QName("http://www.w3.org/2001/XMLSchema","element","xsd")); + + // Did we find at least one writable property? + boolean atLeastOnePropertyHasBeenFound = false; + + for (Element property : properties) + { + // Sanity check : if the property is read-only then proceed with next + // property. + if (!"read-write".equals(property.getAttribute("modifiability"))) + { + continue; + } + + String attributeName = property.getAttribute("name"); // = qman: + + // For this example we are only interested on qman namespace related properties... + if (attributeName.startsWith("qman")) + { + String attributeNameWithoutPrefix = attributeName.replaceFirst("qman:", ""); // = + + for (Element wsdlElement : wsdlElements) + { + String name = wsdlElement.getAttribute("name"); + String type = wsdlElement.getAttribute("type"); + if ((name != null) && (attributeNameWithoutPrefix.equals(name)) && (type != null)) + { + Object newValue = sampleValues.get(type); + if (newValue != null) + { + atLeastOnePropertyHasBeenFound = true; + + inputParameters = new Object[] {newValue}; + + // 9) Makes a GetResourcePropertiesRequest in order to get the current value. + QName propertyQName = new QName( + "http://amqp.apache.org/qpid/management/qman", + name, + "qman"); + + // The returned value is really an array because property shoudl be a multi-value property. + // So in order to get its value we need to extract the first value. + Object currentValue = wsResourceClient.getPropertyAsObject(propertyQName,newValue.getClass()); + + // 10a) If the property is not set (value is null) then an "Insert" request must be sent. + if (currentValue == null || Array.getLength(currentValue) == 0) + { + wsResourceClient.insertResourceProperty(propertyQName,inputParameters); + } + // 10b) If the property is not null then an "Update" request must be sent. + else + { + wsResourceClient.updateResourceProperty(propertyQName,inputParameters); + } + + // 11) Let's query again the resource using GetResourceProperties in order to ensure the + // previous property has been properly updated. + currentValue = wsResourceClient.getPropertyAsObject(propertyQName,newValue.getClass()); + + String resultMessage = (newValue.equals(Array.get(currentValue, 0))) + ? "Resource has been correctly updated." + : "Something was wrong : resource seems not to be properly updated."; + + System.out.println("----------------------------------------------------------------------------------"); + System.out.println(resultMessage); + System.out.println("----------------------------------------------------------------------------------"); + + // Let's stop...one property is enough for this example :) + break; + } + } + } + if (!atLeastOnePropertyHasBeenFound) + { + System.out.println("----------------------------------------------------------------------------------"); + System.out.println("WARNING : This example wasn't able to run because no writable "); + System.out.println("property has been found on the target WS-Resource."); + System.out.println("----------------------------------------------------------------------------------"); + } + } + } + } + + /** + * Prints out a description of this example. + */ + void printOutExampleDescription() + { + System.out.println(" "+getClass().getSimpleName()+" "); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("This example shows how to change the state of a WS-Resource."); + System.out.println("That means a SetResourcePropertyRequest is sent to that"); + System.out.println("WS-Resource."); + System.out.println("First of all a request is send to WS-DM in order to get all"); + System.out.println("registered WS-Resources."); + System.out.println("If the returned list is not empty then two GetMetadataRequests"); + System.out.println("(one for WSDL and one for RDM) are sent to the first child."); + System.out.println("The result metadata descriptors are used for determine :"); + System.out.println(); + System.out.println("1) WS-Resource property names;"); + System.out.println("2) Modifiability (read-only, read-write"); + System.out.println("3) Datatype;"); + System.out.println("-------------------------------------------------------------------"); + System.out.println(); + System.out.println("So a SetResourcePropertyRequest can be sent in order"); + System.out.println("to change the WS-Resource state."); + System.out.println("The example is looking for a property that has one of the"); + System.out.println("following datatype :"); + System.out.println(); + System.out.println("1) String (xsd:string)"); + System.out.println("2) Long (xsd:long)"); + System.out.println("3) Integer (xsd:integer or xsd:int)"); + System.out.println("4) Double (xsd:double)"); + System.out.println("5) Float (xsd:float)"); + System.out.println("6) Short (xsd:short)"); + System.out.println(); + System.out.println("After the update / insert request has been sent, a "); + System.out.println("GetResourcePropertiesRequest is made again"); + System.out.println("in order to see if the state has changed correctly."); + System.out.println(); + } + + /** + * A proxy handler is a module needed in order to make a capability + * service invocation. + * It contains logic to serialize and deserialize request, response, input and + * output parameters during a web service invocation. + * + * @return a proxy handler. + */ + private ProxyHandler createProxyHandler() + { + ProxyHandler handler = new ReflectionProxyHandler(); + handler.setAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata"); + handler.setRequestName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "GetMetadata", PREFIX)); + handler.setRequestParameterNames(new QName[]{new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Dialect", PREFIX)}); + handler.setResponseName(new QName("http://schemas.xmlsoap.org/ws/2004/09/mex", "Metadata", PREFIX)); + handler.setReturnType(Element[].class); + return handler; + } + + public static void main(String[] arguments) + { + new SetResourcePropertyExample().execute(arguments); + } +} \ No newline at end of file diff --git a/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObject.java b/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObject.java index 4026f6102b..8456b2f8ac 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObject.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObject.java @@ -44,6 +44,7 @@ public class QpidDomainObject implements QpidDomainObjectMBean private Short _mgmtPubInterval; private Date _expireTime; private String _type; + private byte [] _byteArray; /** * Builds a new QpidDomainObject with default values for @@ -60,11 +61,12 @@ public class QpidDomainObject implements QpidDomainObjectMBean _arguments.put("Key3", Integer.MAX_VALUE); _arguments.put("Key4", Double.MIN_VALUE); _arguments.put("Key4", Float.MAX_VALUE); - + _msgTotalEnqueues = Long.MAX_VALUE-10; _consumerCount = Integer.MIN_VALUE+10; _mgmtPubInterval = Short.MAX_VALUE; _expireTime = new Date(Long.MAX_VALUE); + _byteArray = new byte[]{1,2,3,5,6,7,8,7,56}; } /** @@ -304,4 +306,9 @@ public class QpidDomainObject implements QpidDomainObjectMBean { return _type; } + + public byte[] getByteArray() + { + return _byteArray; + } } \ No newline at end of file diff --git a/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObjectMBean.java b/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObjectMBean.java index 8a383505c7..da585a9f43 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObjectMBean.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/domain/handler/impl/QpidDomainObjectMBean.java @@ -224,4 +224,11 @@ public interface QpidDomainObjectMBean * @return the type property value. */ String getType(); + +// /** +// * Returns the byteArray property value. +// * +// * @return the byteArray property value. +// */ +// byte[] getByteArray(); } \ No newline at end of file diff --git a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilder.java b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilder.java index 334114f4b0..aa6ec5aee4 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilder.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilder.java @@ -211,7 +211,7 @@ public class MBeanCapabilityBuilder implements IArtifactBuilder{ if (attribute.isReadable()) { - String accessor = generateGetter(type, nameForAccessors); + String accessor = generateGetter(type, nameForAccessors,name); CtMethod getter = CtNewMethod.make(accessor,_capabilityClassDefinition); _capabilityClassDefinition.addMethod(getter); appendToPropertiesArray(name); @@ -224,7 +224,7 @@ public class MBeanCapabilityBuilder implements IArtifactBuilder{ if (attribute.isWritable()) { - String accessor = generateSetter(type, nameForAccessors); + String accessor = generateSetter(type, nameForAccessors,name); CtMethod setter = CtNewMethod.make(accessor,_capabilityClassDefinition); _capabilityClassDefinition.addMethod(setter); @@ -435,10 +435,11 @@ public class MBeanCapabilityBuilder implements IArtifactBuilder{ * Generates the get accessor method for the given property. * * @param type the type of the property. - * @param name the name of the property. + * @param name the name of the property with the first letter capitalized. + * @param plainName the plain name of the property. * @return the getter method (as a string). */ - String generateGetter(String type, String name) + String generateGetter(String type, String name,String plainName) { return new StringBuilder() .append("public ") @@ -449,7 +450,7 @@ public class MBeanCapabilityBuilder implements IArtifactBuilder{ .append("() throws NoSuchAttributeFault,EntityInstanceNotFoundFault,QManFault { return (") .append(type) .append(") getAttribute(\"") - .append(name) + .append(plainName) .append("\"); }") .toString(); } @@ -458,10 +459,11 @@ public class MBeanCapabilityBuilder implements IArtifactBuilder{ * Generates the set accessor method for the given property. * * @param type the type of the property. - * @param name the name of the property. + * @param name the name of the property with the first letter capitalized. + * @param plainName the plain name of the property. * @return the setter method (as a string). */ - String generateSetter(String type, String name) + String generateSetter(String type, String name, String plainName) { return new StringBuilder() .append("public void ") @@ -471,7 +473,7 @@ public class MBeanCapabilityBuilder implements IArtifactBuilder{ .append(type) .append(" newValue) throws NoSuchAttributeFault,EntityInstanceNotFoundFault,QManFault {") .append(" setAttribute(\"") - .append(name) + .append(plainName) .append("\", newValue); }") .toString(); } diff --git a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManAdapterCapability.java b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManAdapterCapability.java index 511587c372..dfb526005f 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManAdapterCapability.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManAdapterCapability.java @@ -82,6 +82,7 @@ public class QManAdapterCapability extends AbstractCapability { EntityLifecycleNotification lifecycleNotification = (EntityLifecycleNotification) notification; eventSourceName = lifecycleNotification.getObjectName(); + ThreadSessionManager.getInstance().getSession().setObjectName(eventSourceName); LOGGER.debug(Messages.QMAN_200039_DEBUG_JMX_NOTIFICATION, notification); @@ -268,10 +269,49 @@ public class QManAdapterCapability extends AbstractCapability } } + /** + * Connects QMan with a broker with the given connection data. + * + * @param host the host where the broker is running. + * @param port the port number where the broker is running. + * @param username username for estabilshing connection. + * @param password password for estabilshing connection. + * @param virtualHost the virtualHost name. + * @param initialPoolCapacity the initial size of broker connection pool. + * @param maxPoolCapacity the max allowed size of broker connection pool. + * @param maxWaitTimeout the max wait timeout for retrieving connections. + * @throws SoapFault when the connection with broker cannot be estabilished. + */ @SuppressWarnings("unchecked") - public void connect(String host, int port, String username, String password, String virtualHost) throws SoapFault + public void connect( + String host, + int port, + String username, + String password, + String virtualHost, + int initialPoolCapacity, + int maxPoolCapacity, + long maxWaitTimeout) throws SoapFault { - + try + { + _mxServer.invoke( + Names.QMAN_OBJECT_NAME, + "addBroker", + new Object[]{host,port,username,password,virtualHost,initialPoolCapacity,maxPoolCapacity,maxWaitTimeout}, + new String[]{ + String.class.getName(), + int.class.getName(), + String.class.getName(), + String.class.getName(), + String.class.getName(), + int.class.getName(), + int.class.getName(), + long.class.getName()}); + } catch(Exception exception) + { + throw new SoapFault(exception); + } } /** diff --git a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManMessageHandler.java b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManMessageHandler.java index 150a7d1905..9c37acbabb 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManMessageHandler.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/QManMessageHandler.java @@ -60,6 +60,7 @@ public class QManMessageHandler extends ReflectionMessageHandler * * @throws SoapFaul when unmarshal operation fails. */ + @SuppressWarnings("unchecked") public Object[] fromXML(Element xml) throws SoapFault { Method method = getMethod(); diff --git a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/WsdlBuilder.java b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/WsdlBuilder.java index bc0e4da4fd..bce0e30e62 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/WsdlBuilder.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/capabilities/WsdlBuilder.java @@ -22,8 +22,6 @@ package org.apache.qpid.management.wsdm.capabilities; import java.net.InetAddress; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; import java.util.Map; import javax.management.MBeanAttributeInfo; @@ -111,6 +109,7 @@ class WsdlBuilder implements IArtifactBuilder { private final static QName XSD_COMPLEX_TYPE_QNAME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI,"complexType","xsd"); private final static QName XSD_SEQUENCE_QNAME = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI,"sequence","xsd"); + @SuppressWarnings("unchecked") private Element defineSchemaFor(String type, String attributeName) throws Exception { if (type.equals("java.util.Map")) diff --git a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/engine/WSDMAdapterEnvironment.java b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/engine/WSDMAdapterEnvironment.java index eb72bfc744..a5d12a55f9 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/engine/WSDMAdapterEnvironment.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/engine/WSDMAdapterEnvironment.java @@ -1,9 +1,7 @@ package org.apache.qpid.management.wsdm.muse.engine; import java.io.File; -import java.net.InetAddress; import java.net.URI; -import java.net.UnknownHostException; import javax.servlet.ServletContext; diff --git a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/resources/QManWsResource.java b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/resources/QManWsResource.java index 78c3aea558..e2091a3337 100644 --- a/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/resources/QManWsResource.java +++ b/java/management/client/src/main/java/org/apache/qpid/management/wsdm/muse/resources/QManWsResource.java @@ -229,7 +229,7 @@ public class QManWsResource implements WsResource initializeCapabilities(); _properties.applyMetadata(); - _properties.validateMetadata(); +// _properties.validateMetadata(); // Resource intialization completed : Let's make a state change. _currentState = _hasBeenInitialized; diff --git a/java/management/client/src/main/java/wsdl/QManAdapter.wsdl b/java/management/client/src/main/java/wsdl/QManAdapter.wsdl index a0ab85c321..21414c53d9 100644 --- a/java/management/client/src/main/java/wsdl/QManAdapter.wsdl +++ b/java/management/client/src/main/java/wsdl/QManAdapter.wsdl @@ -91,6 +91,9 @@ + + + diff --git a/java/management/client/src/test/java/log4j.xml b/java/management/client/src/test/java/log4j.xml index da47cadb80..6624f23aa1 100644 --- a/java/management/client/src/test/java/log4j.xml +++ b/java/management/client/src/test/java/log4j.xml @@ -11,9 +11,13 @@ value="%d{ABSOLUTE} %-5p [%c{1}] %m%n" /> + + + + - - + + diff --git a/java/management/client/src/test/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilderTest.java b/java/management/client/src/test/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilderTest.java index ead6bea6cc..407f903f80 100644 --- a/java/management/client/src/test/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilderTest.java +++ b/java/management/client/src/test/java/org/apache/qpid/management/wsdm/capabilities/MBeanCapabilityBuilderTest.java @@ -103,7 +103,7 @@ public class MBeanCapabilityBuilderTest extends TestCase name+ "\"); }"; - String result = _builder.generateGetter(type, name); + String result = _builder.generateGetter(type, name,name); assertEquals(expected,result); } @@ -121,7 +121,7 @@ public class MBeanCapabilityBuilderTest extends TestCase name+ "\", newValue); }"; - String result = _builder.generateSetter(type, name); + String result = _builder.generateSetter(type, name,name); assertEquals(expected,result); } -- cgit v1.2.1