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

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


    public void updateServiceDescriptor(ServiceDescription descriptor) throws RegistryException {
        if (descriptorRegistry != null) {
            descriptorRegistry.updateServiceDescriptor(descriptor);
        }else {
            GatewayResource gateway = jpa.getGateway();
            String serviceName = descriptor.getType().getName();
            if (!isServiceDescriptorExists(serviceName)){
                throw new DescriptorDoesNotExistsException(serviceName);
            }
            ServiceDescriptorResource serviceDescriptorResource = gateway.getServiceDescriptorResource(serviceName);
            serviceDescriptorResource.setContent(descriptor.toXML());
            serviceDescriptorResource.save();
        }
    }
View Full Code Here


    public ServiceDescription getServiceDescriptor(String serviceName) throws RegistryException, MalformedDescriptorException {
        if (descriptorRegistry != null) {
            return descriptorRegistry.getServiceDescriptor(serviceName);
        }else {
            GatewayResource gateway = jpa.getGateway();
            if (!gateway.isServiceDescriptorExists(serviceName)){
                return null;
            }
            ServiceDescriptorResource serviceDescriptorResource = gateway.getServiceDescriptorResource(serviceName);
            return createServiceDescriptor(serviceDescriptorResource);
        }
    }
View Full Code Here

    public void removeServiceDescriptor(String serviceName) throws RegistryException {
        if (descriptorRegistry != null) {
            descriptorRegistry.removeServiceDescriptor(serviceName);
        }else {
            GatewayResource gateway = jpa.getGateway();
            if (!isServiceDescriptorExists(serviceName)){
                throw new DescriptorDoesNotExistsException(serviceName);
            }
            gateway.removeServiceDescriptor(serviceName);
            try {
        //we need to delete the application descriptors bound to this service
        Map<String, ApplicationDescription> applicationDescriptors = getApplicationDescriptors(serviceName);
        for (String hostName : applicationDescriptors.keySet()) {
          removeApplicationDescriptor(serviceName, hostName, applicationDescriptors.get(hostName).getType().getApplicationName().getStringValue());
View Full Code Here

  public List<ServiceDescription> getServiceDescriptors()
      throws MalformedDescriptorException, RegistryException {
        if (descriptorRegistry != null) {
            return descriptorRegistry.getServiceDescriptors();
        }else {
            GatewayResource gateway = jpa.getGateway();
            List<ServiceDescription> list=new ArrayList<ServiceDescription>();
            List<ServiceDescriptorResource> serviceDescriptorResources = gateway.getServiceDescriptorResources();
            for (ServiceDescriptorResource resource : serviceDescriptorResources) {
                list.add(createServiceDescriptor(resource));
            }
            return list;
        }
View Full Code Here

            descriptorRegistry.addApplicationDescriptor(serviceName, hostName, descriptor);
        else {
            if (serviceName==null || hostName==null){
                throw new InsufficientDataException("Service name or Host name cannot be null");
            }
            GatewayResource gateway = jpa.getGateway();
            WorkerResource workerResource = jpa.getWorker();
            String applicationName = descriptor.getType().getApplicationName().getStringValue();
            applicationName = createAppName(serviceName, hostName, applicationName);
            if (isApplicationDescriptorExists(serviceName,hostName,descriptor.getType().getApplicationName().getStringValue())){
                throw new DescriptorAlreadyExistsException(applicationName);
            }
            ApplicationDescriptorResource applicationDescriptorResource = gateway.createApplicationDescriptorResource(applicationName);
            applicationDescriptorResource.setUpdatedUser(workerResource.getUser());
            applicationDescriptorResource.setServiceDescName(serviceName);
            applicationDescriptorResource.setHostDescName(hostName);
            applicationDescriptorResource.setContent(descriptor.toXML());
            applicationDescriptorResource.save();
View Full Code Here

            descriptorRegistry.updateApplicationDescriptor(serviceName, hostName, descriptor);
        } else {
            if (serviceName==null || hostName==null){
                throw new InsufficientDataException("Service name or Host name cannot be null");
            }
            GatewayResource gateway = jpa.getGateway();
            String applicationName = descriptor.getType().getApplicationName().getStringValue();
            applicationName = createAppName(serviceName, hostName, applicationName);
            if (!isApplicationDescriptorExists(serviceName,hostName,descriptor.getType().getApplicationName().getStringValue())){
                throw new DescriptorDoesNotExistsException(applicationName);
            }
            ApplicationDescriptorResource serviceDescriptorResource = gateway.getApplicationDescriptorResource(applicationName);
            serviceDescriptorResource.setContent(descriptor.toXML());
            serviceDescriptorResource.save();
        }
    }
View Full Code Here

            return descriptorRegistry.getApplicationDescriptor(serviceName, hostname, applicationName);
        }
        if (serviceName==null || hostname==null){
        throw new InsufficientDataException("Service name or Host name cannot be null");
      }
      GatewayResource gateway = jpa.getGateway();
    if (!isApplicationDescriptorExists(serviceName,hostname,applicationName)){
          throw new DescriptorDoesNotExistsException(createAppName(serviceName, hostname, applicationName));
        }
        return createApplicationDescriptor(gateway.getApplicationDescriptorResource(createAppName(serviceName, hostname, applicationName)));
    }
View Full Code Here

    public ApplicationDescription getApplicationDescriptors(String serviceName, String hostname) throws RegistryException {
        if (descriptorRegistry != null){
            return descriptorRegistry.getApplicationDescriptors(serviceName, hostname);
        }
        GatewayResource gateway = jpa.getGateway();
    List<ApplicationDescriptorResource> applicationDescriptorResources = gateway.getApplicationDescriptorResources(serviceName, hostname);
    if (applicationDescriptorResources.size()>0){
      return createApplicationDescriptor(applicationDescriptorResources.get(0));
    }
    return null;
    }
View Full Code Here

    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

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.