ref 8541: StatisticalAlgorithmImporter - Support Java 8 compatibility

https://support.d4science.org/issues/8541

Updated to support Java 8 compatibility

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@148631 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-05-12 16:26:05 +00:00
parent fea1fdb2bc
commit f8aaa60efb
115 changed files with 670 additions and 752 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/statistical-algorithms-importer-1.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/statistical-algorithms-importer-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/statistical-algorithms-importer-1.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/statistical-algorithms-importer-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -45,5 +45,5 @@
</classpathentry>
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA.jar" sourcepath="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="output" path="target/statistical-algorithms-importer-1.5.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/statistical-algorithms-importer-1.6.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,8 +1,12 @@
<ReleaseNotes>
<Changeset component="${groupId}.${artifactId}.1-6-0" date="2017-06-12">
<Change>Support Java 8 compatibility [ticket #8541]</Change>
</Changeset>
<Changeset component="${groupId}.${artifactId}.1-5-0" date="2017-02-15">
<Change>Updated PortalContext support[ticket #6279]</Change>
<Change>Added support only for file data type in output
parameter[ticket #7120]</Change>
parameter[ticket #7120]
</Change>
</Changeset>
<Changeset component="${groupId}.${artifactId}.1-4-0" date="2016-12-01">
<Change>Updated Storage support</Change>

View File

@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>statistical-algorithms-importer</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>
<packaging>war</packaging>
@ -42,7 +42,11 @@
<distroDirectory>distro</distroDirectory>
<configDirectory>config</configDirectory>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<!-- Java -->
<maven.compiler.source>1.7</maven.compiler.source>
<!-- GWT configuration -->
<gwtVersion>2.6.1</gwtVersion>
<gwtLogVersion>3.3.2</gwtLogVersion>

View File

@ -4,8 +4,8 @@ import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface CommonMessages extends Messages {

View File

@ -15,8 +15,8 @@ import com.sencha.gxt.widget.core.client.container.Viewport.ViewportAppearance;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class PortalViewport extends SimpleContainer {
@ -24,13 +24,12 @@ public class PortalViewport extends SimpleContainer {
protected int rightScrollBarSize = 17;
protected boolean enableScroll;
/**
* Creates a viewport layout container with the default appearance.
*/
public PortalViewport() {
this(GWT.<ViewportAppearance> create(ViewportAppearance.class));
this(GWT.<ViewportAppearance>create(ViewportAppearance.class));
}
/**
@ -45,15 +44,14 @@ public class PortalViewport extends SimpleContainer {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
appearance.render(sb);
XElement element=XDOM.create(sb.toSafeHtml());
setElement((Element)element);
XElement element = XDOM.create(sb.toSafeHtml());
setElement((Element) element);
monitorWindowResize = true;
forceLayoutOnResize = true;
getFocusSupport().setIgnore(false);
resize();
} catch (Exception e) {
Log.error("PortalViewport: constructor error "
+ e.getLocalizedMessage());
Log.error("PortalViewport: constructor error " + e.getLocalizedMessage());
}
}
@ -102,21 +100,19 @@ public class PortalViewport extends SimpleContainer {
protected void resize() {
int viewWidth;
if(enableScroll){
viewWidth= calculateWidth() - rightScrollBarSize;
if (enableScroll) {
viewWidth = calculateWidth() - rightScrollBarSize;
} else {
viewWidth = calculateWidth();
}
int viewHeight = calculateHeight();
Log.info("AM resize viewWidth: " + viewWidth + " viewHeight: "
+ viewHeight + " clientWidth: " + Window.getClientWidth()
+ " clientHeight: " + Window.getClientHeight());
Log.info("AM resize viewWidth: " + viewWidth + " viewHeight: " + viewHeight + " clientWidth: "
+ Window.getClientWidth() + " clientHeight: " + Window.getClientHeight());
try {
setPixelSize(viewWidth, viewHeight);
} catch (Exception e) {
Log.error("PortalViewport: error in resize() at setPixelSize "
+ e.getLocalizedMessage());
Log.error("PortalViewport: error in resize() at setPixelSize " + e.getLocalizedMessage());
}
}
@ -127,52 +123,20 @@ public class PortalViewport extends SimpleContainer {
protected void onWindowResize(int width, int height) {
int viewWidth = calculateWidth();
int viewHeight = calculateHeight();
Log.trace("AM onWindowResize viewWidth: " + viewWidth
+ " viewHeight: " + viewHeight + " clientWidth: "
+ Window.getClientWidth() + " clientHeight: "
+ Window.getClientHeight());
Log.trace("AM onWindowResize viewWidth: " + viewWidth + " viewHeight: " + viewHeight + " clientWidth: "
+ Window.getClientWidth() + " clientHeight: " + Window.getClientHeight());
setPixelSize(viewWidth, viewHeight);
}
/**
* Update window size
*/
/*
* public void resize(){
*
* RootPanel workspace = RootPanel.get("tdp");
*
* int topBorder = workspace.getAbsoluteTop();
*
* int leftBorder = workspace.getAbsoluteLeft();
*
* int footer = 85;
*
* int rootHeight = (Window.getClientHeight() - topBorder - 4 - footer);// -
* ((footer == null)?0:(footer.getOffsetHeight()-15));
*
* if (rootHeight < 550) rootHeight = 550;
*
* int rootWidth = Window.getClientWidth() - 2* leftBorder; //-
* rightScrollBar;
*
* System.out.println("New workspace dimension Height: "+rootHeight+" Width: "
* +rootWidth);
*
* this.setHeight(rootHeight); this.setWidth(rootWidth); }
*/
protected int calculateWidth() {
int leftBorder = getAbsoluteLeft();
Log.info("AM width: "
+ String.valueOf(Window.getClientWidth() - 2 * leftBorder));
Log.info("AM width: " + String.valueOf(Window.getClientWidth() - 2 * leftBorder));
return Window.getClientWidth() - 2 * leftBorder;
}
protected int calculateHeight() {
int topBorder = getAbsoluteTop();
Log.info("AM height: "
+ String.valueOf(Window.getClientHeight() - topBorder - 34));
Log.info("AM height: " + String.valueOf(Window.getClientHeight() - topBorder - 34));
return Window.getClientHeight() - topBorder - 34;
}

View File

@ -22,8 +22,8 @@ import com.sencha.gxt.widget.core.client.container.Viewport;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class StatAlgoImporter implements EntryPoint {

View File

@ -40,8 +40,8 @@ import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class StatAlgoImporterController {

View File

@ -9,8 +9,8 @@ import com.google.gwt.regexp.shared.RegExp;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeParser {

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Main Code Set Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class DeleteItemEvent extends

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Import Code Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ImportCodeEvent extends

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Input Save Ready Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InputReadyEvent extends

View File

@ -9,8 +9,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Input Save Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InputRequestEvent extends

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Main Code Set Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class MainCodeSetEvent extends

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Main Code Set Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class NewMainCodeEvent extends

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Input Save Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class NewSelectedRowsVariableEvent

View File

@ -12,8 +12,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Project Status Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ProjectStatusEvent extends

View File

@ -10,8 +10,8 @@ import com.google.gwt.event.shared.HasHandlers;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class SessionExpiredEvent extends GwtEvent<SessionExpiredEvent.SessionExpiredEventHandler> {

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
* Show Code Event
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ShowCodeEvent extends

View File

@ -9,8 +9,8 @@ import com.google.gwt.event.shared.HasHandlers;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class StatAlgoImporterRibbonEvent extends

View File

@ -11,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers;
*
*
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ControllerRequestEvent extends

View File

@ -4,8 +4,8 @@ import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface CodeEditMessages extends Messages {

View File

@ -50,8 +50,8 @@ import edu.ycp.cs.dh.acegwt.client.ace.AceSelectionListener;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeEditPanel extends ContentPanel {

View File

@ -46,8 +46,8 @@ import com.sencha.gxt.widget.core.client.menu.MenuItem;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeViewerPanel extends ContentPanel {

View File

@ -11,8 +11,8 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class MainDataPanel extends SimpleContainer {

View File

@ -5,30 +5,33 @@ import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class StatAlgoImporterMonitor extends AutoProgressMessageBox {
public StatAlgoImporterMonitor(){
public StatAlgoImporterMonitor() {
super("Waiting", "Please wait...");
create();
}
/**
*
* @param headingHtml
* head
* @param messageHtml
* message
*/
public StatAlgoImporterMonitor(SafeHtml headingHtml, SafeHtml messageHtml) {
super(headingHtml, messageHtml);
create();
}
/**
*
* @param headingHtml
* head
*/
public StatAlgoImporterMonitor(SafeHtml headingHtml) {
super(headingHtml);
@ -38,7 +41,9 @@ public class StatAlgoImporterMonitor extends AutoProgressMessageBox {
/**
*
* @param headingHtml
* head
* @param messageHtml
* message
*/
public StatAlgoImporterMonitor(String headingHtml, String messageHtml) {
super(headingHtml, messageHtml);
@ -48,6 +53,7 @@ public class StatAlgoImporterMonitor extends AutoProgressMessageBox {
/**
*
* @param headingHtml
* head
*/
public StatAlgoImporterMonitor(String headingHtml) {
super(headingHtml);
@ -59,7 +65,5 @@ public class StatAlgoImporterMonitor extends AutoProgressMessageBox {
auto();
show();
}
}

View File

@ -35,8 +35,8 @@ import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ProjectManager {

View File

@ -10,7 +10,7 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public interface CodeDataProperties extends PropertyAccess<CodeData> {

View File

@ -9,8 +9,8 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/

View File

@ -9,8 +9,8 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface GlobalVariablesProperties extends

View File

@ -9,8 +9,8 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/

View File

@ -10,8 +10,8 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface InputOutputVariablesProperties extends

View File

@ -8,8 +8,8 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface InterpreterPackageInfoProperties extends

View File

@ -8,8 +8,8 @@ import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface RequestedVREProperties extends PropertyAccess<RequestedVRE> {

View File

@ -7,8 +7,8 @@ import com.google.gwt.resources.client.CssResource;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface SAIStyles extends CssResource {

View File

@ -10,8 +10,8 @@ import com.google.gwt.resources.client.ImageResource;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface StatAlgoImporterResources extends ClientBundle {

View File

@ -5,7 +5,7 @@ import com.sencha.gxt.widget.core.client.ContentPanel;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public class EmptyPanel extends ContentPanel {

View File

@ -28,8 +28,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class HomeToolBar {

View File

@ -4,8 +4,8 @@ import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface HomeToolBarMessages extends Messages {

View File

@ -8,7 +8,7 @@ import com.sencha.gxt.widget.core.client.TabPanel;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public class StatAlgoImporterMenu extends TabPanel {

View File

@ -13,8 +13,8 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class StatAlgoImporterRibbon {

View File

@ -6,7 +6,7 @@ import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public interface StatAlgoImporterRibbonMessages extends Messages {

View File

@ -15,8 +15,8 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
@RemoteServiceRelativePath("statalgoimporterservice")
@ -26,6 +26,7 @@ public interface StatAlgoImporterService extends RemoteService {
*
* @return UserInfo user inforamations
* @throws StatAlgoImporterServiceException
* exception
*/
public UserInfo hello() throws StatAlgoImporterServiceException;
@ -33,48 +34,37 @@ public interface StatAlgoImporterService extends RemoteService {
/**
* Get File Upload Monitor during the file upload operation in Import CSV
*
* @return FileUploadMonitor
* @return FileUploadMonitor file upload monitor
* @throws StatAlgoImporterServiceException
* exception
*/
public FileUploadMonitor getFileUploadMonitor()
throws StatAlgoImporterServiceException;
public FileUploadMonitor getFileUploadMonitor() throws StatAlgoImporterServiceException;
// Code
public ArrayList<CodeData> getCode()
throws StatAlgoImporterServiceException;
public ArrayList<CodeData> getCode() throws StatAlgoImporterServiceException;
public void createProjectOnWorkspace(ItemDescription itemDescription)
throws StatAlgoImporterServiceException;
public void createProjectOnWorkspace(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
//
public Project setMainCode(ItemDescription itemDescription)
throws StatAlgoImporterServiceException;
public Project setMainCode(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public void addResourceToProject(ItemDescription itemDescription)
throws StatAlgoImporterServiceException;
public void addResourceToProject(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public Project deleteResourceOnProject(ItemDescription itemDescription)
throws StatAlgoImporterServiceException;
public Project deleteResourceOnProject(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public void saveProject(InputData inputData)
throws StatAlgoImporterServiceException;
public void saveProject(InputData inputData) throws StatAlgoImporterServiceException;
public Project openProjectOnWorkspace(ItemDescription newProjectFolder)
throws StatAlgoImporterServiceException;
public Project openProjectOnWorkspace(ItemDescription newProjectFolder) throws StatAlgoImporterServiceException;
public void saveCode(String code) throws StatAlgoImporterServiceException;
public void createSoftware(InputData inputData)
throws StatAlgoImporterServiceException;
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException;
public String getPublicLink(ItemDescription itemDescription)
throws StatAlgoImporterServiceException;
public String getPublicLink(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
public Project restoreUISession(String value)
throws StatAlgoImporterServiceException;
public Project restoreUISession(String value) throws StatAlgoImporterServiceException;
public Project setNewMainCode(ItemDescription itemDescription,
String code) throws StatAlgoImporterServiceException;
public Project setNewMainCode(ItemDescription itemDescription, String code) throws StatAlgoImporterServiceException;
public void publishSoftware() throws StatAlgoImporterServiceException;

View File

@ -17,8 +17,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface StatAlgoImporterServiceAsync {
@ -26,43 +26,31 @@ public interface StatAlgoImporterServiceAsync {
public static StatAlgoImporterServiceAsync INSTANCE = (StatAlgoImporterServiceAsync) GWT
.create(StatAlgoImporterService.class);
/**
*
* @param callback
*/
void hello(AsyncCallback<UserInfo> callback);
void getFileUploadMonitor(AsyncCallback<FileUploadMonitor> callback);
void getCode(AsyncCallback<ArrayList<CodeData>> callback);
void createProjectOnWorkspace(ItemDescription itemDescription,
AsyncCallback<Void> callback);
void setMainCode(ItemDescription itemDescription,
AsyncCallback<Project> callback);
void createProjectOnWorkspace(ItemDescription itemDescription, AsyncCallback<Void> callback);
void addResourceToProject(ItemDescription itemDescription,
AsyncCallback<Void> asyncCallback);
void setMainCode(ItemDescription itemDescription, AsyncCallback<Project> callback);
void saveProject(InputData inputData,
AsyncCallback<Void> asyncCallback);
void addResourceToProject(ItemDescription itemDescription, AsyncCallback<Void> asyncCallback);
void deleteResourceOnProject(ItemDescription itemDescription,
AsyncCallback<Project> asyncCallback);
void saveProject(InputData inputData, AsyncCallback<Void> asyncCallback);
void openProjectOnWorkspace(ItemDescription newProjectFolder,
AsyncCallback<Project> asyncCallback);
void deleteResourceOnProject(ItemDescription itemDescription, AsyncCallback<Project> asyncCallback);
void openProjectOnWorkspace(ItemDescription newProjectFolder, AsyncCallback<Project> asyncCallback);
void saveCode(String code, AsyncCallback<Void> asyncCallback);
void setNewMainCode(ItemDescription itemDescription, String code,
AsyncCallback<Project> asyncCallback);
void setNewMainCode(ItemDescription itemDescription, String code, AsyncCallback<Project> asyncCallback);
void createSoftware(InputData inputData, AsyncCallback<Void> callback);
void getPublicLink(ItemDescription itemDescription,
AsyncCallback<String> asyncCallback);
void getPublicLink(ItemDescription itemDescription, AsyncCallback<String> asyncCallback);
void restoreUISession(String value, AsyncCallback<Project> asyncCallback);

View File

@ -14,8 +14,8 @@ import com.sencha.gxt.widget.core.client.container.MarginData;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ToolsPanel extends ContentPanel {

View File

@ -39,8 +39,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ExplorerProjectPanel extends ContentPanel {

View File

@ -60,8 +60,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class GlobalVariablesPanel extends ContentPanel {

View File

@ -59,8 +59,8 @@ import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InputOutputVariablesPanel extends ContentPanel {

View File

@ -7,7 +7,7 @@ import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public interface InputTypeMessages extends Messages {

View File

@ -4,8 +4,8 @@ import com.google.gwt.i18n.client.Messages;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface InputVariableMessages extends Messages {

View File

@ -13,8 +13,8 @@ import com.sencha.gxt.widget.core.client.container.AccordionLayoutContainer.Acco
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InputVariablePanel extends ContentPanel {

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public enum InputVariablePanelState {

View File

@ -15,8 +15,8 @@ import com.sencha.gxt.widget.core.client.TabPanel;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InputVariableTabPanel extends TabPanel {

View File

@ -48,8 +48,8 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InterpreterInfoPanel extends ContentPanel {

View File

@ -19,8 +19,8 @@ import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ProjectInfoPanel extends ContentPanel {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum ControllerRequestEventType {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum ImportCodeType {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum ProjectStatusEventType {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum SessionExpiredType {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum StatAlgoImporterRibbonType {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.type;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum UIStateType {

View File

@ -8,8 +8,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
/**
* Dialog for Code Upload
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeUploadDialog extends Window {

View File

@ -31,8 +31,8 @@ import com.sencha.gxt.widget.core.client.form.FormPanel;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeUploadPanel extends FormPanel {

View File

@ -4,8 +4,8 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.type.ImportC
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ImportCodeDescription {

View File

@ -10,8 +10,8 @@ import com.sencha.gxt.widget.core.client.ProgressBar;
/**
* Updates a {@link ProgressBar} progress and text based on {@link FileUploadProgressListener} events.
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class FileUploadProgressBarUpdater implements FileUploadProgressListener {

View File

@ -8,8 +8,8 @@ import com.allen_sauer.gwt.log.client.Log;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class FileUploadProgressCardUpdater implements FileUploadProgressListener {

View File

@ -3,30 +3,28 @@
*/
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.upload.progress;
/**
* Defines a listener for file upload progress.
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public interface FileUploadProgressListener {
/**
* Called when the operation is starting.
*/
public void operationInitializing();
/**
* Called when there is a progress for the operation.
* @param elaborated the elaborated part.
*
* @param elaborated
* the elaborated part.
*/
public void operationUpdate(float elaborated);
/**
* Called when the operation is complete.
*/
@ -34,8 +32,14 @@ public interface FileUploadProgressListener {
/**
* Called when the operation is failed.
* @param caught the failure exception.
* @param reason the failure reason.
*
*
* @param caught
* error
* @param reason
* reason
* @param failureDetails
* details
*/
public void operationFailed(Throwable caught, String reason, String failureDetails);
}

View File

@ -15,15 +15,14 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
/**
*
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class FileUploadProgressUpdater extends Timer {
protected ArrayList<FileUploadProgressListener> listeners = new ArrayList<FileUploadProgressListener>();
/**
* {@inheritDoc}
*/
@ -32,97 +31,87 @@ public class FileUploadProgressUpdater extends Timer {
Log.debug("requesting operation progress");
StatAlgoImporterServiceAsync.INSTANCE.getFileUploadMonitor(new AsyncCallback<FileUploadMonitor>() {
public void onFailure(Throwable caught) {
cancel();
Log.error("Error retrieving the operation state", caught);
String message = getStack(caught);
fireOperationFailed(caught, "Failed getting operation updates", message);
}
public void onSuccess(FileUploadMonitor result) {
Log.info("retrieved FileUploadMonitor: "+result.getState());
Log.info("retrieved FileUploadMonitor: " + result.getState());
switch (result.getState()) {
case STARTED:
Log.debug("File Upload Started");
break;
case INPROGRESS:
Log.debug("Progress: "+result.getElaboratedLenght()+" of "+result.getTotalLenght());
Log.debug("Progress: " + result.getElaboratedLenght() + " of " + result.getTotalLenght());
fireOperationUpdate(result.getPercentDone());
break;
case FAILED:
Log.debug("File Upload Failed");
Log.debug("File Upload Failed");
cancel();
fireOperationFailed(new Throwable("File Upload Failed") ,result.getFailureReason(), result.getFailureDetails());
fireOperationFailed(new Throwable("File Upload Failed"), result.getFailureReason(),
result.getFailureDetails());
break;
case COMPLETED:
cancel();
Log.debug("File Upload Completed");
fireOperationComplete();
fireOperationComplete();
break;
default:
break;
}
}
});
}
protected String getStack(Throwable e)
{
String message = e.getLocalizedMessage()+" -> <br>";
protected String getStack(Throwable e) {
String message = e.getLocalizedMessage() + " -> <br>";
Throwable c = e.getCause();
if (c!=null) message += getStack(c);
if (c != null)
message += getStack(c);
return message;
}
protected void fireOperationInitializing()
{
for (FileUploadProgressListener listener:listeners) listener.operationInitializing();
}
protected void fireOperationUpdate(float elaborated)
{
for (FileUploadProgressListener listener:listeners) listener.operationUpdate(elaborated);
protected void fireOperationInitializing() {
for (FileUploadProgressListener listener : listeners)
listener.operationInitializing();
}
protected void fireOperationComplete()
{
for (FileUploadProgressListener listener:listeners) listener.operationComplete();
protected void fireOperationUpdate(float elaborated) {
for (FileUploadProgressListener listener : listeners)
listener.operationUpdate(elaborated);
}
protected void fireOperationFailed(Throwable caught, String failure, String failureDetails)
{
for (FileUploadProgressListener listener:listeners) listener.operationFailed(caught, failure, failureDetails);
protected void fireOperationComplete() {
for (FileUploadProgressListener listener : listeners)
listener.operationComplete();
}
protected void fireOperationFailed(Throwable caught, String failure, String failureDetails) {
for (FileUploadProgressListener listener : listeners)
listener.operationFailed(caught, failure, failureDetails);
}
/**
*
* @param listener
* listener
*/
public void addListener(FileUploadProgressListener listener)
{
public void addListener(FileUploadProgressListener listener) {
listeners.add(listener);
}
/**
*
* @param listener
* listener
*/
public void removeListener(FileUploadProgressListener listener)
{
public void removeListener(FileUploadProgressListener listener) {
listeners.remove(listener);
}
}

View File

@ -5,8 +5,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class Format {

View File

@ -4,8 +4,8 @@ import com.sencha.gxt.widget.core.client.box.MessageBox;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InfoMessageBox extends MessageBox {

View File

@ -11,8 +11,8 @@ import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class UtilsGXT3 {

View File

@ -33,8 +33,8 @@ import com.allen_sauer.gwt.log.client.Log;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class LocalUploadServlet extends HttpServlet {

View File

@ -11,10 +11,10 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
* @param <T>
*
* @param <T> type
*/
public class SessionOp<T> {

View File

@ -27,8 +27,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class SessionUtil {
@ -38,11 +38,12 @@ public class SessionUtil {
/**
*
* @param httpServletRequest
* @return
* @throws TDGWTServiceException
* http servlet request
* @return service credentials
* @throws StatAlgoImporterServiceException
* exception
*/
public static ServiceCredentials getServiceCredentials(
HttpServletRequest httpServletRequest)
public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest)
throws StatAlgoImporterServiceException {
return getServiceCredentials(httpServletRequest, null);
}
@ -50,12 +51,14 @@ public class SessionUtil {
/**
*
* @param httpServletRequest
* http servlet request
* @param scopeGroupId
* @return
* @throws TDGWTServiceException
* scope group id
* @return service credentials
* @throws StatAlgoImporterServiceException
* exception
*/
public static ServiceCredentials getServiceCredentials(
HttpServletRequest httpServletRequest, String scopeGroupId)
public static ServiceCredentials getServiceCredentials(HttpServletRequest httpServletRequest, String scopeGroupId)
throws StatAlgoImporterServiceException {
ServiceCredentials sCredentials = null;
@ -113,8 +116,7 @@ public class SessionUtil {
GCubeUser gCubeUser = pContext.getCurrentUser(httpServletRequest);
if (gCubeUser == null) {
String error = "Error retrieving gCubeUser in scope " + scope
+ ": " + gCubeUser;
String error = "Error retrieving gCubeUser in scope " + scope + ": " + gCubeUser;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
@ -122,8 +124,7 @@ public class SessionUtil {
userName = gCubeUser.getUsername();
if (userName == null || userName.isEmpty()) {
String error = "Error retrieving username in scope " + scope
+ ": " + userName;
String error = "Error retrieving username in scope " + scope + ": " + userName;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
@ -131,8 +132,7 @@ public class SessionUtil {
token = pContext.getCurrentUserToken(scope, userName);
if (token == null || token.isEmpty()) {
String error = "Error retrieving token for " + userName
+ " in " + scope + ": " + token;
String error = "Error retrieving token for " + userName + " in " + scope + ": " + token;
logger.error(error);
throw new StatAlgoImporterServiceException(error);
}
@ -176,16 +176,14 @@ public class SessionUtil {
} else {
groupId = String.valueOf(pContext
.getCurrentGroupId(httpServletRequest));
groupId = String.valueOf(pContext.getCurrentGroupId(httpServletRequest));
groupName = pContext.getCurrentGroupName(httpServletRequest);
}
sCredentials = new ServiceCredentials(userName, fullName, name,
lastName, email, scope, groupId, groupName, userAvatarURL,
token);
sCredentials = new ServiceCredentials(userName, fullName, name, lastName, email, scope, groupId, groupName,
userAvatarURL, token);
}
logger.info("ServiceCredentials: " + sCredentials);
@ -194,17 +192,14 @@ public class SessionUtil {
}
//
public static ArrayList<Recipient> getRecipients(
ServletContext servletContest) {
public static ArrayList<Recipient> getRecipients(ServletContext servletContest) {
@SuppressWarnings("unchecked")
ArrayList<Recipient> recipients = (ArrayList<Recipient>) servletContest
.getAttribute(Constants.RECIPIENTS);
ArrayList<Recipient> recipients = (ArrayList<Recipient>) servletContest.getAttribute(Constants.RECIPIENTS);
return recipients;
}
public static ArrayList<Recipient> setRecipients(
ServletContext servletContest, ArrayList<Recipient> recipients) {
public static ArrayList<Recipient> setRecipients(ServletContext servletContest, ArrayList<Recipient> recipients) {
servletContest.setAttribute(Constants.RECIPIENTS, recipients);
return recipients;
@ -214,60 +209,45 @@ public class SessionUtil {
public static FileUploadMonitor getFileUploadMonitor(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials) throws Exception {
SessionOp<FileUploadMonitor> sessionOp = new SessionOp<>();
FileUploadMonitor fileUploadMonitor = sessionOp.get(httpRequest,
serviceCredentials,
SessionConstants.FILE_UPLOAD_MONITOR,FileUploadMonitor.class);
FileUploadMonitor fileUploadMonitor = sessionOp.get(httpRequest, serviceCredentials,
SessionConstants.FILE_UPLOAD_MONITOR, FileUploadMonitor.class);
return fileUploadMonitor;
}
public static void setFileUploadMonitor(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials,
public static void setFileUploadMonitor(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
FileUploadMonitor fileUploadMonitor) {
SessionOp<FileUploadMonitor> sessionOp = new SessionOp<>();
sessionOp.set(httpRequest, serviceCredentials,
SessionConstants.FILE_UPLOAD_MONITOR,
fileUploadMonitor);
sessionOp.set(httpRequest, serviceCredentials, SessionConstants.FILE_UPLOAD_MONITOR, fileUploadMonitor);
}
//
public static CodeFileUploadSession getCodeFileUploadSession(
HttpServletRequest httpRequest,
public static CodeFileUploadSession getCodeFileUploadSession(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials) {
SessionOp<CodeFileUploadSession> sessionOp = new SessionOp<>();
CodeFileUploadSession fileUploadSession = sessionOp.get(httpRequest,
serviceCredentials,
CodeFileUploadSession fileUploadSession = sessionOp.get(httpRequest, serviceCredentials,
SessionConstants.IMPORT_CODE_FILE_UPLOAD_SESSION);
return fileUploadSession;
}
public static void setCodeFileUploadSession(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials,
public static void setCodeFileUploadSession(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
CodeFileUploadSession codeFileUploadSession) {
SessionOp<CodeFileUploadSession> sessionOp = new SessionOp<>();
sessionOp.set(httpRequest, serviceCredentials,
SessionConstants.IMPORT_CODE_FILE_UPLOAD_SESSION,
sessionOp.set(httpRequest, serviceCredentials, SessionConstants.IMPORT_CODE_FILE_UPLOAD_SESSION,
codeFileUploadSession);
}
//
public static Project getProjectSession(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials) {
public static Project getProjectSession(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials) {
SessionOp<Project> sessionOp = new SessionOp<>();
Project project = sessionOp.get(httpRequest, serviceCredentials,
SessionConstants.PROJECT);
Project project = sessionOp.get(httpRequest, serviceCredentials, SessionConstants.PROJECT);
return project;
}
public static void setProjectSession(HttpServletRequest httpRequest,
ServiceCredentials serviceCredentials, Project project) {
public static void setProjectSession(HttpServletRequest httpRequest, ServiceCredentials serviceCredentials,
Project project) {
SessionOp<Project> sessionOp = new SessionOp<>();
sessionOp.set(httpRequest, serviceCredentials,
SessionConstants.PROJECT, project);
sessionOp.set(httpRequest, serviceCredentials, SessionConstants.PROJECT, project);
}
}

View File

@ -30,8 +30,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class WPS4RParser {

View File

@ -7,8 +7,8 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputO
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class WPSAlgorithmInfo implements Serializable {

View File

@ -7,8 +7,8 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUpl
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeFileUploadSession implements Serializable {

View File

@ -20,8 +20,8 @@ import org.slf4j.LoggerFactory;
*
* Read code and convert it in ArrayList
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeReader {

View File

@ -11,8 +11,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class FileUploadListener implements ProgressListener {

View File

@ -17,15 +17,18 @@ import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class FileUtil {
protected static final Logger logger = LoggerFactory
.getLogger(FileUtil.class);
protected static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
public static final String[] ZIP_MIMETYPES = new String[] {
"application/x-compress", "application/x-compressed",
"application/x-gzip", "application/x-winzip", "application/x-zip",
"application/zip", "multipart/x-zip" };
public static final String[] ZIP_MIMETYPES = new String[] { "application/x-compress", "application/x-compressed",
"application/x-gzip", "application/x-winzip", "application/x-zip", "application/zip", "multipart/x-zip" };
/**
* Check if the content type is a zip type.
@ -48,10 +51,12 @@ public class FileUtil {
* the zip stream.
* @param os
* the output stream.
* @return zip entry name
* @throws Exception
* exception
*/
public static String unZip(InputStream is, OutputStream os)
throws Exception {
public static String unZip(InputStream is, OutputStream os) throws Exception {
try {
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry;
@ -87,20 +92,18 @@ public class FileUtil {
return message.toString();
}
public static void setImportCodeFile(CodeFileUploadSession fileUploadSession,
InputStream is, String name, String mimeType) throws Exception {
public static void setImportCodeFile(CodeFileUploadSession fileUploadSession, InputStream is, String name,
String mimeType) throws Exception {
File csvTmp = setImportFile(is, "import", ".code", name, mimeType);
fileUploadSession.setCodeName(name);
fileUploadSession.setCodeFile(csvTmp);
}
public static File setImportFile(InputStream is, String tempName,
String extention, String name, String mimeType) throws Exception {
public static File setImportFile(InputStream is, String tempName, String extention, String name, String mimeType)
throws Exception {
File fileTmp = File.createTempFile(tempName, extention);
fileTmp.deleteOnExit();

View File

@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class AlgorithmGenerator {

View File

@ -16,8 +16,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InfoGenerator {

View File

@ -31,8 +31,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ProjectBuilder {

View File

@ -18,7 +18,7 @@ import org.slf4j.LoggerFactory;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public class StatAlgoImporterPortlet extends GenericPortlet {

View File

@ -24,8 +24,8 @@ import org.slf4j.LoggerFactory;
/**
* TDMNotification notification sharing TR, templates or rules
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class AlgorithmNotification extends Thread {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class Recipient implements Serializable {

View File

@ -24,8 +24,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
@ -35,8 +35,7 @@ public class FilesStorage {
private static final String STATISTICAL_ALGORITHM_PROJECT_FILE_DESCRIPTION = "Statistical Algorithm Project File";
private static final String STATISTICAL_ALGORITHM_PROJECT_FILE_NAME = "stat_algo.project";
public static final Logger logger = LoggerFactory
.getLogger(FilesStorage.class);
public static final Logger logger = LoggerFactory.getLogger(FilesStorage.class);
/**
*
@ -44,28 +43,25 @@ public class FilesStorage {
* User
* @param itemId
* Item id
* @return Public link
* @return public link
* @throws StatAlgoImporterServiceException
* exception
*/
public String getPublicLink(String user, String itemId)
throws StatAlgoImporterServiceException {
public String getPublicLink(String user, String itemId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Get public link: [user=" + user + ", itemId=" + itemId
+ "]");
logger.info("Get public link: [user=" + user + ", itemId=" + itemId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(itemId);
if (workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Attention this is a folder!");
throw new StatAlgoImporterServiceException("Attention this is a folder!");
}
if (workSpaceItem instanceof FolderItem) {
return workSpaceItem.getPublicLink(false);
} else {
throw new StatAlgoImporterServiceException(
"Attention no public link for this item!");
throw new StatAlgoImporterServiceException("Attention no public link for this item!");
}
} catch (Throwable e) {
@ -83,30 +79,28 @@ public class FilesStorage {
* Item id
* @param folderId
* Folder id
* @return workspace item
* @throws StatAlgoImporterServiceException
* exception
*/
public WorkspaceItem copyItemOnFolder(String user, String itemId,
String folderId) throws StatAlgoImporterServiceException {
public WorkspaceItem copyItemOnFolder(String user, String itemId, String folderId)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Copy item on folder: [user=" + user + ", itemId="
+ itemId + ", folderId=" + folderId + "]");
logger.info("Copy item on folder: [user=" + user + ", itemId=" + itemId + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Destination is not a folder!");
throw new StatAlgoImporterServiceException("Destination is not a folder!");
}
WorkspaceItem item = ws.copy(itemId, folderId);
return item;
} catch (Throwable e) {
logger.error(
"Copy item on folder on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Copy item on folder on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -122,33 +116,29 @@ public class FilesStorage {
* Destination folder id
* @param newName
* New name
*
* @return workspace item
* @throws StatAlgoImporterServiceException
* exception
*/
public WorkspaceItem copyItemOnFolderWithNewName(String user,
String itemId, String folderId, String newName)
public WorkspaceItem copyItemOnFolderWithNewName(String user, String itemId, String folderId, String newName)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Copy item on folder with new name: [user=" + user
+ ", itemId=" + itemId + ", folderId=" + folderId
+ ", newName=" + newName + "]");
logger.info("Copy item on folder with new name: [user=" + user + ", itemId=" + itemId + ", folderId="
+ folderId + ", newName=" + newName + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Destination is not a folder!");
throw new StatAlgoImporterServiceException("Destination is not a folder!");
}
WorkspaceItem item = ws.copy(itemId, newName, folderId);
return item;
} catch (Throwable e) {
logger.error(
"Copy item on folder with new name on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Copy item on folder with new name on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -161,21 +151,19 @@ public class FilesStorage {
* @param itemId
* Item id
* @throws StatAlgoImporterServiceException
* exception
*/
public void deleteItemOnFolder(String user, String itemId)
throws StatAlgoImporterServiceException {
public void deleteItemOnFolder(String user, String itemId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Delete item on folder: [user=" + user + ", itemId="
+ itemId + "]");
logger.info("Delete item on folder: [user=" + user + ", itemId=" + itemId + "]");
ws = HomeLibrary.getUserWorkspace(user);
ws.removeItems(itemId);
return;
} catch (Throwable e) {
logger.error(
"Delete Item on workspace: " + e.getLocalizedMessage(), e);
logger.error("Delete Item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -185,24 +173,24 @@ public class FilesStorage {
/**
*
* @param user
* User
* user
* @param parentId
* Foler id
* parent id
* @param folderName
* folder name
* @throws StatAlgoImporterServiceException
* exception
*/
public void deleteFolder(String user, String parentId, String folderName)
throws StatAlgoImporterServiceException {
public void deleteFolder(String user, String parentId, String folderName) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Delete folder: [user=" + user + ", parentId="
+ parentId + ", folderName=" + folderName + "]");
logger.info("Delete folder: [user=" + user + ", parentId=" + parentId + ", folderName=" + folderName + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(parentId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"No valid project folder!");
throw new StatAlgoImporterServiceException("No valid project folder!");
}
WorkspaceItem target = ws.find(folderName, parentId);
@ -213,8 +201,7 @@ public class FilesStorage {
return;
} catch (Throwable e) {
logger.error(
"Delete folder on workspace: " + e.getLocalizedMessage(), e);
logger.error("Delete folder on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -224,36 +211,36 @@ public class FilesStorage {
/**
*
* @param user
* User
* user
* @param parentId
* Destination folder id
* @return Folder
* parent id
* @param folderName
* folder name
* @param folderDescription
* folder description
* @return workspace folder
* @throws StatAlgoImporterServiceException
* exception
*/
public WorkspaceFolder createFolder(String user, String parentId,
String folderName, String folderDescription)
public WorkspaceFolder createFolder(String user, String parentId, String folderName, String folderDescription)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Create folder: [user=" + user + ", parentId="
+ parentId + ", folderName=" + folderName
logger.info("Create folder: [user=" + user + ", parentId=" + parentId + ", folderName=" + folderName
+ ", folderDescription=" + folderDescription + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(parentId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"No valid project folder!");
throw new StatAlgoImporterServiceException("No valid project folder!");
}
WorkspaceFolder projectTargetFolder = ws.createFolder(folderName,
folderDescription, parentId);
WorkspaceFolder projectTargetFolder = ws.createFolder(folderName, folderDescription, parentId);
return projectTargetFolder;
} catch (Throwable e) {
logger.error(
"Create folder on workspace: " + e.getLocalizedMessage(), e);
logger.error("Create folder on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -265,23 +252,23 @@ public class FilesStorage {
* @param user
* User
* @param parentId
* Destination folder id
* @return Folder
* Parent id
* @param name
* Name
* @return workspace item
* @throws StatAlgoImporterServiceException
* Exception
*/
public WorkspaceItem find(String user, String parentId, String name)
throws StatAlgoImporterServiceException {
public WorkspaceItem find(String user, String parentId, String name) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Find: [user=" + user + ", parentId=" + parentId
+ ", name=" + name + "]");
logger.info("Find: [user=" + user + ", parentId=" + parentId + ", name=" + name + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(parentId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"No valid project folder!");
throw new StatAlgoImporterServiceException("No valid project folder!");
}
return ws.find(name, parentId);
@ -297,45 +284,40 @@ public class FilesStorage {
/**
*
* @param user
* user
* User
* @param inputStream
* input stream
* Input stream
* @param folderId
* destination folder
* Folder id
* @throws StatAlgoImporterServiceException
* Exception
*/
public void saveStatisticalAlgorithmProject(String user,
InputStream inputStream, String folderId)
public void saveStatisticalAlgorithmProject(String user, InputStream inputStream, String folderId)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Save project: [user=" + user + ", folderId="
+ folderId + "]");
logger.info("Save project: [user=" + user + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Destination is not a folder!");
throw new StatAlgoImporterServiceException("Destination is not a folder!");
}
WorkspaceItem projectItem = ws.find(
STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
WorkspaceItem projectItem = ws.find(STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
if (projectItem == null) {
ws.createExternalFile(STATISTICAL_ALGORITHM_PROJECT_FILE_NAME,
STATISTICAL_ALGORITHM_PROJECT_FILE_DESCRIPTION,
STATISTICAL_ALGORITHM_PROJECT_MIMETYPE, inputStream,
folderId);
STATISTICAL_ALGORITHM_PROJECT_FILE_DESCRIPTION, STATISTICAL_ALGORITHM_PROJECT_MIMETYPE,
inputStream, folderId);
} else {
ws.updateItem(projectItem.getId(), inputStream);
}
return;
} catch (Throwable e) {
logger.error(
"Save project on workspace: " + e.getLocalizedMessage(), e);
logger.error("Save project on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -344,49 +326,45 @@ public class FilesStorage {
/**
*
* @param user
* user
* User
* @param inputStream
* input stream
* Input stream
* @param name
* item name
* Name
* @param description
* item description
* Description
* @param mimeType
* item mimetype
* Mimetype
* @param folderId
* destination folder
* Folder destination
* @throws StatAlgoImporterServiceException
* Exception
*/
public void saveItemOnWorkspace(String user, InputStream inputStream,
String name, String description, String mimeType, String folderId)
throws StatAlgoImporterServiceException {
public void saveItemOnWorkspace(String user, InputStream inputStream, String name, String description,
String mimeType, String folderId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Save item on workspace: [user=" + user + ", name="
+ name + ", description=" + description + ", mimeType="
+ mimeType + ", folderId=" + folderId + "]");
logger.info("Save item on workspace: [user=" + user + ", name=" + name + ", description=" + description
+ ", mimeType=" + mimeType + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Destination is not a folder!");
throw new StatAlgoImporterServiceException("Destination is not a folder!");
}
WorkspaceItem projectItem = ws.find(name, folderId);
if (projectItem == null) {
ws.createExternalFile(name, description, mimeType, inputStream,
folderId);
ws.createExternalFile(name, description, mimeType, inputStream, folderId);
} else {
ws.updateItem(projectItem.getId(), inputStream);
}
return;
} catch (Throwable e) {
logger.error("Save item on workspace: " + e.getLocalizedMessage(),
e);
logger.error("Save item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -408,32 +386,27 @@ public class FilesStorage {
* Destination folder
* @return Workspace item
* @throws StatAlgoImporterServiceException
* Exceptioon
*/
public WorkspaceItem createItemOnWorkspace(String user,
InputStream inputStream, String name, String description,
String mimeType, String folderId)
throws StatAlgoImporterServiceException {
public WorkspaceItem createItemOnWorkspace(String user, InputStream inputStream, String name, String description,
String mimeType, String folderId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Create item on workspace: [user=" + user + ", name="
+ name + ", description=" + description + ", mimeType="
+ mimeType + ", folderId=" + folderId + "]");
logger.info("Create item on workspace: [user=" + user + ", name=" + name + ", description=" + description
+ ", mimeType=" + mimeType + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Destination is not a folder!");
throw new StatAlgoImporterServiceException("Destination is not a folder!");
}
ExternalFile workspaceItem = ws.createExternalFile(name,
description, mimeType, inputStream, folderId);
ExternalFile workspaceItem = ws.createExternalFile(name, description, mimeType, inputStream, folderId);
return workspaceItem;
} catch (Throwable e) {
logger.error(
"Create item on workspace: " + e.getLocalizedMessage(), e);
logger.error("Create item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -447,36 +420,32 @@ public class FilesStorage {
* Folder id
* @return Input stream
* @throws StatAlgoImporterServiceException
* Exception
*
*/
public InputStream retrieveProjectItemOnWorkspace(String user,
String folderId) throws StatAlgoImporterServiceException {
public InputStream retrieveProjectItemOnWorkspace(String user, String folderId)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Retrieve project item on workspace: [user=" + user
+ ", folderId=" + folderId + "]");
logger.info("Retrieve project item on workspace: [user=" + user + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Item is not valid folder!");
throw new StatAlgoImporterServiceException("Item is not valid folder!");
}
WorkspaceItem projectItem = ws.find(
STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
WorkspaceItem projectItem = ws.find(STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
if (projectItem == null) {
throw new StatAlgoImporterServiceException(
"No project found in this folder!");
throw new StatAlgoImporterServiceException("No project found in this folder!");
}
return retrieveInputStream(user, projectItem);
} catch (Throwable e) {
logger.error(
"Retrieve project item on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Retrieve project item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
@ -484,27 +453,26 @@ public class FilesStorage {
/**
*
* @param user
* User
* @param folderId
* @return boolean
* Folder id
* @return boolean True if exist
* @throws StatAlgoImporterServiceException
* Exception
*/
public boolean existProjectItemOnWorkspace(String user, String folderId)
throws StatAlgoImporterServiceException {
public boolean existProjectItemOnWorkspace(String user, String folderId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Exist project item on workspace: [user=" + user
+ ", folderId=" + folderId + "]");
logger.info("Exist project item on workspace: [user=" + user + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Item is not valid folder!");
throw new StatAlgoImporterServiceException("Item is not valid folder!");
}
WorkspaceItem projectItem = ws.find(
STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
WorkspaceItem projectItem = ws.find(STATISTICAL_ALGORITHM_PROJECT_FILE_NAME, folderId);
if (projectItem == null) {
return false;
@ -513,9 +481,7 @@ public class FilesStorage {
}
} catch (Throwable e) {
logger.error(
"Exist project item on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Exist project item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
@ -523,16 +489,18 @@ public class FilesStorage {
/**
*
* @param user
* User
* @param itemId
* @return WorkspaceItem
* Item id
* @return Workspace Item
* @throws StatAlgoImporterServiceException
* Exception
*/
public WorkspaceItem retrieveItemInfoOnWorkspace(String user, String itemId)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Retrieve item info on workspace: [user=" + user
+ ", itemId=" + itemId + "]");
logger.info("Retrieve item info on workspace: [user=" + user + ", itemId=" + itemId + "]");
ws = HomeLibrary.getUserWorkspace(user);
@ -540,9 +508,7 @@ public class FilesStorage {
return workSpaceItem;
} catch (Throwable e) {
logger.error(
"Retrieve item info on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Retrieve item info on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
@ -555,27 +521,24 @@ public class FilesStorage {
* Item id
* @return Input stream
* @throws StatAlgoImporterServiceException
* Excetpion
*/
public InputStream retrieveItemOnWorkspace(String user, String itemId)
throws StatAlgoImporterServiceException {
public InputStream retrieveItemOnWorkspace(String user, String itemId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Retrieve item on workspace: [user=" + user
+ ", itemId=" + itemId + "]");
logger.info("Retrieve item on workspace: [user=" + user + ", itemId=" + itemId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(itemId);
if (workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Folder Item is not valid!");
throw new StatAlgoImporterServiceException("Folder Item is not valid!");
}
return retrieveInputStream(user, workSpaceItem);
} catch (Throwable e) {
logger.error(
"Retieve item on workspace: " + e.getLocalizedMessage(), e);
logger.error("Retieve item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
@ -586,28 +549,24 @@ public class FilesStorage {
* @param user
* User
* @param wi
* WorkspaceItem
* Workspace item
* @return InputStream
* @throws StatAlgoImporterServiceException
* Exception
*/
public InputStream retrieveInputStream(String user, WorkspaceItem wi)
throws StatAlgoImporterServiceException {
public InputStream retrieveInputStream(String user, WorkspaceItem wi) throws StatAlgoImporterServiceException {
InputStream is = null;
try {
logger.info("Retrieve input stream: [user=" + user
+ ", workspaceItem=" + wi + "]");
logger.info("Retrieve input stream: [user=" + user + ", workspaceItem=" + wi + "]");
org.gcube.common.homelibrary.home.workspace.folder.items.File gcubeItem = ((org.gcube.common.homelibrary.home.workspace.folder.items.File) wi);
is = gcubeItem.getData();
return is;
} catch (Throwable e) {
logger.error(
"Error retrieving file from storage: "
+ e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(
"Error retrieving file from storage: "
+ e.getLocalizedMessage(), e);
logger.error("Error retrieving file from storage: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException("Error retrieving file from storage: " + e.getLocalizedMessage(),
e);
}
}
@ -621,24 +580,21 @@ public class FilesStorage {
* @param data
* String to save
* @throws StatAlgoImporterServiceException
* Exception
*/
public void saveStringInItem(String user, String itemId, String data)
throws StatAlgoImporterServiceException {
public void saveStringInItem(String user, String itemId, String data) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Save string in item: [user=" + user + ", itemId="
+ itemId + "]");
logger.info("Save string in item: [user=" + user + ", itemId=" + itemId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(itemId);
if (workSpaceItem == null) {
throw new StatAlgoImporterServiceException(
"No item retrieved on workspace!");
throw new StatAlgoImporterServiceException("No item retrieved on workspace!");
} else {
if (workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Item is a folder!");
throw new StatAlgoImporterServiceException("Item is a folder!");
} else {
}
@ -651,30 +607,36 @@ public class FilesStorage {
return;
} catch (Throwable e) {
logger.error(
"Save string in item on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Save string in item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
/**
*
* @param user
* User
* @param itemId
* Item id
* @param is
* Input stream
* @throws StatAlgoImporterServiceException
* Exception
*/
public void saveInputStreamInItem(String user, String itemId, InputStream is)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Save input stream in item: [user=" + user + ", itemId="
+ itemId + "]");
logger.info("Save input stream in item: [user=" + user + ", itemId=" + itemId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(itemId);
if (workSpaceItem == null) {
throw new StatAlgoImporterServiceException(
"No item retrieved on workspace!");
throw new StatAlgoImporterServiceException("No item retrieved on workspace!");
} else {
if (workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Item is a folder!");
throw new StatAlgoImporterServiceException("Item is a folder!");
} else {
}
@ -685,26 +647,31 @@ public class FilesStorage {
return;
} catch (Throwable e) {
logger.error(
"Save input stream in item on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Save input stream in item on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
public File zipFolder(String user, String folderId)
throws StatAlgoImporterServiceException {
/**
*
* @param user
* User
* @param folderId
* Folder Id
* @return Zip folder
* @throws StatAlgoImporterServiceException
* Exception
*/
public File zipFolder(String user, String folderId) throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Zip folder: [user=" + user + ", folderId="
+ folderId + "]");
logger.info("Zip folder: [user=" + user + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Item is not valid folder!");
throw new StatAlgoImporterServiceException("Item is not valid folder!");
}
WorkspaceFolder folder = (WorkspaceFolder) workSpaceItem;
@ -714,26 +681,35 @@ public class FilesStorage {
return fileZip;
} catch (Throwable e) {
logger.error("Zip folder on workspace: " + e.getLocalizedMessage(),
e);
logger.error("Zip folder on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
public File zipFolder(String user, String folderId,
List<String> idsToExclude) throws StatAlgoImporterServiceException {
/**
*
* @param user
* User
* @param folderId
* Folder id
* @param idsToExclude
* List of ids to exclude
* @return Zip folder
* @throws StatAlgoImporterServiceException
* Exception
*/
public File zipFolder(String user, String folderId, List<String> idsToExclude)
throws StatAlgoImporterServiceException {
Workspace ws;
try {
logger.info("Zip folder with exclude: [user=" + user + ", folderId="
+ folderId + "]");
logger.info("Zip folder with exclude: [user=" + user + ", folderId=" + folderId + "]");
ws = HomeLibrary.getUserWorkspace(user);
WorkspaceItem workSpaceItem = ws.getItem(folderId);
if (!workSpaceItem.isFolder()) {
throw new StatAlgoImporterServiceException(
"Item is not valid folder!");
throw new StatAlgoImporterServiceException("Item is not valid folder!");
}
WorkspaceFolder folder = (WorkspaceFolder) workSpaceItem;
@ -743,21 +719,25 @@ public class FilesStorage {
return fileZip;
} catch (Throwable e) {
logger.error(
"Zip folder with exclude on workspace: "
+ e.getLocalizedMessage(), e);
logger.error("Zip folder with exclude on workspace: " + e.getLocalizedMessage(), e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
}
public void downloadInputFile(String fileUrl, Path destination)
throws StatAlgoImporterServiceException {
/**
*
* @param fileUrl
* Url
* @param destination
* Destination
* @throws StatAlgoImporterServiceException
* Exception
*/
public void downloadInputFile(String fileUrl, Path destination) throws StatAlgoImporterServiceException {
try {
logger.info("Download input file: [fileUrl=" + fileUrl + ", destination="
+ destination + "]");
logger.info("Download input file: [fileUrl=" + fileUrl + ", destination=" + destination + "]");
URL smpFile = new URL(fileUrl);
URLConnection uc = (URLConnection) smpFile.openConnection();
@ -771,8 +751,7 @@ public class FilesStorage {
}
}
private void inputStreamToFile(InputStream is, Path destination)
throws FileNotFoundException, IOException {
private void inputStreamToFile(InputStream is, Path destination) throws FileNotFoundException, IOException {
FileOutputStream out = new FileOutputStream(destination.toFile());
byte buf[] = new byte[1024];
int len = 0;

View File

@ -17,15 +17,14 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*
*/
public class MainCodeSave {
private static final String ALGORITHM_DESCRIPTION = "Algorithm";
private static final String ALGORITHM_MIMETYPE = "text/plain";
public static final Logger logger = LoggerFactory
.getLogger(MainCodeSave.class);
public static final Logger logger = LoggerFactory.getLogger(MainCodeSave.class);
public MainCodeSave() {
@ -34,39 +33,44 @@ public class MainCodeSave {
/**
*
* @param serviceCredentials
* Service credentials
* @param file
* File
* @param code
* Code
* @param project
* Prject
* @throws StatAlgoImporterServiceException
* Exception
*/
public void save(ServiceCredentials serviceCredentials, ItemDescription file,
String code, Project project) throws StatAlgoImporterServiceException{
public void save(ServiceCredentials serviceCredentials, ItemDescription file, String code, Project project)
throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
filesStorage.saveStringInItem(serviceCredentials.getUserName(), file.getId(), code);
}
/**
*
* @param serviceCredentials
* @param file description of destination file
* @param code code to insert in the file
* @param project
* @return ItemDescription
* Service credentials
* @param file
* Description of destination file
* @param code
* Code to insert in the file
* @param project
* Project
* @return ItemDescription Item description
* @throws StatAlgoImporterServiceException
* exception
*/
public ItemDescription saveNew(ServiceCredentials serviceCredentials, ItemDescription file,
String code, Project project)
throws StatAlgoImporterServiceException {
public ItemDescription saveNew(ServiceCredentials serviceCredentials, ItemDescription file, String code,
Project project) throws StatAlgoImporterServiceException {
Path tempFile = createTempFile(file, code);
ItemDescription mainCode = saveInWorkspace(tempFile, serviceCredentials, file,
project);
ItemDescription mainCode = saveInWorkspace(tempFile, serviceCredentials, file, project);
return mainCode;
}
private Path createTempFile(ItemDescription file, String code)
throws StatAlgoImporterServiceException {
private Path createTempFile(ItemDescription file, String code) throws StatAlgoImporterServiceException {
try {
Path tempFile = Files.createTempFile(file.getName(), "");
@ -78,36 +82,29 @@ public class MainCodeSave {
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
}
private ItemDescription saveInWorkspace(Path tempFile,
ServiceCredentials serviceCredentials, ItemDescription file, Project project)
throws StatAlgoImporterServiceException {
private ItemDescription saveInWorkspace(Path tempFile, ServiceCredentials serviceCredentials, ItemDescription file,
Project project) throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
WorkspaceItem mainCodeItem;
try {
mainCodeItem = filesStorage.createItemOnWorkspace(
serviceCredentials.getUserName(),
Files.newInputStream(tempFile, StandardOpenOption.READ),
file.getName(), ALGORITHM_DESCRIPTION, ALGORITHM_MIMETYPE,
project.getProjectFolder().getFolder().getId());
mainCodeItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(),
Files.newInputStream(tempFile, StandardOpenOption.READ), file.getName(), ALGORITHM_DESCRIPTION,
ALGORITHM_MIMETYPE, project.getProjectFolder().getFolder().getId());
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
ItemDescription mainCode;
try {
mainCode = new ItemDescription(mainCodeItem.getId(),
mainCodeItem.getName(), mainCodeItem.getOwner()
.getPortalLogin(), mainCodeItem.getPath(),
mainCodeItem.getType().name());
mainCode = new ItemDescription(mainCodeItem.getId(), mainCodeItem.getName(),
mainCodeItem.getOwner().getPortalLogin(), mainCodeItem.getPath(), mainCodeItem.getType().name());
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();

View File

@ -19,8 +19,8 @@ import org.slf4j.LoggerFactory;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ProjectArchiver {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.server.uriresolver
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum ApplicationType {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class ServiceCredentials implements Serializable {

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class Constants {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class CodeData implements Serializable {

View File

@ -5,16 +5,14 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class StatAlgoImporterServiceException extends Exception {
private static final long serialVersionUID = -2255657546267656458L;
/**
*
*/
@ -24,15 +22,22 @@ public class StatAlgoImporterServiceException extends Exception {
/**
* @param message
* message
*/
public StatAlgoImporterServiceException(String message) {
super(message);
}
public StatAlgoImporterServiceException(String message,Throwable t) {
super(message,t);
/**
*
* @param message
* message
* @param throwable
* throwable
*
*/
public StatAlgoImporterServiceException(String message, Throwable throwable) {
super(message, throwable);
}
}

View File

@ -3,10 +3,10 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception;
/**
* ASL Session Expired Exception
*
* @author "Giancarlo Panichi"
* @author Giancarlo Panichi
*
*/
public class StatAlgoImporterSessionExpiredException extends StatAlgoImporterServiceException {
public class StatAlgoImporterSessionExpiredException extends StatAlgoImporterServiceException {
private static final long serialVersionUID = -4831171355042165166L;
@ -19,18 +19,21 @@ public class StatAlgoImporterSessionExpiredException extends StatAlgoImporterSe
/**
* @param message
* message
*/
public StatAlgoImporterSessionExpiredException(String message) {
super(message);
}
/**
*
* @param message
* @param t
* message
* @param throwable
* throwable
*/
public StatAlgoImporterSessionExpiredException(String message,Throwable t) {
super(message,t);
public StatAlgoImporterSessionExpiredException(String message, Throwable throwable) {
super(message, throwable);
}
}

View File

@ -7,22 +7,22 @@ import java.io.Serializable;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class FileUploadMonitor implements Serializable {
private static final long serialVersionUID = -1150111422206443617L;
protected long totalLenght;
protected long elaboratedLenght;
protected FileUploadState state;
protected String failureReason;
protected String failureDetails;
protected float percentDone;
public FileUploadMonitor(){
public FileUploadMonitor() {
state = FileUploadState.INPROGRESS;
}
@ -31,7 +31,7 @@ public class FileUploadMonitor implements Serializable {
this.elaboratedLenght = elaboratedLenght;
this.state = state;
this.failureReason = failureReason;
this.percentDone=0;
this.percentDone = 0;
}
/**
@ -40,7 +40,7 @@ public class FileUploadMonitor implements Serializable {
public long getTotalLenght() {
return totalLenght;
}
/**
* @return the elaboratedLenght
*/
@ -48,8 +48,7 @@ public class FileUploadMonitor implements Serializable {
return elaboratedLenght;
}
public FileUploadState getState(){
public FileUploadState getState() {
return state;
}
@ -76,8 +75,7 @@ public class FileUploadMonitor implements Serializable {
this.failureDetails = failureDetails;
}
public void setState(FileUploadState state)
{
public void setState(FileUploadState state) {
this.state = state;
}
@ -90,7 +88,8 @@ public class FileUploadMonitor implements Serializable {
}
/**
* @param totalLenght the totalLenght to set
* @param totalLenght
* the totalLenght to set
*/
public void setTotalLenght(long totalLenght) {
this.totalLenght = totalLenght;
@ -99,6 +98,7 @@ public class FileUploadMonitor implements Serializable {
/**
*
* @param elaboratedLenght
* elaborated lenght
*/
public void setElaboratedLenght(long elaboratedLenght) {
this.elaboratedLenght = elaboratedLenght;
@ -107,7 +107,9 @@ public class FileUploadMonitor implements Serializable {
/**
*
* @param failureReason
* failure reason
* @param failureDetails
* failure details
*/
public void setFailed(String failureReason, String failureDetails) {
this.state = FileUploadState.FAILED;
@ -117,11 +119,9 @@ public class FileUploadMonitor implements Serializable {
@Override
public String toString() {
return "FileUploadMonitor [totalLenght=" + totalLenght
+ ", elaboratedLenght=" + elaboratedLenght + ", state=" + state
+ ", failureReason=" + failureReason + ", failureDetails="
+ failureDetails + ", percentDone=" + percentDone + "]";
return "FileUploadMonitor [totalLenght=" + totalLenght + ", elaboratedLenght=" + elaboratedLenght + ", state="
+ state + ", failureReason=" + failureReason + ", failureDetails=" + failureDetails + ", percentDone="
+ percentDone + "]";
}
}

View File

@ -4,11 +4,16 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file;
/**
* @author Federico De Faveri defaveri@isti.cnr.it
*
* @author Giancarlo Panichi
*
*
*/
public enum FileUploadState {
/**
* The operation is started
*/
STARTED,
/**

View File

@ -5,8 +5,8 @@ import java.util.List;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum DataType {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class GlobalVariables implements Serializable {
@ -23,14 +23,18 @@ public class GlobalVariables implements Serializable {
/**
*
* @param id
* @param id
* id
* @param name
* name
* @param description
* description
* @param defaultValue
* default value
* @param dataType
* data type
*/
public GlobalVariables(int id, String name, String description,
String defaultValue, DataType dataType) {
public GlobalVariables(int id, String name, String description, String defaultValue, DataType dataType) {
super();
this.id = id;
this.name = name;
@ -81,12 +85,8 @@ public class GlobalVariables implements Serializable {
@Override
public String toString() {
return "GlobalVariables [id=" + id + ", name=" + name
+ ", description=" + description + ", defaultValue="
return "GlobalVariables [id=" + id + ", name=" + name + ", description=" + description + ", defaultValue="
+ defaultValue + ", dataType=" + dataType + "]";
}
}

View File

@ -5,8 +5,8 @@ import java.util.List;
/**
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public enum IOType {

View File

@ -4,8 +4,8 @@ import java.io.Serializable;
/**
*
* @author giancarlo email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi
*
*
*/
public class InputOutputVariables implements Serializable {

Some files were not shown because too many files have changed in this diff Show More