You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2012/11/19 18:13:59 UTC
svn commit: r1411313 [2/2] - in /airavata/trunk/modules:
airavata-client/src/main/java/org/apache/airavata/client/
airavata-client/src/main/java/org/apache/airavata/client/api/
airavata-client/src/main/java/org/apache/airavata/client/impl/
gfac-core/sr...
Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java?rev=1411313&r1=1411312&r2=1411313&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java Mon Nov 19 17:13:56 2012
@@ -31,6 +31,9 @@ import com.sun.jersey.core.util.Multival
import org.apache.airavata.registry.api.AiravataExperiment;
import org.apache.airavata.rest.mappings.resourcemappings.ExperimentList;
import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
+import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
+import org.apache.airavata.rest.utils.Callback;
+import org.apache.airavata.rest.utils.ClientConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,6 +50,13 @@ import java.util.List;
public class ExperimentResourceClient {
private WebResource webResource;
private final static Logger logger = LoggerFactory.getLogger(ExperimentResourceClient.class);
+ private String userName;
+ private Callback callback;
+
+ public ExperimentResourceClient(String userName, Callback callback) {
+ this.userName = userName;
+ this.callback = callback;
+ }
private URI getBaseURI() {
logger.info("Creating Base URI");
@@ -75,11 +85,21 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
- String errorMsg = response.getEntity(String.class);
- logger.error(errorMsg);
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
+ logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -90,10 +110,20 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -102,12 +132,20 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
- String errorMsg = response.getEntity(String.class);
- System.out.println(errorMsg);
- logger.error(errorMsg);
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
+ logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentList experimentList = response.getEntity(ExperimentList.class);
@@ -127,10 +165,20 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentList experimentList = response.getEntity(ExperimentList.class);
@@ -155,10 +203,20 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentList experimentList = response.getEntity(ExperimentList.class);
@@ -184,10 +242,20 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentList experimentList = response.getEntity(ExperimentList.class);
@@ -207,10 +275,22 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ } else {
+ return true;
+ }
}else {
return true;
}
@@ -229,10 +309,22 @@ public class ExperimentResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }else {
+ return true;
+ }
}else {
return true;
}
Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java?rev=1411313&r1=1411312&r2=1411313&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java Mon Nov 19 17:13:56 2012
@@ -31,6 +31,9 @@ import com.sun.jersey.core.util.Multival
import org.apache.airavata.registry.api.WorkspaceProject;
import org.apache.airavata.rest.mappings.resourcemappings.WorkspaceProjectList;
import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
+import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
+import org.apache.airavata.rest.utils.Callback;
+import org.apache.airavata.rest.utils.ClientConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +47,13 @@ import java.util.List;
public class ProjectResourceClient {
private WebResource webResource;
private final static Logger logger = LoggerFactory.getLogger(ProjectResourceClient.class);
+ private String userName;
+ private Callback callback;
+
+ public ProjectResourceClient(String userName, Callback callback) {
+ this.callback = callback;
+ this.userName = userName;
+ }
private URI getBaseURI() {
logger.info("Creating Base URI");
@@ -67,11 +77,22 @@ public class ProjectResourceClient {
ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
- } else {
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }else {
+ return true;
+ }
+ }else {
return true;
}
}
@@ -89,10 +110,21 @@ public class ProjectResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }else {
+ return true;
+ }
}else {
return true;
}
@@ -106,10 +138,19 @@ public class ProjectResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -121,10 +162,19 @@ public class ProjectResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -135,10 +185,19 @@ public class ProjectResourceClient {
ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -149,12 +208,20 @@ public class ProjectResourceClient {
ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
-
WorkspaceProject workspaceProject = response.getEntity(WorkspaceProject.class);
return workspaceProject;
}
@@ -164,10 +231,19 @@ public class ProjectResourceClient {
ClientResponse response = webResource.get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ } else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
WorkspaceProjectList workspaceProjectList = response.getEntity(WorkspaceProjectList.class);
Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java?rev=1411313&r1=1411312&r2=1411313&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java Mon Nov 19 17:13:56 2012
@@ -34,6 +34,9 @@ import org.apache.airavata.rest.mappings
import org.apache.airavata.rest.mappings.resourcemappings.ExperimentIDList;
import org.apache.airavata.rest.mappings.resourcemappings.WorkflowInstancesList;
import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
+import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
+import org.apache.airavata.rest.utils.Callback;
+import org.apache.airavata.rest.utils.ClientConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,6 +54,13 @@ import java.util.List;
public class ProvenanceResourceClient {
private WebResource webResource;
private final static Logger logger = LoggerFactory.getLogger(ProvenanceResourceClient.class);
+ private String userName;
+ private Callback callback;
+
+ public ProvenanceResourceClient(String userName, Callback callback) {
+ this.userName = userName;
+ this.callback = callback;
+ }
private URI getBaseURI() {
logger.info("Creating Base URI");
@@ -75,10 +85,19 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -89,10 +108,19 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
String executionUser = response.getEntity(String.class);
@@ -105,10 +133,18 @@ public class ProvenanceResourceClient {
queryParams.add("experimentName", experimentName);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
return true;
}
@@ -119,10 +155,18 @@ public class ProvenanceResourceClient {
queryParams.add("experimentId", experimentId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
String experimentName = response.getEntity(String.class);
@@ -137,10 +181,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -151,12 +203,19 @@ public class ProvenanceResourceClient {
queryParams.add("experimentId", experimentId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
-
String experimentMetadata = response.getEntity(String.class);
return experimentMetadata;
}
@@ -169,10 +228,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -182,10 +249,18 @@ public class ProvenanceResourceClient {
queryParams.add("workflowInstanceId", workflowInstanceId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
String workflowTemplateName = response.getEntity(String.class);
@@ -200,10 +275,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -213,10 +296,18 @@ public class ProvenanceResourceClient {
queryParams.add("experimentId", experimentId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
WorkflowInstancesList workflowInstancesList = response.getEntity(WorkflowInstancesList.class);
@@ -236,10 +327,18 @@ public class ProvenanceResourceClient {
queryParams.add("instanceId", instanceId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
return true;
}
@@ -252,10 +351,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
return true;
}
@@ -268,10 +375,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -286,10 +401,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -299,10 +422,18 @@ public class ProvenanceResourceClient {
queryParams.add("instanceId", instanceId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
WorkflowInstanceStatus workflowInstanceStatus = response.getEntity(WorkflowInstanceStatus.class);
@@ -318,10 +449,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -334,10 +473,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -347,12 +494,19 @@ public class ProvenanceResourceClient {
queryParams.add("experimentId", experimentId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
-
ExperimentDataImpl experimentData = response.getEntity(ExperimentDataImpl.class);
return experimentData;
}
@@ -363,10 +517,18 @@ public class ProvenanceResourceClient {
queryParams.add("experimentId", experimentId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentDataImpl experimentData = response.getEntity(ExperimentDataImpl.class);
@@ -379,10 +541,18 @@ public class ProvenanceResourceClient {
queryParams.add("user", user);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentDataList experimentDataList = response.getEntity(ExperimentDataList.class);
@@ -401,10 +571,18 @@ public class ProvenanceResourceClient {
queryParams.add("experimentNameRegex", experimentNameRegex);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentDataList experimentDataList = response.getEntity(ExperimentDataList.class);
@@ -422,10 +600,18 @@ public class ProvenanceResourceClient {
queryParams.add("username", user);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentIDList experimentIDList = response.getEntity(ExperimentIDList.class);
@@ -439,10 +625,18 @@ public class ProvenanceResourceClient {
queryParams.add("username", user);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
ExperimentDataList experimentDataList = response.getEntity(ExperimentDataList.class);
List<ExperimentDataImpl> dataList = experimentDataList.getExperimentDataList();
@@ -462,10 +656,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -478,10 +680,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -494,10 +704,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -508,10 +726,18 @@ public class ProvenanceResourceClient {
queryParams.add("nodeId", workflowNode.getNodeId());
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
WorkflowInstanceNodeStatus workflowInstanceNodeStatus = response.getEntity(WorkflowInstanceNodeStatus.class);
@@ -525,10 +751,18 @@ public class ProvenanceResourceClient {
queryParams.add("nodeId", workflowNode.getNodeId());
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
String wfNodeStartTime = response.getEntity(String.class);
@@ -548,10 +782,18 @@ public class ProvenanceResourceClient {
queryParams.add("workflowInstanceId", workflowInstance.getWorkflowInstanceId());
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
String wfStartTime = response.getEntity(String.class);
@@ -569,10 +811,18 @@ public class ProvenanceResourceClient {
webResource = getProvenanceRegistryBaseResource().path(ResourcePathConstants.ProvenanceResourcePathConstants.UPDATE_WORKFLOWNODE_GRAMDATA);
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, workflowNodeGramData);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, workflowNodeGramData);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -582,10 +832,18 @@ public class ProvenanceResourceClient {
queryParams.add("workflowInstanceId", workflowInstanceId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
WorkflowInstanceData workflowInstanceData = response.getEntity(WorkflowInstanceData.class);
@@ -599,10 +857,18 @@ public class ProvenanceResourceClient {
queryParams.add("nodeId", nodeId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
return true;
}
@@ -615,10 +881,18 @@ public class ProvenanceResourceClient {
formParams.add("createIfNotPresent", String.valueOf(createIfNotPresent));
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
return true;
}
@@ -630,10 +904,18 @@ public class ProvenanceResourceClient {
queryParams.add("nodeId", nodeId);
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
WorkflowInstanceNodeData workflowInstanceNodeData = response.getEntity(WorkflowInstanceNodeData.class);
@@ -649,10 +931,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -665,10 +955,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -680,10 +978,18 @@ public class ProvenanceResourceClient {
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if( status == ClientConstant.HTTP_UNAUTHORIZED){
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java?rev=1411313&r1=1411312&r2=1411313&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java Mon Nov 19 17:13:56 2012
@@ -32,6 +32,9 @@ import org.apache.airavata.rest.mappings
import org.apache.airavata.rest.mappings.resourcemappings.Workflow;
import org.apache.airavata.rest.mappings.resourcemappings.WorkflowList;
import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
+import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
+import org.apache.airavata.rest.utils.Callback;
+import org.apache.airavata.rest.utils.ClientConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,6 +49,13 @@ import java.util.Map;
public class PublishedWorkflowResourceClient {
private WebResource webResource;
private final static Logger logger = LoggerFactory.getLogger(PublishedWorkflowResourceClient.class);
+ private String userName;
+ private Callback callback;
+
+ public PublishedWorkflowResourceClient(String userName, Callback callback) {
+ this.userName = userName;
+ this.callback = callback;
+ }
private URI getBaseURI() {
logger.info("Creating Base URI");
@@ -69,10 +79,20 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
return true;
@@ -86,10 +106,19 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -100,10 +129,19 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -115,12 +153,21 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_FORM_URLENCODED).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
- }
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_FORM_URLENCODED).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
+ }
String wfGraph = response.getEntity(String.class);
return wfGraph;
@@ -131,10 +178,20 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
PublishWorkflowNamesList workflowNamesList = response.getEntity(PublishWorkflowNamesList.class);
@@ -147,10 +204,20 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
Map<String, String> publishWFmap = new HashMap<String, String>();
@@ -171,10 +238,20 @@ public class PublishedWorkflowResourceCl
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).delete(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).delete(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java?rev=1411313&r1=1411312&r2=1411313&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java (original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java Mon Nov 19 17:13:56 2012
@@ -31,6 +31,9 @@ import com.sun.jersey.core.util.Multival
import org.apache.airavata.rest.mappings.resourcemappings.Workflow;
import org.apache.airavata.rest.mappings.resourcemappings.WorkflowList;
import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
+import org.apache.airavata.rest.utils.BasicAuthHeaderUtil;
+import org.apache.airavata.rest.utils.Callback;
+import org.apache.airavata.rest.utils.ClientConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,6 +48,13 @@ import java.util.Map;
public class UserWorkflowResourceClient {
private WebResource webResource;
private final static Logger logger = LoggerFactory.getLogger(UserWorkflowResourceClient.class);
+ private String userName;
+ private Callback callback;
+
+ public UserWorkflowResourceClient(String userName, Callback callback) {
+ this.userName = userName;
+ this.callback = callback;
+ }
private URI getBaseURI() {
logger.info("Creating Base URI");
@@ -68,12 +78,21 @@ public class UserWorkflowResourceClient
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
- }
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
+ }
return true;
}
@@ -85,10 +104,19 @@ public class UserWorkflowResourceClient
ClientResponse response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -100,10 +128,19 @@ public class UserWorkflowResourceClient
ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formParams);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formParams);
+ status = response.getStatus();
+ if (status != ClientConstant.HTTP_OK) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
@@ -114,10 +151,20 @@ public class UserWorkflowResourceClient
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_FORM_URLENCODED).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_FORM_URLENCODED).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
String worlflowGraph = response.getEntity(String.class);
@@ -129,10 +176,20 @@ public class UserWorkflowResourceClient
ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
Map<String, String> userWFMap = new HashMap<String, String>();
@@ -153,10 +210,20 @@ public class UserWorkflowResourceClient
ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).delete(ClientResponse.class);
int status = response.getStatus();
- if (status != 200) {
+ if (status != ClientConstant.HTTP_OK && status != ClientConstant.HTTP_UNAUTHORIZED) {
logger.error(response.getEntity(String.class));
throw new RuntimeException("Failed : HTTP error code : "
+ status);
+ }else if (status == ClientConstant.HTTP_UNAUTHORIZED){
+ webResource.header("Authorization", BasicAuthHeaderUtil.getBasicAuthHeader(userName, callback.getPassword(userName)));
+ response = webResource.queryParams(queryParams).accept(MediaType.TEXT_PLAIN).delete(ClientResponse.class);
+ status = response.getStatus();
+
+ if (status != ClientConstant.HTTP_OK ) {
+ logger.error(response.getEntity(String.class));
+ throw new RuntimeException("Failed : HTTP error code : "
+ + status);
+ }
}
}
Added: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/Callback.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/Callback.java?rev=1411313&view=auto
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/Callback.java (added)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/Callback.java Mon Nov 19 17:13:56 2012
@@ -0,0 +1,25 @@
+package org.apache.airavata.rest.utils;/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+public interface Callback {
+
+ public String getPassword (String username);
+}
Added: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/ClientConstant.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/ClientConstant.java?rev=1411313&view=auto
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/ClientConstant.java (added)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/utils/ClientConstant.java Mon Nov 19 17:13:56 2012
@@ -0,0 +1,28 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.rest.utils;
+
+public class ClientConstant {
+
+ public static final int HTTP_OK = 200;
+ public static final int HTTP_UNAUTHORIZED = 405;
+}
Modified: airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java?rev=1411313&r1=1411312&r2=1411313&view=diff
==============================================================================
--- airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java (original)
+++ airavata/trunk/modules/rest/mappings/src/main/java/org/apache/airavata/rest/mappings/utils/ResourcePathConstants.java Mon Nov 19 17:13:56 2012
@@ -23,6 +23,7 @@ package org.apache.airavata.rest.mapping
public class ResourcePathConstants {
+ public static final String BASE_URL = "http://localhost:9080/airavata-services";
public final class ConfigResourcePathConstants {
public static final String CONFIGURATION_REGISTRY_RESOURCE = "/registry/api/congfigregistry/";