Search in sources :

Example 1 with ILPPipeConfigToolWrapper

use of logisticspipes.proxy.interfaces.ILPPipeConfigToolWrapper in project LogisticsPipes by RS485.

the class LogisticsWrapperHandler method getWrappedPipeConfigToolWrapper.

public static ILPPipeConfigToolWrapper getWrappedPipeConfigToolWrapper(String clazz, String name, Class<? extends ILPPipeConfigToolWrapper> providerClass) {
    ILPPipeConfigToolWrapper wrapper = null;
    Throwable e = null;
    try {
        Class.forName(clazz);
        try {
            wrapper = providerClass.newInstance();
        } catch (Exception e1) {
            if (e1 instanceof VersionNotSupportedException) {
                throw (VersionNotSupportedException) e1;
            }
            e1.printStackTrace();
            e = e1;
        } catch (NoClassDefFoundError e1) {
            e1.printStackTrace();
            e = e1;
        }
    } catch (NoClassDefFoundError | ClassNotFoundException ignored) {
    }
    GenericLPPipeConfigToolWrapper instance = new GenericLPPipeConfigToolWrapper(wrapper, name);
    if (wrapper != null) {
        LogisticsPipes.log.info("Loaded " + name + " PipeConfigToolWrapper");
    } else {
        if (e != null) {
            instance.setState(WrapperState.Exception);
            instance.setReason(e);
            LogisticsPipes.log.info("Couldn't load " + name + " PipeConfigToolWrapper");
        } else {
            LogisticsPipes.log.info("Didn't load " + name + " PipeConfigToolWrapper");
            instance.setState(WrapperState.ModMissing);
        }
    }
    LogisticsWrapperHandler.wrapperController.add(instance);
    return instance;
}
Also used : ILPPipeConfigToolWrapper(logisticspipes.proxy.interfaces.ILPPipeConfigToolWrapper) VersionNotSupportedException(logisticspipes.proxy.VersionNotSupportedException) VersionNotSupportedException(logisticspipes.proxy.VersionNotSupportedException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 VersionNotSupportedException (logisticspipes.proxy.VersionNotSupportedException)1 ILPPipeConfigToolWrapper (logisticspipes.proxy.interfaces.ILPPipeConfigToolWrapper)1