本文整理汇总了Java中org.pentaho.di.core.util.EnvUtil.getSystemProperty方法的典型用法代码示例。如果您正苦于以下问题:Java EnvUtil.getSystemProperty方法的具体用法?Java EnvUtil.getSystemProperty怎么用?Java EnvUtil.getSystemProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.util.EnvUtil
的用法示例。
在下文中一共展示了EnvUtil.getSystemProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateFolders
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
/**
* Create a list of plugin folders based on the specified xml sub folder
* @param xmlSubfolder the sub-folder to consider for XML plugin files or null if it's not applicable.
* @return The list of plugin folders found
*/
public static List<PluginFolderInterface> populateFolders(String xmlSubfolder) {
List<PluginFolderInterface> pluginFolders = new ArrayList<PluginFolderInterface>();
String folderPaths = EnvUtil.getSystemProperty("KETTLE_PLUGIN_BASE_FOLDERS");
if (folderPaths == null) {
folderPaths = Const.DEFAULT_PLUGIN_BASE_FOLDERS;
}
if (folderPaths != null) {
String folders[] = folderPaths.split(",");
// for each folder in the list of plugin base folders
// add an annotation and xml path for searching
// trim the folder - we don't need leading and trailing spaces
for (String folder : folders) {
folder = folder.trim();
pluginFolders.add(new PluginFolder(folder, false, true));
if (!Const.isEmpty(xmlSubfolder)) {
pluginFolders.add(new PluginFolder(folder + File.separator + xmlSubfolder, true, false));
}
}
}
return pluginFolders;
}
示例2: populateFolders
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
/**
* Create a list of plugin folders based on the specified xml sub folder
*
* @param xmlSubfolder
* the sub-folder to consider for XML plugin files or null if it's not applicable.
* @return The list of plugin folders found
*/
public static List<PluginFolderInterface> populateFolders( String xmlSubfolder ) {
List<PluginFolderInterface> pluginFolders = new ArrayList<>();
String folderPaths = EnvUtil.getSystemProperty( "KETTLE_PLUGIN_BASE_FOLDERS" );
if ( folderPaths == null ) {
folderPaths = Const.DEFAULT_PLUGIN_BASE_FOLDERS;
}
if ( folderPaths != null ) {
String[] folders = folderPaths.split( "," );
// for each folder in the list of plugin base folders
// add an annotation and xml path for searching
// trim the folder - we don't need leading and trailing spaces
for ( String folder : folders ) {
folder = folder.trim();
pluginFolders.add( new PluginFolder( folder, false, true ) );
if ( !Utils.isEmpty( xmlSubfolder ) ) {
pluginFolders.add( new PluginFolder( folder + File.separator + xmlSubfolder, true, false ) );
}
}
}
return pluginFolders;
}
示例3: registerType
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
private void registerType(PluginTypeInterface pluginType) throws KettlePluginException {
registerPluginType(pluginType.getClass());
// Search plugins for this type...
//
long startScan = System.currentTimeMillis();
pluginType.searchPlugins();
for(PluginRegistryExtension ext : extensions){
ext.searchForType(pluginType);
}
// Also scan for plugin classes to facilitate debugging etc.
//
String pluginClasses = EnvUtil.getSystemProperty(Const.KETTLE_PLUGIN_CLASSES);
if (!Const.isEmpty(pluginClasses)) {
String[] classNames = pluginClasses.split(",");
for (String className : classNames) {
try {
// What annotation does the plugin type have?
//
PluginAnnotationType annotationType = pluginType.getClass().getAnnotation(PluginAnnotationType.class);
Class<? extends Annotation> annotationClass = annotationType.value();
Class<?> clazz = Class.forName(className);
Annotation annotation = clazz.getAnnotation(annotationClass);
if (annotation!=null) {
// Register this one!
//
pluginType.handlePluginAnnotation(clazz, annotation, new ArrayList<String>(), true, null);
}
} catch(Exception e) {
LogChannel.GENERAL.logError("Error registring plugin class from KETTLE_PLUGIN_CLASSES: "+className, e);
}
}
}
LogChannel.GENERAL.logDetailed("Registered "+getPlugins(pluginType.getClass()).size()+" plugins of type '"+pluginType.getName()+"' in "+(System.currentTimeMillis()-startScan)+"ms.");
}
示例4: getDatabaseFactoryName
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
public String getDatabaseFactoryName() {
return EnvUtil.getSystemProperty(Const.KETTLE_SAP_CONNECTION_FACTORY, Const.KETTLE_SAP_CONNECTION_FACTORY_DEFAULT_NAME);
}
示例5: init
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
/**
* This method registers plugin types and loads their respective plugins
*
* @throws KettlePluginException
*/
public synchronized static void init() throws KettlePluginException {
PluginRegistry registry = getInstance();
for (PluginTypeInterface pluginType : pluginTypes) {
// Register the plugin type
//
registry.registerPluginType(pluginType.getClass());
// Search plugins for this type...
//
long startScan = System.currentTimeMillis();
pluginType.searchPlugins();
// Also scan for plugin classes to facilitate debugging etc.
//
String pluginClasses = EnvUtil.getSystemProperty(Const.KETTLE_PLUGIN_CLASSES);
if (!Const.isEmpty(pluginClasses)) {
String[] classNames = pluginClasses.split(",");
for (String className : classNames) {
try {
// What annotation does the plugin type have?
//
PluginAnnotationType annotationType = pluginType.getClass().getAnnotation(PluginAnnotationType.class);
Class<? extends Annotation> annotationClass = annotationType.value();
Class<?> clazz = Class.forName(className);
Annotation annotation = clazz.getAnnotation(annotationClass);
if (annotation!=null) {
// Register this one!
//
pluginType.handlePluginAnnotation(clazz, annotation, new ArrayList<String>(), true, null);
}
} catch(Exception e) {
LogChannel.GENERAL.logError("Error registring plugin class from KETTLE_PLUGIN_CLASSES: "+className, e);
}
}
}
LogChannel.GENERAL.logDetailed("Registered "+registry.getPlugins(pluginType.getClass()).size()+" plugins of type '"+pluginType.getName()+"' in "+(System.currentTimeMillis()-startScan)+"ms.");
}
}
示例6: init
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
/**
* This method registers plugin types and loads their respective plugins
*
* @throws KettlePluginException
*/
public synchronized static void init() throws KettlePluginException {
PluginRegistry registry = getInstance();
for (PluginTypeInterface pluginType : pluginTypes) {
// Register the plugin type
//
registry.registerPluginType(pluginType.getClass());
// Search plugins for this type...
//
long startScan = System.currentTimeMillis();
pluginType.searchPlugins();
// Also scan for plugin classes to facilitate debugging etc.
//
String pluginClasses = EnvUtil.getSystemProperty(Const.KETTLE_PLUGIN_CLASSES);
if (!Const.isEmpty(pluginClasses)) {
String[] classNames = pluginClasses.split(",");
for (String className : classNames) {
try {
// What annotation does the plugin type have?
//
PluginAnnotationType annotationType = pluginType.getClass().getAnnotation(PluginAnnotationType.class);
Class<? extends Annotation> annotationClass = annotationType.value();
Class<?> clazz = Class.forName(className);
Annotation annotation = clazz.getAnnotation(annotationClass);
if (annotation!=null) {
// Register this one!
//
pluginType.handlePluginAnnotation(clazz, annotation, new ArrayList<String>(), true, null);
}
} catch(Exception e) {
LogChannel.GENERAL.logError("Error registring plugin class from KETTLE_PLUGIN_CLASSES: "+className, e);
}
}
}
LogChannel.GENERAL.logDetailed("Registered "+registry.getPlugins(pluginType.getClass()).size()+" plugins of type '"+pluginType.getName()+"' in "+(System.currentTimeMillis()-startScan)+"ms.");
}
// Clear the jar file cache so that we don't waste memory...
//
JarFileCache.getInstance().clear();
}
示例7: getHostname
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
/**
* Determine the hostname of the machine Kettle is running on
*
* @return The hostname
*/
public static String getHostname() {
if ( cachedHostname != null ) {
return cachedHostname;
}
// In case we don't want to leave anything to doubt...
//
String systemHostname = EnvUtil.getSystemProperty( KETTLE_SYSTEM_HOSTNAME );
if ( !Utils.isEmpty( systemHostname ) ) {
cachedHostname = systemHostname;
return systemHostname;
}
String lastHostname = "localhost";
try {
Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
while ( en.hasMoreElements() ) {
NetworkInterface nwi = en.nextElement();
Enumeration<InetAddress> ip = nwi.getInetAddresses();
while ( ip.hasMoreElements() ) {
InetAddress in = ip.nextElement();
lastHostname = in.getHostName();
// System.out.println(" ip address bound : "+in.getHostAddress());
// System.out.println(" hostname : "+in.getHostName());
// System.out.println(" Cann.hostname : "+in.getCanonicalHostName());
// System.out.println(" ip string : "+in.toString());
if ( !lastHostname.equalsIgnoreCase( "localhost" ) && !( lastHostname.indexOf( ':' ) >= 0 ) ) {
break;
}
}
}
} catch ( SocketException e ) {
// Eat exception, just return what you have
}
cachedHostname = lastHostname;
return lastHostname;
}
示例8: registerType
import org.pentaho.di.core.util.EnvUtil; //导入方法依赖的package包/类
private void registerType( PluginTypeInterface pluginType ) throws KettlePluginException {
registerPluginType( pluginType.getClass() );
// Search plugins for this type...
//
long startScan = System.currentTimeMillis();
pluginType.searchPlugins();
for ( PluginRegistryExtension ext : extensions ) {
ext.searchForType( pluginType );
}
Set<String> pluginClassNames = new HashSet<>();
// Scan for plugin classes to facilitate debugging etc.
//
String pluginClasses = EnvUtil.getSystemProperty( Const.KETTLE_PLUGIN_CLASSES );
if ( !Utils.isEmpty( pluginClasses ) ) {
String[] classNames = pluginClasses.split( "," );
Collections.addAll( pluginClassNames, classNames );
}
for ( String className : pluginClassNames ) {
try {
// What annotation does the plugin type have?
//
PluginAnnotationType annotationType = pluginType.getClass().getAnnotation( PluginAnnotationType.class );
if ( annotationType != null ) {
Class<? extends Annotation> annotationClass = annotationType.value();
Class<?> clazz = Class.forName( className );
Annotation annotation = clazz.getAnnotation( annotationClass );
if ( annotation != null ) {
// Register this one!
//
pluginType.handlePluginAnnotation( clazz, annotation, new ArrayList<>(), true, null );
LogChannel.GENERAL.logBasic( "Plugin class "
+ className + " registered for plugin type '" + pluginType.getName() + "'" );
} else {
if ( KettleLogStore.isInitialized() && LogChannel.GENERAL.isDebug() ) {
LogChannel.GENERAL.logDebug( "Plugin class "
+ className + " doesn't contain annotation for plugin type '" + pluginType.getName() + "'" );
}
}
} else {
if ( KettleLogStore.isInitialized() && LogChannel.GENERAL.isDebug() ) {
LogChannel.GENERAL.logDebug( "Plugin class "
+ className + " doesn't contain valid class for plugin type '" + pluginType.getName() + "'" );
}
}
} catch ( Exception e ) {
if ( KettleLogStore.isInitialized() ) {
LogChannel.GENERAL.logError( "Error registring plugin class from KETTLE_PLUGIN_CLASSES: "
+ className + Const.CR + Const.getStackTracker( e ) );
}
}
}
if ( LogChannel.GENERAL.isDetailed() ) {
LogChannel.GENERAL.logDetailed( "Registered "
+ getPlugins( pluginType.getClass() ).size() + " plugins of type '" + pluginType.getName() + "' in "
+ ( System.currentTimeMillis() - startScan ) + "ms." );
}
}