added undeploy capability for Feature #852, but it does not work

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/vre-manager@119310 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-10-01 13:47:28 +00:00
parent f541fa3d85
commit 87f25d1ae0
12 changed files with 93 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/vre-manager-5.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/vre-manager-5.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/vre-manager-5.2.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/vre-manager-5.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -5,7 +5,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="aslvre-5.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/asl-vre/asl-vre"> <dependent-module archiveName="aslvre-5.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/asl-vre/asl-vre">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/> <property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>

View File

@ -1,6 +1,5 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-admin.vre-manager.5-2-0" <Changeset component="org.gcube.portlets-admin.vre-manager.5-2-0" date="2015-04-28">
date="2015-04-28">
<Change>added possibility to postpone VRE expiration time of six <Change>added possibility to postpone VRE expiration time of six
months</Change> months</Change>
<Change>moved to GWT 2.7.0</Change> <Change>moved to GWT 2.7.0</Change>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.admin</groupId> <groupId>org.gcube.portlets.admin</groupId>
<artifactId>vre-manager</artifactId> <artifactId>vre-manager</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>5.2.0-SNAPSHOT</version> <version>5.3.0-SNAPSHOT</version>
<name>VRE Manager Portlet</name> <name>VRE Manager Portlet</name>
<description> <description>
gCube VRE Manager Portlet shows a Wizard to create VREs. gCube VRE Manager Portlet shows a Wizard to create VREs.

View File

@ -17,6 +17,8 @@ public interface VREDeploymentService extends RemoteService {
boolean doRemove(String vreId); boolean doRemove(String vreId);
boolean doUndeploy(String vreId);
boolean doEdit(String vreId); boolean doEdit(String vreId);
String doViewDetails(String vreId); String doViewDetails(String vreId);

View File

@ -25,4 +25,6 @@ public interface VREDeploymentServiceAsync {
void getHTMLReport(String vreId, AsyncCallback<String> callback); void getHTMLReport(String vreId, AsyncCallback<String> callback);
void postPone(String vreId, AsyncCallback<Boolean> callback); void postPone(String vreId, AsyncCallback<Boolean> callback);
void doUndeploy(String vreId, AsyncCallback<Boolean> callback);
} }

View File

@ -99,6 +99,18 @@ public class VREDeploymentPresenter implements Presenter {
display.getRemoveButton().addSelectionListener(removesl); display.getRemoveButton().addSelectionListener(removesl);
display.getRemoveMenu().addSelectionListener(removesl); display.getRemoveMenu().addSelectionListener(removesl);
// REMOVE
@SuppressWarnings("rawtypes")
SelectionListener undeploysl = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
String vreEPR = display.getGridSelectionModel().getSelectedItem().getId();
String vreName = display.getGridSelectionModel().getSelectedItem().getName();
doUndeploy(vreEPR, vreName);
}
};
display.getUndeployButton().addSelectionListener(undeploysl);
// VIEW REPORT // VIEW REPORT
SelectionListener viewreportSL = new SelectionListener<ComponentEvent>() { SelectionListener viewreportSL = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) { public void componentSelected(ComponentEvent ce) {
@ -143,6 +155,7 @@ public class VREDeploymentPresenter implements Presenter {
} }
/** /**
* go method * go method
*/ */
@ -211,6 +224,32 @@ public class VREDeploymentPresenter implements Presenter {
}); });
} }
protected void doUndeploy(final String vreEPR, final String vreName) {
MessageBox.confirm("Confirm", "Are you REALLY REALLY sure you want to undeploy "+ vreName +"?", new Listener<MessageBoxEvent>() {
public void handleEvent(MessageBoxEvent ce) {
if (ce.getButtonClicked().getText().equals("Yes")) {
display.maskCenterPanel("Undeploying VRE " + vreName +", please wait", true);
rpcService.doUndeploy(vreEPR, new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean arg0) {
display.maskCenterPanel("", false);
fetchVREDefinitions();
Info.display("VRE Removal", "The '{0}' VRE undeploy has been successfully triggered. "
+ "The infrastructure feels now relieved by having these resources back available. Thank you", vreName);
}
@Override
public void onFailure(Throwable arg0) {
display.maskCenterPanel("", false);
Window.alert("Failed to remove VRE" + arg0.getMessage());
}
});
}
}
});
}
private void doViewReport(String vreEPR, String vreName) { private void doViewReport(String vreEPR, String vreName) {
display.maskCenterPanel("Switching to VRE report for " + vreName +", please wait", true); display.maskCenterPanel("Switching to VRE report for " + vreName +", please wait", true);

View File

@ -26,6 +26,7 @@ public interface Display {
Button getRefreshButton(); Button getRefreshButton();
Button getViewTextualReportButton(); Button getViewTextualReportButton();
Button getPostPoneButton(); Button getPostPoneButton();
Button getUndeployButton();
MenuItem getViewMenu(); MenuItem getViewMenu();

View File

@ -41,6 +41,7 @@ public class VREDeploymentView extends Composite implements Display {
private Button viewButton; private Button viewButton;
private Button editButton; private Button editButton;
private Button removeButton; private Button removeButton;
private Button undeployButton;
private Button approveButton; private Button approveButton;
private Button viewReportButton; private Button viewReportButton;
private Button refreshButton; private Button refreshButton;
@ -101,11 +102,12 @@ public class VREDeploymentView extends Composite implements Display {
editButton = new Button("Edit"); editButton = new Button("Edit");
approveButton = new Button("Approve"); approveButton = new Button("Approve");
viewReportButton = new Button("View Report"); viewReportButton = new Button("View Report");
removeButton = new Button("Remove from infrastructure"); removeButton = new Button("Remove from list");
undeployButton = new Button("Undeploy VRE");
refreshButton = new Button("Refresh"); refreshButton = new Button("Refresh");
viewTextualReportButton = new Button("View Text-Only Report"); viewTextualReportButton = new Button("View Text-Only Report");
postPoneExpiration = new Button("Postpone Expiration Time"); postPoneExpiration = new Button("Postpone Expiration ");
viewButton.setEnabled(false); viewButton.setEnabled(false);
editButton.setEnabled(false); editButton.setEnabled(false);
@ -115,6 +117,7 @@ public class VREDeploymentView extends Composite implements Display {
refreshButton.setEnabled(true); refreshButton.setEnabled(true);
viewTextualReportButton.setEnabled(false); viewTextualReportButton.setEnabled(false);
postPoneExpiration.setEnabled(false); postPoneExpiration.setEnabled(false);
undeployButton.setEnabled(false);
initWidget(mainPanel); initWidget(mainPanel);
@ -144,6 +147,7 @@ public class VREDeploymentView extends Composite implements Display {
gridPanel.addButton(viewReportButton); gridPanel.addButton(viewReportButton);
gridPanel.addButton(viewTextualReportButton); gridPanel.addButton(viewTextualReportButton);
gridPanel.addButton(removeButton); gridPanel.addButton(removeButton);
gridPanel.addButton(undeployButton);
gridPanel.addButton(postPoneExpiration); gridPanel.addButton(postPoneExpiration);
gridPanel.addButton(refreshButton); gridPanel.addButton(refreshButton);
@ -260,6 +264,7 @@ public class VREDeploymentView extends Composite implements Display {
//also enable postpone just for deployed VREs //also enable postpone just for deployed VREs
if (selectedItem.getStatus().compareTo("Deployed") == 0) { if (selectedItem.getStatus().compareTo("Deployed") == 0) {
getPostPoneButton().setEnabled(true); getPostPoneButton().setEnabled(true);
getUndeployButton().setEnabled(true);
} }
} }
else { else {
@ -321,7 +326,9 @@ public class VREDeploymentView extends Composite implements Display {
} }
} }
@Override
public Button getUndeployButton() { return undeployButton;
}
@Override @Override
public Button getApproveButton() { return approveButton; public Button getApproveButton() { return approveButton;
} }

View File

@ -51,9 +51,9 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
* The server side implementation of the RPC service. * The server side implementation of the RPC service.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VREDeploymentServiceImpl extends RemoteServiceServlet implements VREDeploymentService { public class VREManagerServiceImpl extends RemoteServiceServlet implements VREDeploymentService {
private static final Logger _log = LoggerFactory.getLogger(VREDeploymentServiceImpl.class); private static final Logger _log = LoggerFactory.getLogger(VREManagerServiceImpl.class);
private static final String APPROVE_MODE = "approve"; private static final String APPROVE_MODE = "approve";
private static final String EDIT_MODE = "edit"; private static final String EDIT_MODE = "edit";
@ -61,7 +61,7 @@ public class VREDeploymentServiceImpl extends RemoteServiceServlet implements VR
private static final String VRE_GENERATOR_ATTRIBUTE = "VREGenerator"; private static final String VRE_GENERATOR_ATTRIBUTE = "VREGenerator";
private static final String VIEW_MODE_ATTRIBUTE = "viewMode"; private static final String VIEW_MODE_ATTRIBUTE = "viewMode";
private static final String HARD_CODED_VO_NAME = "/d4science.research-infrastructures.eu/gCubeApps"; private static final String HARD_CODED_VO_NAME = "/gcube/devsec";
@Override @Override
@ -167,6 +167,14 @@ public class VREDeploymentServiceImpl extends RemoteServiceServlet implements VR
return true; return true;
} }
@Override
public boolean doUndeploy(String epr) {
ASLSession aslSession = getASLSession();
VREGeneratorEvo evo = new VREGeneratorEvo(aslSession);
evo.undeployVRE(epr);
return true;
}
@Override @Override
public boolean doEdit(String epr) { public boolean doEdit(String epr) {
epr = unCodeERP(epr); epr = unCodeERP(epr);
@ -379,4 +387,6 @@ public class VREDeploymentServiceImpl extends RemoteServiceServlet implements VR
return false; return false;
} }
} }
} }

View File

@ -0,0 +1,19 @@
log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d %-5p %c - %m%n
# Print only messages of level TRACE or above in the package org.gcube
log4j.logger.org.gcube=TRACE
log4j.logger.org.gcube.application.framework.core.session=INFO
log4j.logger.org.gcube.contentmanager=ERROR
log4j.logger.org.gcube.common.scope=ERROR
log4j.logger.org.gcube.contentmanagement=ERROR
log4j.logger.org.gcube.resources.discovery.icclient=ERROR
log4j.logger.org.gcube.common.clients=ERROR
log4j.logger.org.gcube.common.homelibrary.jcr=ERROR
log4j.logger.org.gcube.application.framework.accesslogger=ERROR
log4j.logger.org.apache.pdfbox.util.PDFStreamEngine=ERROR
log4j.logger.org.apache.http=INFO

View File

@ -8,7 +8,7 @@
<!-- Servlets --> <!-- Servlets -->
<servlet> <servlet>
<servlet-name>vreDeploymentServlet</servlet-name> <servlet-name>vreDeploymentServlet</servlet-name>
<servlet-class>org.gcube.portlets.admin.vredeployment.server.VREDeploymentServiceImpl</servlet-class> <servlet-class>org.gcube.portlets.admin.vredeployment.server.VREManagerServiceImpl</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>