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

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


    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

            gatewayResource.save();
            UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
            userResource.setUserName(RegistrySettings.getSetting(REGISTRY_DEFAULT_USER));
            userResource.setPassword(RegistrySettings.getSetting(REGISTRY_DEFAULT_USER_PASSWORD));
            userResource.save();
            WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
            workerResource.setUser(userResource.getUserName());
            workerResource.save();
        } catch (RegistrySettingsException e) {
            logger.error("Unable to read properties", e);
        }

    }
View Full Code Here

  public JPAResourceAccessor(AiravataRegistry2 registry) {
    this.registry=registry;
    gatewayResource = new GatewayResource();
    gatewayResource.setGatewayName(this.registry.getGateway().getGatewayName());
    workerResource = new WorkerResource(registry.getUser().getUserName(), getGateway());
  }
View Full Code Here

        UserResource userResource2 = (UserResource) gatewayResource.create(ResourceType.USER);
        userResource2.setUserName("testUser");
        userResource2.setPassword("testPassword");
        userResource2.save();

        WorkerResource workerResource1 = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
        workerResource1.setUser(userResource1.getUserName());
        workerResource1.save();

        WorkerResource workerResource2 = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
        workerResource2.setUser(userResource2.getUserName());
        workerResource2.save();

    }
View Full Code Here

        UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
        userResource.setUserName((String) properties.get(REGISTRY_USER));
        userResource.setPassword((String) properties.get(REGISTRY_PASSWORD));
        userResource.save();

        WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
        workerResource.setUser(userResource.getUserName());
        workerResource.save();

    }
View Full Code Here

        gatewayResource.save();
        UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
        userResource.setUserName((String) properties.get(REGISTRY_USER));
        userResource.setPassword((String) properties.get(REGISTRY_PASSWORD));
        userResource.save();
        WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
        workerResource.setUser(userResource.getUserName());
        workerResource.save();
    }
View Full Code Here

    public void addHostDescriptor(HostDescription descriptor) throws RegistryException {
        if (descriptorRegistry != null){
            descriptorRegistry.addHostDescriptor(descriptor);
        } else {
            GatewayResource gateway = jpa.getGateway();
            WorkerResource workerResource = jpa.getWorker();
            String hostName = descriptor.getType().getHostName();
            if (isHostDescriptorExists(hostName)){
                throw new DescriptorAlreadyExistsException(hostName);
            }
            HostDescriptorResource hostDescriptorResource = gateway.createHostDescriptorResource(hostName);
            hostDescriptorResource.setUserName(workerResource.getUser());
            hostDescriptorResource.setContent(descriptor.toXML());
            hostDescriptorResource.save();
        }
    }
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.