ref 8819: Extend The Algorithms Importer to Manage Many Processes as Black Boxes

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

Updated the support for Processes as Black Boxes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@150345 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-06-12 16:21:54 +00:00
parent 27640a0cff
commit 7d94425542
11 changed files with 225 additions and 343 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/statistical-algorithms-importer-1.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/statistical-algorithms-importer-1.7.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.6.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/statistical-algorithms-importer-1.7.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.6.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/statistical-algorithms-importer-1.7.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,7 @@
<ReleaseNotes>
<Changeset component="${groupId}.${artifactId}.1-7-0" date="2017-07-01">
<Change>Added support for Processes as Black Boxes[ticket #8819]</Change>
</Changeset>
<Changeset component="${groupId}.${artifactId}.1-6-0" date="2017-06-12">
<Change>Support Java 8 compatibility [ticket #8541]</Change>
</Changeset>

View File

@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>statistical-algorithms-importer</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.7.0-SNAPSHOT</version>
<packaging>war</packaging>

View File

@ -404,10 +404,11 @@ public class ProjectManager {
public void softwareCreate(final InputData inputData, final StatAlgoImporterMonitor monitor) {
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData, new AsyncCallback<Void>() {
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData, new AsyncCallback<Project>() {
@Override
public void onSuccess(Void result) {
public void onSuccess(Project p) {
project=p;
monitor.hide();
fireProjectStatusSoftwareCreatedEvent();
UtilsGXT3.info("Create Software", "Software Created!");

View File

@ -70,7 +70,7 @@ public interface StatAlgoImporterService extends RemoteService {
public void saveCode(String code) throws StatAlgoImporterServiceException;
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException;
public Project createSoftware(InputData inputData) throws StatAlgoImporterServiceException;
public String getPublicLink(ItemDescription itemDescription) throws StatAlgoImporterServiceException;

View File

@ -54,7 +54,7 @@ public interface StatAlgoImporterServiceAsync {
void setNewMainCode(ItemDescription itemDescription, String code, AsyncCallback<Project> asyncCallback);
void createSoftware(InputData inputData, AsyncCallback<Void> callback);
void createSoftware(InputData inputData, AsyncCallback<Project> callback);
void getPublicLink(ItemDescription itemDescription, AsyncCallback<String> asyncCallback);

View File

@ -572,7 +572,7 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
}
@Override
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException {
public Project createSoftware(InputData inputData) throws StatAlgoImporterServiceException {
try {
HttpServletRequest httpRequest = this.getThreadLocalRequest();
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest);
@ -585,11 +585,13 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
project = projectBuilder.buildTarget();
SessionUtil.setProjectSession(httpRequest, serviceCredentials, project);
ProjectArchiver.archive(project, serviceCredentials);
return project;
} else {
throw new StatAlgoImporterServiceException("No project open!");
}
return;
} catch (StatAlgoImporterServiceException e) {
e.printStackTrace();
throw e;

View File

@ -14,6 +14,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.File
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.MainCode;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectSupportBlackBox;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
@ -126,10 +127,12 @@ public class MainGenerator {
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
project.getMainCode().setItemDescription(mainItemDescription);
MainCode mainCode=new MainCode(mainItemDescription);
project.setMainCode(mainCode);
logger.debug("MainCode: "
+ project.getMainCode().getItemDescription());
+ project.getMainCode());
} catch (StatAlgoImporterServiceException e) {

View File

@ -18,12 +18,15 @@ import org.apache.commons.io.FileUtils;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.blackbox.MainGenerator;
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage;
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.util.ServiceCredentials;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectCompile;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectDeploy;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectSupportBlackBox;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectSupportREdit;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.ProjectTarget;
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
import org.slf4j.Logger;
@ -66,11 +69,9 @@ public class ProjectBuilder {
private static final String CODE_JAR_DESCRIPTION = "Statistical Algorithm Jar";
private static final String JAR_EXTENTION = ".jar";
private static final SimpleDateFormat sdf = new SimpleDateFormat(
"yyyyMMdd_HHmmss");
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
public static final Logger logger = LoggerFactory
.getLogger(ProjectBuilder.class);
public static final Logger logger = LoggerFactory.getLogger(ProjectBuilder.class);
private Project project;
private String backupFolderId;
@ -128,57 +129,56 @@ public class ProjectBuilder {
private void createBackup() throws StatAlgoImporterServiceException {
createBackupOfPackageProject();
}
private void createMainCodeIfRequest() throws StatAlgoImporterServiceException {
//TODO
if (project.getMainCode() != null && project.getMainCode().getItemDescription() != null) {
ItemDescription mainCodeItemDescription = project.getMainCode().getItemDescription();
if (mainCodeItemDescription.getId() != null && !mainCodeItemDescription.getId().isEmpty()) {
FilesStorage filesStorage = new FilesStorage();
filesStorage.deleteItemOnFolder(serviceCredentials.getUserName(), mainCodeItemDescription.getId());
}
}
MainGenerator mainGenerator = new MainGenerator();
mainGenerator.createMain(serviceCredentials, project);
}
private void repackageProjectPackage()
throws StatAlgoImporterServiceException {
private void repackageProjectPackage() throws StatAlgoImporterServiceException {
List<String> idsToExclude = new ArrayList<String>();
idsToExclude.add(backupFolderId);
FilesStorage filesStorage = new FilesStorage();
if (project.getProjectTarget() != null
&& project.getProjectTarget().getFolder() != null
if (project.getProjectTarget() != null && project.getProjectTarget().getFolder() != null
&& project.getProjectTarget().getFolder().getId() != null
&& !project.getProjectTarget().getFolder().getId().isEmpty()) {
idsToExclude.add(project.getProjectTarget().getFolder().getId());
}
File projectPackageFile = filesStorage.zipFolder(
serviceCredentials.getUserName(), project.getProjectFolder()
.getFolder().getId(), idsToExclude);
File projectPackageFile = filesStorage.zipFolder(serviceCredentials.getUserName(),
project.getProjectFolder().getFolder().getId(), idsToExclude);
InputStream inputStream;
try {
inputStream = Files.newInputStream(projectPackageFile.toPath(),
StandardOpenOption.READ);
inputStream = Files.newInputStream(projectPackageFile.toPath(), StandardOpenOption.READ);
} catch (IOException e) {
logger.error("Error input stream generation for project package file: "
+ e.getLocalizedMessage());
logger.error("Error input stream generation for project package file: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
filesStorage.saveInputStreamInItem(serviceCredentials.getUserName(),
project.getProjectTarget().getProjectDeploy()
.getPackageProject().getId(), inputStream);
project.getProjectTarget().getProjectDeploy().getPackageProject().getId(), inputStream);
WorkspaceItem packageProject = filesStorage
.retrieveItemInfoOnWorkspace(serviceCredentials.getUserName(),
project.getProjectTarget().getProjectDeploy()
.getPackageProject().getId());
WorkspaceItem packageProject = filesStorage.retrieveItemInfoOnWorkspace(serviceCredentials.getUserName(),
project.getProjectTarget().getProjectDeploy().getPackageProject().getId());
ItemDescription packageProjectItemDescription;
try {
packageProjectItemDescription = new ItemDescription(
packageProject.getId(), packageProject.getName(),
packageProject.getOwner().getPortalLogin(),
packageProject.getPath(), packageProject.getType().name());
packageProjectItemDescription.setPublicLink(packageProject
.getPublicLink(false));
packageProjectItemDescription = new ItemDescription(packageProject.getId(), packageProject.getName(),
packageProject.getOwner().getPortalLogin(), packageProject.getPath(),
packageProject.getType().name());
packageProjectItemDescription.setPublicLink(packageProject.getPublicLink(false));
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
@ -186,24 +186,17 @@ public class ProjectBuilder {
}
project.getProjectTarget().getProjectDeploy()
.setPackageProject(packageProjectItemDescription);
logger.debug("ProjectDeploy: "
+ project.getProjectTarget().getProjectDeploy());
project.getProjectTarget().getProjectDeploy().setPackageProject(packageProjectItemDescription);
logger.debug("ProjectDeploy: " + project.getProjectTarget().getProjectDeploy());
}
private void createBackupOfPackageProject()
throws StatAlgoImporterServiceException {
private void createBackupOfPackageProject() throws StatAlgoImporterServiceException {
logger.debug("Create Backup of PackageProject");
if (project.getProjectTarget() != null
&& project.getProjectTarget().getProjectDeploy() != null
&& project.getProjectTarget().getProjectDeploy()
.getPackageProject() != null
&& project.getProjectTarget().getProjectDeploy()
.getPackageProject().getId() != null
&& !project.getProjectTarget().getProjectDeploy()
.getPackageProject().getId().isEmpty()) {
if (project.getProjectTarget() != null && project.getProjectTarget().getProjectDeploy() != null
&& project.getProjectTarget().getProjectDeploy().getPackageProject() != null
&& project.getProjectTarget().getProjectDeploy().getPackageProject().getId() != null
&& !project.getProjectTarget().getProjectDeploy().getPackageProject().getId().isEmpty()) {
createBackupFolder();
@ -211,16 +204,11 @@ public class ProjectBuilder {
GregorianCalendar now = new GregorianCalendar();
String packageProjectNewName = project.getInputData()
.getProjectInfo().getAlgorithmNameToClassName()
+ "_backup_"
+ sdf.format(now.getTime())
+ PROJECT_PACKAGE_EXTENTION;
String packageProjectNewName = project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
+ "_backup_" + sdf.format(now.getTime()) + PROJECT_PACKAGE_EXTENTION;
filesStorage.copyItemOnFolderWithNewName(
serviceCredentials.getUserName(), project
.getProjectTarget().getProjectDeploy()
.getPackageProject().getId(), backupFolderId,
filesStorage.copyItemOnFolderWithNewName(serviceCredentials.getUserName(),
project.getProjectTarget().getProjectDeploy().getPackageProject().getId(), backupFolderId,
packageProjectNewName);
}
@ -229,30 +217,23 @@ public class ProjectBuilder {
private void copyJarInDeploy() throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
if (project.getProjectTarget().getProjectDeploy().getCodeJar() != null
&& project.getProjectTarget().getProjectDeploy().getCodeJar()
.getId() != null
&& !project.getProjectTarget().getProjectDeploy().getCodeJar()
.getId().isEmpty()) {
&& project.getProjectTarget().getProjectDeploy().getCodeJar().getId() != null
&& !project.getProjectTarget().getProjectDeploy().getCodeJar().getId().isEmpty()) {
filesStorage.deleteItemOnFolder(serviceCredentials.getUserName(),
project.getProjectTarget().getProjectDeploy().getCodeJar()
.getId());
project.getProjectTarget().getProjectDeploy().getCodeJar().getId());
}
WorkspaceItem deployableCodeJarItem = filesStorage.copyItemOnFolder(
serviceCredentials.getUserName(), project.getProjectTarget()
.getProjectCompile().getCodeJar().getId(), project
.getProjectTarget().getProjectDeploy().getFolder()
.getId());
WorkspaceItem deployableCodeJarItem = filesStorage.copyItemOnFolder(serviceCredentials.getUserName(),
project.getProjectTarget().getProjectCompile().getCodeJar().getId(),
project.getProjectTarget().getProjectDeploy().getFolder().getId());
logger.debug("DeployableCodeJarItem:" + deployableCodeJarItem);
ItemDescription dCodeJar;
try {
dCodeJar = new ItemDescription(deployableCodeJarItem.getId(),
deployableCodeJarItem.getName(), deployableCodeJarItem
.getOwner().getPortalLogin(),
deployableCodeJarItem.getPath(), deployableCodeJarItem
.getType().name());
dCodeJar = new ItemDescription(deployableCodeJarItem.getId(), deployableCodeJarItem.getName(),
deployableCodeJarItem.getOwner().getPortalLogin(), deployableCodeJarItem.getPath(),
deployableCodeJarItem.getType().name());
dCodeJar.setPublicLink(deployableCodeJarItem.getPublicLink(false));
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
@ -262,47 +243,37 @@ public class ProjectBuilder {
}
project.getProjectTarget().getProjectDeploy().setCodeJar(dCodeJar);
logger.debug("ProjectDeploy: "
+ project.getProjectTarget().getProjectDeploy());
logger.debug("ProjectDeploy: " + project.getProjectTarget().getProjectDeploy());
}
private void checkInfoForRepackage()
throws StatAlgoImporterServiceException {
private void checkInfoForRepackage() throws StatAlgoImporterServiceException {
if (project == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Found!");
throw new StatAlgoImporterServiceException("Attention No Project Found!");
}
if (project.getProjectFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Project Folder Found!");
}
if (project.getProjectTarget() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Target Found!");
throw new StatAlgoImporterServiceException("Attention No Project Target Found!");
}
if (project.getProjectTarget().getFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Target Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Target Folder Found!");
}
if (project.getProjectTarget().getProjectDeploy() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Deploy Found!");
throw new StatAlgoImporterServiceException("Attention No Project Deploy Found!");
}
if (project.getProjectTarget().getProjectDeploy().getFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Deploy Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Deploy Folder Found!");
}
if (project.getProjectTarget().getProjectDeploy().getPackageProject() == null
|| project.getProjectTarget().getProjectDeploy()
.getPackageProject().getId() == null
|| project.getProjectTarget().getProjectDeploy()
.getPackageProject().getId().isEmpty()) {
|| project.getProjectTarget().getProjectDeploy().getPackageProject().getId() == null
|| project.getProjectTarget().getProjectDeploy().getPackageProject().getId().isEmpty()) {
throw new StatAlgoImporterServiceException(
"Attention No Project Package Found. Try to create software before!");
}
@ -311,81 +282,65 @@ public class ProjectBuilder {
private void checkInfoForDeploy() throws StatAlgoImporterServiceException {
if (project == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Found!");
throw new StatAlgoImporterServiceException("Attention No Project Found!");
}
if (project.getProjectFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Project Folder Found!");
}
if (project.getProjectTarget() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Target Found!");
throw new StatAlgoImporterServiceException("Attention No Project Target Found!");
}
if (project.getProjectTarget().getFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Target Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Target Folder Found!");
}
if (project.getProjectTarget().getProjectDeploy() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Deploy Found!");
throw new StatAlgoImporterServiceException("Attention No Project Deploy Found!");
}
if (project.getProjectTarget().getProjectDeploy().getFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Deploy Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Deploy Folder Found!");
}
if (project.getProjectTarget().getProjectDeploy().getPackageProject() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Package Found!");
throw new StatAlgoImporterServiceException("Attention No Project Package Found!");
}
if (project.getProjectTarget().getProjectCompile().getFolder() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Compile Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Compile Folder Found!");
}
if (project.getProjectTarget().getProjectCompile().getCodeSource() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Source Code Found!");
throw new StatAlgoImporterServiceException("Attention No Source Code Found!");
}
if (project.getProjectTarget().getProjectCompile().getCodeJar() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Jar Code Found!");
throw new StatAlgoImporterServiceException("Attention No Jar Code Found!");
}
if (project.getProjectTarget().getProjectCompile().getIntegrationInfo() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Integration Info Found!");
throw new StatAlgoImporterServiceException("Attention No Integration Info Found!");
}
}
private void createDeployFolder() throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
filesStorage.deleteFolder(serviceCredentials.getUserName(), project
.getProjectTarget().getFolder().getId(),
filesStorage.deleteFolder(serviceCredentials.getUserName(), project.getProjectTarget().getFolder().getId(),
STATISTICAL_ALGORITHM_DEPLOY_FOLDER_NAME);
WorkspaceFolder deployFolder = filesStorage.createFolder(
serviceCredentials.getUserName(), project.getProjectTarget()
.getFolder().getId(),
STATISTICAL_ALGORITHM_DEPLOY_FOLDER_NAME,
WorkspaceFolder deployFolder = filesStorage.createFolder(serviceCredentials.getUserName(),
project.getProjectTarget().getFolder().getId(), STATISTICAL_ALGORITHM_DEPLOY_FOLDER_NAME,
STATISTICAL_ALGORITHM_DEPLOY_FOLDER_DESCRIPTION);
logger.debug("PublicFolder:" + deployFolder);
ItemDescription pFolder;
try {
pFolder = new ItemDescription(deployFolder.getId(),
deployFolder.getName(), deployFolder.getOwner()
.getPortalLogin(), deployFolder.getPath(),
deployFolder.getType().name());
pFolder = new ItemDescription(deployFolder.getId(), deployFolder.getName(),
deployFolder.getOwner().getPortalLogin(), deployFolder.getPath(), deployFolder.getType().name());
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
@ -399,64 +354,64 @@ public class ProjectBuilder {
private void checkInfoForBuild() throws StatAlgoImporterServiceException {
if (project == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Found!");
throw new StatAlgoImporterServiceException("Attention No Project Found!");
}
if (project.getProjectFolder() == null
|| project.getProjectFolder().getFolder() == null
if (project.getProjectFolder() == null || project.getProjectFolder().getFolder() == null
|| project.getProjectFolder().getFolder().getId() == null
|| project.getProjectFolder().getFolder().getId().isEmpty()) {
throw new StatAlgoImporterServiceException(
"Attention No Project Folder Found!");
throw new StatAlgoImporterServiceException("Attention No Project Folder Found!");
}
if (project.getInputData() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Input Set!");
throw new StatAlgoImporterServiceException("Attention No Input Set!");
}
if (project.getInputData().getProjectInfo() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Project Information Set!");
throw new StatAlgoImporterServiceException("Attention No Project Information Set!");
}
if (project.getInputData().getProjectInfo().getAlgorithmName() == null
|| project.getInputData().getProjectInfo().getAlgorithmName()
.isEmpty()) {
throw new StatAlgoImporterServiceException(
"Attention No Info Name Set!");
|| project.getInputData().getProjectInfo().getAlgorithmName().isEmpty()) {
throw new StatAlgoImporterServiceException("Attention No Info Name Set!");
}
if (project.getInputData().getProjectInfo().getAlgorithmDescription() == null
|| project.getInputData().getProjectInfo()
.getAlgorithmDescription().isEmpty()) {
throw new StatAlgoImporterServiceException(
"Attention No Info Description Set!");
|| project.getInputData().getProjectInfo().getAlgorithmDescription().isEmpty()) {
throw new StatAlgoImporterServiceException("Attention No Info Description Set!");
}
if (project.getInputData().getInterpreterInfo() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Interpreter Info Set!");
throw new StatAlgoImporterServiceException("Attention No Interpreter Info Set!");
}
if (project.getInputData().getInterpreterInfo().getVersion() == null
|| project.getInputData().getInterpreterInfo().getVersion()
.isEmpty()) {
throw new StatAlgoImporterServiceException(
"Attention No Interpreter Version Set!");
|| project.getInputData().getInterpreterInfo().getVersion().isEmpty()) {
throw new StatAlgoImporterServiceException("Attention No Interpreter Version Set!");
}
if (project.getInputData().getListInputOutputVariables() == null
|| project.getInputData().getListInputOutputVariables().size() < 1) {
throw new StatAlgoImporterServiceException(
"Attention No Input/Output Set!");
throw new StatAlgoImporterServiceException("Attention No Input/Output Set!");
}
if (project.getMainCode() == null
|| project.getMainCode().getItemDescription() == null) {
throw new StatAlgoImporterServiceException(
"Attention No Main Code Set");
if (project.getProjectConfig() == null || project.getProjectConfig().getProjectSupport() == null) {
throw new StatAlgoImporterServiceException("Attention Invalid Project Configuration");
} else {
if (project.getProjectConfig().getProjectSupport() instanceof ProjectSupportREdit) {
if (project.getMainCode() == null || project.getMainCode().getItemDescription() == null) {
throw new StatAlgoImporterServiceException("Attention No Main Code Set");
}
} else {
if (project.getProjectConfig().getProjectSupport() instanceof ProjectSupportBlackBox) {
ProjectSupportBlackBox projectSupportBlackBox = (ProjectSupportBlackBox) project.getProjectConfig()
.getProjectSupport();
if (projectSupportBlackBox.getBinaryItem() == null) {
throw new StatAlgoImporterServiceException("Attention No Code Set");
}
}
}
}
}
@ -467,46 +422,37 @@ public class ProjectBuilder {
FilesStorage filesStorage = new FilesStorage();
if (project.getProjectTarget() != null
&& project.getProjectTarget().getFolder() != null
if (project.getProjectTarget() != null && project.getProjectTarget().getFolder() != null
&& project.getProjectTarget().getFolder().getId() != null
&& !project.getProjectTarget().getFolder().getId().isEmpty()) {
idsToExclude.add(project.getProjectTarget().getFolder().getId());
}
File projectPackageFile = filesStorage.zipFolder(
serviceCredentials.getUserName(), project.getProjectFolder()
.getFolder().getId(), idsToExclude);
File projectPackageFile = filesStorage.zipFolder(serviceCredentials.getUserName(),
project.getProjectFolder().getFolder().getId(), idsToExclude);
InputStream inputStream;
try {
inputStream = Files.newInputStream(projectPackageFile.toPath(),
StandardOpenOption.READ);
inputStream = Files.newInputStream(projectPackageFile.toPath(), StandardOpenOption.READ);
} catch (IOException e) {
logger.error("Error input stream generation for project package file: "
+ e.getLocalizedMessage());
logger.error("Error input stream generation for project package file: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
WorkspaceItem projectPackageItem;
projectPackageItem = filesStorage.createItemOnWorkspace(
serviceCredentials.getUserName(), inputStream, project
.getInputData().getProjectInfo()
.getAlgorithmNameToClassName()
+ PROJECT_PACKAGE_EXTENTION,
PROJECT_PACKAGE_DESCRIPTION, PROJECT_PACKAGE_MIMETYPE, project
.getProjectTarget().getProjectDeploy().getFolder()
.getId());
projectPackageItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(), inputStream,
project.getInputData().getProjectInfo().getAlgorithmNameToClassName() + PROJECT_PACKAGE_EXTENTION,
PROJECT_PACKAGE_DESCRIPTION, PROJECT_PACKAGE_MIMETYPE,
project.getProjectTarget().getProjectDeploy().getFolder().getId());
logger.debug("ProjectPackageItem:" + projectPackageItem);
ItemDescription packageUrl;
try {
packageUrl = new ItemDescription(projectPackageItem.getId(),
projectPackageItem.getName(), projectPackageItem.getOwner()
.getPortalLogin(), projectPackageItem.getPath(),
packageUrl = new ItemDescription(projectPackageItem.getId(), projectPackageItem.getName(),
projectPackageItem.getOwner().getPortalLogin(), projectPackageItem.getPath(),
projectPackageItem.getType().name());
packageUrl.setPublicLink(projectPackageItem.getPublicLink(false));
} catch (InternalErrorException e) {
@ -515,29 +461,23 @@ public class ProjectBuilder {
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
}
project.getProjectTarget().getProjectDeploy()
.setPackageProject(packageUrl);
project.getProjectTarget().getProjectDeploy().setPackageProject(packageUrl);
}
private void createTargetFolder() throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
filesStorage.deleteFolder(serviceCredentials.getUserName(), project
.getProjectFolder().getFolder().getId(),
filesStorage.deleteFolder(serviceCredentials.getUserName(), project.getProjectFolder().getFolder().getId(),
STATISTICAL_ALGORITHM_TARGET_FOLDER_NAME);
WorkspaceFolder targetFolder = filesStorage.createFolder(
serviceCredentials.getUserName(), project.getProjectFolder()
.getFolder().getId(),
STATISTICAL_ALGORITHM_TARGET_FOLDER_NAME,
WorkspaceFolder targetFolder = filesStorage.createFolder(serviceCredentials.getUserName(),
project.getProjectFolder().getFolder().getId(), STATISTICAL_ALGORITHM_TARGET_FOLDER_NAME,
STATISTICAL_ALGORITHM_TARGET_FOLDER_DESCRIPTION);
logger.debug("TargetFolder:" + targetFolder);
ItemDescription tFolder;
try {
tFolder = new ItemDescription(targetFolder.getId(),
targetFolder.getName(), targetFolder.getOwner()
.getPortalLogin(), targetFolder.getPath(),
targetFolder.getType().name());
tFolder = new ItemDescription(targetFolder.getId(), targetFolder.getName(),
targetFolder.getOwner().getPortalLogin(), targetFolder.getPath(), targetFolder.getType().name());
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
@ -551,23 +491,18 @@ public class ProjectBuilder {
private void createCompileFolder() throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
filesStorage.deleteFolder(serviceCredentials.getUserName(), project
.getProjectTarget().getFolder().getId(),
filesStorage.deleteFolder(serviceCredentials.getUserName(), project.getProjectTarget().getFolder().getId(),
STATISTICAL_ALGORITHM_COMPILE_FOLDER_NAME);
WorkspaceFolder compileFolder = filesStorage.createFolder(
serviceCredentials.getUserName(), project.getProjectTarget()
.getFolder().getId(),
STATISTICAL_ALGORITHM_COMPILE_FOLDER_NAME,
WorkspaceFolder compileFolder = filesStorage.createFolder(serviceCredentials.getUserName(),
project.getProjectTarget().getFolder().getId(), STATISTICAL_ALGORITHM_COMPILE_FOLDER_NAME,
STATISTICAL_ALGORITHM_COMPILE_FOLDER_DESCRIPTION);
logger.debug("CompileFolder:" + compileFolder);
ItemDescription cFolder;
try {
cFolder = new ItemDescription(compileFolder.getId(),
compileFolder.getName(), compileFolder.getOwner()
.getPortalLogin(), compileFolder.getPath(),
compileFolder.getType().name());
cFolder = new ItemDescription(compileFolder.getId(), compileFolder.getName(),
compileFolder.getOwner().getPortalLogin(), compileFolder.getPath(), compileFolder.getType().name());
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
@ -582,38 +517,30 @@ public class ProjectBuilder {
private void createBackupFolder() throws StatAlgoImporterServiceException {
FilesStorage filesStorage = new FilesStorage();
WorkspaceItem backupFolder = filesStorage.find(
serviceCredentials.getUserName(), project.getProjectFolder()
.getFolder().getId(),
STATISTICAL_ALGORITHM_BACKUP_FOLDER_NAME);
WorkspaceItem backupFolder = filesStorage.find(serviceCredentials.getUserName(),
project.getProjectFolder().getFolder().getId(), STATISTICAL_ALGORITHM_BACKUP_FOLDER_NAME);
if (backupFolder == null) {
WorkspaceFolder newBackupFolder = filesStorage.createFolder(
serviceCredentials.getUserName(), project
.getProjectFolder().getFolder().getId(),
STATISTICAL_ALGORITHM_BACKUP_FOLDER_NAME,
WorkspaceFolder newBackupFolder = filesStorage.createFolder(serviceCredentials.getUserName(),
project.getProjectFolder().getFolder().getId(), STATISTICAL_ALGORITHM_BACKUP_FOLDER_NAME,
STATISTICAL_ALGORITHM_BACKUP_FOLDER_DESCRIPTION);
logger.debug("BackupFolder:" + backupFolder);
try {
backupFolderId = newBackupFolder.getId();
} catch (InternalErrorException e) {
logger.error("Error retrieving Backup Folder Id: "
+ e.getLocalizedMessage());
logger.error("Error retrieving Backup Folder Id: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(
"Error retrieving Backup Folder Id", e);
throw new StatAlgoImporterServiceException("Error retrieving Backup Folder Id", e);
}
} else {
try {
backupFolderId = backupFolder.getId();
} catch (InternalErrorException e) {
logger.error("Error retrieving Backup Folder Id: "
+ e.getLocalizedMessage());
logger.error("Error retrieving Backup Folder Id: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(
"Error retrieving Backup Folder Id", e);
throw new StatAlgoImporterServiceException("Error retrieving Backup Folder Id", e);
}
}
@ -627,27 +554,21 @@ public class ProjectBuilder {
WorkspaceItem algorithmItem;
try {
algorithmItem = filesStorage.createItemOnWorkspace(
serviceCredentials.getUserName(), Files.newInputStream(
algorithmJava, StandardOpenOption.READ), project
.getInputData().getProjectInfo()
.getAlgorithmNameToClassName()
+ ALGORITHM_EXTENTION, ALGORITHM_DESCRIPTION,
ALGORITHM_MIMETYPE, project.getProjectTarget()
.getProjectCompile().getFolder().getId());
algorithmItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(),
Files.newInputStream(algorithmJava, StandardOpenOption.READ),
project.getInputData().getProjectInfo().getAlgorithmNameToClassName() + ALGORITHM_EXTENTION,
ALGORITHM_DESCRIPTION, ALGORITHM_MIMETYPE,
project.getProjectTarget().getProjectCompile().getFolder().getId());
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
ItemDescription codeSource;
try {
codeSource = new ItemDescription(algorithmItem.getId(),
algorithmItem.getName(), algorithmItem.getOwner()
.getPortalLogin(), algorithmItem.getPath(),
algorithmItem.getType().name());
codeSource = new ItemDescription(algorithmItem.getId(), algorithmItem.getName(),
algorithmItem.getOwner().getPortalLogin(), algorithmItem.getPath(), algorithmItem.getType().name());
codeSource.setPublicLink(algorithmItem.getPublicLink(false));
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
@ -656,15 +577,12 @@ public class ProjectBuilder {
}
project.getProjectTarget().getProjectCompile()
.setCodeSource(codeSource);
logger.debug("ProjectCompile: "
+ project.getProjectTarget().getProjectCompile());
project.getProjectTarget().getProjectCompile().setCodeSource(codeSource);
logger.debug("ProjectCompile: " + project.getProjectTarget().getProjectCompile());
}
private void createIntegrationInfo()
throws StatAlgoImporterServiceException {
private void createIntegrationInfo() throws StatAlgoImporterServiceException {
InfoGenerator integrationInfoGenerator = new InfoGenerator(project);
infoTXT = integrationInfoGenerator.createInfo();
@ -672,26 +590,21 @@ public class ProjectBuilder {
WorkspaceItem infoItem;
try {
infoItem = filesStorage.createItemOnWorkspace(
serviceCredentials.getUserName(),
Files.newInputStream(infoTXT, StandardOpenOption.READ),
INFO_NAME + INFO_EXTENTION, INFO_DESCRIPTION,
INFO_MIMETYPE, project.getProjectTarget()
.getProjectCompile().getFolder().getId());
infoItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(),
Files.newInputStream(infoTXT, StandardOpenOption.READ), INFO_NAME + INFO_EXTENTION,
INFO_DESCRIPTION, INFO_MIMETYPE,
project.getProjectTarget().getProjectCompile().getFolder().getId());
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
ItemDescription integrationItemDescription;
try {
integrationItemDescription = new ItemDescription(infoItem.getId(),
infoItem.getName(), infoItem.getOwner().getPortalLogin(),
infoItem.getPath(), infoItem.getType().name());
integrationItemDescription.setPublicLink(infoItem
.getPublicLink(false));
integrationItemDescription = new ItemDescription(infoItem.getId(), infoItem.getName(),
infoItem.getOwner().getPortalLogin(), infoItem.getPath(), infoItem.getType().name());
integrationItemDescription.setPublicLink(infoItem.getPublicLink(false));
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
@ -699,10 +612,8 @@ public class ProjectBuilder {
}
project.getProjectTarget().getProjectCompile()
.setIntegrationInfo(integrationItemDescription);
logger.debug("ProjectCompile: "
+ project.getProjectTarget().getProjectCompile());
project.getProjectTarget().getProjectCompile().setIntegrationInfo(integrationItemDescription);
logger.debug("ProjectCompile: " + project.getProjectTarget().getProjectCompile());
}
@ -714,54 +625,41 @@ public class ProjectBuilder {
try {
tempDirectory = Files.createTempDirectory("StatAlgorithmsJar");
} catch (IOException e) {
logger.error("Error creating temporal directory: "
+ e.getLocalizedMessage());
logger.error("Error creating temporal directory: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
logger.debug("TempDir: " + tempDirectory);
File packageHome = new File(tempDirectory.toAbsolutePath().toString()
+ File.separator + "org" + File.separator + "gcube"
+ File.separator + "dataanalysis" + File.separator + "executor"
+ File.separator + "rscripts");
File packageHome = new File(
tempDirectory.toAbsolutePath().toString() + File.separator + "org" + File.separator + "gcube"
+ File.separator + "dataanalysis" + File.separator + "executor" + File.separator + "rscripts");
packageHome.mkdirs();
Path packageHomeDir = packageHome.toPath();
Path ecologicalEngineJar = new File(tempDirectory.toFile(),
ECOLOGICAL_ENGINE_JAR).toPath();
storage.downloadInputFile(ECOLOGICAL_ENGINE_JAR_URL,
ecologicalEngineJar);
Path ecologicalEngineSmartExecutorJar = new File(
tempDirectory.toFile(), ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR)
Path ecologicalEngineJar = new File(tempDirectory.toFile(), ECOLOGICAL_ENGINE_JAR).toPath();
storage.downloadInputFile(ECOLOGICAL_ENGINE_JAR_URL, ecologicalEngineJar);
Path ecologicalEngineSmartExecutorJar = new File(tempDirectory.toFile(), ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR)
.toPath();
storage.downloadInputFile(ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR_URL,
ecologicalEngineSmartExecutorJar);
storage.downloadInputFile(ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR_URL, ecologicalEngineSmartExecutorJar);
Path algorithmTempFile = new File(packageHomeDir.toFile(), project
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
+ ALGORITHM_EXTENTION).toPath();
Path algorithmTempFile = new File(packageHomeDir.toFile(),
project.getInputData().getProjectInfo().getAlgorithmNameToClassName() + ALGORITHM_EXTENTION).toPath();
try {
Files.copy(algorithmJava, algorithmTempFile);
} catch (IOException e) {
logger.error("Error in alogrithm java copy in package directory: "
+ e.getLocalizedMessage());
logger.error("Error in alogrithm java copy in package directory: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
Path infoTempFile = new File(tempDirectory.toFile(), INFO_NAME
+ INFO_EXTENTION).toPath();
Path infoTempFile = new File(tempDirectory.toFile(), INFO_NAME + INFO_EXTENTION).toPath();
try {
Files.copy(infoTXT, infoTempFile);
} catch (IOException e) {
logger.error("Error in info copy in temp directory: "
+ e.getLocalizedMessage());
logger.error("Error in info copy in temp directory: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
createClassFile(tempDirectory, packageHomeDir);
@ -769,11 +667,9 @@ public class ProjectBuilder {
try {
Files.delete(algorithmTempFile);
} catch (IOException e) {
logger.error("Error in delete java file in package directory: "
+ e.getLocalizedMessage());
logger.error("Error in delete java file in package directory: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
createJarFile(tempDirectory, infoTempFile);
@ -783,50 +679,39 @@ public class ProjectBuilder {
FileUtils.cleanDirectory(tempDirectory.toFile());
FileUtils.deleteDirectory(tempDirectory.toFile());
} catch (IOException e) {
logger.error("Error in delete temp directory: "
+ e.getLocalizedMessage());
logger.error("Error in delete temp directory: " + e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
return;
}
private void copyJarOnWorkspace(Path tempDirectory)
throws StatAlgoImporterServiceException {
Path codeJar = Paths.get(tempDirectory.toString(), project
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
+ JAR_EXTENTION);
private void copyJarOnWorkspace(Path tempDirectory) throws StatAlgoImporterServiceException {
Path codeJar = Paths.get(tempDirectory.toString(),
project.getInputData().getProjectInfo().getAlgorithmNameToClassName() + JAR_EXTENTION);
FilesStorage filesStorage = new FilesStorage();
WorkspaceItem codeJarItem;
try {
codeJarItem = filesStorage.createItemOnWorkspace(
serviceCredentials.getUserName(),
codeJarItem = filesStorage.createItemOnWorkspace(serviceCredentials.getUserName(),
Files.newInputStream(codeJar, StandardOpenOption.READ),
project.getInputData().getProjectInfo()
.getAlgorithmNameToClassName()
+ JAR_EXTENTION, CODE_JAR_DESCRIPTION,
CODE_JAR_MIMETYPE, project.getProjectTarget()
.getProjectCompile().getFolder().getId());
project.getInputData().getProjectInfo().getAlgorithmNameToClassName() + JAR_EXTENTION,
CODE_JAR_DESCRIPTION, CODE_JAR_MIMETYPE,
project.getProjectTarget().getProjectCompile().getFolder().getId());
} catch (IOException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
ItemDescription codeJarItemDescription;
try {
codeJarItemDescription = new ItemDescription(codeJarItem.getId(),
codeJarItem.getName(), codeJarItem.getOwner()
.getPortalLogin(), codeJarItem.getPath(),
codeJarItem.getType().name());
codeJarItemDescription.setPublicLink(codeJarItem
.getPublicLink(false));
codeJarItemDescription = new ItemDescription(codeJarItem.getId(), codeJarItem.getName(),
codeJarItem.getOwner().getPortalLogin(), codeJarItem.getPath(), codeJarItem.getType().name());
codeJarItemDescription.setPublicLink(codeJarItem.getPublicLink(false));
} catch (InternalErrorException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
@ -834,24 +719,19 @@ public class ProjectBuilder {
}
project.getProjectTarget().getProjectCompile()
.setCodeJar(codeJarItemDescription);
logger.debug("ProjectCompile: "
+ project.getProjectTarget().getProjectCompile());
project.getProjectTarget().getProjectCompile().setCodeJar(codeJarItemDescription);
logger.debug("ProjectCompile: " + project.getProjectTarget().getProjectCompile());
}
private void createClassFile(Path tempDirectory, Path packageHome)
throws StatAlgoImporterServiceException {
private void createClassFile(Path tempDirectory, Path packageHome) throws StatAlgoImporterServiceException {
try {
ProcessBuilder pb = new ProcessBuilder("javac", "-encoding",
"utf-8", "-cp", tempDirectory.toAbsolutePath().toString()
+ "/*", packageHome.toAbsolutePath().toString()
+ File.separator
+ project.getInputData().getProjectInfo()
.getAlgorithmNameToClassName()
ProcessBuilder pb = new ProcessBuilder("javac", "-encoding", "utf-8", "-cp",
tempDirectory.toAbsolutePath().toString() + "/*",
packageHome.toAbsolutePath().toString() + File.separator
+ project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
+ ALGORITHM_EXTENTION);
pb.directory(tempDirectory.toFile());
Path logTXT = new File(tempDirectory.toFile(), LOG_TXT).toPath();
@ -865,8 +745,7 @@ public class ProjectBuilder {
int exitValue = process.waitFor();
logger.debug("Create Algo Class: Exit Value is " + exitValue);
DirectoryStream<Path> packageHomeStream = Files
.newDirectoryStream(packageHome);
DirectoryStream<Path> packageHomeStream = Files.newDirectoryStream(packageHome);
boolean createdFilesClass = false;
for (Path path : packageHomeStream) {
if (path.toString().endsWith(".class")) {
@ -876,28 +755,23 @@ public class ProjectBuilder {
}
if (!createdFilesClass) {
throw new StatAlgoImporterServiceException(
"Error in the creation of the class files!");
throw new StatAlgoImporterServiceException("Error in the creation of the class files!");
}
} catch (IOException | InterruptedException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
}
private void createJarFile(Path tempDirectory, Path infoTempFile)
throws StatAlgoImporterServiceException {
private void createJarFile(Path tempDirectory, Path infoTempFile) throws StatAlgoImporterServiceException {
try {
List<String> commands = new ArrayList<>();
commands.add("jar");
commands.add("-cvf");
commands.add(project.getInputData().getProjectInfo()
.getAlgorithmNameToClassName()
+ JAR_EXTENTION);
commands.add(project.getInputData().getProjectInfo().getAlgorithmNameToClassName() + JAR_EXTENTION);
/*
* DirectoryStream<Path> directoryStream = Files
@ -913,8 +787,7 @@ public class ProjectBuilder {
ProcessBuilder pb = new ProcessBuilder(commands);
pb.directory(tempDirectory.toFile());
Path logTXT = new File(tempDirectory.toFile(), LOG_JAR_TXT)
.toPath();
Path logTXT = new File(tempDirectory.toFile(), LOG_JAR_TXT).toPath();
pb.redirectErrorStream(true);
pb.redirectOutput(Redirect.appendTo(logTXT.toFile()));
@ -928,8 +801,7 @@ public class ProjectBuilder {
} catch (IOException | InterruptedException e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
e);
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(), e);
}
}

View File

@ -8,7 +8,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared;
*/
public class Constants {
public static final boolean DEBUG_MODE = true;
public static final boolean DEBUG_MODE = false;
public static final boolean TEST_ENABLE = false;
public static final String APPLICATION_ID = "org.gcube.portlets.user.statisticalalgorithmsimporter.server.portlet.StatAlgoImporterPortlet";

View File

@ -1,5 +1,6 @@
{ "recipients": [ { "user":"giancarlo.panichi", "surname":"Panichi", "name":"Giancarlo"},
{ "user":"gianpaolo.coro", "surname":"Coro", "name":"Gianpaolo"},
{ "user":"scarponi", "surname":"Scarponi", "name":"Paolo"},
{ "user":"lucio.lelii", "surname":"Lelii", "name":"Lucio"},
{ "user":"statistical.manager", "surname":"Manager", "name":"Statistical"},
{ "user":"roberto.cirillo", "surname":"Cirillo", "name":"Roberto"} ] }