本文整理汇总了Java中org.pentaho.di.core.plugins.KettleURLClassLoader类的典型用法代码示例。如果您正苦于以下问题:Java KettleURLClassLoader类的具体用法?Java KettleURLClassLoader怎么用?Java KettleURLClassLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KettleURLClassLoader类属于org.pentaho.di.core.plugins包,在下文中一共展示了KettleURLClassLoader类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: install
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
/**
* Installs the passed MarketEntry into the folder built by
* buildPluginsFolderPath(marketEntry).
*
* A warning dialog box is displayed if the plugin folder already exists. If
* the user chooses to install then the plugin folder is deleted and then
* recreated.
*
* @param marketEntry
* @throws KettleException
*/
public static void install(final MarketEntry marketEntry) throws KettleException {
String parentFolderName = buildPluginsFolderPath(marketEntry);
File pluginFolder = new File(parentFolderName + File.separator + marketEntry.getId());
if (pluginFolder.exists()) {
MessageBox mb = new MessageBox(Spoon.getInstance().getShell(), SWT.NO | SWT.YES | SWT.ICON_WARNING);
mb.setMessage(BaseMessages.getString(PKG, "Marketplace.Dialog.PromptOverwritePlugin.Message", pluginFolder.getAbsolutePath()));
mb.setText(BaseMessages.getString(PKG, "Marketplace.Dialog.PromptOverwritePlugin.Title"));
int answer = SWT.NO;
answer = mb.open();
if (answer == SWT.YES) {
ClassLoader cl = PluginRegistry.getInstance().getClassLoader(getPluginObject(marketEntry.getId()));
if (cl instanceof KettleURLClassLoader) {
((KettleURLClassLoader)cl).closeClassLoader();
}
deleteDirectory(pluginFolder);
unzipMarketEntry(parentFolderName, marketEntry.getPackageUrl());
refreshSpoon();
}
} else {
unzipMarketEntry(parentFolderName, marketEntry.getPackageUrl());
refreshSpoon();
}
}
示例2: uninstallMarketInSeparateClassLoader
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
public static void uninstallMarketInSeparateClassLoader(final File path) throws Exception {
try {
uninstall("market");
Spoon.getInstance().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
MessageBox box = new MessageBox(Spoon.getInstance().getShell(), SWT.ICON_WARNING | SWT.OK);
box.setText(BaseMessages.getString(PKG, "MarketplacesDialog.RestartUninstall.Title"));
box.setMessage(BaseMessages.getString(PKG, "MarketplacesDialog.RestartUninstall.Message"));
box.open();
} finally {
if (Market.class.getClassLoader() instanceof KettleURLClassLoader) {
((KettleURLClassLoader)Market.class.getClassLoader()).closeClassLoader();
}
path.delete();
}
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: LoadAdditionalClass
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
private static Class<?> LoadAdditionalClass(String strJar, String strClassName) throws KettleException{
try{
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
URL u = new URL("jar:file:"+strJar+"!/");
KettleURLClassLoader kl = new KettleURLClassLoader(new URL[]{u}, cl);
Class<?> toRun = kl.loadClass(strClassName);
return toRun;
}catch(Exception e){
throw new KettleException(BaseMessages.getString(PKG, "ScriptMeta.Exception.UnableToLoadAdditionalClass"), e); //$NON-NLS-1$
}
}
示例4: LoadAdditionalClass
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
private static Class<?> LoadAdditionalClass(String strJar, String strClassName) throws KettleException{
try{
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
URL u = new URL("jar:file:"+strJar+"!/");
KettleURLClassLoader kl = new KettleURLClassLoader(new URL[]{u}, cl);
Class<?> toRun = kl.loadClass(strClassName);
return toRun;
}catch(Exception e){
throw new KettleException(BaseMessages.getString(PKG, "ScriptValuesMetaMod.Exception.UnableToLoadAdditionalClass"), e); //$NON-NLS-1$
}
}
示例5: uninstall
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
/**
* Uninstalls the passed MarketEntry.
*
* @param marketEntry
* @throws KettleException
*/
public static void uninstall(final String pluginId) throws KettleException {
PluginInterface plugin = getPluginObject(pluginId);
if (plugin == null) {
throw new KettleException("No Plugin!");
}
String pluginFolderName = plugin.getPluginDirectory().getFile();
File folder = new File(pluginFolderName);
try {
ClassLoader cl = PluginRegistry.getInstance().getClassLoader(getPluginObject(pluginId));
if (cl instanceof KettleURLClassLoader) {
((KettleURLClassLoader)cl).closeClassLoader();
}
} catch (Throwable t) {
t.printStackTrace();
}
deleteDirectory(folder);
if (!Display.getDefault().getThread().equals(Thread.currentThread()) ) {
Spoon.getInstance().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
refreshSpoon();
} catch (KettleException e) {
e.printStackTrace();
}
}
});
} else {
refreshSpoon();
}
}
示例6: LoadAdditionalClass
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException {
try {
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
URL u = new URL( "jar:file:" + strJar + "!/" );
KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl );
Class<?> toRun = kl.loadClass( strClassName );
return toRun;
} catch ( Exception e ) {
throw new KettleException( BaseMessages
.getString( PKG, "GremlinScriptMeta.Exception.UnableToLoadAdditionalClass" ), e );
}
}
示例7: LoadAdditionalClass
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException {
try {
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
URL u = new URL( "jar:file:" + strJar + "!/" );
// We never know what else the script wants to load with the class loader, so lets not close it just like that.
@SuppressWarnings( "resource" )
KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl );
Class<?> toRun = kl.loadClass( strClassName );
return toRun;
} catch ( Exception e ) {
throw new KettleException(
BaseMessages.getString( PKG, "ScriptMeta.Exception.UnableToLoadAdditionalClass" ), e );
}
}
示例8: LoadAdditionalClass
import org.pentaho.di.core.plugins.KettleURLClassLoader; //导入依赖的package包/类
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException {
try {
Thread t = Thread.currentThread();
ClassLoader cl = t.getContextClassLoader();
URL u = new URL( "jar:file:" + strJar + "!/" );
// We never know what else the script wants to load with the class loader, so lets not close it just like that.
@SuppressWarnings( "resource" )
KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl );
Class<?> toRun = kl.loadClass( strClassName );
return toRun;
} catch ( Exception e ) {
throw new KettleException( BaseMessages.getString(
PKG, "ScriptValuesMetaMod.Exception.UnableToLoadAdditionalClass" ), e );
}
}