Search in sources :

Example 1 with BasicVersionCheckerProvider

use of org.pentaho.versionchecker.BasicVersionCheckerProvider in project pentaho-kettle by pentaho.

the class VersionCheckerListener method onStart.

/**
 * Interface method: checks the version
 */
public void onStart(final LifeEventHandler handler) throws LifecycleException {
    // Should we run this listener?
    String prop = Props.getInstance().getProperty(PDI_CHECK_VERSION_FLAG);
    if (prop != null && !Boolean.parseBoolean(prop)) {
        log.logBasic("Skipping version check.", new Object[] {});
        return;
    }
    try {
        // check to see if pentaho version checker is in the classpath
        // 
        Class.forName("org.pentaho.versionchecker.BasicVersionCheckerProvider");
    } catch (ClassNotFoundException e) {
        return;
    }
    Runnable r = new Runnable() {

        public void run() {
            final BasicVersionCheckerProvider dataProvider = new BasicVersionCheckerProvider(Spoon.class);
            VersionChecker vc = new VersionChecker();
            vc.setDataProvider(dataProvider);
            vc.addResultHandler(new IVersionCheckResultHandler() {

                public void processResults(String result) {
                }
            });
            vc.addErrorHandler(new IVersionCheckErrorHandler() {

                public void handleException(Exception e) {
                    root = new LifecycleException(e, false);
                }
            });
            vc.performCheck(false);
            if (root != null)
                return;
        }
    };
    new Thread(r).start();
}
Also used : VersionChecker(org.pentaho.versionchecker.VersionChecker) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException) IVersionCheckResultHandler(org.pentaho.versionchecker.IVersionCheckResultHandler) BasicVersionCheckerProvider(org.pentaho.versionchecker.BasicVersionCheckerProvider) IVersionCheckErrorHandler(org.pentaho.versionchecker.IVersionCheckErrorHandler) LifecycleException(org.pentaho.di.core.lifecycle.LifecycleException)

Aggregations

LifecycleException (org.pentaho.di.core.lifecycle.LifecycleException)1 BasicVersionCheckerProvider (org.pentaho.versionchecker.BasicVersionCheckerProvider)1 IVersionCheckErrorHandler (org.pentaho.versionchecker.IVersionCheckErrorHandler)1 IVersionCheckResultHandler (org.pentaho.versionchecker.IVersionCheckResultHandler)1 VersionChecker (org.pentaho.versionchecker.VersionChecker)1