Package org.apache.airavata.commons.gfac.type

Examples of org.apache.airavata.commons.gfac.type.HostDescription


      String hostName = this.hostIdTextField.getText();
      if (hostName == null
          || hostName.trim().equals("")) {
        throw new Exception("Id of the host cannot be empty!!!");
      }
      HostDescription hostDescription2 = null;
        hostDescription2 = getRegistry().getHostDescriptor(hostName);
      if (hostDescription2 != null) {
        throw new Exception(
            "Host descriptor with the given id already exists!!!");
      }
View Full Code Here


        this.hostCreated = hostCreated;
    }

    public HostDescription getHostDescription() {
        if (hostDescription == null) {
            hostDescription = new HostDescription(GlobusHostType.type);
        }
        return hostDescription;
    }
View Full Code Here

        }
        return hostDescription;
    }

    public void saveHostDescription() {
        HostDescription desc = getHostDescription();
        try {
          if (getRegistry().isHostDescriptorExists(desc.getType().getHostName())){
            getRegistry().updateHostDescriptor(desc)
          }else{
            getRegistry().addHostDescriptor(desc);
          }
      setHostCreated(true);
View Full Code Here

                    + " does not found on resource Catalog " + registryService);

        /*
         * Load host
         */
        HostDescription host = scheduleToHost(registryService, context.getServiceName());

        if (host == null)
            throw new SchedulerException("Host Desciption for " + context.getServiceName()
                    + " does not found on resource Catalog " + registryService);

        /*
         * Load app
         */
        ApplicationDeploymentDescription app = null;
        try {
            app = registryService.getApplicationDescriptors(context.getServiceName(),
                    getRegisteredHost(registryService,context.getServiceName()).getType().getHostName());
        } catch (RegistryException e2) {
            e2.printStackTrace();
        }

        if (app == null)
            throw new SchedulerException("App Desciption for " + context.getServiceName()
                    + " does not found on resource Catalog " + registryService);

        /*
         * Check class and binding
         */

        if (context.getExecutionDescription() == null) {
            context.setExecutionDescription(new DefaultExecutionDescription());
        }
        context.getExecutionDescription().setHost(host);
        context.getExecutionDescription().setService(serviceDesc);
        context.getExecutionDescription().setApp(app);

        OMElement omSecurityContextHeader = context.getExecutionContext().getSecurityContextHeader();

        ContextHeaderDocument document = null;
        try {
            if (omSecurityContextHeader != null) {
                document = ContextHeaderDocument.Factory.parse(omSecurityContextHeader.toStringWithConsume());
            }
        } catch (XMLStreamException e) {
            e.printStackTrace();
        } catch (XmlException e) {
            e.printStackTrace();
        }

        SecurityContextDocument.SecurityContext.AmazonWebservices amazonWebservices = null;
        if (document != null) {
            amazonWebservices = document.getContextHeader().getSecurityContext().getAmazonWebservices();
        }

        /*
         * Determine provider
         */
        String hostName = host.getType().getHostAddress();
        try {
            if (GfacUtils.isLocalHost(hostName)) {
                return new LocalProvider();
            } else if (amazonWebservices != null && hostName != null) {
                log.info("host name: " + hostName);
View Full Code Here

            if (applicationSchedulingContextArray != null && applicationSchedulingContextArray.length > 0) {
                hostName = applicationSchedulingContextArray[0].getHostName();
            }
        }
        log.info("Searching registry for some deployed application hosts");
        HostDescription result = null;
        Map<HostDescription, List<ApplicationDeploymentDescription>> deploymentDescription = null;
        result = getRegisteredHost(regService, serviceName);
        // if user specify the host in the workflowcontext header we pick that host instead of picking the last hostName
        if(hostName != null){
            HostDescription hostDescription = null;
            try {
                hostDescription = regService.getHostDescriptor(hostName);
            } catch (RegistryException e) {
                e.printStackTrace();
                log.warn("Wrong host Name provided in WorkflowContext Header");
View Full Code Here

//            return null;
//        }
    }

    private HostDescription getRegisteredHost(AiravataRegistry2 regService, String serviceName) {
        HostDescription result = null;
        try {
            Map<String, ApplicationDeploymentDescription> applicationDescriptors = regService.getApplicationDescriptors(serviceName);
            for (String hostDescName : applicationDescriptors.keySet()) {
                HostDescription hostDescriptor = regService.getHostDescriptor(hostDescName);
                result = hostDescriptor;
                log.info("Found service on: " + result.getType().getHostAddress());
            }
        } catch (RegistryException e) {
            e.printStackTrace();
View Full Code Here

public class RegistryDataService extends DataServiceChain {

    public boolean execute(InvocationContext context) throws ExtensionException {

        ServiceDescription serviceDesc = context.getExecutionDescription().getService();
        HostDescription hostDesc = context.getExecutionDescription().getHost();
        ApplicationDeploymentDescriptionType appDesc = context.getExecutionDescription().getApp().getType();
        if (serviceDesc != null && hostDesc != null && appDesc != null) {
            /*
             * if there is no setting in deployment description, use from host
             */
 
View Full Code Here

        registry.unsetMessageBoxURI();
        assertNotNull("message url removed successfully", ResourceUtils.isConfigurationExist("messagebox.url"));
    }

    public void testIsHostDescriptorExists() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        assertTrue("Host added successfully", registry.isHostDescriptorExists("testHost"));
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

        registry.removeHostDescriptor("testHost");
    }


    public void testAddHostDescriptor() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        assertTrue("Host added successfully", registry.isHostDescriptorExists("testHost"));
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

        registry.removeHostDescriptor("testHost");
    }


    public void testUpdateHostDescriptor() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        HostDescription hostDescriptor = registry.getHostDescriptor("testHost");
        hostDescriptor.getType().setHostAddress("testHostAddress2");
        registry.updateHostDescriptor(hostDescriptor);
        HostDescription testHost = registry.getHostDescriptor("testHost");
        assertTrue("host updated successfully", testHost.getType().getHostAddress().equals("testHostAddress2"));
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.commons.gfac.type.HostDescription

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.