Package org.apache.airavata.persistance.registry.jpa.resources

Examples of org.apache.airavata.persistance.registry.jpa.resources.WorkerResource


    public void addWorkflow(String workflowName, String workflowGraphXml) throws RegistryException {
        if (userWorkflowRegistry != null){
            userWorkflowRegistry.addWorkflow(workflowName, workflowGraphXml);
        }else {
            WorkerResource worker = jpa.getWorker();
            if (isWorkflowExists(workflowName)){
                throw new UserWorkflowAlreadyExistsException(workflowName);
            }
            UserWorkflowResource workflowResource = worker.createWorkflowTemplate(workflowName);
            workflowResource.setContent(workflowGraphXml);
            workflowResource.save();
        }
    }
View Full Code Here


    public void updateWorkflow(String workflowName, String workflowGraphXml) throws RegistryException {
        if (userWorkflowRegistry != null){
            userWorkflowRegistry.updateWorkflow(workflowName, workflowGraphXml);
        }else {
            WorkerResource worker = jpa.getWorker();
            if (!isWorkflowExists(workflowName)){
                throw new UserWorkflowDoesNotExistsException(workflowName);
            }
            UserWorkflowResource workflowResource = worker.getWorkflowTemplate(workflowName);
            workflowResource.setContent(workflowGraphXml);
            workflowResource.save();
        }
    }
View Full Code Here

    public String getWorkflowGraphXML(String workflowName) throws RegistryException {
        if (userWorkflowRegistry != null){
            return userWorkflowRegistry.getWorkflowGraphXML(workflowName);
        }
        WorkerResource worker = jpa.getWorker();
    if (!isWorkflowExists(workflowName)){
          throw new UserWorkflowDoesNotExistsException(workflowName);
        }
    return worker.getWorkflowTemplate(workflowName).getContent();
    }
View Full Code Here

  @Override
  public Map<String, String> getWorkflows() throws RegistryException {
        if (userWorkflowRegistry != null){
            return userWorkflowRegistry.getWorkflows();
        }
        WorkerResource worker = jpa.getWorker();
      Map<String, String> workflows=new HashMap<String, String>();
      List<UserWorkflowResource> workflowTemplates = worker.getWorkflowTemplates();
      for (UserWorkflowResource resource : workflowTemplates) {
        workflows.put(resource.getName(), resource.getContent());
    }
      return workflows;
  }
View Full Code Here

    public void removeWorkflow(String workflowName) throws RegistryException {
        if (userWorkflowRegistry != null){
            userWorkflowRegistry.removeWorkflow(workflowName);
        }else {
            WorkerResource worker = jpa.getWorker();
            if (!isWorkflowExists(workflowName)){
                throw new UserWorkflowDoesNotExistsException(workflowName);
            }
            worker.removeWorkflowTemplate(workflowName);
        }
    }
View Full Code Here

            try{
                GatewayResource gateway = (GatewayResource)ResourceUtils.createGateway(ServerSettings.getSystemUserGateway());
                gateway.save();
                UserResource user = ResourceUtils.createUser(ServerSettings.getSystemUser(), ServerSettings.getSystemUserPassword());
                user.save();
                WorkerResource workerResource = (WorkerResource)gateway.create(ResourceType.GATEWAY_WORKER);
                workerResource.setUser(user.getUserName());
                workerResource.save();
                ProjectResource projectResource = workerResource.createProject(DEFAULT_PROJECT_NAME);
                projectResource.setName(DEFAULT_PROJECT_NAME);
                projectResource.setGateway(gateway);
                projectResource.save();
            } catch (ApplicationSettingsException e) {
                logger.error("Unable to read airavata-server properties...", e.getMessage());
View Full Code Here

            try{
                GatewayResource gateway = (GatewayResource)ResourceUtils.createGateway(ServerSettings.getSystemUserGateway());
                gateway.save();
                UserResource user = ResourceUtils.createUser(ServerSettings.getSystemUser(), ServerSettings.getSystemUserPassword());
                user.save();
                WorkerResource workerResource = (WorkerResource)gateway.create(ResourceType.GATEWAY_WORKER);
                workerResource.setUser(user.getUserName());
                workerResource.save();
                ProjectResource projectResource = workerResource.createProject(DEFAULT_PROJECT_NAME);
                projectResource.setName(DEFAULT_PROJECT_NAME);
                projectResource.setGateway(gateway);
                projectResource.save();
            } catch (ApplicationSettingsException e) {
                logger.error("Unable to read airavata-server properties...", e.getMessage());
View Full Code Here

            UserResource userResource = new UserResource();
            userResource.setUserName(RegistrySettings.getSetting("default.registry.user"));
            userResource.setPassword(RegistrySettings.getSetting("default.registry.password"));
            userResource.save();

            WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
            workerResource.setUser(userResource.getUserName());
            workerResource.save();
           
            ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
            projectResource.setGateway(gatewayResource);
            projectResource.setId("default");
            projectResource.setName("default");
            projectResource.setWorker(workerResource);
            projectResource.save();
View Full Code Here

                GatewayResource gatewayResource = (GatewayResource)ResourceUtils.getGateway(getGatewayName());
                UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
                userResource.setUserName(getUsername());
                userResource.setPassword(getPassword());
                userResource.save();
                WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
                workerResource.setUser(userResource.getUserName());
                workerResource.save();
                setUserCreated(true);
//                JCRComponentRegistry registry = new JCRComponentRegistry(getUsername(),getPassword());
            } catch (Exception e) {
                e.printStackTrace();
                engine.getGUI().getErrorWindow().error(e.getMessage());
View Full Code Here

    public WorkspaceProject getWorkspaceProject(String projectName) throws RegistryException {
        if (projectsRegistry != null){
            return projectsRegistry.getWorkspaceProject(projectName);
        }
      WorkerResource worker = jpa.getWorker();
    if (!isWorkspaceProjectExists(projectName)){
          throw new WorkspaceProjectDoesNotExistsException(createProjName(projectName));
        }
    ProjectResource projectResource = worker.getProject(createProjName(projectName));
    return new WorkspaceProject(getProjName(projectResource.getName()), this);
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.persistance.registry.jpa.resources.WorkerResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.