From: <bsc...@us...> - 2012-05-24 07:13:25
|
Revision: 13473 http://unicore.svn.sourceforge.net/unicore/?rev=13473&view=rev Author: bschuller Date: 2012-05-24 07:13:10 +0000 (Thu, 24 May 2012) Log Message: ----------- cxf version of wsrfclient module Added Paths: ----------- wsrflite/trunk/use-cxfclient/ wsrflite/trunk/use-cxfclient/pom.xml wsrflite/trunk/use-cxfclient/src/ wsrflite/trunk/use-cxfclient/src/main/ wsrflite/trunk/use-cxfclient/src/main/java/ wsrflite/trunk/use-cxfclient/src/main/java/de/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapabilities.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapability.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/WSRFConstants.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/ClientException.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/WSRFClientFactory.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/AdminService.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/BaseFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceLifetime.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceProperties.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSResource.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSUtilities.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/AdminServiceClient.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/BaseWSRFClient.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/Consumer.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/ExternalRegistryClient.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/IRegistryQuery.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/MultiInvocationHandler.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/MultiWSRFClient.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/NotificationClient.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/RegistryClient.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/Resources.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/package.html wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/InvalidResourcePropertyQNameFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/ResourceNotDestroyedFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/ResourceUnavailableFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/ResourceUnknownFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/TerminationTimeChangeRejectedFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/exceptions/UnableToSetTerminationTimeFault.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/sg/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/sg/ServiceGroup.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/sg/ServiceGroupEntry.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/sg/ServiceGroupRegistration.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/Event.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/EventPoster.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/ISubscription.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/NotificationConsumer.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/NotificationProducer.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/Topic.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/WSNConstants.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/WSNTopicExpression.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/WSRFNotificationProducer.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/ConcreteWSNTopicExpression.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/Filters.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/SimpleTopic.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/SimpleWSNTopicExpression.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/WSNTopicExpressionBuilder.java wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/wsn/util/WSNTopicExpressionType.java wsrflite/trunk/use-cxfclient/src/main/resources/ wsrflite/trunk/use-cxfclient/src/main/resources/META-INF/ wsrflite/trunk/use-cxfclient/src/main/resources/META-INF/jax-ws-catalog.xml wsrflite/trunk/use-cxfclient/src/test/ wsrflite/trunk/use-cxfclient/src/test/java/ wsrflite/trunk/use-cxfclient/src/test/java/de/ wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/ wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/ wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/ wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/SimpleWSRFTest.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/TestBaseWSRFClient.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/TestWSUtilities.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/ wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/AbstractTestBase.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/JettyServer.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/MockSecurityConfig.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/MockServiceImpl.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/SimpleService.java wsrflite/trunk/use-cxfclient/src/test/java/de/fzj/unicore/wsrflite/testutils/SimpleServiceImpl.java wsrflite/trunk/use-cxfclient/src/test/resources/ wsrflite/trunk/use-cxfclient/src/test/resources/client/ wsrflite/trunk/use-cxfclient/src/test/resources/client/client.jks wsrflite/trunk/use-cxfclient/src/test/resources/conf/ wsrflite/trunk/use-cxfclient/src/test/resources/conf/server.jks wsrflite/trunk/use-cxfclient/src/test/resources/log4j.properties Added: wsrflite/trunk/use-cxfclient/pom.xml =================================================================== --- wsrflite/trunk/use-cxfclient/pom.xml (rev 0) +++ wsrflite/trunk/use-cxfclient/pom.xml 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>eu.unicore.services</groupId> + <artifactId>use-cxfclient</artifactId> + <version>2.2.0-SNAPSHOT</version> + <parent> + <groupId>eu.unicore.services</groupId> + <artifactId>use</artifactId> + <version>2.2.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <name>UNICORE Services Environment WS(RF) client side</name> + + <repositories> + <repository> + <id>unicore.eu</id> + <name>UNICORE repository</name> + <url>http://unicore-dev.zam.kfa-juelich.de/maven</url> + </repository> + </repositories> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-sslengine</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>servlet-api-2.5</artifactId> + <version>6.1.14</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>eu.unicore.services</groupId> + <artifactId>use-wsrftypes</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.xmlbeans</groupId> + <artifactId>xmlbeans-xpath</artifactId> + </dependency> + <dependency> + <groupId>net.sf.saxon</groupId> + <artifactId>saxon</artifactId> + </dependency> + <dependency> + <groupId>net.sf.saxon</groupId> + <artifactId>saxon-dom</artifactId> + </dependency> + <dependency> + <groupId>net.sf.saxon</groupId> + <artifactId>saxon-xpath</artifactId> + </dependency> + <dependency> + <groupId>eu.unicore.security</groupId> + <artifactId>secutils-cxf</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + </dependencies> + +</project> Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapabilities.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapabilities.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapabilities.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,18 @@ +package de.fzj.unicore.wsrflite; + +/** + * the ClientCapabilities interface is used to automatically load extensions + * using the Java service provider interface approach.<br/> + * + * a ClientCapabilities implementation provides a wrapper around a set of {@link ClientCapability} instances + * + * @author schuller + */ +public interface ClientCapabilities { + + /** + * returns the client capabilities + */ + public ClientCapability[] getClientCapabilities(); + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapability.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapability.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/ClientCapability.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,23 @@ +package de.fzj.unicore.wsrflite; + + +/** + * a Capability provides information about a concrete implementation of + * some abstract interface + * + * @author schuller + */ +public interface ClientCapability { + + /** + * the service interface implemented by the capability + */ + public Class<?> getInterface(); + + /** + * the implementation + * @return + */ + public Class<?> getImplementation(); + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/WSRFConstants.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/WSRFConstants.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/WSRFConstants.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,201 @@ +package de.fzj.unicore.wsrflite; + +import javax.xml.namespace.QName; + +/** + * common constants, such as namespaces, porttypes and SOAP actions + */ +public interface WSRFConstants { + + + public final String WSA_200508 = "http://www.w3.org/2005/08/addressing"; + + //TODO add the w3c recommendation + //String wsa200604 = "http://www.w3.org/2006/04/addressing"; + + @Deprecated + public final static QName FLE_RESOURCE_DISAMBIGUATOR= + new QName("http://com.fujitsu.arcon.addressing", + "ResourceDisambiguator"); + + public final static QName U6_RESOURCE_ID= + new QName("http://www.unicore.eu/unicore6", + "ResourceId"); + + + public final static QName EPR_METADATA= + new QName("http://www.w3.org/2005/08/addressing", + "Metadata"); + + public final static QName INTERFACE_NAME= + new QName("http://www.w3.org/2005/08/addressing/metadata", + "InterfaceName"); + + /** + * QName of the EPR metadata field holding the server DN + */ + public final static QName SERVER_NAME= + new QName("http://www.unicore.eu/unicore6", + "ServerIdentity"); + + /** + * QName of the EPR metadata field holding the "friendly name" of the EPR + */ + public final static QName FRIENDLY_NAME= + new QName("http://www.unicore.eu/unicore6", + "FriendlyName"); + + public static QName[] supported=new QName[]{ + + + U6_RESOURCE_ID, + new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", + "Security"), + //the next one is for backwards compatibility with older clients + FLE_RESOURCE_DISAMBIGUATOR, + }; + + /** + * the base WS-RL (wsdl) namespace supported by this implementation + */ + public static final String WSRL_BASENS = "http://docs.oasis-open.org/wsrf/rlw-2"; + + /** + * the wsa:Action for ImmediateResourceTermination + */ + public static final String WSRL_DESTROY = WSRL_BASENS + + "/ImmediateResourceTermination/DestroyRequest"; + + /** + * the WSDL porttype for ImmediateResourceTermination + */ + public static final QName WSRL_DESTROY_PORT = new QName(WSRL_BASENS,"ImmediateResourceTermination"); + + /** + * the wsa:Action for ScheduledResourceTermination + */ + public static final String WSRL_SCHEDULED = WSRL_BASENS + + "/ScheduledResourceTermination/SetTerminationTimeRequest"; + + /** + * the WSDL porttype for ImmediateResourceTermination + */ + public static final QName WSRL_SET_TERMTIME_PORT = new QName (WSRL_BASENS,"ScheduledResourceTermination"); + + /** + * the base WS-RP (wsdl) namespace supported by this implementation + */ + public static final String WSRP_BASENS="http://docs.oasis-open.org/wsrf/rpw-2"; + + /** + * Query RP dialect + */ + public static final String QUERY_EXPRESSION_DIALECT_XPATH= + "http://www.w3.org/TR/1999/REC-xpath-19991116"; + + /** + * the wsa:Action for GetResourcePropertyDocument + */ + public static final String WSRP_GET_RP_DOCUMENT=WSRP_BASENS+"/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest"; + + /** + * the WSDL porttype for GetResourcePropertyDocument + */ + public static final QName WSRP_GET_RP_DOCUMENT_PORT=new QName(WSRP_BASENS,"GetResourcePropertyDocument"); + + /** + * the wsa:Action for GetResourceProperty + */ + public static final String WSRP_GET_RP=WSRP_BASENS+"/GetResourceProperty/GetResourcePropertyRequest"; + + /** + * the porttype for GetResourceProperty + */ + public static final QName WSRP_GET_RP_PORT=new QName(WSRP_BASENS,"GetResourceProperty"); + + /** + * the wsa:Action for GetMultipleResourceProperties + */ + public static final String WSRP_GET_MULTIPLE_RP=WSRP_BASENS+"/GetMultipleResourceProperties/GetMultipleResourcePropertiesRequest"; + + /** + * the porttype for GetMultipleResourceProperties + */ + public static final QName WSRP_GET_MULTIPLE_RP_PORT=new QName(WSRP_BASENS,"GetMultipleResourceProperties"); + + /** + * the wsa:Action for QueryResourceProperties + */ + public static final String WSRP_QUERY_RP=WSRP_BASENS+"/QueryResourceProperties/QueryResourcePropertiesRequest"; + + /** + * the porttype for QueryResourceProperties + */ + public static final QName WSRP_QUERY_RP_PORT=new QName(WSRP_BASENS,"QueryResourceProperties"); + + /** + * the QueryExpressionDialect ResourceProperty + */ + public static final QName WSRP_RP_QueryExpressionDialect=new QName(WSRP_BASENS,"QueryExpressionDialect"); + + /** + * the wsa:Action for PutResourcePropertyDocument + */ + public static final String WSRP_PUT_RP_DOCUMENT=WSRP_BASENS+"/PutResourcePropertyDocument/PutResourcePropertyDocumentRequest"; + /** + * the porttype for PutResourcePropertyDocument + */ + public static final QName WSRP_PUT_RP_DOCUMENT_PORT=new QName(WSRP_BASENS,"PutResourcePropertyDocument"); + + /** + * the wsa:Action for InsertResourceProperties + */ + public static final String WSRP_SET_RP=WSRP_BASENS+"/SetResourceProperties/SetResourcePropertiesRequest"; + + /** + * the porttype for InsertResourceProperties + */ + public static final QName WSRP_SET_RP_PORT=new QName(WSRP_BASENS+"SetResourceProperties"); + + /** + * the wsa:Action for InsertResourceProperties + */ + public static final String WSRP_INSERT_RP=WSRP_BASENS+"/InsertResourceProperties/InsertResourcePropertiesRequest"; + + /** + * the porttype for InsertResourceProperties + */ + public static final QName WSRP_INSERT_RP_PORT=new QName(WSRP_BASENS,"InsertResourceProperties"); + + /** + * the wsa:Action for UpdateResourceProperties + */ + public static final String WSRP_UPDATE_RP=WSRP_BASENS+"/UpdateResourceProperties/UpdateResourcePropertiesRequest"; + + /** + * the porttype for UpdateResourceProperties + */ + public static final QName WSRP_UPDATE_RP_PORT=new QName(WSRP_BASENS,"UpdateResourceProperties"); + + /** + * the wsa:Action for DeleteResourceProperties + */ + public static final String WSRP_DELETE_RP=WSRP_BASENS+"/DeleteResourceProperties/DeleteResourcePropertiesRequest"; + + /** + * the porttype for DeleteResourceProperties + */ + public static final QName WSRP_DELETE_RP_PORT=new QName(WSRP_BASENS,"DeleteResourceProperties"); + + /** + * the QName of the "termination time" resource property + */ + public static final QName RPterminationTimeQName = + new QName("http://docs.oasis-open.org/wsrf/rl-2","TerminationTime"); + + /** + * the QName of the "current time" resource property + */ + public static final QName RPcurrentTimeQName = + new QName("http://docs.oasis-open.org/wsrf/rl-2","CurrentTime"); +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/ClientException.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/ClientException.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/ClientException.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,30 @@ +package de.fzj.unicore.wsrflite.xfire; + +/** + * thrown on errors related to web service invocations, where the client + * is the source of the fault. + * + * @author schuller + * @since 1.8.11 + */ +public class ClientException extends Exception{ + + private static final long serialVersionUID=1L; + + public ClientException() { + super(); + } + + public ClientException(String message, Throwable cause) { + super(message, cause); + } + + public ClientException(String message) { + super(message); + } + + public ClientException(Throwable cause) { + super(cause); + } + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/WSRFClientFactory.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/WSRFClientFactory.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xfire/WSRFClientFactory.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,95 @@ +/********************************************************************************* + * Copyright (c) 2006-2012 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + +package de.fzj.unicore.wsrflite.xfire; + +import java.util.List; + +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.interceptor.Interceptor; +import org.apache.cxf.message.Message; +import org.apache.cxf.ws.addressing.MAPAggregator; +import org.apache.cxf.ws.addressing.soap.MAPCodec; +import org.w3.x2005.x08.addressing.EndpointReferenceType; + +import eu.unicore.security.util.client.IClientConfiguration; +import eu.unicore.security.xfireutil.client.UnicoreXFireClientFactory; + +/** + * Extends {@link eu.unicore.security.xfireutil.client.UnicoreXFireClientFactory} + * with support for creation of WS-Addressing aware WSRF client proxies. + * + * @author schuller + * @author golbi + */ +public class WSRFClientFactory extends UnicoreXFireClientFactory { + + public WSRFClientFactory() { + super(); + } + + public WSRFClientFactory(IClientConfiguration sec){ + super(sec); + } + + public IClientConfiguration getSecurityConfiguration(){ + return security; + } + + /** + * Create a proxy for the service at the given EPR<br/> + * + * @see de.fzj.unicore.wsrflite.xmlbeans.client.BaseWSRFClient + * + * @param iFace Interface class + * @param url The url to contact + * @param wsaEPR The EPR of the Service + * @param securityProperties + * @return + */ + public synchronized <T> T createProxy(Class<T> iFace, String url, + EndpointReferenceType wsaEPR) throws Exception { + + T proxy=super.createPlainWSProxy(iFace, url); + + Client xfireClient = getXfireClient(proxy); + List<Interceptor<? extends Message>> l=xfireClient.getOutInterceptors(); + + l.add(new MAPCodec()); + l.add(new MAPAggregator()); + + //l.add(new MTOMOutHandler()); + //xfireClient.getInInterceptors().add(new MTOMInHandler()); + + return proxy; + } +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/AdminService.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/AdminService.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/AdminService.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,97 @@ +/********************************************************************************* + * Copyright (c) 2008-2011 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + + +package de.fzj.unicore.wsrflite.xmlbeans; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.xml.namespace.QName; + + +/** + * Default remote administration facade for WSRFLite.<br> + * It offers + * <li>dynamic (un-)deployment of Web Services + * <li>retrieval of service and container metrics + * + * @author j.d...@fz... + */ +@WebService(targetNamespace="http://www.fz-juelich.de/unicore/wsrflite/adminservice",portName = AdminService.SERVICE_NAME) +public interface AdminService extends WSResource { + + public static final QName RPAdminServiceQName=new QName("http://www.fz-juelich.de/unicore/wsrflite","AdminServiceProperties"); + + public static final QName RPServicesInfoQName=new QName("http://www.fz-juelich.de/unicore/wsrflite","ServicesInfo"); + + public static final QName RPServiceEntryQName=ServiceEntryDocument.type.getDocumentElementName(); + + public static final QName RPMonitorEntryQName=MetricValueDocument.type.getDocumentElementName(); + + public static final QName RPMetricCategoryQName=MetricCategoryDocument.type.getDocumentElementName(); + + public static final QName RPAvailableActionsQName=AvailableAdminActionDocument.type.getDocumentElementName(); + + public static final String SERVICE_NAME="AdminService"; + + public static final String SINGLETON_ID = "default_admin"; + + public static final String ADMINSERVICE_NS="http://www.fz-juelich.de/unicore/wsrflite/adminservice"; + + public static final QName ADMINSERVICE_PORT=new QName(ADMINSERVICE_NS,SERVICE_NAME); + + /** Deploys the specified Web Service */ + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/DeployServiceRequest") + public void deployService(DeployServiceRequestDocument req) throws BaseFault; + + /** Undeploys the specified Web Service */ + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/UndeployServiceRequest") + public void undeployService(UndeployServiceRequestDocument req) throws BaseFault; + + /** Retrieves a list of all WS-Resource UIDs for the specified WSRF Web Service */ + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/GetServiceInstancesRequest") + public GetServiceInstancesResponseDocument getServiceInstances(GetServiceInstancesRequestDocument req) throws BaseFault; + + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/GetMetrics") + public GetMetricsResponseDocument getMetrics(GetMetricsRequestDocument req) throws BaseFault; + + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/GetMetric") + public GetMetricResponseDocument getMetric(GetMetricRequestDocument req)throws BaseFault; + + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/ClearMetricData") + public ClearMetricDataResponseDocument clearMetricData(ClearMetricDataRequestDocument req)throws BaseFault; + + @WebMethod(action = "http://www.fz-juelich.de/unicore/wsrflite/InvokeAdminAction") + AdminActionResponseDocument invokeAdminAction(AdminActionRequestDocument req)throws BaseFault; + + +} \ No newline at end of file Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/BaseFault.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/BaseFault.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/BaseFault.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,122 @@ +/********************************************************************************* + * Copyright (c) 2006-2012 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + + +package de.fzj.unicore.wsrflite.xmlbeans; + +import java.util.Calendar; + +import javax.xml.namespace.QName; + +import org.apache.cxf.frontend.FaultInfoException; +import org.oasisOpen.docs.wsrf.bf2.BaseFaultDocument; +import org.oasisOpen.docs.wsrf.bf2.BaseFaultType; + +/** + * represents a WSRF BaseFault.<br> + * + * @author schuller + */ +public class BaseFault extends FaultInfoException{ + + protected static final long serialVersionUID=1L; + + private BaseFaultType faultDetail; + + public BaseFault(String message, Throwable cause, BaseFaultType details){ + super(message,cause); + this.faultDetail=details; + } + + //this one seems to be required by Xfire?! + public BaseFault(String message, BaseFaultType details){ + super(message); + this.faultDetail=details; + } + + public BaseFault(String message){ + super(message); + } + + public BaseFaultType getFaultInfo() { + return faultDetail; + } + + public static QName getFaultName() { + return BaseFaultDocument.type.getDocumentElementName(); + } + + /** + * helper for creating a BaseFault including the mandatory timestamp + * @param fault message + */ + public static BaseFault createFault(String message){ + return createFault(message, null, false); + } + + /** + * helper for creating a BaseFault including the mandatory timestamp + * @param the fault message + * @param the cause + */ + public static BaseFault createFault(String message, Throwable cause){ + return createFault(message, cause, false); + } + + /** + * Helper for creating a BaseFault including the mandatory timestamp. + * This version allows for controlling whether a detailed message should be created + * using the message contained in the cause of the fault. + * @param message the fault message + * @param cause the cause + * @param addDetails whether to use cause parameter to get additional information + */ + public static BaseFault createFault(String message, Throwable cause, boolean addDetails) { + BaseFaultType bft=BaseFaultType.Factory.newInstance(); + bft.setTimestamp(Calendar.getInstance()); + StringBuilder finalMsg = new StringBuilder(); + finalMsg.append(message); + if (addDetails) { + if (cause != null && cause.getMessage() != null) { + finalMsg.append(" Reason: "); + finalMsg.append(cause.getMessage()); + } else if (cause != null) { + finalMsg.append(" Reason: "); + finalMsg.append(cause.toString()); + } + } + bft.addNewDescription().setStringValue(finalMsg.toString()); + return cause == null ? new BaseFault(finalMsg.toString(), bft) : + new BaseFault(finalMsg.toString(), cause, bft); + } + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceLifetime.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceLifetime.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceLifetime.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,79 @@ +/********************************************************************************* + * Copyright (c) 2006 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + +package de.fzj.unicore.wsrflite.xmlbeans; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; + +import org.oasisOpen.docs.wsrf.rl2.DestroyDocument; +import org.oasisOpen.docs.wsrf.rl2.DestroyResponseDocument; +import org.oasisOpen.docs.wsrf.rl2.SetTerminationTimeDocument; +import org.oasisOpen.docs.wsrf.rl2.SetTerminationTimeResponseDocument; + +import de.fzj.unicore.wsrflite.WSRFConstants; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.ResourceNotDestroyedFault; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.ResourceUnavailableFault; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.ResourceUnknownFault; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.TerminationTimeChangeRejectedFault; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.UnableToSetTerminationTimeFault; +import eu.unicore.security.xfireutil.RequiresSignature; + +/** + * ResourceLifetime interface + * (XMLBeans binding) + */ + +@WebService + +@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, + use=SOAPBinding.Use.LITERAL, + parameterStyle=SOAPBinding.ParameterStyle.BARE) + +public interface ResourceLifetime extends WSRFConstants { + + @RequiresSignature + @WebMethod(action = WSRL_DESTROY) + public DestroyResponseDocument Destroy(DestroyDocument in) + throws ResourceNotDestroyedFault, ResourceUnknownFault, + ResourceUnavailableFault; + + @RequiresSignature + @WebMethod(action = WSRL_SCHEDULED) + public SetTerminationTimeResponseDocument SetTerminationTime( + SetTerminationTimeDocument in) + throws UnableToSetTerminationTimeFault, + TerminationTimeChangeRejectedFault, ResourceUnknownFault, + ResourceUnavailableFault; + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceProperties.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceProperties.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/ResourceProperties.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,163 @@ +/********************************************************************************* + * Copyright (c) 2006 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + + +package de.fzj.unicore.wsrflite.xmlbeans; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.xml.namespace.QName; + +import org.oasisOpen.docs.wsrf.rp2.DeleteResourcePropertiesDocument; +import org.oasisOpen.docs.wsrf.rp2.DeleteResourcePropertiesResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.GetMultipleResourcePropertiesDocument; +import org.oasisOpen.docs.wsrf.rp2.GetMultipleResourcePropertiesResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.GetResourcePropertyDocument; +import org.oasisOpen.docs.wsrf.rp2.GetResourcePropertyDocumentDocument1; +import org.oasisOpen.docs.wsrf.rp2.GetResourcePropertyDocumentResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.GetResourcePropertyResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.InsertResourcePropertiesDocument; +import org.oasisOpen.docs.wsrf.rp2.InsertResourcePropertiesResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.PutResourcePropertyDocumentDocument1; +import org.oasisOpen.docs.wsrf.rp2.PutResourcePropertyDocumentResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.QueryResourcePropertiesDocument; +import org.oasisOpen.docs.wsrf.rp2.QueryResourcePropertiesResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.SetResourcePropertiesDocument; +import org.oasisOpen.docs.wsrf.rp2.SetResourcePropertiesResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.UpdateResourcePropertiesDocument; +import org.oasisOpen.docs.wsrf.rp2.UpdateResourcePropertiesResponseDocument; + +import de.fzj.unicore.wsrflite.WSRFConstants; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.InvalidResourcePropertyQNameFault; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.ResourceUnavailableFault; +import de.fzj.unicore.wsrflite.xmlbeans.exceptions.ResourceUnknownFault; + +/** + * ResourceProperties interface + */ + +@WebService + +@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, + use=SOAPBinding.Use.LITERAL, + parameterStyle=SOAPBinding.ParameterStyle.BARE) + +public interface ResourceProperties extends WSRFConstants { + + /** + * the wsa:Action for GetResourcePropertyDocument + */ + public static final String WSRP_GET_RP_DOCUMENT=WSRP_BASENS+"/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest"; + + /** + * the wsa:Action for GetResourceProperty + */ + public static final String WSRP_GET_RP=WSRP_BASENS+"/GetResourceProperty/GetResourcePropertyRequest"; + + /** + * the wsa:Action for GetMultipleResourceProperties + */ + public static final String WSRP_GET_MULTIPLE_RP=WSRP_BASENS+"/GetMultipleResourceProperties/GetMultipleResourcePropertiesRequest"; + + /** + * the wsa:Action for QueryResourceProperties + */ + public static final String WSRP_QUERY_RP=WSRP_BASENS+"/QueryResourceProperties/QueryResourcePropertiesRequest"; + + /** + * the QueryExpressionDialect ResourceProperty + */ + public static final QName WSRP_RP_QueryExpressionDialect=new QName(WSRP_BASENS,"QueryExpressionDialect"); + + /** + * the wsa:Action for PutResourcePropertyDocument + */ + public static final String WSRP_PUT_RP_DOCUMENT=WSRP_BASENS+"/PutResourcePropertyDocument/PutResourcePropertyDocumentRequest"; + + /** + * the wsa:Action for InsertResourceProperties + */ + public static final String WSRP_SET_RP=WSRP_BASENS+"/SetResourceProperties/SetResourcePropertiesRequest"; + + /** + * the wsa:Action for InsertResourceProperties + */ + public static final String WSRP_INSERT_RP=WSRP_BASENS+"/InsertResourceProperties/InsertResourcePropertiesRequest"; + + /** + * the wsa:Action for UpdateResourceProperties + */ + public static final String WSRP_UPDATE_RP=WSRP_BASENS+"/UpdateResourceProperties/UpdateResourcePropertiesRequest"; + + /** + * the wsa:Action for DeleteResourceProperties + */ + public static final String WSRP_DELETE_RP=WSRP_BASENS+"/DeleteResourceProperties/DeleteResourcePropertiesRequest"; + + @WebMethod(action=WSRP_DELETE_RP) + public DeleteResourcePropertiesResponseDocument DeleteResourceProperties(DeleteResourcePropertiesDocument in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + + @WebMethod(action=WSRP_PUT_RP_DOCUMENT) + public PutResourcePropertyDocumentResponseDocument PutResourcePropertyDocument(PutResourcePropertyDocumentDocument1 in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + + @WebMethod(action=WSRP_INSERT_RP) + public InsertResourcePropertiesResponseDocument InsertResourceProperties(InsertResourcePropertiesDocument in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + + @WebMethod(action=WSRP_GET_RP_DOCUMENT) + public GetResourcePropertyDocumentResponseDocument GetResourcePropertyDocument(GetResourcePropertyDocumentDocument1 in) + throws BaseFault,ResourceUnknownFault, ResourceUnavailableFault; + + @WebMethod(action=WSRP_UPDATE_RP) + public UpdateResourcePropertiesResponseDocument UpdateResourceProperties(UpdateResourcePropertiesDocument in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + + @WebMethod(action=WSRP_GET_RP) + public GetResourcePropertyResponseDocument GetResourceProperty(GetResourcePropertyDocument in) + throws BaseFault,ResourceUnknownFault, ResourceUnavailableFault,InvalidResourcePropertyQNameFault; + + @WebMethod(action=WSRP_GET_MULTIPLE_RP) + public GetMultipleResourcePropertiesResponseDocument GetMultipleResourceProperties(GetMultipleResourcePropertiesDocument in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + + @WebMethod(action=WSRP_QUERY_RP) + public QueryResourcePropertiesResponseDocument QueryResourceProperties(QueryResourcePropertiesDocument in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + + @WebMethod(action=WSRP_SET_RP) + public SetResourcePropertiesResponseDocument SetResourceProperties(SetResourcePropertiesDocument in) + throws ResourceUnknownFault, ResourceUnavailableFault, BaseFault; + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSResource.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSResource.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSResource.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,54 @@ +/********************************************************************************* + * Copyright (c) 2006 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + + +package de.fzj.unicore.wsrflite.xmlbeans; + +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; + + +/** + * a WS Resource + * (XmlBeans binding) + */ + +@WebService + +@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, + use=SOAPBinding.Use.LITERAL, + parameterStyle=SOAPBinding.ParameterStyle.BARE) + +public interface WSResource extends + ResourceLifetime, ResourceProperties{ + +} Added: wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSUtilities.java =================================================================== --- wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSUtilities.java (rev 0) +++ wsrflite/trunk/use-cxfclient/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/WSUtilities.java 2012-05-24 07:13:10 UTC (rev 13473) @@ -0,0 +1,637 @@ +/********************************************************************************* + * Copyright (c) 2006 Forschungszentrum Juelich GmbH + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * (1) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the disclaimer at the end. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * (2) Neither the name of Forschungszentrum Juelich GmbH nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ********************************************************************************/ + + +package de.fzj.unicore.wsrflite.xmlbeans; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import javax.security.auth.x500.X500Principal; +import javax.xml.namespace.QName; + +import org.apache.xmlbeans.SchemaType; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlCursor.TokenType; +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; +import org.oasisOpen.docs.wsrf.rp2.GetResourcePropertyDocumentResponseDocument; +import org.oasisOpen.docs.wsrf.rp2.GetResourcePropertyResponseDocument; +import org.w3.x2003.x05.soapEnvelope.Header; +import org.w3.x2005.x08.addressing.EndpointReferenceType; +import org.w3.x2005.x08.addressing.MetadataType; +import org.w3.x2005.x08.addressing.ReferenceParametersType; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import de.fzj.unicore.wsrflite.WSRFConstants; +import eu.emi.security.authn.x509.impl.X500NameUtils; + + +/** + * tools and utilities, mainly for working with endpoint references, soap headers, and WSRF + * related XML types + * + * @author schuller + * @author demuth + */ +public class WSUtilities { + + protected WSUtilities() { + } + + /** + * returns a new globally unique identifier + * @return + */ + public static String newUniqueID(){ + return UUID.randomUUID().toString(); + } + + /** + * helper: converts XmlBeans schematype to QName + * @param type + * @return QName + */ + public static QName toQName(SchemaType type){ + try{ + if(!type.isDocumentType())return null; + return type.getDocumentElementName(); + } + catch(Exception e){return null;} + } + + /** + * get the resourceproperty from a GetResourcePropertyResponse + * @param res + * @return + */ + public static XmlObject extractResourceProperty(GetResourcePropertyResponseDocument res)throws IOException, XmlException{ + XmlCursor c=res.getGetResourcePropertyResponse().newCursor(); + while(c.toNextToken()!=XmlCursor.TokenType.START){} + try{ + XmlObject o=XmlObject.Factory.parse(c.newInputStream()); + return o; + } + finally{ + try{ + c.dispose(); + }catch(Exception e){} + } + } + + public static XmlObject[] extractResourceProperty(GetResourcePropertyDocumentResponseDocument res, QName q){ + return res.selectChildren(q); + } + + + /** + * appends a XmlObject into another XML document, immediately before the end tag<br/> + * + * @param what + * @param toWhere + */ + public static void append(XmlObject what, XmlObject toWhere){ + XmlCursor sourceCurs=what.newCursor(); + sourceCurs.toNextToken(); + XmlCursor targetCurs = toWhere.newCursor(); + targetCurs.toEndDoc(); + targetCurs.toPrevToken(); + sourceCurs.copyXml(targetCurs); + sourceCurs.dispose(); + targetCurs.dispose(); + } + + public static void append(XmlObject[] what, XmlObject toWhere){ + XmlCursor targetCurs = toWhere.newCursor(); + targetCurs.toEndDoc(); + targetCurs.toPrevToken(); + for(XmlObject source: what){ + XmlCursor sourceCurs=source.newCursor(); + sourceCurs.toNextToken(); + sourceCurs.copyXml(targetCurs); + sourceCurs.dispose(); + } + targetCurs.dispose(); + } + + public static void insertAny(XmlObject what, XmlObject toWhere){ + XmlCursor sourceCurs=what.newCursor(); + sourceCurs.toNextToken(); + XmlCursor targetCurs = toWhere.newCursor(); + targetCurs.toNextToken(); + sourceCurs.copyXml(targetCurs); + sourceCurs.dispose(); + targetCurs.dispose(); + } + + /** + * retrieve Xml content by QName (careful, this will not + * return XML documents, but XML fragments. If you want documents + * use extractAnyElements() instead) + * + * @param source XmlObject + * @param q QName + * @return XmlObject array + */ + public static XmlObject[] extractAny(XmlObject source, QName q){ + return source.selectChildren(q); + } + + + /** + * extract all XML elements matching the given qname from an XML source + * document. + * + * @param source - the xml fragment + * @param q - QName of elements to extract + * @return XmlObject[] + */ + public static XmlObject[] extractAllMatchingElements(XmlObject source, QName q){ + List<XmlObject>results=new ArrayList<XmlObject>(); + XmlCursor cursor=source.newCursor(); + try{ + while(goToNextElement(cursor, q)){ + XmlObject o=XmlObject.Factory.parse(cursor.newReader()); + results.add(o); + } + }catch(Exception ioe){ + //ignored + }finally{ + cursor.dispose(); + } + return results.toArray(new XmlObject[results.size()]); + } + + + + public static XmlObject[] extractAllChildren(XmlObject xBean) { + List<XmlObject> results = new ArrayList<XmlObject>( ); + + XmlCursor cursor = xBean.newCursor(); + if(cursor.getName() == null) cursor.toFirstChild(); + try { + for ( boolean hasNext = cursor.toFirstChild( ); hasNext; hasNext = cursor.toNextSibling() ) + { + XmlObject next; + try { + next = XmlObject.Factory.parse(cursor.newXMLStreamReader()); + } catch (XmlException e) { + continue; + } + + results.add(next); + + } + } + finally + { + cursor.dispose( ); + } + return (XmlObject[]) results.toArray( new XmlObject[0] ); + } + + + + /** + * extracts XML elements of the given qname + * @param source - the source XML + * @param q - the qname + * @return an non-null array. If no elements of the required name exist, the list will be empty + */ + public static XmlObject[] extractAnyElements(XmlObject source, QName q){ + List<XmlObject>results=new ArrayList<XmlObject>(); + XmlCursor cursor=null; + try{ + if(source != null){ + cursor = source.newCursor(); + boolean hasMore = skipToElement(cursor, q); + while(hasMore){ + XmlObject next = XmlObject.Factory.parse(cursor.newXMLStreamReader()); + QName name = cursor.getName(); + if(q.getNamespaceURI().equals(name.getNamespaceURI()) + && q.getLocalPart().equals(name.getLocalPart())){ + results.add(next); + + } + hasMore = cursor.toNextSibling(q); + } + } + } + catch(XmlException xe){ + //what? + } + finally{ + if(cursor!=null)cursor.dispose(); + } + return results.toArray(new XmlObject[results.size()]); + } + /** + * extract an array of XML elements identified by their qname from an XML source + * document. + * + * @param source - the xml fragment + * @param q - QName of elements to extract + * @param asClass - the XMLbeans class of the elements to extract + * @return List<T> - a list of XMLBeans objects with the correct runtime type + */ + @SuppressWarnings("unchecked") + public static <T> List<T>extractAnyElements(XmlObject source, QName q, Class<? extends XmlObject>asClass){ + List<T>results=new ArrayList<T>(); + XmlCursor cursor=null; + try{ + if(source != null){ + cursor = source.newCursor(); + skipToElement(cursor, q); + boolean hasMore =true; + while(hasMore){ + XmlObject next = XmlObject.Factory.parse(cursor.newXMLStreamReader()); + QName name = cursor.getName(); + if(q.getNamespaceURI().equals(name.getNamespaceURI()) + && q.getLocalPart().equals(name.getLocalPart())){ + results.add((T)next); + } + hasMore = cursor.toNextSibling(q); + } + } + } + catch(XmlException xe){ + //what? + } + finally{ + if(cursor!=null)cursor.dispose(); + } + return results; + } + + /** + * for an element containing an xsd:any element, find the Qname of the xsd:any + * + * @param o + * @return + */ + public static QName findAnyElementQName(XmlObject o){ + NodeList nodes=o.getDomNode().getChildNodes(); + if(nodes.getLength()>0){ + Node n=nodes.item(0); + return new QName(n.getNamespaceURI(),n.getLocalName()); + } + return null; + } + + /** + * extract the text content of an XML element + * + * @param source the xml element + * + * @return the text content, or "" if element has no content + */ + public static String extractElementTextAsString(XmlObject source){ + XmlCursor c=null; + try{ + c=source.newCursor(); + while(c.hasNextToken()){ + if(c.toNextToken().equals(TokenType.TEXT)){ + return c.getChars(); + } + } + return ""; + }finally{ + try{ + c.dispose(); + }catch(Exception e){} + } + } + + /** + * fast-forward the cursor up to the element with the given QName + * + * @param cursor + * @param name + * @return false if element does not exist + */ + public static boolean skipToElement(XmlCursor cursor, QName name){ + // walk through element tree in prefix order (root first, then children from left to right) + if(name.equals(cursor.getName())) return true; + boolean hasMoreChildren=true; + int i=0; + while(hasMoreChildren){ + hasMoreChildren = cursor.toChild(i++); + ... [truncated message content] |