git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/vre-management/VREModeler@7892 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ca7acff4d8
commit
a8337ffc47
|
@ -0,0 +1,68 @@
|
|||
package org.gcube.vremanagement.vremodeler.impl.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.axis.message.addressing.EndpointReferenceType;
|
||||
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
||||
import org.gcube.common.core.contexts.GHNContext;
|
||||
import org.gcube.common.core.informationsystem.client.AtomicCondition;
|
||||
import org.gcube.common.core.informationsystem.client.ISClient;
|
||||
import org.gcube.common.core.informationsystem.client.queries.GCUBERIQuery;
|
||||
import org.gcube.common.core.resources.GCUBERunningInstance;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEServiceClient;
|
||||
import org.gcube.common.core.utils.handlers.GCUBEServiceHandler;
|
||||
import org.gcube.common.vremanagement.ghnmanager.impl.contexts.ServiceContext;
|
||||
import org.gcube.vremanagement.vremanager.stubs.vremanager.VREManagerPortType;
|
||||
import org.gcube.vremanagement.vremanager.stubs.vremanager.service.VREManagerServiceAddressingLocator;
|
||||
|
||||
public abstract class VREManagerServiceHandler<T, P> extends GCUBEServiceHandler<GCUBEServiceClient> {
|
||||
|
||||
private T returnValue;
|
||||
|
||||
private P parameter;
|
||||
|
||||
public T getReturnValue(){
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public void setParameter(P param){
|
||||
this.parameter= param;
|
||||
}
|
||||
|
||||
protected P getParameter(){
|
||||
return this.parameter;
|
||||
}
|
||||
|
||||
|
||||
protected void setReturnValue(T returnValue){
|
||||
this.returnValue= returnValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<EndpointReferenceType> findInstances() throws Exception {
|
||||
ISClient client = GHNContext.getImplementation(ISClient.class);
|
||||
GCUBERIQuery query = client.getQuery(GCUBERIQuery.class);
|
||||
query.addAtomicConditions(new AtomicCondition("//ServiceName", "VREManager"));
|
||||
query.addAtomicConditions(new AtomicCondition("//ServiceClass", "VREManagement"));
|
||||
List<EndpointReferenceType> eprs = new ArrayList<EndpointReferenceType>();
|
||||
for (GCUBERunningInstance instance : client.execute(query, ServiceContext.getContext().getScope()))
|
||||
eprs.add(instance.getAccessPoint().getEndpoint("gcube/vremanagement/VREManager"));
|
||||
return eprs;
|
||||
|
||||
}
|
||||
|
||||
protected abstract T makeCall(VREManagerPortType mbportType) throws Exception;
|
||||
|
||||
|
||||
|
||||
protected void interact(EndpointReferenceType arg0) throws Exception{
|
||||
VREManagerPortType mbpt= null;
|
||||
try{
|
||||
VREManagerServiceAddressingLocator mbsal= new VREManagerServiceAddressingLocator();
|
||||
mbpt= mbsal.getVREManagerPortTypePort(arg0);
|
||||
mbpt = GCUBERemotePortTypeContext.getProxy(mbpt,ServiceContext.getContext().getScope());
|
||||
this.setReturnValue(this.makeCall(mbpt));
|
||||
}catch(Exception e){throw e;}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue