airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [32/90] [abbrv] [partial] AIRAVATA-1124
Date Mon, 14 Apr 2014 18:30:34 GMT
http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/PublishWorkflowRegistryResource.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/PublishWorkflowRegistryResource.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/PublishWorkflowRegistryResource.java
deleted file mode 100644
index 5eecb01..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/PublishWorkflowRegistryResource.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- *
- * 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.services.registry.rest.resources;
-
-import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowAlreadyExistsException;
-import org.apache.airavata.registry.api.exception.gateway.PublishedWorkflowDoesNotExistsException;
-import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
-import org.apache.airavata.rest.mappings.resourcemappings.PublishWorkflowNamesList;
-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.mappings.utils.RegPoolUtils;
-import org.apache.airavata.services.registry.rest.utils.WebAppUtil;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class is the REST interface for all the operations related to published workflows that has
- * been exposed by Airavata Registry API
- */
-@Path(ResourcePathConstants.PublishedWFConstants.REGISTRY_API_PUBLISHWFREGISTRY)
-public class PublishWorkflowRegistryResource {
-
-    @Context
-    ServletContext context;
-
-    /**---------------------------------Published Workflow Registry----------------------------------**/
-
-    /**
-     * This method will check whether a given published workflow name already exists
-     *
-     * @param workflowname publish workflow name
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.PublishedWFConstants.PUBLISHWF_EXIST)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response isPublishedWorkflowExists(@QueryParam("workflowName") String workflowname) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            boolean workflowExists = airavataRegistry.isPublishedWorkflowExists(workflowname);
-            if (workflowExists) {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity("True");
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity("False");
-                return builder.build();
-            }
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.PUBLISHWF_EXIST, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will make a user workflow as a published workflow with the given name
-     *
-     * @param workflowName        user workflow name
-     * @param publishWorkflowName name need to save the published workflow as
-     * @return HTTP response
-     */
-    @POST
-    @Path(ResourcePathConstants.PublishedWFConstants.PUBLISH_WORKFLOW)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response publishWorkflow(@FormParam("workflowName") String workflowName,
-                                    @FormParam("publishWorkflowName") String publishWorkflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            airavataRegistry.publishWorkflow(workflowName, publishWorkflowName);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity("Workflow published successfully...");
-            return builder.build();
-        } catch (UserWorkflowDoesNotExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (PublishedWorkflowAlreadyExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.PUBLISH_WORKFLOW, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will publish a workflow with the default workflow name
-     *
-     * @param workflowName workflow name
-     * @return HTTP response
-     */
-    @POST
-    @Path(ResourcePathConstants.PublishedWFConstants.PUBLISH_DEFAULT_WORKFLOW)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response publishWorkflow(@FormParam("workflowName") String workflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            airavataRegistry.publishWorkflow(workflowName);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity("Workflow published successfully...");
-            return builder.build();
-        } catch (UserWorkflowDoesNotExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (PublishedWorkflowAlreadyExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.PUBLISH_DEFAULT_WORKFLOW, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will return the worklflow graph
-     *
-     * @param workflowName workflow name
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.PublishedWFConstants.GET_PUBLISHWORKFLOWGRAPH)
-    @Produces(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response getPublishedWorkflowGraphXML(@QueryParam("workflowName") String workflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            String publishedWorkflowGraphXML =
-                    airavataRegistry.getPublishedWorkflowGraphXML(workflowName);
-            if (publishedWorkflowGraphXML != null) {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(publishedWorkflowGraphXML);
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
-                return builder.build();
-            }
-        } catch (PublishedWorkflowDoesNotExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.GET_PUBLISHWORKFLOWGRAPH, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will return all the published workflow names
-     *
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.PublishedWFConstants.GET_PUBLISHWORKFLOWNAMES)
-    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-    public Response getPublishedWorkflowNames() {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            List<String> publishedWorkflowNames = airavataRegistry.getPublishedWorkflowNames();
-            PublishWorkflowNamesList publishWorkflowNamesList = new PublishWorkflowNamesList();
-            publishWorkflowNamesList.setPublishWorkflowNames(publishedWorkflowNames);
-            if (publishedWorkflowNames.size() != 0) {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(publishWorkflowNamesList);
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
-                return builder.build();
-            }
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.GET_PUBLISHWORKFLOWNAMES, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will return all the published workflows
-     *
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.PublishedWFConstants.GET_PUBLISHWORKFLOWS)
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response getPublishedWorkflows() {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            Map<String, String> publishedWorkflows = airavataRegistry.getPublishedWorkflows();
-            WorkflowList workflowList = new WorkflowList();
-            List<Workflow> workflowsModels = new ArrayList<Workflow>();
-            for (String workflowName : publishedWorkflows.keySet()) {
-                Workflow workflow = new Workflow();
-                workflow.setWorkflowName(workflowName);
-                workflow.setWorkflowGraph(publishedWorkflows.get(workflowName));
-                workflowsModels.add(workflow);
-            }
-            workflowList.setWorkflowList(workflowsModels);
-            if (publishedWorkflows.size() != 0) {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(workflowList);
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
-                return builder.build();
-            }
-
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.GET_PUBLISHWORKFLOWS, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will delete a published workflow with the given published workflow name
-     *
-     * @param workflowName published workflow name
-     * @return HTTP response
-     */
-    @DELETE
-    @Path(ResourcePathConstants.PublishedWFConstants.REMOVE_PUBLISHWORKFLOW)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response removePublishedWorkflow(@QueryParam("workflowName") String workflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            airavataRegistry.removePublishedWorkflow(workflowName);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity("Publish workflow removed successfully...");
-            return builder.build();
-        } catch (PublishedWorkflowDoesNotExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.PublishedWFConstants.REMOVE_PUBLISHWORKFLOW, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserRegistryResource.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserRegistryResource.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserRegistryResource.java
deleted file mode 100644
index 36b7a4a..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserRegistryResource.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *
- * 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.services.registry.rest.resources;
-
-import java.util.List;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.AiravataUser;
-import org.apache.airavata.rest.mappings.resourcemappings.UserList;
-import org.apache.airavata.rest.mappings.utils.RegPoolUtils;
-import org.apache.airavata.rest.mappings.utils.ResourcePathConstants;
-import org.apache.airavata.services.registry.rest.utils.WebAppUtil;
-
-/**
- * This class provides a REST interface to all the user management related operations
- */
-@Path(ResourcePathConstants.UserResourceConstants.REGISTRY_API_USERREGISTRY)
-public class UserRegistryResource {
-
-    @Context
-    ServletContext context;
-
-    /**
-     * This method gets all users of Airavata present in the registry
-     *
-     * @return HTTP response - List of AiravataUsers
-     */
-    @GET
-    @Path(ResourcePathConstants.UserResourceConstants.GET_ALL_USERS)
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response getAllUsers() {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-        	List<AiravataUser> users = airavataRegistry.getUsers();
-        	UserList userList = new UserList();
-        	userList.setUserList(users);
-            if (users.size() != 0) {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(userList);
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
-                return builder.build();
-            }
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserResourceConstants.GET_ALL_USERS, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java
deleted file mode 100644
index c2fc066..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- *
- * 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.services.registry.rest.resources;
-
-import de.odysseus.staxon.json.JsonXMLConfig;
-import de.odysseus.staxon.json.JsonXMLConfigBuilder;
-import de.odysseus.staxon.json.JsonXMLOutputFactory;
-import org.apache.airavata.registry.api.AiravataRegistry2;
-import org.apache.airavata.registry.api.exception.worker.UserWorkflowAlreadyExistsException;
-import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
-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.mappings.utils.RegPoolUtils;
-import org.apache.airavata.services.registry.rest.utils.WebAppUtil;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class is a REST interface to all the operations related to user workflows that has been
- * exposed by Airavata Registry API
- */
-@Path(ResourcePathConstants.UserWFConstants.REGISTRY_API_USERWFREGISTRY)
-public class UserWorkflowRegistryResource {
-
-    @Context
-    ServletContext context;
-
-    /**---------------------------------User Workflow Registry----------------------------------**/
-
-    /**
-     * This method will check whether a given user workflow name already exists
-     *
-     * @param workflowName workflow name
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.UserWFConstants.WORKFLOW_EXIST)
-    @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON})
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response isWorkflowExists(@QueryParam("workflowName") String workflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            boolean workflowExists = airavataRegistry.isWorkflowExists(workflowName);
-            if (workflowExists) {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity("True");
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity("False");
-                return builder.build();
-            }
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.WORKFLOW_EXIST, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will add a new workflow
-     *
-     * @param workflowName     workflow name
-     * @param workflowGraphXml workflow content
-     * @return HTTP response
-     */
-    @POST
-    @Path(ResourcePathConstants.UserWFConstants.ADD_WORKFLOW)
-    @Consumes({MediaType.APPLICATION_FORM_URLENCODED,MediaType.APPLICATION_JSON})
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response addWorkflow(@FormParam("workflowName") String workflowName,
-                                @FormParam("workflowGraphXml") String workflowGraphXml) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            airavataRegistry.addWorkflow(workflowName, workflowGraphXml);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity("Workflow added successfully...");
-            return builder.build();
-        } catch (UserWorkflowAlreadyExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.ADD_WORKFLOW, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will update the workflow
-     *
-     * @param workflowName     workflow name
-     * @param workflowGraphXml workflow content
-     * @return HTTP response
-     */
-    @POST
-    @Path(ResourcePathConstants.UserWFConstants.UPDATE_WORKFLOW)
-    @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON})
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response updateWorkflow(@FormParam("workflowName") String workflowName,
-                                   @FormParam("workflowGraphXml") String workflowGraphXml) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            airavataRegistry.updateWorkflow(workflowName, workflowGraphXml);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity("Workflow updated successfully...");
-            return builder.build();
-        } catch (UserWorkflowAlreadyExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.UPDATE_WORKFLOW, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will return the content of the given workflow
-     *
-     * @param workflowName workflow name
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.UserWFConstants.GET_WORKFLOWGRAPH)
-    @Produces({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON})
-    public Response getWorkflowGraphXML(@DefaultValue("false") @QueryParam("isJson") boolean isJson,
-                                        @QueryParam("workflowName") String workflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            String workflowGraphXML = airavataRegistry.getWorkflowGraphXML(workflowName);
-            if (workflowGraphXML != null) {
-                if (isJson && workflowGraphXML.startsWith("<")) {
-                    workflowGraphXML = getJSONWorkflowGraph(workflowGraphXML);
-                }
-                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(workflowGraphXML);
-                return builder.build();
-            } else {
-                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
-                return builder.build();
-            }
-        } catch (UserWorkflowDoesNotExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.GET_WORKFLOWGRAPH, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will return all the user workflows
-     *
-     * @return HTTP response
-     */
-    @GET
-    @Path(ResourcePathConstants.UserWFConstants.GET_WORKFLOWS)
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response getWorkflows(@DefaultValue("false") @QueryParam("isJson") boolean isJson) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            Map<String, String> workflows = airavataRegistry.getWorkflows();
-            WorkflowList workflowList = new WorkflowList();
-            List<Workflow> workflowsModels = new ArrayList<Workflow>();
-            for (String workflowName : workflows.keySet()) {
-                Workflow workflow = new Workflow();
-                workflow.setWorkflowName(workflowName);
-                String workflowGraph = workflows.get(workflowName);
-                if (isJson && workflowGraph.startsWith("<")) {
-                    workflowGraph = getJSONWorkflowGraph(workflowGraph);
-                }
-                workflow.setWorkflowGraph(workflowGraph);
-                workflowsModels.add(workflow);
-            }
-            workflowList.setWorkflowList(workflowsModels);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity(workflowList);
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.GET_WORKFLOWS, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-    /**
-     * This method will delete a user workflow with the given user workflow name
-     *
-     * @param workflowName user workflow name
-     * @return HTTP response
-     */
-    @DELETE
-    @Path(ResourcePathConstants.UserWFConstants.REMOVE_WORKFLOW)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response removeWorkflow(@QueryParam("workflowName") String workflowName) {
-        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
-        try {
-            airavataRegistry.removeWorkflow(workflowName);
-            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-            builder.entity("Workflow removed successfully...");
-            return builder.build();
-        } catch (UserWorkflowDoesNotExistsException e) {
-            Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
-            builder.entity(e.getMessage());
-            return builder.build();
-        } catch (Throwable e) {
-            return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.REMOVE_WORKFLOW, e);
-        } finally {
-            if (airavataRegistry != null) {
-                RegPoolUtils.releaseRegistry(context, airavataRegistry);
-            }
-        }
-    }
-
-
-    private String getJSONWorkflowGraph(String workflowGraphXML) throws XMLStreamException, IOException {
-        String workflowGraphJSON;
-        ByteArrayOutputStream output = new ByteArrayOutputStream();
-        ByteArrayInputStream input = new ByteArrayInputStream(workflowGraphXML.getBytes());
-        try {
-            JsonXMLConfig config = new JsonXMLConfigBuilder()
-                    .autoArray(true)
-                    .autoPrimitive(true)
-                    .prettyPrint(true)
-                    .build();
-            XMLEventReader reader = XMLInputFactory.newInstance().
-                    createXMLEventReader(input);
-
-            XMLEventWriter writer = new JsonXMLOutputFactory(config).createXMLEventWriter(output);
-            writer.add(reader);
-            reader.close();
-            workflowGraphJSON = output.toString("UTF-8");
-            writer.close();
-        } finally {
-            /*
-			 * As per StAX specification, XMLEventReader/Writer.close() doesn't close
-			 * the underlying stream.
-			 */
-            output.close();
-            input.close();
-        }
-        return workflowGraphJSON;
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java
deleted file mode 100644
index 8865a0e..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/HttpAuthenticatorFilter.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.services.registry.rest.security;
-
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.airavata.security.Authenticator;
-import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
-
-import javax.servlet.*;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Calendar;
-import java.util.List;
-
-/**
- * A servlet filter class which intercepts the request and do authentication.
- */
-public class HttpAuthenticatorFilter implements Filter {
-
-    private List<Authenticator> authenticatorList;
-
-    private static Logger log = LoggerFactory.getLogger(HttpAuthenticatorFilter.class);
-
-    private ServletRequestHelper servletRequestHelper = new ServletRequestHelper();
-
-    @Override
-    public void init(FilterConfig filterConfig) throws ServletException {
-        String authenticatorConfiguration = filterConfig.getInitParameter("authenticatorConfigurations");
-
-        //TODO make this able to read from a file as well
-
-
-        InputStream configurationFileStream = HttpAuthenticatorFilter.class.getClassLoader().
-                getResourceAsStream(authenticatorConfiguration);
-
-        if (configurationFileStream == null) {
-            String msg = "Invalid authenticator configuration. Cannot read file - ".concat(authenticatorConfiguration);
-            log.error(msg);
-            throw new ServletException(msg);
-        }
-
-        AuthenticatorConfigurationReader authenticatorConfigurationReader
-                = new AuthenticatorConfigurationReader();
-        try {
-            authenticatorConfigurationReader.init(configurationFileStream);
-        } catch (IOException e) {
-            String msg = "Error reading authenticator configurations.";
-
-            log.error(msg, e);
-            throw new ServletException(msg, e);
-        } catch (ParserConfigurationException e) {
-            String msg = "Error parsing authenticator configurations.";
-
-            log.error(msg, e);
-            throw new ServletException(msg, e);
-        } catch (SAXException e) {
-            String msg = "Error parsing authenticator configurations.";
-
-            log.error(msg, e);
-            throw new ServletException(msg, e);
-        } finally {
-            try {
-                configurationFileStream.close();
-            } catch (IOException e) {
-                log.error("Error closing authenticator file stream.", e);
-            }
-        }
-
-        this.authenticatorList = authenticatorConfigurationReader.getAuthenticatorList();
-
-        if (this.authenticatorList.isEmpty()) {
-            String msg = "No authenticators registered in the system. System cannot function without authenticators";
-            log.error(msg);
-            throw new ServletException(msg);
-        }
-
-    }
-
-    @Override
-    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
-
-        // Firs check whether authenticators are disabled
-        if (! AuthenticatorConfigurationReader.isAuthenticationEnabled()) {
-
-            // Extract user id and gateway id
-            try {
-                servletRequestHelper.addIdentityInformationToSession((HttpServletRequest) servletRequest);
-            } catch (AuthenticationException e) {
-                log.warn("Error adding identity information to session.", e);
-                populateUnauthorisedData(servletResponse, "Error adding identity information to session.");
-
-            }
-
-            filterChain.doFilter(servletRequest, servletResponse);
-            return;
-        }
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
-
-        Authenticator authenticator = getAuthenticator(httpServletRequest);
-
-        if (authenticator == null) {
-            //sendUnauthorisedError(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-            populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-        } else {
-            if (authenticator.isAuthenticated(httpServletRequest)) {
-                // Allow request to flow
-                filterChain.doFilter(servletRequest, servletResponse);
-            } else {
-                try {
-                    if (!authenticator.authenticate(httpServletRequest)) {
-                        //sendUnauthorisedError(servletResponse, "Unauthorised : Provided credentials are not valid.");
-                        populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-                    } else {
-                        // Allow request to flow
-                        filterChain.doFilter(servletRequest, servletResponse);
-                    }
-                } catch (AuthenticationException e) {
-                    String msg = "An error occurred while authenticating request.";
-                    log.error(msg, e);
-                    //sendUnauthorisedError(servletResponse, e.getMessage());
-                    populateUnauthorisedData(servletResponse, "Invalid request. Request does not contain sufficient credentials to authenticate");
-                }
-            }
-        }
-    }
-
-    public static void sendUnauthorisedError(ServletResponse servletResponse, String message) throws IOException {
-        HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
-        httpServletResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED, message);
-    }
-
-    @Override
-    public void destroy() {
-
-        this.authenticatorList = null;
-    }
-
-    private Authenticator getAuthenticator(HttpServletRequest httpServletRequest) {
-
-        for (Authenticator authenticator : authenticatorList) {
-            if (authenticator.canProcess(httpServletRequest)) {
-                return authenticator;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * This method will create a 401 unauthorized response to be sent.
-     *
-     * @param servletResponse The HTTP response.
-     */
-    public static void populateUnauthorisedData(ServletResponse servletResponse, String message) {
-
-        HttpServletResponse httpServletResponse = (HttpServletResponse)servletResponse;
-
-        httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-        httpServletResponse.addHeader("Server", "Airavata Server");
-        httpServletResponse.addHeader("Description", message);
-        httpServletResponse.addDateHeader("Date", Calendar.getInstance().getTimeInMillis());
-        httpServletResponse.addHeader("WWW-Authenticate", "Basic realm=Airavata");
-        httpServletResponse.setContentType("text/html");
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/ServletRequestHelper.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/ServletRequestHelper.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/ServletRequestHelper.java
deleted file mode 100644
index a8e5dbc..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/ServletRequestHelper.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * 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.services.registry.rest.security;
-
-import org.apache.airavata.common.context.RequestContext;
-import org.apache.airavata.common.context.WorkflowContext;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.commons.codec.binary.Base64;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Helper class to extract request information.
- */
-public class ServletRequestHelper {
-
-    /**
-     * Header names
-     */
-    public static final String AUTHORISATION_HEADER_NAME = "Authorization";
-
-    protected void addIdentityInformationToSession(HttpServletRequest servletRequest) throws AuthenticationException {
-
-        addUserToSession(null, servletRequest);
-    }
-
-    public void addUserToSession(String userName, HttpServletRequest servletRequest) throws AuthenticationException {
-
-        if (userName == null) {
-            userName = getUserName(servletRequest);
-        }
-
-        String gatewayId = getGatewayId(servletRequest);
-
-        if (servletRequest.getSession() != null) {
-            servletRequest.getSession().setAttribute(Constants.USER_IN_SESSION, userName);
-            servletRequest.getSession().setAttribute(Constants.GATEWAY_NAME, gatewayId);
-        }
-
-        addToContext(userName, gatewayId);
-    }
-
-    String getUserName(HttpServletRequest httpServletRequest) throws AuthenticationException {
-
-        String basicHeader = httpServletRequest.getHeader(AUTHORISATION_HEADER_NAME);
-
-        if (basicHeader == null) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String[] userNamePasswordArray = basicHeader.split(" ");
-
-        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String decodedString = decode(userNamePasswordArray[1]);
-
-        String[] array = decodedString.split(":");
-
-        if (array == null || array.length != 1) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        return array[0];
-
-    }
-
-    public String decode(String encoded) {
-        return new String(Base64.decodeBase64(encoded.getBytes()));
-    }
-
-    String getGatewayId(HttpServletRequest request) throws AuthenticationException {
-        String gatewayId = request.getHeader(Constants.GATEWAY_NAME);
-
-        if (gatewayId == null) {
-            try {
-                gatewayId = ServerSettings.getSystemUserGateway();
-            } catch (ApplicationSettingsException e) {
-                throw new AuthenticationException("Unable to retrieve default gateway", e);
-            }
-        }
-
-        return gatewayId;
-    }
-
-    public void addToContext(String userName, String gatewayId) {
-
-        RequestContext requestContext = new RequestContext();
-        requestContext.setUserIdentity(userName);
-        requestContext.setGatewayId(gatewayId);
-
-        WorkflowContext.set(requestContext);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java
deleted file mode 100644
index 8908743..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/basic/BasicAccessAuthenticator.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.services.registry.rest.security.basic;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.security.AbstractAuthenticator;
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.airavata.security.UserStoreException;
-import org.apache.airavata.services.registry.rest.security.ServletRequestHelper;
-import org.apache.commons.codec.binary.Base64;
-import org.w3c.dom.Node;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * This authenticator handles basic access authentication requests. In basic access authentication
- * we get user name and password as HTTP headers. The password is encoded with base64.
- * More information @link{http://en.wikipedia.org/wiki/Basic_access_authentication}
- */
-public class BasicAccessAuthenticator extends AbstractAuthenticator {
-
-
-    private static final String AUTHENTICATOR_NAME = "BasicAccessAuthenticator";
-
-    private ServletRequestHelper servletRequestHelper = new ServletRequestHelper();
-
-    public BasicAccessAuthenticator() {
-        super(AUTHENTICATOR_NAME);
-    }
-
-
-    /**
-     * Returns user name and password as an array. The first element is user name and second is password.
-     *
-     * @param httpServletRequest The servlet request.
-     * @return User name password pair as an array.
-     * @throws AuthenticationException If an error occurred while extracting user name and password.
-     */
-    private String[] getUserNamePassword(HttpServletRequest httpServletRequest) throws AuthenticationException {
-
-        String basicHeader = httpServletRequest.getHeader(ServletRequestHelper.AUTHORISATION_HEADER_NAME);
-
-        if (basicHeader == null) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String[] userNamePasswordArray = basicHeader.split(" ");
-
-        if (userNamePasswordArray == null || userNamePasswordArray.length != 2) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        String decodedString = servletRequestHelper.decode(userNamePasswordArray[1]);
-
-        String[] array = decodedString.split(":");
-
-        if (array == null || array.length != 2) {
-            throw new AuthenticationException("Authorization Required");
-        }
-
-        return array;
-
-    }
-
-    @Override
-    protected boolean doAuthentication(Object credentials) throws AuthenticationException {
-        if (this.getUserStore() == null) {
-            throw new AuthenticationException("Authenticator is not initialized. Error processing request.");
-        }
-
-        if (credentials == null)
-            return false;
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
-
-        String[] array = getUserNamePassword(httpServletRequest);
-
-        String userName = array[0];
-        String password = array[1];
-
-        try {
-            return this.getUserStore().authenticate(userName, password);
-
-        } catch (UserStoreException e) {
-            throw new AuthenticationException("Error querying database for session information.", e);
-        }
-    }
-
-
-
-    @Override
-    public void onSuccessfulAuthentication(Object authenticationInfo) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
-
-        try {
-            String[] array = getUserNamePassword(httpServletRequest);
-
-            StringBuilder stringBuilder = new StringBuilder("User : ");
-
-            if (array != null) {
-
-                servletRequestHelper.addUserToSession(array[0], httpServletRequest);
-
-                stringBuilder.append(array[0]).append(" successfully logged into system at ").append(getCurrentTime());
-                log.debug(stringBuilder.toString());
-
-            } else {
-                log.error("System error occurred while extracting user name after authentication. " +
-                        "Couldn't extract user name from the request.");
-            }
-        } catch (AuthenticationException e) {
-            log.error("System error occurred while extracting user name after authentication.", e);
-        }
-
-    }
-
-    @Override
-    public void onFailedAuthentication(Object authenticationInfo) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) authenticationInfo;
-
-        try {
-            String[] array = getUserNamePassword(httpServletRequest);
-
-            StringBuilder stringBuilder = new StringBuilder("User : ");
-
-            if (array != null) {
-
-                stringBuilder.append(array[0]).append(" Failed login attempt to system at ").append(getCurrentTime());
-                log.warn(stringBuilder.toString());
-
-            } else {
-                stringBuilder.append("Failed login attempt to system at ").append(getCurrentTime()).append( ". User unknown.");
-                log.warn(stringBuilder.toString());
-            }
-        } catch (AuthenticationException e) {
-            log.error("System error occurred while extracting user name after authentication.", e);
-        }
-    }
-
-    @Override
-    public boolean isAuthenticated(Object credentials) {
-        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
-
-        HttpSession httpSession = httpServletRequest.getSession();
-
-        boolean seenInSession = false;
-
-        if (httpSession != null) {
-            String user = (String)httpSession.getAttribute(Constants.USER_IN_SESSION);
-            String gateway = (String)httpSession.getAttribute(Constants.GATEWAY_NAME);
-
-            if (user != null && gateway != null) {
-                servletRequestHelper.addToContext(user, gateway);
-                seenInSession = true;
-            }
-        }
-
-        return seenInSession;
-
-    }
-
-    @Override
-    public boolean canProcess(Object credentials) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest) credentials;
-
-        return (httpServletRequest.getHeader(ServletRequestHelper.AUTHORISATION_HEADER_NAME) != null);
-    }
-
-
-
-    @Override
-    public void configure(Node node) throws RuntimeException {
-
-        /**
-         <specificConfigurations>
-         <database>
-         <jdbcUrl></jdbcUrl>
-         <databaseDriver></databaseDriver>
-         <userName></userName>
-         <password></password>
-         <userTableName></userTableName>
-         <userNameColumnName></userNameColumnName>
-         <passwordColumnName></passwordColumnName>
-         </database>
-         </specificConfigurations>
-         */
-
-        try {
-            this.getUserStore().configure(node);
-        } catch (UserStoreException e) {
-            throw new RuntimeException("Error while configuring authenticator user store", e);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/local/LocalUserStore.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/local/LocalUserStore.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/local/LocalUserStore.java
deleted file mode 100644
index c4ec4c1..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/local/LocalUserStore.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *
- * 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.services.registry.rest.security.local;
-
-import java.security.NoSuchAlgorithmException;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.SecurityUtil;
-import org.apache.airavata.registry.api.util.RegistrySettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * User store to maintain internal DB database.
- */
-public class LocalUserStore {
-
-    protected static Logger log = LoggerFactory.getLogger(LocalUserStore.class);
-
-    private DBUtil dbUtil;
-
-    private String hashMethod;
-
-    public LocalUserStore(ServletContext servletContext) throws Exception {
-        // Properties properties = WebAppUtil.getAiravataProperties(servletContext);
-
-        hashMethod = RegistrySettings.getSetting("default.registry.password.hash.method");
-
-        dbUtil = new DBUtil(RegistrySettings.getSetting("registry.jdbc.url"),
-                RegistrySettings.getSetting("registry.jdbc.user"),
-                RegistrySettings.getSetting("registry.jdbc.password"),
-                RegistrySettings.getSetting("registry.jdbc.driver"));
-
-    }
-
-    public LocalUserStore(DBUtil db) {
-        dbUtil = db;
-    }
-
-    public void addUser(String userName, String password) {
-
-        String sql = "insert into Users values (?, ?)";
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, userName);
-            preparedStatement.setString(2, SecurityUtil.digestString(password, hashMethod));
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("User " + userName + " successfully added.");
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error persisting user information.");
-            stringBuilder.append(" user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } catch (NoSuchAlgorithmException e) {
-            String stringBuilder = "Error creating hash value for password.";
-            log.error(stringBuilder, e);
-
-            throw new RuntimeException(stringBuilder, e);
-        } finally {
-
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    protected String getPassword(String userName, Connection connection) {
-
-        String sql = "select password from Users where user_name = ?";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-
-        try {
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, userName);
-
-            resultSet = preparedStatement.executeQuery();
-
-            if (resultSet.next()) {
-                return resultSet.getString("password");
-            }
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error retrieving credentials for user.");
-            stringBuilder.append("name - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } finally {
-
-            if (resultSet != null) {
-                try {
-                    resultSet.close();
-                } catch (SQLException e) {
-                    log.error("Error closing result set", e);
-                }
-            }
-
-            if (preparedStatement != null) {
-                try {
-                    preparedStatement.close();
-                } catch (SQLException e) {
-                    log.error("Error closing prepared statement", e);
-                }
-            }
-        }
-
-        return null;
-    }
-
-    public void changePassword(String userName, String oldPassword, String newPassword) {
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-
-            String storedPassword = getPassword(userName, connection);
-
-            String oldDigestedPassword = SecurityUtil.digestString(oldPassword, hashMethod);
-
-            if (storedPassword != null) {
-                if (!storedPassword.equals(oldDigestedPassword)) {
-                    throw new RuntimeException("Previous password did not match correctly. Please specify old password"
-                            + " correctly.");
-                }
-            }
-
-            String sql = "update Users set password = ? where user_name = ?";
-
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, SecurityUtil.digestString(newPassword, hashMethod));
-            preparedStatement.setString(2, userName);
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("Password changed for user " + userName);
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
-            stringBuilder.append(" user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } catch (NoSuchAlgorithmException e) {
-            String stringBuilder = "Error creating hash value for password.";
-            log.error(stringBuilder, e);
-
-            throw new RuntimeException(stringBuilder, e);
-        } finally {
-
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    public void changePasswordByAdmin(String userName, String newPassword) {
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-
-            String sql = "update Users set password = ? where user_name = ?";
-
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, SecurityUtil.digestString(newPassword, hashMethod));
-            preparedStatement.setString(2, userName);
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("Admin changed password of user " + userName);
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error updating credentials.");
-            stringBuilder.append(" user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } catch (NoSuchAlgorithmException e) {
-            String stringBuilder = "Error creating hash value for password.";
-            log.error(stringBuilder, e);
-
-            throw new RuntimeException(stringBuilder, e);
-        } finally {
-
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    public void deleteUser(String userName) {
-
-        String sql = "delete from Users where user_name=?";
-
-        Connection connection = null;
-        PreparedStatement preparedStatement = null;
-
-        try {
-            connection = dbUtil.getConnection();
-            preparedStatement = connection.prepareStatement(sql);
-
-            preparedStatement.setString(1, userName);
-
-            preparedStatement.executeUpdate();
-
-            connection.commit();
-
-            log.debug("User " + userName + " deleted.");
-
-        } catch (SQLException e) {
-            StringBuilder stringBuilder = new StringBuilder("Error deleting user.");
-            stringBuilder.append("user - ").append(userName);
-
-            log.error(stringBuilder.toString(), e);
-
-            throw new RuntimeException(stringBuilder.toString(), e);
-        } finally {
-            dbUtil.cleanup(preparedStatement, connection);
-        }
-
-    }
-
-    public List<String> getUsers() {
-
-        List<String> userList = new ArrayList<String>();
-
-        String sql = "select user_name from Users";
-
-        PreparedStatement preparedStatement = null;
-        ResultSet resultSet = null;
-        Connection connection = null;
-
-        try {
-
-            connection = dbUtil.getConnection();
-            preparedStatement = connection.prepareStatement(sql);
-
-            resultSet = preparedStatement.executeQuery();
-
-            while (resultSet.next()) {
-                userList.add(resultSet.getString("user_name"));
-            }
-
-        } catch (SQLException e) {
-            String errorString = "Error retrieving Users.";
-            log.error(errorString, e);
-
-            throw new RuntimeException(errorString, e);
-        } finally {
-
-            if (resultSet != null) {
-                try {
-                    resultSet.close();
-                } catch (SQLException e) {
-                    log.error("Error closing result set", e);
-                }
-            }
-
-            if (preparedStatement != null) {
-                try {
-                    preparedStatement.close();
-                } catch (SQLException e) {
-                    log.error("Error closing prepared statement", e);
-                }
-            }
-
-            if (connection != null) {
-                try {
-                    connection.close();
-                } catch (SQLException e) {
-                    log.error("Error closing connection", e);
-                }
-            }
-        }
-
-        Collections.sort(userList);
-
-        return userList;
-
-    }
-
-    public static String getPasswordRegularExpression() {
-        return "'^[a-zA-Z0-9_-]{6,15}$'";
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java
deleted file mode 100644
index 86299a4..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/security/session/SessionAuthenticator.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.services.registry.rest.security.session;
-
-import org.apache.airavata.security.AbstractAuthenticator;
-import org.apache.airavata.security.AuthenticationException;
-import org.apache.airavata.security.UserStoreException;
-import org.w3c.dom.Node;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * This authenticator will authenticate requests based on a session (NOT HTTP Session) id stored
- * in the database.
- */
-public class SessionAuthenticator extends AbstractAuthenticator {
-
-    private static final String AUTHENTICATOR_NAME = "SessionAuthenticator";
-
-    private static final String SESSION_TICKET = "sessionTicket";
-
-    public SessionAuthenticator() {
-        super(AUTHENTICATOR_NAME);
-    }
-
-    @Override
-    public boolean doAuthentication(Object credentials) throws AuthenticationException {
-
-       if (credentials == null)
-            return false;
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest)credentials;
-        String sessionTicket = httpServletRequest.getHeader(SESSION_TICKET);
-        try {
-            return this.getUserStore().authenticate(sessionTicket);
-        } catch (UserStoreException e) {
-            throw new AuthenticationException("Error querying database for session information.", e);
-        }
-    }
-
-    @Override
-    public boolean canProcess(Object credentials) {
-
-        if (credentials instanceof HttpServletRequest) {
-            HttpServletRequest request = (HttpServletRequest) credentials;
-
-            String ticket = request.getHeader(SESSION_TICKET);
-            if (ticket != null) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    @Override
-    public void onSuccessfulAuthentication(Object authenticationInfo) {
-
-        HttpServletRequest httpServletRequest = (HttpServletRequest)authenticationInfo;
-        String sessionTicket = httpServletRequest.getHeader(SESSION_TICKET);
-
-        // Add sessionTicket to http session
-        HttpSession httpSession = httpServletRequest.getSession();
-
-        if (httpSession != null) {
-            httpSession.setAttribute(SESSION_TICKET, sessionTicket);
-        }
-
-        log.debug("A request with a session ticket is successfully logged in.");
-
-    }
-
-    @Override
-    public void onFailedAuthentication(Object authenticationInfo) {
-        log.warn("Failed attempt to login.");
-    }
-
-    @Override
-    public void configure(Node node) throws RuntimeException {
-
-        try {
-            this.getUserStore().configure(node);
-        } catch (UserStoreException e) {
-            throw new RuntimeException("Error while configuring authenticator user store", e);
-        }
-    }
-
-
-    @Override
-    public boolean isAuthenticated(Object credentials) {
-        HttpServletRequest httpServletRequest = (HttpServletRequest)credentials;
-
-        if (httpServletRequest.getSession() != null) {
-            String sessionTicket = (String)httpServletRequest.getSession().getAttribute(SESSION_TICKET);
-            return (sessionTicket != null);
-        }
-
-        return false;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/WebAppUtil.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/WebAppUtil.java b/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/WebAppUtil.java
deleted file mode 100644
index 6a58c56..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/registry/rest/utils/WebAppUtil.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.services.registry.rest.utils;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Properties;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.core.Response;
-
-import org.apache.airavata.rest.mappings.utils.RestServicesConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A utility class for webapp operations.
- */
-public class WebAppUtil {
-
-    protected static Logger log = LoggerFactory.getLogger(WebAppUtil.class);
-
-    public static Response reportInternalServerError(String resourceMethod, Throwable t) {
-
-        log.error("Resource Method : " + resourceMethod + " : Internal Server Error ", t);
-        Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
-        builder.entity(t.getMessage());
-        return builder.build();
-    }
-
-    // public static Properties getAiravataProperties(ServletContext servletContext) throws IOException {
-    //
-    // URL url = WebAppUtil.class.getClassLoader().
-    // getResource(RestServicesConstants.AIRAVATA_SERVER_PROPERTIES);
-    // Properties properties = new Properties();
-    // try {
-    // properties.load(url.openStream());
-    // } catch (IOException e) {
-    // log.error("Error reading Airavata properties");
-    // throw e;
-    // }
-    //
-    // return properties;
-    // }
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/main/java/org/apache/airavata/services/server/ServerConfigurationService.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/main/java/org/apache/airavata/services/server/ServerConfigurationService.java b/modules/rest/service/src/main/java/org/apache/airavata/services/server/ServerConfigurationService.java
deleted file mode 100644
index ff6713c..0000000
--- a/modules/rest/service/src/main/java/org/apache/airavata/services/server/ServerConfigurationService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * 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.services.server;
-
-import javax.ws.rs.Path;
-
-import org.apache.airavata.rest.mappings.utils.ResourcePathConstants.ServerManagerConstants;
-import org.apache.airavata.services.registry.rest.resources.ConfigurationRegistryResource;
-
-@Path(ServerManagerConstants.PATH)
-public class ServerConfigurationService extends ConfigurationRegistryResource{
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/0e2c10f5/modules/rest/service/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/modules/rest/service/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java b/modules/rest/service/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java
deleted file mode 100644
index 65ca00f..0000000
--- a/modules/rest/service/src/test/java/org/apache/airavata/services/registry/rest/security/AbstractAuthenticatorTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * 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.services.registry.rest.security;
-
-import junit.framework.TestCase;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.security.Authenticator;
-import org.apache.airavata.security.configurations.AuthenticatorConfigurationReader;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.List;
-
-/**
- * An abstract class to implement test cases for authenticators.
- */
-public abstract class AbstractAuthenticatorTest extends DatabaseTestCases {
-
-    private String authenticatorName;
-
-    protected Authenticator authenticator = null;
-
-    public AbstractAuthenticatorTest(String name) throws Exception {
-        authenticatorName = name;
-    }
-
-    protected AuthenticatorConfigurationReader authenticatorConfigurationReader;
-
-    @Before
-    public void setUp() throws Exception {
-
-        authenticatorConfigurationReader = new AuthenticatorConfigurationReader();
-        authenticatorConfigurationReader.init(this.getClass().getClassLoader()
-                .getResourceAsStream("authenticators.xml"));
-
-        List<Authenticator> listAuthenticators = authenticatorConfigurationReader.getAuthenticatorList();
-
-        if (listAuthenticators == null) {
-            throw new Exception("No authenticators found !");
-        }
-
-        for (Authenticator a : listAuthenticators) {
-            if (a.getAuthenticatorName().equals(authenticatorName)) {
-                authenticator = a;
-            }
-        }
-
-        if (authenticator == null) {
-            throw new Exception("Could not find an authenticator with name " + authenticatorName);
-        }
-
-    }
-
-    @Test
-    public abstract void testAuthenticateSuccess() throws Exception;
-
-    @Test
-    public abstract void testAuthenticateFail() throws Exception;
-
-    @Test
-    public abstract void testCanProcess() throws Exception;
-}


Mime
View raw message