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

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


        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().getApplicationManager().isHostDescriptorExists(desc.getType().getHostName())){
            getRegistry().getApplicationManager().updateHostDescriptor(desc);
          }else{
            getRegistry().getApplicationManager().saveHostDescription(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
         */
        ApplicationDescription app = null;
        try {
            app = registryService.getApplicationManager().getApplicationDescription(context.getServiceName(),
                    getRegisteredHost(registryService, context.getServiceName()).getType().getHostName());
        } catch (AiravataAPIInvocationException 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<ApplicationDescription>> 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.getApplicationManager().getHostDescription(hostName);
            } catch (AiravataAPIInvocationException e) {
                e.printStackTrace();
                log.warn("Wrong host Name provided in WorkflowContext Header");
View Full Code Here

//            return null;
//        }
    }

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

    }
   
    private void editDescriptor() throws AiravataAPIInvocationException {
      switch (descriptorType){
        case HOST:
          HostDescription h = (HostDescription) getSelected();
          HostDescriptionDialog hostDescriptionDialog = new HostDescriptionDialog(engine.getConfiguration().getAiravataAPI(),false,h, null);
          hostDescriptionDialog.setLocationRelativeTo(this.engine.getGUI().getFrame());
          hostDescriptionDialog.open();
          if (hostDescriptionDialog.isHostCreated()) {
          loadDescriptors();
View Full Code Here

    private boolean deleteDescriptor() throws AiravataAPIInvocationException{
      String title=null;
      String question=null;
      switch (descriptorType){
        case HOST:
          HostDescription h = (HostDescription) getSelected();
          title = "Host description";
          question = "Are you sure that you want to remove the service description \""
                      + h.getType().getHostName() + "\"?";
          break;
        case SERVICE:
            ServiceDescription d = (ServiceDescription) getSelected();
          title = "Service description";
          question = "Are you sure that you want to remove the applications associated with \""
                      + d.getType().getName() + "\"?";
          break;
        case APPLICATION:
          ApplicationDescription a = (ApplicationDescription) getSelected();
          title = "Service description";
          question = "Are you sure that you want to remove the service description \""
                      + a.getType().getApplicationName().getStringValue() + "\"?";
          break;
      }
     
       
    if (askQuestion(title, question)) {
              switch (descriptorType){
              case HOST:
                HostDescription h = (HostDescription) getSelected();
                  getRegistry().getApplicationManager().deleteHostDescription(h.getType().getHostName());
                        loadDescriptors();
                break;
              case SERVICE:
                  ServiceDescription d = (ServiceDescription) getSelected();
                  getRegistry().getApplicationManager().deleteServiceDescription(d.getType().getName());
View Full Code Here

            throw new RuntimeException("Failed : HTTP error code : "
                    + status);
        }

        HostDescriptor hostDescriptor = response.getEntity(HostDescriptor.class);
        HostDescription hostDescription = DescriptorUtil.createHostDescription(hostDescriptor);
        return hostDescription;
    }
View Full Code Here

        HostDescriptionList hostDescriptionList = response.getEntity(HostDescriptionList.class);
        HostDescriptor[] hostDescriptors = hostDescriptionList.getHostDescriptions();

        for (HostDescriptor hostDescriptor : hostDescriptors) {
            HostDescription hostDescription = DescriptorUtil.createHostDescription(hostDescriptor);
            hostDescriptions.add(hostDescription);
        }

        return hostDescriptions;
    }
View Full Code Here

        StAXOMBuilder builder = new StAXOMBuilder(reader);
        OMElement documentElement = builder.getDocumentElement();
        Iterator server = documentElement.getChildrenWithName(new QName("server"));
        while (server.hasNext()) {
            OMElement next = (OMElement) server.next();
            HostDescription hostDescription;
            if (next.getFirstChildWithName(new QName("gram.endpoint")) != null) {
                hostDescription = new HostDescription(GlobusHostType.type);
                ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(next.getFirstChildWithName(new QName("gram.endpoint")).getText());
                ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(next.getFirstChildWithName(new QName("gridftp.endpoint")).getText());
            } else {
                hostDescription = new HostDescription(HostDescriptionType.type);
            }
            (hostDescription.getType()).setHostName(next.getFirstChildWithName(new QName("name")).getText());
            (hostDescription.getType()).setHostAddress(next.getFirstChildWithName(new QName("host")).getText());
            hostDescriptions.add(hostDescription);
        }
        return hostDescriptions;
    }
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.