From: <bsc...@us...> - 2007-07-08 12:34:13
|
Revision: 1291 http://svn.sourceforge.net/unicore/?rev=1291&view=rev Author: bschuller Date: 2007-07-08 05:34:12 -0700 (Sun, 08 Jul 2007) Log Message: ----------- initialise the proxies lazily, to allow proper re-configuration of security in subclasses Modified Paths: -------------- wsrflite/wsrfcore/trunk/pom.xml wsrflite/wsrfcore/trunk/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/BaseWSRFClient.java Modified: wsrflite/wsrfcore/trunk/pom.xml =================================================================== --- wsrflite/wsrfcore/trunk/pom.xml 2007-07-08 12:32:16 UTC (rev 1290) +++ wsrflite/wsrfcore/trunk/pom.xml 2007-07-08 12:34:12 UTC (rev 1291) @@ -4,7 +4,7 @@ <groupId>de.fzj.unicore.wsrflite</groupId> <artifactId>wsrflite</artifactId> <name>UNICORE Lightweight WSRF Environment</name> - <version>1.8.1-SNAPSHOT</version> + <version>1.8.2</version> <url>http://unicore.sourceforge.net/wsrflite</url> <scm> <connection>scm:svn:http://unicore.svn.sourceforge.net/svnroot/unicore/wsrflite/wsrfcore/trunk</connection> Modified: wsrflite/wsrfcore/trunk/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/BaseWSRFClient.java =================================================================== --- wsrflite/wsrfcore/trunk/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/BaseWSRFClient.java 2007-07-08 12:32:16 UTC (rev 1290) +++ wsrflite/wsrfcore/trunk/src/main/java/de/fzj/unicore/wsrflite/xmlbeans/client/BaseWSRFClient.java 2007-07-08 12:34:12 UTC (rev 1291) @@ -36,6 +36,7 @@ import java.util.Calendar; import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.namespace.QName; @@ -82,8 +83,8 @@ protected String url; protected ISecurityProperties securityProperties; protected XFireClientFactory proxyMaker; - protected ResourceLifetime lifetime; - protected ResourceProperties resourceProperties; + private ResourceLifetime lifetime; + private ResourceProperties resourceProperties; /** @@ -131,8 +132,7 @@ this.url=endpointUrl; this.securityProperties=sec; this.proxyMaker=clientFactory; - lifetime=makeProxy(ResourceLifetime.class); - resourceProperties=makeProxy(ResourceProperties.class); + } /** @@ -174,7 +174,7 @@ logger.fine("Calling service at wsaTo: "+epr.getAddress().getStringValue()); GetResourcePropertyDocument req=GetResourcePropertyDocument.Factory.newInstance(); req.setGetResourceProperty(rpQname); - GetResourcePropertyResponseDocument res=(GetResourcePropertyResponseDocument)resourceProperties.GetResourceProperty(req); + GetResourcePropertyResponseDocument res=(GetResourcePropertyResponseDocument)getRP().GetResourceProperty(req); return res.getGetResourcePropertyResponse().toString(); } @@ -185,7 +185,7 @@ logger.fine("Calling service at wsaTo: "+epr.getAddress().getStringValue()); DestroyDocument dd=DestroyDocument.Factory.newInstance(); dd.addNewDestroy(); - lifetime.Destroy(dd); + getLT().Destroy(dd); } /** @@ -199,7 +199,7 @@ logger.fine("Calling service at wsaTo: "+epr.getAddress().getStringValue()); SetTerminationTimeDocument req=SetTerminationTimeDocument.Factory.newInstance(); req.addNewSetTerminationTime().setRequestedTerminationTime(newTerminationTime); - return(lifetime.SetTerminationTime(req).getSetTerminationTimeResponse().getNewTerminationTime()); + return(getLT().SetTerminationTime(req).getSetTerminationTimeResponse().getNewTerminationTime()); } /** @@ -212,7 +212,7 @@ public synchronized Calendar getTerminationTime() throws Exception{ GetResourcePropertyDocument req=GetResourcePropertyDocument.Factory.newInstance(); req.setGetResourceProperty(WSResource.RPterminationTimeQName); - GetResourcePropertyResponseDocument res=(GetResourcePropertyResponseDocument)resourceProperties.GetResourceProperty(req); + GetResourcePropertyResponseDocument res=(GetResourcePropertyResponseDocument)getRP().GetResourceProperty(req); TerminationTimeDocument o=TerminationTimeDocument.Factory.parse(Utilities.extractResourceProperty(res).newInputStream()); if(o==null)return null; if(o.getTerminationTime().isNil())return null; @@ -229,7 +229,7 @@ public synchronized Calendar getCurrentTime() throws Exception{ GetResourcePropertyDocument req=GetResourcePropertyDocument.Factory.newInstance(); req.setGetResourceProperty(WSResource.RPcurrentTimeQName); - GetResourcePropertyResponseDocument res=(GetResourcePropertyResponseDocument)resourceProperties.GetResourceProperty(req); + GetResourcePropertyResponseDocument res=(GetResourcePropertyResponseDocument)getRP().GetResourceProperty(req); CurrentTimeDocument o=CurrentTimeDocument.Factory.parse(Utilities.extractResourceProperty(res).newInputStream()); if(o==null)return null; return o.getCurrentTime().getCalendarValue(); @@ -254,7 +254,7 @@ logger.fine("Calling service at wsaTo: "+epr.getAddress().getStringValue()); GetResourcePropertyDocumentDocument1 req=GetResourcePropertyDocumentDocument1.Factory.newInstance(); req.addNewGetResourcePropertyDocument(); - GetResourcePropertyDocumentResponseDocument res=resourceProperties.GetResourcePropertyDocument(req); + GetResourcePropertyDocumentResponseDocument res=getRP().GetResourcePropertyDocument(req); return res; } @@ -267,7 +267,7 @@ q.setDialect(WSResource.QUERY_EXPRESSION_DIALECT_XPATH); q.newCursor().setTextValue(xpath); req.addNewQueryResourceProperties().setQueryExpression(q); - return resourceProperties.QueryResourceProperties(req); + return getRP().QueryResourceProperties(req); } @@ -285,7 +285,7 @@ for(QName q: names){ in.getGetMultipleResourceProperties().addNewResourceProperty().setQNameValue(q); } - GetMultipleResourcePropertiesResponseDocument res=resourceProperties.GetMultipleResourceProperties(in); + GetMultipleResourcePropertiesResponseDocument res=getRP().GetMultipleResourceProperties(in); Map<QName,XmlObject[]>result=new HashMap<QName, XmlObject[]>(); XmlObject response=res.getGetMultipleResourcePropertiesResponse(); @@ -298,6 +298,27 @@ } return result; } + + public ResourceLifetime getLT(){ + if(lifetime==null){ + try{ + lifetime=makeProxy(ResourceLifetime.class); + }catch(Exception e){ + logger.log(Level.SEVERE,"can't create lifetime interface",e); + } + } + return lifetime; + } + public ResourceProperties getRP() { + if(resourceProperties==null){ + try{ + resourceProperties=makeProxy(ResourceProperties.class); + }catch(Exception e){ + logger.log(Level.SEVERE,"can't create resourceproperty interface",e); + } + } + return resourceProperties; + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |