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

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


        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


        registry.removeHostDescriptor("testHost");
    }


    public void testGetHostDescriptor() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        HostDescription hostDescriptor = registry.getHostDescriptor("testHost");
        assertNotNull("host descriptor retrieved successfully", hostDescriptor);
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

        assertNotNull("host descriptor retrieved successfully", hostDescriptor);
        registry.removeHostDescriptor("testHost");
    }

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

        registry.removeHostDescriptor("testHost");
        assertFalse("host descriptor removed successfully", registry.isHostDescriptorExists("testHost"));
    }

    public void testGetHostDescriptors() throws Exception {
        HostDescription descriptor = new HostDescription(GlobusHostType.type);
        descriptor.getType().setHostName("testHost");
        descriptor.getType().setHostAddress("testHostAddress");
        registry.addHostDescriptor(descriptor);
        List<HostDescription> hostDescriptors = registry.getHostDescriptors();
        assertTrue("host descriptors retrieved successfully", hostDescriptors.size() == 1);
        registry.removeHostDescriptor("testHost");
    }
View Full Code Here

        applicationDescription.getType().setApplicationName(applicationName);
        applicationDescription.getType().setInputDataDirectory("/bin");
        applicationDescription.getType().setExecutableLocation("/bin/echo");
        applicationDescription.getType().setOutputDataDirectory("/tmp");

        HostDescription hostDescription = new HostDescription(GlobusHostType.type);
        hostDescription.getType().setHostName("testHost");
        hostDescription.getType().setHostAddress("testHostAddress");

        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
View Full Code Here

        applicationDescription.getType().setApplicationName(applicationName);
        applicationDescription.getType().setInputDataDirectory("/bin");
        applicationDescription.getType().setExecutableLocation("/bin/echo");
        applicationDescription.getType().setOutputDataDirectory("/tmp");

        HostDescription hostDescription = new HostDescription(GlobusHostType.type);
        hostDescription.getType().setHostName("testHost");
        hostDescription.getType().setHostAddress("testHostAddress");

        ServiceDescription serviceDescription = new ServiceDescription();
        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        serviceDescription.getType().setName("testServiceDesc");
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
        */
        ApplicationDescription appDesc = new ApplicationDescription(HpcApplicationDeploymentType.type);
        HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) 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 = ((HpcApplicationDeploymentType) 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
        */
        airavataAPI.getApplicationManager().saveHostDescription(host);
        airavataAPI.getApplicationManager().saveApplicationDescription(serv.getType().getName(), host.getType().getHostName(), appDesc);
        airavataAPI.getApplicationManager().saveServiceDescription(serv);
//        jcrRegistry.deployServiceOnHost(serv.getType().getName(), host.getType().getHostName());
    }
View Full Code Here

public class DescriptorUtil {

    public static HostDescription createHostDescription(String hostName, String hostAddress,
                                                        String hostEndpoint, String gatekeeperEndpoint) {
        HostDescription host = new HostDescription();
        if("".equalsIgnoreCase(gatekeeperEndpoint) || "".equalsIgnoreCase(hostEndpoint)) {
            host.getType().changeType(GlobusHostType.type);
            host.getType().setHostName(hostName);
            host.getType().setHostAddress(hostAddress);
            ((GlobusHostType) host.getType()).
                    setGridFTPEndPointArray(new String[]{hostEndpoint});
            ((GlobusHostType) host.getType()).
                    setGlobusGateKeeperEndPointArray(new String[]{gatekeeperEndpoint});
        } else {
            host.getType().setHostName(hostName);
            host.getType().setHostAddress(hostAddress);
        }
        return host;
    }
View Full Code Here

        hostDescriptor.setHostType(hostType);
        return hostDescriptor;
    }

    public static HostDescription createHostDescription (HostDescriptor hostDescriptor){
        HostDescription hostDescription = new HostDescription(HostDescriptionType.type);
        hostDescription.getType().setHostAddress(hostDescriptor.getHostAddress());
        hostDescription.getType().setHostName(hostDescriptor.getHostname());

        if (hostDescriptor.getHostType() != null && !hostDescriptor.getHostType().isEmpty()) {
            if (hostDescriptor.getHostType().get(0).equals(HostTypes.GLOBUS_HOST_TYPE)) {
                hostDescription.getType().changeType(GlobusHostType.type);
                if (!hostDescriptor.getGlobusGateKeeperEndPoint().isEmpty() && hostDescriptor.getGlobusGateKeeperEndPoint() != null){
                    ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(hostDescriptor.getGlobusGateKeeperEndPoint().get(0));
                }
                if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
                    ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
                }

            } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.GSISSH_HOST_TYPE)) {
                hostDescription.getType().changeType(GsisshHostType.type);
                if (!hostDescriptor.getGridFTPEndPoint().isEmpty() && hostDescriptor.getGridFTPEndPoint() != null){
                    ((GsisshHostType) hostDescription).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
                }

            } else if (hostDescriptor.getHostType().get(0).equals(HostTypes.EC2_HOST_TYPE)) {
                hostDescription.getType().changeType(Ec2HostType.type);
                if (!hostDescriptor.getImageID().isEmpty() && hostDescriptor.getImageID() != null ){
                    ((Ec2HostType) hostDescription).addImageID(hostDescriptor.getImageID().get(0));
                }
                if (!hostDescriptor.getInstanceID().isEmpty() && hostDescriptor.getInstanceID() != null){
                    ((Ec2HostType) hostDescription).addInstanceID(hostDescriptor.getInstanceID().get(0));
View Full Code Here

      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().getApplicationManager().getHostDescription(hostName);
      if (hostDescription2 != null) {
        throw new Exception(
            "Host descriptor with the given id already exists!!!");
      }
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.