Example usage for java.lang Module toString

List of usage examples for java.lang Module toString

Introduction

In this page you can find the example usage for java.lang Module toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns the string representation of this module.

Usage

From source file:fr.treeptik.cloudunit.service.impl.ModuleServiceImpl.java

@Override
@Transactional/*from   ww w . java  2  s.  c o  m*/
public Module update(Module module) throws ServiceException {

    logger.debug("update : Methods parameters : " + module.toString());
    logger.info("ModuleService : Starting updating Module " + module.getName());
    try {
        module = moduleDAO.save(module);
    } catch (PersistenceException e) {
        module.setStatus(Status.FAIL);
        module = this.saveInDB(module);
        logger.error("ModuleService Error : update Module" + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
    logger.info("ModuleService : Module " + module.getName() + " successfully updated.");
    return module;
}

From source file:fr.treeptik.cloudunit.service.impl.ServerServiceImpl.java

/**
 * Change the version of the jvm// w w  w.j  a  v  a2s .  c o  m
 *
 * @param application
 * @param javaVersion
 * @throws CheckException
 * @throws ServiceException
 */
@Override
public void changeJavaVersion(Application application, String javaVersion)
        throws CheckException, ServiceException {

    logger.info(
            "Starting changing to java version " + javaVersion + ", the application " + application.getName());

    Map<String, String> configShell = new HashMap<>();
    String command = null;

    // Servers
    List<Server> listServers = application.getServers();
    for (Server server : listServers) {
        try {
            configShell.put("password", server.getApplication().getUser().getPassword());
            configShell.put("port", server.getSshPort());
            configShell.put("dockerManagerAddress", application.getManagerIp());

            // Need to be root for shell call because we modify /etc/environme,t
            command = "bash /cloudunit/scripts/change-java-version.sh " + javaVersion;
            logger.info("command shell to execute [" + command + "]");
            shellUtils.executeShell(command, configShell);

        } catch (Exception e) {
            server.setStatus(Status.FAIL);
            saveInDB(server);
            logger.error("java version = " + javaVersion + " - " + application.toString() + " - "
                    + server.toString(), e);
            throw new ServiceException(application + ", javaVersion:" + javaVersion, e);
        }
    }

    //
    // PARTIE GIT
    //
    Module moduleGit = moduleService.findGitModule(application.getUser().getLogin(), application);
    try {
        configShell.put("password", moduleGit.getApplication().getUser().getPassword());
        configShell.put("port", moduleGit.getSshPort());
        configShell.put("dockerManagerAddress", application.getManagerIp());

        // Besoin des permissions ROOT
        command = "bash /cloudunit/scripts/change-java-version.sh " + javaVersion;
        logger.info("command shell to execute [" + command + "]");

        shellUtils.executeShell(command, configShell);

        application.setJvmRelease(javaVersion);
        application = applicationService.saveInDB(application);
    } catch (Exception e) {
        moduleGit.setStatus(Status.FAIL);
        moduleService.saveInDB(moduleGit);
        logger.error(
                "java version = " + javaVersion + " - " + application.toString() + " - " + moduleGit.toString(),
                e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }

}

From source file:fr.treeptik.cloudunit.service.impl.ModuleServiceImpl.java

@Transactional
private Module createAndAffectModuleValues(Application application, Module module, String tagName)
        throws ServiceException, CheckException {

    try {// w  ww.  j a v  a 2s .c  o  m
        // user = userService.findById(user.getId());

        module.setImage(imageService.findByName(module.getImage().getName()));

        // Create container module in docker
        module = this.create(application, module, tagName);

        Long instanceNumber = module.getInstanceNumber();

        // Add extra properties
        module.setStartDate(new Date());
        module.setInternalDNSName(module.getName() + "." + module.getImage().getName() + ".cloud.unit");

        this.addModuleManager(module, instanceNumber);

        // save module in DB
        module = this.update(module);

    } catch (ServiceException e) {
        module.setStatus(Status.FAIL);
        logger.error(application.toString() + module.toString(), e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
    return module;
}

From source file:org.wandora.modules.LoggingModule.java

public Log getLog(Module module) {
    String name = module.toString();
    return new SubLog(name + " - ", log);
}