Search in sources :

Example 1 with ModuleJvm

use of com.ibeiliao.deployment.admin.vo.project.ModuleJvm in project Corgi by kevinYin.

the class ModuleJvmServiceImplTest method testBatchInsert.

@Test
public void testBatchInsert() {
    ModuleJvm moduleJvm01 = new ModuleJvm();
    moduleJvm01.setJvmArgs("-Xms180m -Xmx180m");
    moduleJvm01.setEnvId(1);
    moduleJvm01.setEnvName("dev");
    moduleJvm01.setModuleId(1);
    ModuleJvm moduleJvm02 = new ModuleJvm();
    moduleJvm02.setJvmArgs("-Xms190m -Xmx190m");
    moduleJvm02.setEnvId(2);
    moduleJvm02.setEnvName("test");
    moduleJvm02.setModuleId(2);
    ArrayList<ModuleJvm> moduleJvmArgses = Lists.newArrayList(moduleJvm01, moduleJvm02);
    moduleJvmService.saveModuleJvm(moduleJvmArgses);
}
Also used : ModuleJvm(com.ibeiliao.deployment.admin.vo.project.ModuleJvm) Test(org.junit.Test)

Example 2 with ModuleJvm

use of com.ibeiliao.deployment.admin.vo.project.ModuleJvm in project Corgi by kevinYin.

the class ProjectModuleServiceImpl method validateJvmArgs.

private void validateJvmArgs(ProjectModule projectModule) {
    if (projectModule.getModuleType() == ModuleType.WEB_PROJECT.getValue() || ModuleUtil.isMainClass(projectModule.getRestartShell())) {
        List<ModuleJvm> moduleJvms = projectModule.getModuleJvms();
        Assert.notNull(moduleJvms, "jvm list不能为null");
        boolean found = false;
        for (ModuleJvm jvm : moduleJvms) {
            String arg = StringUtils.trimToEmpty(jvm.getJvmArgs());
            found |= StringUtils.isNotEmpty(arg);
            jvm.setJvmArgs(arg);
        }
        Assert.isTrue(found, "至少要配置一个环境的JVM参数");
    }
}
Also used : ModuleJvm(com.ibeiliao.deployment.admin.vo.project.ModuleJvm)

Example 3 with ModuleJvm

use of com.ibeiliao.deployment.admin.vo.project.ModuleJvm in project Corgi by kevinYin.

the class ProjectModuleServiceImpl method saveModuleJvms.

private void saveModuleJvms(ProjectModule projectModule, int projectModuleId) {
    List<ModuleJvm> moduleJvms = projectModule.getModuleJvms();
    ArrayList<ModuleJvm> newModuleJvms = Lists.newArrayList();
    ArrayList<ModuleJvm> oldModuleJvms = Lists.newArrayList();
    for (ModuleJvm moduleJvm : moduleJvms) {
        moduleJvm.setModuleId(projectModuleId);
        if (moduleJvm.getModuleJvmId() > 0) {
            oldModuleJvms.add(moduleJvm);
        } else {
            newModuleJvms.add(moduleJvm);
        }
    }
    moduleJvmService.saveModuleJvm(newModuleJvms);
    moduleJvmService.updateModuleJvm(oldModuleJvms);
}
Also used : ModuleJvm(com.ibeiliao.deployment.admin.vo.project.ModuleJvm)

Example 4 with ModuleJvm

use of com.ibeiliao.deployment.admin.vo.project.ModuleJvm in project Corgi by kevinYin.

the class ProjectModuleServiceImpl method buildModuleJvms.

private List<ModuleJvm> buildModuleJvms(int moduleId) {
    List<ModuleJvm> moduleJvmArgs = moduleJvmService.queryByModuleId(moduleId);
    List<ProjectEnv> allEnv = projectEnvService.findAllEnv();
    HashMap<Integer, ModuleJvm> envId2ModuleJvmMap = Maps.newHashMap();
    for (ModuleJvm moduleJvm : moduleJvmArgs) {
        envId2ModuleJvmMap.put(moduleJvm.getEnvId(), moduleJvm);
    }
    for (ProjectEnv env : allEnv) {
        if (envId2ModuleJvmMap.get(env.getEnvId()) == null) {
            ModuleJvm newModuleJvm = new ModuleJvm();
            newModuleJvm.setEnvId(env.getEnvId());
            newModuleJvm.setEnvName(env.getEnvName());
            envId2ModuleJvmMap.put(env.getEnvId(), newModuleJvm);
        }
    }
    return Lists.newArrayList(envId2ModuleJvmMap.values());
}
Also used : ProjectEnv(com.ibeiliao.deployment.admin.vo.global.ProjectEnv) ModuleJvm(com.ibeiliao.deployment.admin.vo.project.ModuleJvm)

Example 5 with ModuleJvm

use of com.ibeiliao.deployment.admin.vo.project.ModuleJvm in project Corgi by kevinYin.

the class CreateDeploymentController method getJvmArgs.

private String getJvmArgs(int moduleId, int envId) {
    ProjectModule module = projectModuleService.getByModuleId(moduleId);
    Assert.notNull(module, "模块不存在");
    List<ModuleJvm> list = module.getModuleJvms();
    if (CollectionUtils.isNotEmpty(list)) {
        for (ModuleJvm jvm : list) {
            if (jvm.getEnvId() == envId) {
                return jvm.getJvmArgs();
            }
        }
    }
    return null;
}
Also used : ProjectModule(com.ibeiliao.deployment.admin.vo.project.ProjectModule) ModuleJvm(com.ibeiliao.deployment.admin.vo.project.ModuleJvm)

Aggregations

ModuleJvm (com.ibeiliao.deployment.admin.vo.project.ModuleJvm)6 ProjectModule (com.ibeiliao.deployment.admin.vo.project.ProjectModule)2 ProjectModulePO (com.ibeiliao.deployment.admin.po.project.ProjectModulePO)1 ProjectEnv (com.ibeiliao.deployment.admin.vo.global.ProjectEnv)1 Test (org.junit.Test)1