All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.yawp.tools.pipes.ReloadPipe Maven / Gradle / Ivy

There is a newer version: 2.08alpha
Show newest version
package io.yawp.tools.pipes;

import io.yawp.commons.utils.ReflectionUtils;
import io.yawp.repository.pipes.Pipe;
import io.yawp.tools.Tool;

public class ReloadPipe extends Tool {

    public static final String PIPE_PARAM = "pipe";

    @Override
    public void execute() {
        String pipeClazzName = params.get(PIPE_PARAM);

        if (pipeClazzName == null) {
            pw.println("use: pipes/reload?pipe=pipe-class-name");
            return;
        }
        reload(pipeClazzName);
        pw.println("ok");
    }

    public void reload(String pipeClazzName) {
        Class pipeClazz = getPipeClazz(pipeClazzName);
        yawp.driver().pipes().reload(pipeClazz);
    }

    private Class getPipeClazz(String pipeClazzName) {
        return (Class) ReflectionUtils.clazzForName(pipeClazzName);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy