added undeploy capability for Feature #852

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/application-support-layer/aslvre@119308 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-10-01 13:43:24 +00:00
parent fa2a847224
commit c9ce62e4da
3 changed files with 29 additions and 3 deletions

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslvre</artifactId> <artifactId>aslvre</artifactId>
<version>5.1.0-SNAPSHOT</version> <version>5.2.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>VRE Management ASL Extension</name> <name>VRE Management ASL Extension</name>
<description> <description>

View File

@ -3,6 +3,7 @@ package org.gcube.application.framework.vremanagement.vremanagement;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.List; import java.util.List;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.vremanagement.vremodel.cl.stubs.types.FunctionalityItem; import org.gcube.vremanagement.vremodel.cl.stubs.types.FunctionalityItem;
import org.gcube.vremanagement.vremodel.cl.stubs.types.FunctionalityNodes; import org.gcube.vremanagement.vremodel.cl.stubs.types.FunctionalityNodes;
import org.gcube.vremanagement.vremodel.cl.stubs.types.GHN; import org.gcube.vremanagement.vremodel.cl.stubs.types.GHN;
@ -94,5 +95,9 @@ public interface VREGeneratorInterface {
boolean isCloudSelected(); boolean isCloudSelected();
void removeVRE(ASLSession session, String id);
void undeployVRE(String id);
int getCloudVMSelected(); int getCloudVMSelected();
} }

View File

@ -126,14 +126,35 @@ protected static AtomicInteger vreId = new AtomicInteger(0);
* @param session the d4s session * @param session the d4s session
* @param id the id of the VRE to be removed * @param id the id of the VRE to be removed
*/ */
@Override
public void removeVRE(ASLSession session, String id) { public void removeVRE(ASLSession session, String id) {
System.out.println("ID RECEIVED TO REMOVE:" + id); log.info("ID RECEIVED TO REMOVE:" + id);
String currScope = ScopeProvider.instance.get(); String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);
factory().build().removeVRE(id); factory().build().removeVRE(id);
ScopeProvider.instance.set(currScope); ScopeProvider.instance.set(currScope);
} }
/**
* @param session the d4s session
* @param id the id of the VRE to be removed
*/
@Override
public void undeployVRE(String id) {
System.out.println("ID RECEIVED TO UNDEPLOY:" + id);
String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope);
modelPortType = manager().at(factory().build().getEPRbyId(id)).build();
log.info("Trying UNDEPLOY:" + id + " name="+ modelPortType.getDescription().name());
modelPortType.undeployVRE();
ScopeProvider.instance.set(currScope);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Override @Override
public DeployReport checkVREStatus() throws RemoteException { public DeployReport checkVREStatus() throws RemoteException {
@ -276,7 +297,7 @@ protected static AtomicInteger vreId = new AtomicInteger(0);
* *
*/ */
public boolean isCloudSelected() { public boolean isCloudSelected() {
System.out.println("isCloudSelected()"); log.info("isCloudSelected()");
String currScope = ScopeProvider.instance.get(); String currScope = ScopeProvider.instance.get();
ScopeProvider.instance.set(scope); ScopeProvider.instance.set(scope);
boolean toReturn = modelPortType.isUseCloud(); boolean toReturn = modelPortType.isUseCloud();