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

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


           */

        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("host.commom.name"));
        host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});


        /*
        * App
        */
        ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
        GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
        app.setCpuCount(1);
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("EchoLocal");
        app.setExecutableLocation("/bin/echo");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setCpuCount(1);
        ProjectAccountType projectAccountType = ((GramApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));
        QueueType queueType = app.addNewQueue();
        queueType.setQueueName(properties.getProperty("defualt.queue"));
        app.setMaxMemory(100);
       
        /*
           * Service
           */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("SimpleEcho");

        InputParameterType input = InputParameterType.Factory.newInstance();
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setName("echo_input");
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setName("echo_output");
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /*
           * Save to registry
           */

        jcrRegistry.getApplicationDescriptors(serv.getType().getName());

        if(jcrRegistry.isHostDescriptorExists(host.getType().getHostName())) {
            jcrRegistry.updateHostDescriptor(host);
        } else {
            jcrRegistry.addHostDescriptor(host);
        }

        if (jcrRegistry.isApplicationDescriptorExists(serv.getType().getName(),host.getType().getHostName(),appDesc.getType().getApplicationName().getStringValue())){
            jcrRegistry.updateApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
        } else {
            jcrRegistry.addApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
        }

        if (jcrRegistry.isServiceDescriptorExists(serv.getType().getName())){
            jcrRegistry.updateServiceDescriptor(serv);
        } else {
View Full Code Here


    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
        if (hostName!=null) {
      HostDescription hostDescription;
      try {
        hostDescription = registry.getHostDescriptor(hostName);
        if (hostDescription.getType() instanceof GlobusHostType) {
          getShellApplicationDescription().getType().changeType(
              GramApplicationDeploymentType.type);
        } else {
          getShellApplicationDescription().getType().changeType(
              ApplicationDeploymentDescriptionType.type);
        }
        btnHostAdvanceOptions.setVisible(hostDescription.getType() instanceof GlobusHostType);
        String hostAddress = hostDescription.getType().getHostAddress();
        boolean isLocal = isLocalAddress(hostAddress);
        btnExecBrowse.setVisible(isLocal);
        btnTmpDirBrowse.setVisible(isLocal);
       
      } catch (RegistryException e) {
View Full Code Here

    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
        if (hostName != null) {
            HostDescription hostDescription;
            try {
        hostDescription = registry.getHostDescriptor(hostName);
        if (hostDescription.getType() instanceof GlobusHostType) {
            getShellApplicationDescription().getType().changeType(
                    GramApplicationDeploymentType.type);
        } else {
            getShellApplicationDescription().getType().changeType(
                    ApplicationDeploymentDescriptionType.type);
        }
        btnHostAdvanceOptions.setVisible(hostDescription.getType() instanceof GlobusHostType);
        String hostAddress = hostDescription.getType().getHostAddress();
        boolean isLocal = isLocalAddress(hostAddress);
        btnExecBrowse.setVisible(isLocal);
        btnTmpDirBrowse.setVisible(isLocal);
      } catch (DescriptorDoesNotExistsException e) {
        e.printStackTrace();
View Full Code Here

        // Host
        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("host.commom.name"));
        host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});

        /* Application */
        ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
        GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
        app.setCpuCount(1);
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("EchoMPILocal");
        app.setExecutableLocation("/share/home/01437/ogce/airavata-test/mpi-hellow-world");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setCpuCount(16);
        app.setJobType(JobTypeType.MPI);
        //app.setMinMemory();
        ProjectAccountType projectAccountType = ((GramApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));

        /* Service */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("SimpleMPIEcho");

        InputParameterType input = InputParameterType.Factory.newInstance();
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setName("echo_mpi_input");
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setName("echo_mpi_output");
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /* Save to Registry */
        jcrRegistry.addHostDescriptor(host);
        jcrRegistry.addApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
        jcrRegistry.addServiceDescriptor(serv);
//        jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
    }
View Full Code Here

        // Host
        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("host.commom.name"));
        host.getType().setHostAddress(properties.getProperty("host.fqdn.name"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});

        /* Application */
        ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
        GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("MockPwscfMPI");
        app.setExecutableLocation("/share/home/01437/ogce/airavata-test/applications/MockPwscf/pwscf.w");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setStaticWorkingDirectory("/share/home/01437/ogce/airavata-test/applications/MockPwscf");
        app.setCpuCount(4);
        app.setJobType(JobTypeType.MPI);
        app.setMaxWallTime(9);
        ProjectAccountType projectAccountType = ((GramApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));

        /* Service */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("MockPwscfMPIService");

        InputParameterType input = InputParameterType.Factory.newInstance();
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setName("echo_mpi_input");
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setName("echo_mpi_output");
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /* Save to Registry */
        jcrRegistry.addHostDescriptor(host);
        jcrRegistry.addApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
        jcrRegistry.addServiceDescriptor(serv);
//        jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
    }
View Full Code Here

        */

        URL url = this.getClass().getClassLoader().getResource(GRAM_PROPERTIES);
        Properties properties = new Properties();
        properties.load(url.openStream());
        HostDescription host = new HostDescription();
        host.getType().changeType(GlobusHostType.type);
        host.getType().setHostName(properties.getProperty("gram.name"));
        host.getType().setHostAddress(properties.getProperty("gram.host"));
        ((GlobusHostType) host.getType()).setGridFTPEndPointArray(new String[]{properties.getProperty("gridftp.endpoint")});
        ((GlobusHostType) host.getType()).setGlobusGateKeeperEndPointArray(new String[]{properties.getProperty("gram.endpoints")});


        /*
        * Application deployment description
        */
        ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
        GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
        app.setCpuCount(1);
        app.setNodeCount(1);
        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
        name.setStringValue("FileBreed");
        app.setExecutableLocation("/bin/echo");
        app.setScratchWorkingDirectory(properties.getProperty("scratch.working.directory"));
        app.setCpuCount(1);
        ProjectAccountType projectAccountType = ((GramApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
        projectAccountType.setProjectAccountNumber(properties.getProperty("allocation.charge.number"));
        QueueType queueType = app.addNewQueue();
        queueType.setQueueName(properties.getProperty("defualt.queue"));
       
        /*
        * Application Service
        */
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("FileBreedTest");
        InputParameterType inputParameter = InputParameterType.Factory.newInstance();
        inputParameter.setParameterName("Input_File");
        inputParameter.setParameterDescription("File to Replicate");
        ParameterType parameterType1 = inputParameter.addNewParameterType();
        parameterType1.setType(DataType.Enum.forString("URI"));
        inputParameter.setParameterType(URIParameterType.Factory.newInstance());

        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(inputParameter);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);
       
        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
        ParameterType outputParameterType = outputParameter.addNewParameterType();
        outputParameterType.setName("replicated_file");
        outputParameterType.setType(DataType.URI);
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        outputList.add(outputParameter);
        OutputParameterType[] outputParamList = outputList
                .toArray(new OutputParameterType[outputList.size()]);
        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        /*
        * Save deployment descriptions to registry
        */
        jcrRegistry.addHostDescriptor(host);
        jcrRegistry.addApplicationDescriptor(serv.getType().getName(), host.getType().getHostName(), appDesc);
        jcrRegistry.addServiceDescriptor(serv);
//        jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
    }
View Full Code Here

  @After
  public void cleanup() throws RegistryException {
  }

  private HostDescription createHostDescription() {
    HostDescription host = new HostDescription();
    host.getType().setHostName("localhost");
    host.getType().setHostAddress("localhost");
    return host;
  }
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

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

    private boolean deleteDescriptor() throws DescriptorDoesNotExistsException, RegistryException{
      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:
          ApplicationDeploymentDescription a = (ApplicationDeploymentDescription) 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().removeHostDescriptor(h.getType().getHostName());
                break;
              case SERVICE:
                  ServiceDescription d = (ServiceDescription) getSelected();
                  getRegistry().removeServiceDescriptor(d.getType().getName());
                break;
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.