Package org.airavata.appcatalog.cpi

Examples of org.airavata.appcatalog.cpi.AppCatalogException


            AppDeploymentResource existingDep = (AppDeploymentResource)deploymentResource.get(deploymentId);
            ComputeResourceResource computeHostResource = new ComputeResourceResource();
            AppModuleResource moduleResource = new AppModuleResource();
            if (!computeHostResource.isExists(updatedDeployment.getComputeHostId())){
                logger.error("Compute host does not exist in the system. Please create a Compute host first...");
                throw new AppCatalogException("Compute host does not exist in the system. Please create a Compute host first...");
            }
            if (!moduleResource.isExists(updatedDeployment.getAppModuleId())){
                logger.error("Application module does not exist in the system. Please create an application module first...");
                throw new AppCatalogException("Application module does not exist in the system. Please create an application module first...");
            }
            AppModuleResource module = (AppModuleResource)moduleResource.get(updatedDeployment.getAppModuleId());
            existingDep.setAppModuleId(updatedDeployment.getAppModuleId());
            existingDep.setModuleResource(module);
            existingDep.setHostId(updatedDeployment.getComputeHostId());
            existingDep.setHostResource((ComputeResourceResource)computeHostResource.get(updatedDeployment.getComputeHostId()));
            existingDep.setAppDes(updatedDeployment.getAppDeploymentDescription());
            existingDep.setExecutablePath(updatedDeployment.getExecutablePath());
            if (updatedDeployment.getParallelism() != null){
                deploymentResource.setParallelism(updatedDeployment.getParallelism().toString());
            }

            existingDep.save();

            List<String> moduleLoadCmds = updatedDeployment.getModuleLoadCmds();
            if (moduleLoadCmds != null && !moduleLoadCmds.isEmpty()){
                for (String cmd : moduleLoadCmds){
                    ModuleLoadCmdResource cmdResource = new ModuleLoadCmdResource();
                    Map<String, String> ids = new HashMap<String, String>();
                    ids.put(AbstractResource.ModuleLoadCmdConstants.APP_DEPLOYMENT_ID, deploymentId);
                    ids.put(AbstractResource.ModuleLoadCmdConstants.CMD, cmd);
                    if (cmdResource.isExists(ids)){
                        cmdResource = (ModuleLoadCmdResource)cmdResource.get(ids);
                    }
                    cmdResource.setCmd(cmd);
                    cmdResource.setAppDeploymentResource(existingDep);
                    cmdResource.save();
                }
            }
            List<SetEnvPaths> libPrependPaths = updatedDeployment.getLibPrependPaths();
            if (libPrependPaths != null && !libPrependPaths.isEmpty()){
                for (SetEnvPaths path : libPrependPaths){
                    LibraryPrepandPathResource prepandPathResource = new LibraryPrepandPathResource();
                    Map<String, String> ids = new HashMap<String, String>();
                    ids.put(AbstractResource.LibraryPrepandPathConstants.DEPLOYMENT_ID, deploymentId);
                    ids.put(AbstractResource.LibraryPrepandPathConstants.NAME, path.getName());
                    if (prepandPathResource.isExists(ids)){
                        prepandPathResource = (LibraryPrepandPathResource)prepandPathResource.get(ids);
                    }
                    prepandPathResource.setAppDeploymentResource(existingDep);
                    prepandPathResource.setName(path.getName());
                    prepandPathResource.setValue(path.getValue());
                    prepandPathResource.setDeploymentId(deploymentId);
                    prepandPathResource.save();
                }
            }

            List<SetEnvPaths> libApendPaths = updatedDeployment.getLibAppendPaths();
            if (libApendPaths != null && !libApendPaths.isEmpty()){
                for (SetEnvPaths path : libApendPaths){
                    LibraryApendPathResource apendPathResource = new LibraryApendPathResource();
                    Map<String, String> ids = new HashMap<String, String>();
                    ids.put(AbstractResource.LibraryApendPathConstants.DEPLOYMENT_ID, deploymentId);
                    ids.put(AbstractResource.LibraryApendPathConstants.NAME, path.getName());
                    if (apendPathResource.isExists(ids)){
                        apendPathResource = (LibraryApendPathResource)apendPathResource.get(ids);
                    }
                    apendPathResource.setAppDeploymentResource(existingDep);
                    apendPathResource.setName(path.getName());
                    apendPathResource.setValue(path.getValue());
                    apendPathResource.setDeploymentId(deploymentId);
                    apendPathResource.save();
                }
            }

            List<SetEnvPaths> setEnvironment = updatedDeployment.getSetEnvironment();
            if (setEnvironment != null && !setEnvironment.isEmpty()){
                for (SetEnvPaths path : setEnvironment){
                    AppEnvironmentResource environmentResource = new AppEnvironmentResource();
                    Map<String, String> ids = new HashMap<String, String>();
                    ids.put(AbstractResource.AppEnvironmentConstants.DEPLOYMENT_ID, deploymentId);
                    ids.put(AbstractResource.AppEnvironmentConstants.NAME, path.getName());
                    if (environmentResource.isExists(ids)){
                        environmentResource = (AppEnvironmentResource)environmentResource.get(ids);
                    }
                    environmentResource.setAppDeploymentResource(existingDep);
                    environmentResource.setName(path.getName());
                    environmentResource.setValue(path.getValue());
                    environmentResource.setDeploymentId(deploymentId);
                    environmentResource.save();
                }
            }
        }catch (Exception e) {
            logger.error("Error while updating application deployment...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here


            AppDeploymentResource deploymentResource = new AppDeploymentResource();
            AppDeploymentResource appDep = (AppDeploymentResource)deploymentResource.get(deploymentId);
            return AppCatalogThriftConversion.getApplicationDeploymentDescription(appDep);
        }catch (Exception e) {
            logger.error("Error while retrieving application deployment...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

                  deploymentDescriptions.addAll(tmp2Descriptions);
                }
            }
        }catch (Exception e){
            logger.error("Error while retrieving app deployment list...", e);
            throw new AppCatalogException(e);
        }
        return deploymentDescriptions;
    }
View Full Code Here

                deploymentDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
            }

        }catch (Exception e){
            logger.error("Error while retrieving app deployment list...", e);
            throw new AppCatalogException(e);
        }
        return deploymentDescriptions;
    }
View Full Code Here

        try {
            AppDeploymentResource resource = new AppDeploymentResource();
            return resource.getAllIds();
        }catch (Exception e){
            logger.error("Error while retrieving app deployment list...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

        try {
           AppDeploymentResource deploymentResource = new AppDeploymentResource();
            return deploymentResource.isExists(deploymentId);
        }catch (Exception e){
            logger.error("Error while retrieving app deployment...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

        try {
            AppDeploymentResource deploymentResource = new AppDeploymentResource();
            deploymentResource.remove(deploymentId);
        }catch (Exception e){
            logger.error("Error while deleting app deployment...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

                }
            }
            return profileResource.getGatewayID();
        }catch (Exception e) {
            logger.error("Error while saving gateway profile...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

                    resource.save();
                }
            }
        }catch (Exception e) {
            logger.error("Error while updating gateway profile...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
            List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
            return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences);
        }catch (Exception e) {
            logger.error("Error while retrieving gateway profile...", e);
            throw new AppCatalogException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.airavata.appcatalog.cpi.AppCatalogException

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.