Minor update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/data-miner-manager-cl@134863 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7cda53e606
commit
177f399ea2
|
@ -8,7 +8,7 @@ import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClient;
|
|||
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClient4WPSBuilder;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClientBuilder;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.SClientDirector;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredential;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredentials;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.Constants;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.exception.ServiceException;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -41,7 +41,7 @@ public class DataMinerService {
|
|||
|
||||
public SClient getClient() throws Exception {
|
||||
|
||||
ServiceCredential serviceCredential = getServiceCredential();
|
||||
ServiceCredentials serviceCredential = getServiceCredentials();
|
||||
|
||||
/*
|
||||
* if (cachedSClients.isEmpty() ||
|
||||
|
@ -65,7 +65,7 @@ public class DataMinerService {
|
|||
|
||||
public SClient getClient(String token) throws Exception {
|
||||
|
||||
ServiceCredential serviceCredential = getServiceCredential(token);
|
||||
ServiceCredentials serviceCredential = getServiceCredentials(token);
|
||||
|
||||
/*
|
||||
* if (cachedSClients.isEmpty() ||
|
||||
|
@ -88,7 +88,7 @@ public class DataMinerService {
|
|||
|
||||
|
||||
|
||||
private ServiceCredential getServiceCredential() throws ServiceException {
|
||||
private ServiceCredentials getServiceCredentials() throws ServiceException {
|
||||
String userName = null;
|
||||
String token = null;
|
||||
String scope = null;
|
||||
|
@ -120,7 +120,7 @@ public class DataMinerService {
|
|||
|
||||
}
|
||||
|
||||
ServiceCredential serviceCredential = new ServiceCredential(userName,
|
||||
ServiceCredentials serviceCredential = new ServiceCredentials(userName,
|
||||
scope, token);
|
||||
|
||||
logger.debug("Credential: " + serviceCredential);
|
||||
|
@ -130,7 +130,7 @@ public class DataMinerService {
|
|||
}
|
||||
|
||||
|
||||
private ServiceCredential getServiceCredential(String token) throws ServiceException {
|
||||
private ServiceCredentials getServiceCredentials(String token) throws ServiceException {
|
||||
String userName = null;
|
||||
String scope = null;
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class DataMinerService {
|
|||
|
||||
}
|
||||
|
||||
ServiceCredential serviceCredential = new ServiceCredential(userName,
|
||||
ServiceCredentials serviceCredential = new ServiceCredentials(userName,
|
||||
scope, token);
|
||||
|
||||
logger.debug("Credential: " + serviceCredential);
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.gcube.data.analysis.dataminermanagercl.server.dmservice.wps.WPS2DM;
|
|||
import org.gcube.data.analysis.dataminermanagercl.server.dmservice.wps.computationsvalue.ComputationValueBuilder;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.is.InformationSystemUtils;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.storage.StorageUtil;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredential;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredentials;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.Constants;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData;
|
||||
|
@ -94,16 +94,16 @@ public class SClient4WPS extends SClient {
|
|||
|
||||
private SClient4WPSSession wpsClient;
|
||||
|
||||
public SClient4WPS(ServiceCredential serviceCredential)
|
||||
public SClient4WPS(ServiceCredentials serviceCredentials)
|
||||
throws ServiceException {
|
||||
super();
|
||||
process = new HashMap<>();
|
||||
runningProcess = new HashMap<>();
|
||||
if (serviceCredential == null) {
|
||||
if (serviceCredentials == null) {
|
||||
logger.error("Error credetials are null!");
|
||||
throw new ServiceException("Error credetials are null!");
|
||||
} else {
|
||||
String token = serviceCredential.getToken();
|
||||
String token = serviceCredentials.getToken();
|
||||
if (token == null || token.isEmpty()) {
|
||||
logger.error("Error authorization token invalid: " + token);
|
||||
throw new ServiceException(
|
||||
|
@ -112,7 +112,7 @@ public class SClient4WPS extends SClient {
|
|||
wpsToken = token;
|
||||
}
|
||||
|
||||
String userName = serviceCredential.getUsername();
|
||||
String userName = serviceCredentials.getUsername();
|
||||
if (userName == null || userName.isEmpty()) {
|
||||
logger.error("Error invalid user name: " + userName);
|
||||
throw new ServiceException("Error invalid user name: "
|
||||
|
@ -125,7 +125,7 @@ public class SClient4WPS extends SClient {
|
|||
serviceAddress = InformationSystemUtils.retrieveServiceAddress(
|
||||
Constants.DATAMINER_SERVICE_CATEGORY,
|
||||
Constants.DATA_MINER_SERVICE_NAME,
|
||||
serviceCredential.getScope());
|
||||
serviceCredentials.getScope());
|
||||
} catch (Exception e) {
|
||||
logger.error("Error retrieving service address: "
|
||||
+ e.getLocalizedMessage());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.data.analysis.dataminermanagercl.server.dmservice;
|
||||
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredential;
|
||||
import org.gcube.data.analysis.dataminermanagercl.server.util.ServiceCredentials;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.exception.ServiceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -16,10 +16,10 @@ import org.slf4j.LoggerFactory;
|
|||
public class SClient4WPSBuilder extends SClientBuilder {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(SClient4WPSBuilder.class);
|
||||
private ServiceCredential serviceCredendial;
|
||||
private ServiceCredentials serviceCredendials;
|
||||
|
||||
public SClient4WPSBuilder(ServiceCredential serviceCredential) {
|
||||
this.serviceCredendial= serviceCredential;
|
||||
public SClient4WPSBuilder(ServiceCredentials serviceCredentials) {
|
||||
this.serviceCredendials= serviceCredentials;
|
||||
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ public class SClient4WPSBuilder extends SClientBuilder {
|
|||
public void buildSClient() throws ServiceException {
|
||||
try {
|
||||
logger.debug("Build SC4WPS");
|
||||
logger.debug("ServiceCredential: " + serviceCredendial);
|
||||
SClient sClient = new SClient4WPS(serviceCredendial);
|
||||
logger.debug("ServiceCredentials: " + serviceCredendials);
|
||||
SClient sClient = new SClient4WPS(serviceCredendials);
|
||||
|
||||
sClientSpec.setSClient(sClient);
|
||||
} catch (Throwable e) {
|
||||
|
|
|
@ -8,14 +8,14 @@ import java.io.Serializable;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ServiceCredential implements Serializable {
|
||||
public class ServiceCredentials implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3560918948310315680L;
|
||||
private String username;
|
||||
private String scope;
|
||||
private String token;
|
||||
|
||||
public ServiceCredential() {
|
||||
public ServiceCredentials() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class ServiceCredential implements Serializable {
|
|||
* @param scope
|
||||
* @param token
|
||||
*/
|
||||
public ServiceCredential(String username, String scope, String token) {
|
||||
public ServiceCredentials(String username, String scope, String token) {
|
||||
super();
|
||||
this.username = username;
|
||||
this.scope = scope;
|
||||
|
@ -58,8 +58,10 @@ public class ServiceCredential implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServiceCredential [username=" + username + ", scope=" + scope
|
||||
return "ServiceCredentials [username=" + username + ", scope=" + scope
|
||||
+ ", token=" + token + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue