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

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


    public void updateHostDescriptor(HostDescription descriptor) throws RegistryException {
        if (descriptorRegistry != null){
            descriptorRegistry.updateHostDescriptor(descriptor);
        } else {
            GatewayResource gateway = jpa.getGateway();
            String hostName = descriptor.getType().getHostName();
            if (!isHostDescriptorExists(hostName)){
                throw new DescriptorDoesNotExistsException(hostName);
            }
            HostDescriptorResource hostDescriptorResource = gateway.getHostDescriptorResource(hostName);
            hostDescriptorResource.setContent(descriptor.toXML());
            hostDescriptorResource.save();
        }
    }
View Full Code Here


    public HostDescription getHostDescriptor(String hostName) throws RegistryException {
        if (descriptorRegistry != null){
            return descriptorRegistry.getHostDescriptor(hostName);
        } else {
            GatewayResource gateway = jpa.getGateway();
            if (!isHostDescriptorExists(hostName)){
                return null;
            }
            HostDescriptorResource hostDescriptorResource = gateway.getHostDescriptorResource(hostName);
            return createHostDescriptor(hostDescriptorResource);
        }
    }
View Full Code Here

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

  public List<HostDescription> getHostDescriptors()
      throws MalformedDescriptorException, RegistryException {
        if (descriptorRegistry != null){
            return descriptorRegistry.getHostDescriptors();
        }
    GatewayResource gateway = jpa.getGateway();
    List<HostDescription> list=new ArrayList<HostDescription>();
    List<HostDescriptorResource> hostDescriptorResources = gateway.getHostDescriptorResources();
    for (HostDescriptorResource resource : hostDescriptorResources) {
      list.add(createHostDescriptor(resource));
    }
    return list;
  }
View Full Code Here

    public void addServiceDescriptor(ServiceDescription descriptor) throws RegistryException {
        if (descriptorRegistry != null) {
            descriptorRegistry.addServiceDescriptor(descriptor);
        }else {
            GatewayResource gateway = jpa.getGateway();
            WorkerResource workerResource = jpa.getWorker();
            String serviceName = descriptor.getType().getName();
            if (isServiceDescriptorExists(serviceName)){
                throw new DescriptorAlreadyExistsException(serviceName);
            }
            ServiceDescriptorResource serviceDescriptorResource = gateway.createServiceDescriptorResource(serviceName);
            serviceDescriptorResource.setUserName(workerResource.getUser());
            serviceDescriptorResource.setContent(descriptor.toXML());
            serviceDescriptorResource.save();
        }
    }
View Full Code Here

    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

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.