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

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


    public Map<String, ApplicationDescription> getApplicationDescriptors(String serviceName) throws RegistryException {
        if (descriptorRegistry != null){
            return descriptorRegistry.getApplicationDescriptors(serviceName);
        }
        GatewayResource gateway = jpa.getGateway();
    Map<String, ApplicationDescription> map=new HashMap<String,ApplicationDescription>();
    List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(serviceName, null);
    for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
      map.put(resource.getHostDescName(),createApplicationDescriptor(resource));
    }
    return map;
    }
View Full Code Here


    }
    return map;
    }

    private Map<String,ApplicationDescription> getApplicationDescriptorsFromHostName(String hostName)throws RegistryException {
        GatewayResource gateway = jpa.getGateway();
    Map<String, ApplicationDescription> map=new HashMap<String,ApplicationDescription>();
    List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(null, hostName);
    for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
      map.put(resource.getServiceDescName(),createApplicationDescriptor(resource));
    }
    return map;
    }
View Full Code Here

   
    public Map<String[],ApplicationDescription> getApplicationDescriptors()throws MalformedDescriptorException, RegistryException{
        if (descriptorRegistry != null){
            return descriptorRegistry.getApplicationDescriptors();
        }
        GatewayResource gateway = jpa.getGateway();
    Map<String[], ApplicationDescription> map=new HashMap<String[],ApplicationDescription>();
    List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources();
    for (ApplicationDescriptorResource resource : applicationDescriptorResources) {
      map.put(new String[]{resource.getServiceDescName(),resource.getHostDescName()},createApplicationDescriptor(resource));
    }
    return map;
    }
View Full Code Here

    public void removeApplicationDescriptor(String serviceName, String hostName, String applicationName) throws RegistryException {
        if (descriptorRegistry != null){
             descriptorRegistry.removeApplicationDescriptor(serviceName, hostName, applicationName);
        } else {
            GatewayResource gateway = jpa.getGateway();
            String appName = createAppName(serviceName, hostName, applicationName);
            if (!isApplicationDescriptorExists(serviceName,hostName,applicationName)){
                throw new DescriptorDoesNotExistsException(appName);
            }
            gateway.removeApplicationDescriptor(appName);
        }

    }
View Full Code Here

    public void publishWorkflow(String workflowName, String publishWorkflowName) throws RegistryException {
        if (publishedWorkflowRegistry != null){
            publishedWorkflowRegistry.publishWorkflow(workflowName, publishWorkflowName);
        } else {
            GatewayResource gateway = jpa.getGateway();
            String workflowGraphXML = getWorkflowGraphXML(workflowName);
            if (gateway.isPublishedWorkflowExists(publishWorkflowName)){
                throw new PublishedWorkflowAlreadyExistsException(publishWorkflowName);
            }
            PublishWorkflowResource publishedWorkflow = gateway.createPublishedWorkflow(publishWorkflowName);
            publishedWorkflow.setCreatedUser(getUser().getUserName());
            publishedWorkflow.setContent(workflowGraphXML);
            publishedWorkflow.setPublishedDate(new Timestamp(Calendar.getInstance().getTime().getTime()));
            publishedWorkflow.save();
        }
View Full Code Here

    public String getPublishedWorkflowGraphXML(String workflowName) throws RegistryException {
        if (publishedWorkflowRegistry != null){
            return publishedWorkflowRegistry.getPublishedWorkflowGraphXML(workflowName);
        }
        GatewayResource gateway = jpa.getGateway();
        if (!isPublishedWorkflowExists(workflowName)){
          throw new PublishedWorkflowDoesNotExistsException(workflowName);
        }
        return gateway.getPublishedWorkflow(workflowName).getContent();
    }
View Full Code Here

  public List<String> getPublishedWorkflowNames() throws RegistryException{
        if (publishedWorkflowRegistry != null){
            return publishedWorkflowRegistry.getPublishedWorkflowNames();
        }
    GatewayResource gateway = jpa.getGateway();
    List<String> result=new ArrayList<String>();
      List<PublishWorkflowResource> publishedWorkflows = gateway.getPublishedWorkflows();
      for (PublishWorkflowResource resource : publishedWorkflows) {
      result.add(resource.getName());
    }
      return result;
  }
View Full Code Here

    public Map<String,String> getPublishedWorkflows() throws RegistryException{
        if (publishedWorkflowRegistry != null){
            return publishedWorkflowRegistry.getPublishedWorkflows();
        }
      GatewayResource gateway = jpa.getGateway();
      Map<String,String> result=new HashMap<String, String>();
      List<PublishWorkflowResource> publishedWorkflows = gateway.getPublishedWorkflows();
      for (PublishWorkflowResource resource : publishedWorkflows) {
      result.put(resource.getName(), resource.getContent());
    }
      return result;
    }
View Full Code Here

    public void removePublishedWorkflow(String workflowName) throws RegistryException {
        if (publishedWorkflowRegistry != null){
            publishedWorkflowRegistry.removePublishedWorkflow(workflowName);
        } else {
            GatewayResource gateway = jpa.getGateway();
            if (!isPublishedWorkflowExists(workflowName)){
                throw new PublishedWorkflowDoesNotExistsException(workflowName);
            }
            gateway.removePublishedWorkflow(workflowName);
        }
    }
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.GatewayResource

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.