#3148 added possibility to postpone VRE expiration time of six months, moved to GWT 2.7.0

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/vre-manager@113713 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-03-24 18:19:41 +00:00
parent 4afe3ad77d
commit 39495ea81c
12 changed files with 157 additions and 60 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/vre-manager-5.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/vre-manager-5.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -14,7 +14,7 @@
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT (5)"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/vre-manager-5.1.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/vre-manager-5.2.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
validateFragments=false
validation.use-project-settings=true

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<wb-module deploy-name="vre-manager-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>

View File

@ -4,4 +4,5 @@
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.6"/>
<installed facet="liferay.portlet" version="6.0"/>
</faceted-project>

40
pom.xml
View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>vre-manager</artifactId>
<packaging>war</packaging>
<version>5.1.0-SNAPSHOT</version>
<version>5.2.0-SNAPSHOT</version>
<name>VRE Manager Portlet</name>
<description>
gCube VRE Manager Portlet shows a Wizard to create VREs.
@ -24,11 +24,10 @@
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.5.1</gwtVersion>
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -42,22 +41,31 @@
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- This dependency is needed to use GWT UI BInder without old Xerces
version of gCore complaining -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
<version>${gwtVersion}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
@ -82,6 +90,7 @@
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.vremanagement</groupId>
@ -90,8 +99,9 @@
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>2.2.5</version>
<artifactId>gxt2.2.5-gwt2.X</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>

View File

@ -2,9 +2,10 @@ package org.gcube.portlets.admin.vredeployment.client;
import java.util.ArrayList;
import org.gcube.portlets.admin.vredeployment.shared.VREDefinitionBean;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import org.gcube.portlets.admin.vredeployment.shared.VREDefinitionBean;
/**
* The client side stub for the RPC service.
*/
@ -12,15 +13,17 @@ import org.gcube.portlets.admin.vredeployment.shared.VREDefinitionBean;
public interface VREDeploymentService extends RemoteService {
ArrayList<VREDefinitionBean> getVREDefinitions();
boolean doApprove(String epr);
boolean doApprove(String vreId);
boolean doRemove(String epr);
boolean doRemove(String vreId);
boolean doEdit(String epr);
boolean doEdit(String vreId);
String doViewDetails(String epr);
String doViewDetails(String vreId);
boolean doViewReport(String epr);
boolean doViewReport(String vreId);
String getHTMLReport(String epr) ;
String getHTMLReport(String vreId);
boolean postPone(String vreId);
}

View File

@ -12,15 +12,17 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
public interface VREDeploymentServiceAsync {
void getVREDefinitions(AsyncCallback<ArrayList<VREDefinitionBean>> callback);
void doApprove(String epr, AsyncCallback<Boolean> callback);
void doApprove(String vreId, AsyncCallback<Boolean> callback);
void doRemove(String epr, AsyncCallback<Boolean> callback);
void doRemove(String vreId, AsyncCallback<Boolean> callback);
void doEdit(String epr, AsyncCallback<Boolean> callback);
void doEdit(String vreId, AsyncCallback<Boolean> callback);
void doViewDetails(String epr, AsyncCallback<String> callback);
void doViewDetails(String vreId, AsyncCallback<String> callback);
void doViewReport(String epr, AsyncCallback<Boolean> callback);
void doViewReport(String vreId, AsyncCallback<Boolean> callback);
void getHTMLReport(String epr, AsyncCallback<String> callback);
void getHTMLReport(String vreId, AsyncCallback<String> callback);
void postPone(String vreId, AsyncCallback<Boolean> callback);
}

View File

@ -58,7 +58,7 @@ public class VREDeploymentPresenter implements Presenter {
};
display.getViewButton().addSelectionListener(viewsl);
display.getViewMenu().addSelectionListener(viewsl);
//APPROVE
SelectionListener approvesl = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
@ -69,7 +69,7 @@ public class VREDeploymentPresenter implements Presenter {
};
display.getApproveButton().addSelectionListener(approvesl);
display.getApproveMenu().addSelectionListener(approvesl);
// EDIT
SelectionListener editsl = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
@ -80,14 +80,14 @@ public class VREDeploymentPresenter implements Presenter {
};
display.getEditButton().addSelectionListener(editsl);
display.getEditMenu().addSelectionListener(editsl);
// REFRESH
display.getRefreshButton().addSelectionListener( new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
fetchVREDefinitions();
}
});
// REMOVE
SelectionListener removesl = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
@ -98,7 +98,7 @@ public class VREDeploymentPresenter implements Presenter {
};
display.getRemoveButton().addSelectionListener(removesl);
display.getRemoveMenu().addSelectionListener(removesl);
// VIEW REPORT
SelectionListener viewreportSL = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
@ -109,7 +109,7 @@ public class VREDeploymentPresenter implements Presenter {
};
display.getViewReportButton().addSelectionListener(viewreportSL);
display.getViewReportMenu().addSelectionListener(viewreportSL);
// VIEW TEXTUAL REPORT
SelectionListener viewTreportSL = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
@ -119,17 +119,30 @@ public class VREDeploymentPresenter implements Presenter {
}
};
display.getViewTextualReportButton().addSelectionListener(viewTreportSL);
//POSTPONE
SelectionListener postPonesl = new SelectionListener<ComponentEvent>() {
public void componentSelected(ComponentEvent ce) {
String vreId = display.getGridSelectionModel().getSelectedItem().getId();
String vreName = display.getGridSelectionModel().getSelectedItem().getName();
doPostPone(vreId, vreName);
}
};
display.getPostPoneButton().addSelectionListener(postPonesl);
///*** GRID
display.getGridSelectionModel().addSelectionChangedListener(new SelectionChangedListener<VREDefinitionBean>() {
public void selectionChanged(SelectionChangedEvent<VREDefinitionBean> event) {
if (event.getSelectedItem() != null)
display.setGridContextMenu(event.getSelectedItem().getStatus());
display.enableActionButtons(event.getSelectedItem());
display.enableActionButtons(event.getSelectedItem());
}
});
}
/**
* go method
*/
@ -193,11 +206,11 @@ public class VREDeploymentPresenter implements Presenter {
}
});
}
}
});
}
private void doViewReport(String vreEPR, String vreName) {
display.maskCenterPanel("Switching to VRE report for " + vreName +", please wait", true);
@ -213,9 +226,9 @@ public class VREDeploymentPresenter implements Presenter {
Window.alert("Failed to view report VRE" + arg0.getMessage());
}
});
}
private void doViewTextualReport(String vreEPR, String vreName) {
display.maskCenterPanel("Fetching textual VRE report for " + vreName +", please wait", true);
rpcService.getHTMLReport(vreEPR, new AsyncCallback<String>() {
@ -227,7 +240,7 @@ public class VREDeploymentPresenter implements Presenter {
window.setModal(true);
window.setBlinkModal(true);
window.setHeading("Textual Report");
ContentPanel cp = new ContentPanel();
cp.setHeaderVisible(false);
@ -236,7 +249,7 @@ public class VREDeploymentPresenter implements Presenter {
scroller.add(new Html(reportHTML));
cp.add(scroller);
cp.setLayout(new FitLayout());
window.add(cp);
@ -247,7 +260,7 @@ public class VREDeploymentPresenter implements Presenter {
window.hide();
}
}));
cp.layout();
display.maskCenterPanel("", false);
window.show();
@ -258,9 +271,9 @@ public class VREDeploymentPresenter implements Presenter {
Window.alert("Failed to view report VRE" + arg0.getMessage());
}
});
}
private void doEdit(String vreEPR, String vreName) {
display.maskCenterPanel("Switching to edit mode for " + vreName +", please wait", true);
rpcService.doEdit(vreEPR, new AsyncCallback<Boolean>() {
@ -276,6 +289,23 @@ public class VREDeploymentPresenter implements Presenter {
}
});
}
private void doPostPone(String vreId, String vreName) {
Window.confirm("You are going to postpone of 6 months the expiration date of " + vreName);
rpcService.postPone(vreId, new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
display.maskCenterPanel("", false);
Window.alert("Failed to postpone VRE of 6 months" + caught.getMessage());
}
@Override
public void onSuccess(Boolean result) {
display.maskCenterPanel("", false);
fetchVREDefinitions();
}
});
}
private void doViewDetails(String vreEPR, String vreName) {
@ -292,9 +322,9 @@ public class VREDeploymentPresenter implements Presenter {
Window.alert("Failed to get VRE details" + arg0.getMessage());
}
});
}
/**
* Redirect to VRE Deployer Portlet
*/
@ -318,6 +348,6 @@ public class VREDeploymentPresenter implements Presenter {
this.@org.gcube.portlets.admin.vredeployment.client.presenter.VREDeploymentPresenter::location = $wnd.location.href;
}-*/;
}

View File

@ -6,7 +6,6 @@ import org.gcube.portlets.admin.vredeployment.shared.VREDefinitionBean;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.google.gwt.user.client.ui.Widget;
@ -26,6 +25,7 @@ public interface Display {
Button getApproveButton();
Button getRefreshButton();
Button getViewTextualReportButton();
Button getPostPoneButton();
MenuItem getViewMenu();

View File

@ -45,6 +45,7 @@ public class VREDeploymentView extends Composite implements Display {
private Button viewReportButton;
private Button refreshButton;
private Button viewTextualReportButton;
private Button postPoneExpiration;
private MenuItem viewMenu;
private MenuItem editMenu;
@ -103,6 +104,8 @@ public class VREDeploymentView extends Composite implements Display {
removeButton = new Button("Remove from infrastructure");
refreshButton = new Button("Refresh");
viewTextualReportButton = new Button("View Text-Only Report");
postPoneExpiration = new Button("Postpone Expiration Time");
viewButton.setEnabled(false);
editButton.setEnabled(false);
@ -111,7 +114,7 @@ public class VREDeploymentView extends Composite implements Display {
removeButton.setEnabled(false);
refreshButton.setEnabled(true);
viewTextualReportButton.setEnabled(false);
postPoneExpiration.setEnabled(false);
initWidget(mainPanel);
@ -136,10 +139,12 @@ public class VREDeploymentView extends Composite implements Display {
gridPanel.setButtonAlign(HorizontalAlignment.CENTER);
gridPanel.addButton(viewButton);
gridPanel.addButton(editButton);
gridPanel.addButton(approveButton);
gridPanel.addButton(viewReportButton);
gridPanel.addButton(viewTextualReportButton);
gridPanel.addButton(removeButton);
gridPanel.addButton(postPoneExpiration);
gridPanel.addButton(refreshButton);
gridPanel.setBorders(false);
@ -212,6 +217,11 @@ public class VREDeploymentView extends Composite implements Display {
column.setHidden(false);
column.setRowHeader(true);
configs.add(column);
column = new ColumnConfig("endingDate", "Expires", 100);
column.setHidden(false);
column.setRowHeader(true);
configs.add(column);
return new ColumnModel(configs);
}
@ -245,7 +255,12 @@ public class VREDeploymentView extends Composite implements Display {
getApproveButton().setEnabled(true);
getRemoveButton().setEnabled(true);
getViewReportButton().setEnabled(false);
}
}
//also enable postpone just for deployed VREs
if (selectedItem.getStatus().compareTo("Deployed") == 0) {
getPostPoneButton().setEnabled(true);
}
}
else {
getViewButton().setEnabled(false);
@ -254,6 +269,7 @@ public class VREDeploymentView extends Composite implements Display {
getRemoveButton().setEnabled(false);
getViewReportButton().setEnabled(false);
getViewTextualReportButton().setEnabled(false);
getPostPoneButton().setEnabled(false);
}
}
@ -313,6 +329,9 @@ public class VREDeploymentView extends Composite implements Display {
public Button getEditButton() {return editButton;
}
@Override
public Button getPostPoneButton() {return postPoneExpiration;
}
@Override
public GridSelectionModel<VREDefinitionBean> getGridSelectionModel() { return grid.getSelectionModel();
}
@Override

View File

@ -7,6 +7,7 @@ import java.io.StringReader;
import java.rmi.RemoteException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -77,7 +78,19 @@ public class VREDeploymentServiceImpl extends RemoteServiceServlet implements VR
doRemove(vre.id());
}
else {
toReturn.add(new VREDefinitionBean(vre.id(), vre.name(), vre.description(), "", "", new Date(), new Date(), vre.state(), ""));
VREDescription vreDetail = null;
try {
vreDetail = new VREGeneratorEvo(aslSession, vre.id()).getVREModel();
} catch (RemoteException e) {
e.printStackTrace();
}
Date start = new Date();
Date end = new Date();
if (vreDetail != null) {
start = vreDetail.startTime().getTime();
end = vreDetail.endTime().getTime();
}
toReturn.add(new VREDefinitionBean(vre.id(), vre.name(), vre.description(), "", "", start, end, vre.state(), ""));
_log.debug(vre.name() + " id=" + vre.id());
}
}
@ -343,4 +356,22 @@ public class VREDeploymentServiceImpl extends RemoteServiceServlet implements VR
return resultStream.toString();
}
@Override
public boolean postPone(String vreId) {
_log.debug("VRE Instance to postpone id: " + vreId);
try {
ASLSession session = getASLSession();
VREGeneratorEvo evo = new VREGeneratorEvo(session, vreId);
VREDescription vre = evo.getVREModel();
Calendar endTime = vre.endTime();
endTime.set(Calendar.MONTH, (endTime.get(Calendar.MONTH)+6));
vre.endTime(endTime);
evo.setVREModel(vre.name(), vre.description(), vre.designer(), vre.manager(), vre.startTime().getTimeInMillis(), endTime.getTimeInMillis());
return true;
} catch (RemoteException e) {
e.printStackTrace();
return false;
}
}
}

View File

@ -4,7 +4,7 @@
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<set-property name="user.agent" value="gecko1_8,safari" />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
@ -15,9 +15,7 @@
<!-- Other module inherits -->
<inherits name='com.extjs.gxt.ui.GXT' />
<inherits name='com.extjs.gxt.themes.Themes' />
<!-- Specify the app entry point class. -->
<!-- inherits GCUBE Widgets -->
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />