Package org.apache.aiaravata.application.catalog.data.resources

Examples of org.apache.aiaravata.application.catalog.data.resources.GatewayProfileResource


    private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileImpl.class);

    @Override
    public String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException {
        try {
            GatewayProfileResource profileResource = new GatewayProfileResource();
            profileResource.setGatewayName(gatewayProfile.getGatewayName());
            profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName()));
            profileResource.setGatewayDesc(gatewayProfile.getGatewayDescription());
            profileResource.save();
            gatewayProfile.setGatewayID(profileResource.getGatewayID());
            List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
            if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
                for (ComputeResourcePreference preference : computeResourcePreferences ){
                    ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
                    resource.setGatewayProfile(profileResource);
                    resource.setResourceId(preference.getComputeResourceId());
                    ComputeResourceResource computeHostResource = new ComputeResourceResource();
                    resource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
                    resource.setGatewayId(profileResource.getGatewayID());
                    resource.setOverrideByAiravata(preference.isOverridebyAiravata());
                    resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol());
                    resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol());
                    resource.setBatchQueue(preference.getPreferredBatchQueue());
                    resource.setProjectNumber(preference.getAllocationProjectNumber());
                    resource.setScratchLocation(preference.getScratchLocation());
                    resource.save();
                }
            }
            return profileResource.getGatewayID();
        }catch (Exception e) {
            logger.error("Error while saving gateway profile...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here


    }

    @Override
    public void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
        try {
            GatewayProfileResource profileResource = new GatewayProfileResource();
            GatewayProfileResource existingGP = (GatewayProfileResource)profileResource.get(gatewayId);
            existingGP.setGatewayName(updatedProfile.getGatewayName());
            existingGP.setGatewayDesc(updatedProfile.getGatewayDescription());
            existingGP.save();

            List<ComputeResourcePreference> computeResourcePreferences = updatedProfile.getComputeResourcePreferences();
            if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
                for (ComputeResourcePreference preference : computeResourcePreferences ){
                    ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
View Full Code Here

    }

    @Override
    public GatewayResourceProfile getGatewayProfile(String gatewayId) throws AppCatalogException {
        try {
            GatewayProfileResource resource = new GatewayProfileResource();
            GatewayProfileResource gwresource = (GatewayProfileResource)resource.get(gatewayId);
            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
            List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
            return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences);
        }catch (Exception e) {
View Full Code Here

    }

    @Override
    public boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException {
       try {
           GatewayProfileResource resource = new GatewayProfileResource();
           resource.remove(gatewayId);
           return true;
       }catch (Exception e) {
           logger.error("Error while deleting gateway profile...", e);
           throw new AppCatalogException(e);
       }
View Full Code Here

    }

    @Override
    public boolean isGatewayResourceProfileExists(String gatewayId) throws AppCatalogException {
        try {
            GatewayProfileResource resource = new GatewayProfileResource();
            return resource.isExists(gatewayId);
        }catch (Exception e) {
            logger.error("Error while retrieving gateway profile...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

    }

    @Override
    public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException {
        try {
            GatewayProfileResource profileResource = new GatewayProfileResource();
            List<Resource> resourceList = profileResource.get(AbstractResource.GatewayProfileConstants.GATEWAY_NAME, gatewayName);
            List<String> gatewayIds = new ArrayList<String>();
            if (resourceList != null && !resourceList.isEmpty()){
                for (Resource resource : resourceList){
                    gatewayIds.add(((GatewayProfileResource)resource).getGatewayID());
                }
View Full Code Here

        }
        return resource;
    }

    private static Resource createGatewayProfile(GatewayProfile o) {
        GatewayProfileResource resource = new GatewayProfileResource();
        if (o != null) {
            resource.setGatewayID(o.getGatewayID());
            resource.setGatewayName(o.getGatewayName());
            resource.setGatewayDesc(o.getGatewayDesc());
        }
        return resource;
    }
View Full Code Here

TOP

Related Classes of org.apache.aiaravata.application.catalog.data.resources.GatewayProfileResource

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.