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

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


            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

                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
        }

        try{
            GatewayResource gatewayResource = new GatewayResource();
            gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
            gatewayResource.setOwner(RegistrySettings.getSetting("default.registry.gateway"));
            gatewayResource.save();

            UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
            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();
        } catch (RegistrySettingsException e) {
            logger.error("Unable to read properties", e);
        }
View Full Code Here

                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
        }

        try{
            GatewayResource gatewayResource = new GatewayResource();
            gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
            gatewayResource.setOwner(RegistrySettings.getSetting("default.registry.gateway"));
            gatewayResource.save();

            UserResource userResource = (UserResource) gatewayResource.create(ResourceType.USER);
            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();
        } catch (RegistrySettingsException e) {
            logger.error("Unable to read properties", e);
        }
View Full Code Here

  public JPAResourceAccessor(AiravataRegistry2 registry) {
    this.registry=registry;
  }
 
  public GatewayResource getGateway(){
        GatewayResource gatewayResource = new GatewayResource();
        gatewayResource.setGatewayName(this.registry.getGateway().getGatewayName());
    return gatewayResource;
  }
View Full Code Here

                logger.error(e.getMessage(), e);
                e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
        }
        try{
            GatewayResource gatewayResource = new GatewayResource();
            gatewayResource.setGatewayName(RegistrySettings.getSetting(REGISTRY_DEFAULT_GATEWAY_ID));
            gatewayResource.setOwner(RegistrySettings.getSetting(REGISTRY_DEFAULT_GATEWAY_ID));
            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 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

    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

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.