use of org.pentaho.versionchecker.VersionChecker 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();
}
use of org.pentaho.versionchecker.VersionChecker in project pentaho-platform by pentaho.
the class PentahoVersionCheckHelper method performUpdate.
public void performUpdate() {
IVersionCheckResultHandler resultHandler = new IVersionCheckResultHandler() {
public void processResults(String results) {
// parse xml results vs spewing out xml?
resultList.add(results);
}
};
IVersionCheckErrorHandler errorHandler = new IVersionCheckErrorHandler() {
public void handleException(Exception e) {
// $NON-NLS-1$ //$NON-NLS-2$
resultList.add("<vercheck><error><![CDATA[" + e.getMessage() + "]]></error></vercheck>");
}
};
// PentahoVersionCheckDataProvider dataProvider = new PentahoVersionCheckDataProvider();
IVersionCheckDataProvider dataProvider = // $NON-NLS-1$
PentahoSystem.get(IVersionCheckDataProvider.class, "IVersionCheckDataProvider", null);
if (dataProvider == null) {
dataProvider = new PentahoVersionCheckDataProvider();
}
if (versionRequestFlags != -1) {
dataProvider.setVersionRequestFlags(versionRequestFlags);
}
VersionChecker vc = new VersionChecker();
vc.setDataProvider(dataProvider);
vc.addResultHandler(resultHandler);
vc.addErrorHandler(errorHandler);
vc.performCheck(ignoreExistingUpdates);
}
Aggregations