refs 2521: Explore the possibility to port the StatMan interface onto Dataminer
https://support.d4science.org/issues/2521 Fixed WPS Service access by cache git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128718 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
17fbaf90ca
commit
7309dd2a8f
|
@ -11,7 +11,10 @@ import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||||
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
@ -35,7 +38,7 @@ public class HomePanel extends SimpleContainer {
|
||||||
setItemId("HomePanel");
|
setItemId("HomePanel");
|
||||||
setStylePrimaryName("smMenu");
|
setStylePrimaryName("smMenu");
|
||||||
//setBodyStyle("backgroundColor:white;");
|
//setBodyStyle("backgroundColor:white;");
|
||||||
addStyleName("smLayoutContainer");
|
//addStyleName("smLayoutContainer");
|
||||||
//setHeaderVisible(false);
|
//setHeaderVisible(false);
|
||||||
setBorders(false);
|
setBorders(false);
|
||||||
//setBodyBorder(false);
|
//setBodyBorder(false);
|
||||||
|
@ -45,11 +48,17 @@ public class HomePanel extends SimpleContainer {
|
||||||
private void create() {
|
private void create() {
|
||||||
VerticalLayoutContainer lc = new VerticalLayoutContainer();
|
VerticalLayoutContainer lc = new VerticalLayoutContainer();
|
||||||
lc.setScrollMode(ScrollMode.AUTO);
|
lc.setScrollMode(ScrollMode.AUTO);
|
||||||
VerticalLayoutData layoutTop = new VerticalLayoutData(-1, -1,
|
|
||||||
new Margins(20, 90, 10, 90));
|
|
||||||
VerticalLayoutData layoutNext = new VerticalLayoutData(-1, -1,
|
|
||||||
new Margins(10, 90, 10, 90));
|
|
||||||
|
|
||||||
|
VerticalLayoutData layoutTop = new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(20,0,10,0));
|
||||||
|
VerticalLayoutData layoutNext = new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(10,0,10,0));
|
||||||
|
/*
|
||||||
|
VerticalLayoutData layoutTop = new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(20, 90, 10, 90));
|
||||||
|
VerticalLayoutData layoutNext = new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(10, 90, 10, 90));
|
||||||
|
*/
|
||||||
SimpleContainer itemDataSpace = createMenuItem(
|
SimpleContainer itemDataSpace = createMenuItem(
|
||||||
"Access to the Data Space",
|
"Access to the Data Space",
|
||||||
"The data space contains the set of input and output data sets of the users. It is possible to upload and share tables. Data sources can be chosen from those hosted by the infrastructure. Outputs of the computations can be even saved in this space.",
|
"The data space contains the set of input and output data sets of the users. It is possible to upload and share tables. Data sources can be chosen from those hosted by the infrastructure. Outputs of the computations can be even saved in this space.",
|
||||||
|
@ -102,19 +111,28 @@ public class HomePanel extends SimpleContainer {
|
||||||
|
|
||||||
private SimpleContainer createMenuItem(String title, String description,
|
private SimpleContainer createMenuItem(String title, String description,
|
||||||
ImageResource imgResource, MouseDownHandler handle) {
|
ImageResource imgResource, MouseDownHandler handle) {
|
||||||
HorizontalLayoutContainer horiz = new HorizontalLayoutContainer();
|
HBoxLayoutContainer horiz=new HBoxLayoutContainer(HBoxLayoutAlign.MIDDLE);
|
||||||
|
horiz.setPack(BoxLayoutPack.CENTER);
|
||||||
|
horiz.setEnableOverflow(false);
|
||||||
|
|
||||||
|
//HorizontalLayoutContainer horiz = new HorizontalLayoutContainer();
|
||||||
|
|
||||||
Image img = new Image(imgResource);
|
Image img = new Image(imgResource);
|
||||||
|
|
||||||
HTML text = new HTML("<b>" + title + "</b><br>" + description);
|
HTML text = new HTML("<b>" + title + "</b><br>" + description);
|
||||||
text.addStyleName("smMenuItemText");
|
text.addStyleName("smMenuItemText");
|
||||||
|
text.setWidth("400px");
|
||||||
HorizontalLayoutData textLayoutData = new HorizontalLayoutData(400,
|
HorizontalLayoutData textLayoutData = new HorizontalLayoutData(400,
|
||||||
140, new Margins(10, 5, 10, 10));
|
140, new Margins(10, 5, 10, 10));
|
||||||
HorizontalLayoutData imgLayoutData = new HorizontalLayoutData(140, 140,
|
HorizontalLayoutData imgLayoutData = new HorizontalLayoutData(140, 140,
|
||||||
new Margins(10, 10, 10, 5));
|
new Margins(10, 10, 10, 5));
|
||||||
|
|
||||||
horiz.add(text, textLayoutData);
|
//horiz.add(text, textLayoutData);
|
||||||
horiz.add(img, imgLayoutData);
|
//horiz.add(img, imgLayoutData);
|
||||||
|
|
||||||
|
horiz.add(text, new BoxLayoutData(new Margins(0)));
|
||||||
|
horiz.add(img,new BoxLayoutData(new Margins(0)));
|
||||||
|
|
||||||
|
|
||||||
SimpleContainer container = new SimpleContainer();
|
SimpleContainer container = new SimpleContainer();
|
||||||
container.addDomHandler(handle, MouseDownEvent.getType());
|
container.addDomHandler(handle, MouseDownEvent.getType());
|
||||||
|
@ -124,7 +142,14 @@ public class HomePanel extends SimpleContainer {
|
||||||
container.addStyleName("smMenuItem");
|
container.addStyleName("smMenuItem");
|
||||||
container.addStyleOnOver(container.getElement(), "smMenuItem:HOVER");
|
container.addStyleOnOver(container.getElement(), "smMenuItem:HOVER");
|
||||||
container.add(horiz);
|
container.add(horiz);
|
||||||
return container;
|
|
||||||
|
SimpleContainer container2 = new SimpleContainer();
|
||||||
|
HBoxLayoutContainer hbox=new HBoxLayoutContainer(HBoxLayoutAlign.MIDDLE);
|
||||||
|
hbox.setPack(BoxLayoutPack.CENTER);
|
||||||
|
hbox.setEnableOverflow(false);
|
||||||
|
hbox.add(container, new BoxLayoutData(new Margins(0)));
|
||||||
|
container2.add(hbox);
|
||||||
|
return container2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,8 @@ package org.gcube.portlets.user.dataminermanager.client.dataspace;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum DataSpacePropertiesType {
|
public enum DataSpacePropertiesType {
|
||||||
COMPUTATION_ID("computation_id"), DATA_DESCRIPTION("data_description"), CREATION_DATE(
|
COMPUTATION_ID("computation_id"), DATA_DESCRIPTION("data_description"), DATA_TYPE(
|
||||||
"creation_date"), DATA_TYPE("data_type"), OPERATOR_NAME("operator_name"), VRE(
|
"data_type"), OPERATOR_NAME("operator_name"), VRE("VRE");
|
||||||
"VRE");
|
|
||||||
/**
|
/**
|
||||||
* @param text
|
* @param text
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class InputDataSetsPanel extends FramedPanel {
|
||||||
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
||||||
|
|
||||||
VerticalLayoutContainer vResourcesExplorerContainer = new VerticalLayoutContainer();
|
VerticalLayoutContainer vResourcesExplorerContainer = new VerticalLayoutContainer();
|
||||||
vResourcesExplorerContainer.setScrollMode(ScrollMode.AUTO);
|
vResourcesExplorerContainer.setScrollMode(ScrollMode.AUTOY);
|
||||||
vResourcesExplorerContainer.add(wsResourcesExplorerPanel,
|
vResourcesExplorerContainer.add(wsResourcesExplorerPanel,
|
||||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ public class OutputDataSetsPanel extends FramedPanel {
|
||||||
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
||||||
|
|
||||||
VerticalLayoutContainer vResourcesExplorerContainer = new VerticalLayoutContainer();
|
VerticalLayoutContainer vResourcesExplorerContainer = new VerticalLayoutContainer();
|
||||||
vResourcesExplorerContainer.setScrollMode(ScrollMode.AUTO);
|
vResourcesExplorerContainer.setScrollMode(ScrollMode.AUTOY);
|
||||||
vResourcesExplorerContainer.add(wsResourcesExplorerPanel,
|
vResourcesExplorerContainer.add(wsResourcesExplorerPanel,
|
||||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
return smClient.getOperatorsClassifications();
|
List<OperatorsClassification> list= smClient.getOperatorsClassifications();
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
|
return list;
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -116,8 +118,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
|
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
return smClient.getInputParameters(operator);
|
List<Parameter> list=smClient.getInputParameters(operator);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
|
return list;
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -137,7 +140,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
logger.debug("StartComputation(): [ operator=" + operator + "]");
|
logger.debug("StartComputation(): [ operator=" + operator + "]");
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
return smClient.startComputation(operator);
|
ComputationId computationId= smClient.startComputation(operator);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
|
return computationId;
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -160,7 +165,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), itemDescription.getId());
|
aslSession.getUsername(), itemDescription.getId());
|
||||||
logger.debug("Properties: " + properties);
|
logger.debug("Properties: " + properties);
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
return smClient.resubmitComputation(properties);
|
ComputationId computationId= smClient.resubmitComputation(properties);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
|
return computationId;
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -180,7 +187,9 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
ASLSession aslSession = SessionUtil.getASLSession(session);
|
||||||
|
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
return smClient.getComputationStatus(computationId);
|
ComputationStatus computationStatus= smClient.getComputationStatus(computationId);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
|
return computationStatus;
|
||||||
|
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
|
@ -205,6 +214,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
StorageUtil.deleteItem(aslSession.getUsername(),
|
StorageUtil.deleteItem(aslSession.getUsername(),
|
||||||
itemDescription.getId());
|
itemDescription.getId());
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -285,7 +295,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
logger.debug("CancelComputation(): " + computationId);
|
logger.debug("CancelComputation(): " + computationId);
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
String result = smClient.cancelComputation(computationId);
|
String result = smClient.cancelComputation(computationId);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
return result;
|
return result;
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
|
@ -308,6 +318,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
OutputData outputData = smClient
|
OutputData outputData = smClient
|
||||||
.getOutputDataByComputationId(computationId);
|
.getOutputDataByComputationId(computationId);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
Log.debug("OutputData: " + outputData);
|
Log.debug("OutputData: " + outputData);
|
||||||
return outputData;
|
return outputData;
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
|
@ -334,7 +345,11 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
aslSession.getUsername(), itemDescription.getId());
|
aslSession.getUsername(), itemDescription.getId());
|
||||||
logger.debug("Properties: " + properties);
|
logger.debug("Properties: " + properties);
|
||||||
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
SClient smClient = SessionUtil.getSClient(session, aslSession);
|
||||||
return smClient.getComputationDataByComputationProperties(properties);
|
ComputationData computationData= smClient.getComputationDataByComputationProperties(properties);
|
||||||
|
SessionUtil.putSClient(session, smClient);
|
||||||
|
return computationData;
|
||||||
|
|
||||||
|
|
||||||
} catch (ServiceException e) {
|
} catch (ServiceException e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -90,12 +90,26 @@ public class SessionUtil {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void putSClient(HttpSession session, SClient sClient)
|
||||||
|
throws Exception {
|
||||||
|
SClient sc = (SClient) session.getAttribute(Constants.SClient);
|
||||||
|
if (sc == null) {
|
||||||
|
session.setAttribute(Constants.SClient, sClient);
|
||||||
|
} else {
|
||||||
|
session.removeAttribute(Constants.SClient);
|
||||||
|
session.setAttribute(Constants.SClient, sClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static SClient getSClient(HttpSession session, ASLSession aslSession)
|
public static SClient getSClient(HttpSession session, ASLSession aslSession)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
SClient sClient = (SClient) session.getAttribute(Constants.SClient);
|
SClient sClient = (SClient) session.getAttribute(Constants.SClient);
|
||||||
|
|
||||||
if (sClient == null) {
|
if (sClient == null) {
|
||||||
|
logger.info("Created new SClient");
|
||||||
ServiceCredential serviceCredential=new ServiceCredential(aslSession.getUsername(), aslSession.getScope(),
|
ServiceCredential serviceCredential=new ServiceCredential(aslSession.getUsername(), aslSession.getScope(),
|
||||||
SessionUtil.getToken(aslSession));
|
SessionUtil.getToken(aslSession));
|
||||||
SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential);
|
SClientBuilder sBuilder = new SClient4WPSBuilder(serviceCredential);
|
||||||
|
@ -105,6 +119,8 @@ public class SessionUtil {
|
||||||
director.constructSClient();
|
director.constructSClient();
|
||||||
sClient = director.getSClient();
|
sClient = director.getSClient();
|
||||||
session.setAttribute(Constants.SClient, sClient);
|
session.setAttribute(Constants.SClient, sClient);
|
||||||
|
} else {
|
||||||
|
logger.info("Use SClient in session");
|
||||||
}
|
}
|
||||||
|
|
||||||
return sClient;
|
return sClient;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.dataminermanager.server.smservice;
|
package org.gcube.portlets.user.dataminermanager.server.smservice;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -19,7 +20,10 @@ import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class SClient {
|
public abstract class SClient implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7087349607933493388L;
|
||||||
|
|
||||||
public SClient() {
|
public SClient() {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -74,6 +74,8 @@ import org.w3c.dom.NodeList;
|
||||||
*/
|
*/
|
||||||
public class SClient4WPS extends SClient {
|
public class SClient4WPS extends SClient {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1909871837115147159L;
|
||||||
private static Logger logger = LoggerFactory.getLogger(SClient4WPS.class);
|
private static Logger logger = LoggerFactory.getLogger(SClient4WPS.class);
|
||||||
// private static final int OPERATOR_BRIEF_DESCRIPTION_MAX_LENGHT = 170;
|
// private static final int OPERATOR_BRIEF_DESCRIPTION_MAX_LENGHT = 170;
|
||||||
private static final String OTHERS = "OTHERS";
|
private static final String OTHERS = "OTHERS";
|
||||||
|
@ -92,6 +94,7 @@ public class SClient4WPS extends SClient {
|
||||||
|
|
||||||
private StatWPSClientSession wpsClient;
|
private StatWPSClientSession wpsClient;
|
||||||
|
|
||||||
|
|
||||||
public SClient4WPS(ServiceCredential serviceCredential) throws Exception {
|
public SClient4WPS(ServiceCredential serviceCredential) throws Exception {
|
||||||
super();
|
super();
|
||||||
process = new HashMap<>();
|
process = new HashMap<>();
|
||||||
|
@ -155,12 +158,17 @@ public class SClient4WPS extends SClient {
|
||||||
private StatWPSClientSession createWPSClientSession() {
|
private StatWPSClientSession createWPSClientSession() {
|
||||||
if (wpsClient == null) {
|
if (wpsClient == null) {
|
||||||
wpsClient = new StatWPSClientSession(wpsUser, wpsToken);
|
wpsClient = new StatWPSClientSession(wpsUser, wpsToken);
|
||||||
|
logger.debug("Created StatWPSClientSession");
|
||||||
return wpsClient;
|
return wpsClient;
|
||||||
} else {
|
} else {
|
||||||
|
logger.debug("Use already created StatWPSClientSession");
|
||||||
return wpsClient;
|
return wpsClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OperatorsClassification> getOperatorsClassifications()
|
public List<OperatorsClassification> getOperatorsClassifications()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -365,6 +373,7 @@ public class SClient4WPS extends SClient {
|
||||||
|
|
||||||
private String executeProcessAsync(ExecuteRequestBuilder executeBuilder,
|
private String executeProcessAsync(ExecuteRequestBuilder executeBuilder,
|
||||||
ProcessDescriptionType processDescription) throws Exception {
|
ProcessDescriptionType processDescription) throws Exception {
|
||||||
|
StatWPSClientSession wpsClient = null;
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -388,8 +397,6 @@ public class SClient4WPS extends SClient {
|
||||||
ExecuteDocument execute = executeBuilder.getExecute();
|
ExecuteDocument execute = executeBuilder.getExecute();
|
||||||
execute.getExecute().setService("WPS");
|
execute.getExecute().setService("WPS");
|
||||||
// System.out.println("RESPONSE FORM:"+execute.getExecute().getResponseForm());
|
// System.out.println("RESPONSE FORM:"+execute.getExecute().getResponseForm());
|
||||||
StatWPSClientSession wpsClient = null;
|
|
||||||
|
|
||||||
wpsClient = createWPSClientSession();
|
wpsClient = createWPSClientSession();
|
||||||
wpsClient.connect(wpsProcessingServlet);
|
wpsClient.connect(wpsProcessingServlet);
|
||||||
logger.debug("Sending: " + execute);
|
logger.debug("Sending: " + execute);
|
||||||
|
@ -445,6 +452,7 @@ public class SClient4WPS extends SClient {
|
||||||
|
|
||||||
private ProcessOutputs retrieveProcessResult(String processLocation)
|
private ProcessOutputs retrieveProcessResult(String processLocation)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
StatWPSClientSession wpsClient = null;
|
||||||
try {
|
try {
|
||||||
logger.debug("RetrieveProcessResult: " + processLocation);
|
logger.debug("RetrieveProcessResult: " + processLocation);
|
||||||
wpsClient = createWPSClientSession();
|
wpsClient = createWPSClientSession();
|
||||||
|
@ -656,7 +664,7 @@ public class SClient4WPS extends SClient {
|
||||||
throw new Exception(e.getLocalizedMessage());
|
throw new Exception(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("ProcessInformation: "+processInformations);
|
logger.debug("ProcessInformation: " + processInformations);
|
||||||
|
|
||||||
List<Parameter> parameters = new ArrayList<>();
|
List<Parameter> parameters = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -831,6 +839,7 @@ public class SClient4WPS extends SClient {
|
||||||
@Override
|
@Override
|
||||||
public ComputationStatus getComputationStatus(ComputationId computationId)
|
public ComputationStatus getComputationStatus(ComputationId computationId)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
StatWPSClientSession wpsClient = null;
|
||||||
try {
|
try {
|
||||||
logger.debug("GetComputationStatus(): ComputationId="
|
logger.debug("GetComputationStatus(): ComputationId="
|
||||||
+ computationId);
|
+ computationId);
|
||||||
|
@ -859,7 +868,6 @@ public class SClient4WPS extends SClient {
|
||||||
computationStatus = new ComputationStatus(
|
computationStatus = new ComputationStatus(
|
||||||
Status.FAILED, 100f);
|
Status.FAILED, 100f);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
StatusType statusType = ((ExecuteResponseDocumentImpl) responseObject)
|
StatusType statusType = ((ExecuteResponseDocumentImpl) responseObject)
|
||||||
.getExecuteResponse().getStatus();
|
.getExecuteResponse().getStatus();
|
||||||
|
@ -1167,6 +1175,7 @@ public class SClient4WPS extends SClient {
|
||||||
@Override
|
@Override
|
||||||
public String cancelComputation(ComputationId computationId)
|
public String cancelComputation(ComputationId computationId)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
StatWPSClientSession wpsClient = null;
|
||||||
try {
|
try {
|
||||||
wpsClient = createWPSClientSession();
|
wpsClient = createWPSClientSession();
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,13 @@ package org.gcube.portlets.user.dataminermanager.server.smservice.wps;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
@ -41,18 +41,20 @@ import org.xml.sax.SAXException;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class StatWPSClientSession {
|
public class StatWPSClientSession implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1387670579312851370L;
|
||||||
private static Logger logger = LoggerFactory
|
private static Logger logger = LoggerFactory
|
||||||
.getLogger(StatWPSClientSession.class);
|
.getLogger(StatWPSClientSession.class);
|
||||||
private static final String OGC_OWS_URI = "http://www.opengeospatial.net/ows";
|
private static final String OGC_OWS_URI = "http://www.opengeospatial.net/ows";
|
||||||
private static String SUPPORTED_VERSION = "1.0.0";
|
private static String SUPPORTED_VERSION = "1.0.0";
|
||||||
|
|
||||||
// private static StatWPSClientSession session;
|
// private static StatWPSClientSession session;
|
||||||
private Map<String, CapabilitiesDocument> loggedServices;
|
private HashMap<String, CapabilitiesDocument> loggedServices;
|
||||||
private XmlOptions options = null;
|
private XmlOptions options = null;
|
||||||
|
|
||||||
// a Map of <url, all available process descriptions>
|
// a Map of <url, all available process descriptions>
|
||||||
public Map<String, ProcessDescriptionsDocument> processDescriptions;
|
public HashMap<String, ProcessDescriptionsDocument> processDescriptions;
|
||||||
private String user;
|
private String user;
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@ -61,6 +63,9 @@ public class StatWPSClientSession {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public StatWPSClientSession(String user, String password) {
|
public StatWPSClientSession(String user, String password) {
|
||||||
|
super();
|
||||||
|
logger.debug("Create StatWPSClientSession: [user=" + user
|
||||||
|
+ ", password=" + password + "]");
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
options = new XmlOptions();
|
options = new XmlOptions();
|
||||||
|
@ -80,20 +85,35 @@ public class StatWPSClientSession {
|
||||||
* @return true, if connect succeeded, false else.
|
* @return true, if connect succeeded, false else.
|
||||||
* @throws WPSClientException
|
* @throws WPSClientException
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean connect(String url) throws WPSClientException {
|
public boolean connect(String url) throws WPSClientException {
|
||||||
logger.info("CONNECT");
|
logger.info("CONNECT: " + url);
|
||||||
|
logger.info("LoggedSevices: " + loggedServices.keySet());
|
||||||
if (loggedServices.containsKey(url)) {
|
if (loggedServices.containsKey(url)) {
|
||||||
logger.info("Service already registered: " + url);
|
logger.info("Service already registered: " + url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
logger.debug("Service not registered");
|
||||||
CapabilitiesDocument capsDoc = retrieveCapsViaGET(url);
|
CapabilitiesDocument capsDoc = retrieveCapsViaGET(url);
|
||||||
if (capsDoc != null) {
|
if (capsDoc != null) {
|
||||||
|
logger.debug("Adding caps to logged services " + url);
|
||||||
loggedServices.put(url, capsDoc);
|
loggedServices.put(url, capsDoc);
|
||||||
|
logger.debug("Logged Services key: " + loggedServices.keySet());
|
||||||
|
} else {
|
||||||
|
logger.error("CapsDoc is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessDescriptionsDocument processDescs = describeAllProcesses(url);
|
ProcessDescriptionsDocument processDescs = describeAllProcesses(url);
|
||||||
if (processDescs != null && capsDoc != null) {
|
if (processDescs != null && capsDoc != null) {
|
||||||
|
logger.info("Adding processes descriptions to logged services "
|
||||||
|
+ url);
|
||||||
processDescriptions.put(url, processDescs);
|
processDescriptions.put(url, processDescs);
|
||||||
|
logger.debug("ProcessDescriptions key: "
|
||||||
|
+ processDescriptions.keySet());
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
logger.error("ProcessDescs is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.warn("retrieving caps failed, caps are null");
|
logger.warn("retrieving caps failed, caps are null");
|
||||||
|
@ -127,11 +147,11 @@ public class StatWPSClientSession {
|
||||||
* @param url
|
* @param url
|
||||||
*/
|
*/
|
||||||
public void disconnect(String url) {
|
public void disconnect(String url) {
|
||||||
if (loggedServices.containsKey(url)) {
|
/*
|
||||||
loggedServices.remove(url);
|
* if (loggedServices.containsKey(url)) { loggedServices.remove(url);
|
||||||
processDescriptions.remove(url);
|
* processDescriptions.remove(url);
|
||||||
logger.info("service removed successfully: " + url);
|
* logger.info("service removed successfully: " + url); }
|
||||||
}
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +160,11 @@ public class StatWPSClientSession {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<String> getLoggedServices() {
|
public List<String> getLoggedServices() {
|
||||||
return new ArrayList<String>(loggedServices.keySet());
|
if (loggedServices != null && loggedServices.keySet() != null) {
|
||||||
|
return new ArrayList<String>(loggedServices.keySet());
|
||||||
|
} else {
|
||||||
|
return new ArrayList<String>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,8 +358,10 @@ public class StatWPSClientSession {
|
||||||
|
|
||||||
private CapabilitiesDocument retrieveCapsViaGET(String url)
|
private CapabilitiesDocument retrieveCapsViaGET(String url)
|
||||||
throws WPSClientException {
|
throws WPSClientException {
|
||||||
|
logger.debug("retrieveCapsViaGET: " + url);
|
||||||
ClientCapabiltiesRequest req = new ClientCapabiltiesRequest();
|
ClientCapabiltiesRequest req = new ClientCapabiltiesRequest();
|
||||||
url = req.getRequest(url);
|
url = req.getRequest(url);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String authString = user + ":" + password;
|
String authString = user + ":" + password;
|
||||||
logger.debug("auth string: " + authString);
|
logger.debug("auth string: " + authString);
|
||||||
|
@ -351,7 +377,9 @@ public class StatWPSClientSession {
|
||||||
connection.setRequestProperty("Authorization", "Basic " + encoded);
|
connection.setRequestProperty("Authorization", "Basic " + encoded);
|
||||||
InputStream is = connection.getInputStream();
|
InputStream is = connection.getInputStream();
|
||||||
Document doc = checkInputStream(is);
|
Document doc = checkInputStream(is);
|
||||||
return CapabilitiesDocument.Factory.parse(doc, options);
|
CapabilitiesDocument capabilitiesDocument = CapabilitiesDocument.Factory
|
||||||
|
.parse(doc, options);
|
||||||
|
return capabilitiesDocument;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new WPSClientException(
|
throw new WPSClientException(
|
||||||
|
@ -410,7 +438,8 @@ public class StatWPSClientSession {
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new WPSClientException(e.getLocalizedMessage(), new Exception(e));
|
throw new WPSClientException(e.getLocalizedMessage(),
|
||||||
|
new Exception(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,8 +632,7 @@ public class StatWPSClientSession {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String cancelComputation(String url, String computationId)
|
||||||
public String cancelComputation(String url,String computationId)
|
|
||||||
throws WPSClientException {
|
throws WPSClientException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -614,14 +642,14 @@ public class StatWPSClientSession {
|
||||||
String encoded = new String(authEncBytes);
|
String encoded = new String(authEncBytes);
|
||||||
logger.debug("Base64 encoded auth string: " + encoded);
|
logger.debug("Base64 encoded auth string: " + encoded);
|
||||||
|
|
||||||
url+="?id="+computationId;
|
url += "?id=" + computationId;
|
||||||
URL urlObj = new URL(url);
|
URL urlObj = new URL(url);
|
||||||
HttpURLConnection connection = (HttpURLConnection) urlObj
|
HttpURLConnection connection = (HttpURLConnection) urlObj
|
||||||
.openConnection();
|
.openConnection();
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
connection.setRequestProperty("Authorization", "Basic " + encoded);
|
connection.setRequestProperty("Authorization", "Basic " + encoded);
|
||||||
String responseMessage= connection.getResponseMessage();
|
String responseMessage = connection.getResponseMessage();
|
||||||
return responseMessage;
|
return responseMessage;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -635,5 +663,4 @@ public class StatWPSClientSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.smMenu {
|
.smMenu {
|
||||||
width: 720px !important;
|
/*width: 720px !important;*/
|
||||||
height: 570px !important;
|
/*height: 570px !important;*/
|
||||||
|
/*overflow: auto;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.layoutContainerArea {
|
.layoutContainerArea {
|
||||||
|
|
Loading…
Reference in New Issue