本文整理汇总了Java中org.pentaho.di.core.util.EnvUtil类的典型用法代码示例。如果您正苦于以下问题:Java EnvUtil类的具体用法?Java EnvUtil怎么用?Java EnvUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnvUtil类属于org.pentaho.di.core.util包,在下文中一共展示了EnvUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
@Override
public void init(AppView app) throws BeanFactoryException {
this.app = app;
// dlSystem = (DataLogicSystem) app.getBean(DataLogicSystem.class.getName());
// hostProp = dlSystem.getResourceAsProperties(app.getProperties() + "/properties");
this.app.waitCursorBegin();
try {
KettleEnvironment.init(false);
EnvUtil.environmentInit();
} catch (KettleException ex) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.syncerror"), ex);
msg.show(this);
}
this.app.waitCursorEnd();
}
示例2: main
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
/**
* 1) create a new transformation <br>
* 2) Express the transformation as XML file <br>
* 3) Execute the transformation <br>
* <br>
* @param args
*/
public static void main(String[] args) throws Exception
{
EnvUtil.environmentInit();
// Init the logging...
//
LogWriter.getInstance("TransBuilderFilter.log", true, LogWriter.LOG_LEVEL_DETAILED);
// Load the Kettle steps & plugins
StepLoader.init();
// The parameters we want, optionally this can be
String transformationName = "Filter test Transformation";
TransMeta transMeta = buildFilterSample(transformationName);
System.out.println(transMeta.getXML());
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.execute(null);
trans.waitUntilFinished();
}
示例3: init
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
public void init() {
jobListeners = new ArrayList<JobListener>();
jobEntryListeners = new ArrayList<JobEntryListener>();
activeJobEntryTransformations = new HashMap<JobEntryCopy, JobEntryTrans>();
activeJobEntryJobs = new HashMap<JobEntryCopy, JobEntryJob>();
active = new AtomicBoolean(false);
stopped = new AtomicBoolean(false);
jobTracker = new JobTracker(jobMeta);
jobEntryResults = new ArrayList<JobEntryResult>();
initialized = new AtomicBoolean(false);
finished = new AtomicBoolean(false);
errors = new AtomicInteger(0);
batchId = -1;
passedBatchId = -1;
maxJobEntriesLogged = Const.toInt(EnvUtil.getSystemProperty(Const.KETTLE_MAX_JOB_ENTRIES_LOGGED), 1000);
result = null;
this.setDefaultLogCommitSize();
}
示例4: 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;
}
示例5: loadSettings
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
private void loadSettings() throws IOException
{
Properties properties = new Properties();
FileInputStream fis = new FileInputStream(getSettingsFilename());
try {
properties.load(fis);
} finally {
try {
fis.close();
} catch (IOException ignored) {
// Ignore closure exceptions
}
}
String defaultLocaleStr = properties.getProperty(STRING_DEFAULT_LOCALE, Const.DEFAULT_LOCALE.toString());
defaultLocale = EnvUtil.createLocale(defaultLocaleStr);
String failoverLocaleStr = properties.getProperty(STRING_FAILOVER_LOCALE, "en_US"); //$NON-NLS-1$
failoverLocale = EnvUtil.createLocale(failoverLocaleStr);
}
示例6: init
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
/**
* Initializes the Job.
*/
public void init() {
jobListeners = new ArrayList<JobListener>();
jobEntryListeners = new ArrayList<JobEntryListener>();
activeJobEntryTransformations = new HashMap<JobEntryCopy, JobEntryTrans>();
activeJobEntryJobs = new HashMap<JobEntryCopy, JobEntryJob>();
active = new AtomicBoolean(false);
stopped = new AtomicBoolean(false);
jobTracker = new JobTracker(jobMeta);
jobEntryResults = new LinkedList<JobEntryResult>();
initialized = new AtomicBoolean(false);
finished = new AtomicBoolean(false);
errors = new AtomicInteger(0);
batchId = -1;
passedBatchId = -1;
maxJobEntriesLogged = Const.toInt(EnvUtil.getSystemProperty(Const.KETTLE_MAX_JOB_ENTRIES_LOGGED), 1000);
result = null;
this.setDefaultLogCommitSize();
}
示例7: init
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
public static synchronized void init() throws KettleException {
if (initialized!=null) {
return;
}
createKettleHome();
// Read the kettle.properties file before anything else
//
EnvUtil.environmentInit();
// Load value meta data plugins
//
PluginRegistry.addPluginType(ValueMetaPluginType.getInstance());
PluginRegistry.init(true);
initialized=new Boolean(true);
}
示例8: getXML
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
public String getXML() throws KettleException {
// See PDI-15781
boolean sendResultXmlWithStatus = EnvUtil.getSystemProperty( "KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS", "N" ).equalsIgnoreCase( "Y" );
StringBuilder xml = new StringBuilder();
xml.append( XMLHandler.openTag( XML_TAG ) ).append( Const.CR );
xml.append( " " ).append( XMLHandler.addTagValue( "jobname", jobName ) );
xml.append( " " ).append( XMLHandler.addTagValue( "id", id ) );
xml.append( " " ).append( XMLHandler.addTagValue( "status_desc", statusDescription ) );
xml.append( " " ).append( XMLHandler.addTagValue( "error_desc", errorDescription ) );
xml.append( " " ).append( XMLHandler.addTagValue( "log_date", XMLHandler.date2string( logDate ) ) );
xml.append( " " ).append( XMLHandler.addTagValue( "logging_string", XMLHandler.buildCDATA( loggingString ) ) );
xml.append( " " ).append( XMLHandler.addTagValue( "first_log_line_nr", firstLoggingLineNr ) );
xml.append( " " ).append( XMLHandler.addTagValue( "last_log_line_nr", lastLoggingLineNr ) );
if ( result != null ) {
String resultXML = sendResultXmlWithStatus ? result.getXML() : result.getBasicXml();
xml.append( resultXML );
}
xml.append( XMLHandler.closeTag( XML_TAG ) );
return xml.toString();
}
示例9: 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;
}
示例10: loadSettings
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
private void loadSettings() throws IOException {
Properties properties = new Properties();
FileInputStream fis = new FileInputStream( getSettingsFilename() );
try {
properties.load( fis );
} finally {
try {
fis.close();
} catch ( IOException ignored ) {
// Ignore closure exceptions
}
}
String defaultLocaleStr = properties.getProperty( STRING_DEFAULT_LOCALE, Const.DEFAULT_LOCALE.toString() );
defaultLocale = EnvUtil.createLocale( defaultLocaleStr );
String failoverLocaleStr = properties.getProperty( STRING_FAILOVER_LOCALE, "en_US" );
failoverLocale = EnvUtil.createLocale( failoverLocaleStr );
}
示例11: validateAndInitialiseKettelEngine
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
private void validateAndInitialiseKettelEngine() throws GraphGeneratorException {
File file = new File(
outputLocation + File.separator + schemaInfo.getDatabaseName() + File.separator
+ this.tableName + File.separator + this.segmentId + File.separator + this.taskNo
+ File.separator);
boolean isDirCreated = false;
if (!file.exists()) {
isDirCreated = file.mkdirs();
if (!isDirCreated) {
LOGGER.error(
"Unable to create directory or directory already exist" + file.getAbsolutePath());
throw new GraphGeneratorException("INTERNAL_SYSTEM_ERROR");
}
}
synchronized (DRIVERS) {
try {
if (!kettleInitialized) {
EnvUtil.environmentInit();
KettleEnvironment.init();
kettleInitialized = true;
}
} catch (KettleException kettlExp) {
LOGGER.error(kettlExp);
throw new GraphGeneratorException("Error While Initializing the Kettel Engine ", kettlExp);
}
}
}
示例12: beforeClass
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
@BeforeClass public static void beforeClass() throws KettleException {
PluginRegistry.addPluginType( TwoWayPasswordEncoderPluginType.getInstance() );
PluginRegistry.addPluginType( ValueMetaPluginType.getInstance() );
PluginRegistry.init();
String
passwordEncoderPluginID =
Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );
Encr.init( passwordEncoderPluginID );
}
示例13: beforeClass
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
@BeforeClass public static void beforeClass() throws KettleException {
PluginRegistry.addPluginType( TwoWayPasswordEncoderPluginType.getInstance() );
PluginRegistry.addPluginType( ValueMetaPluginType.getInstance() );
PluginRegistry.init();
String passwordEncoderPluginID = Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );
Encr.init( passwordEncoderPluginID );
}
示例14: executeCommand
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
private static void executeCommand(String[] cmd, File directory) throws IOException, InterruptedException
{
String command = "";
for (int i=0;i<cmd.length;i++) command+=" "+cmd[i];
log.logBasic("Jar generator", "Executing command : "+command);
Runtime runtime = java.lang.Runtime.getRuntime();
Process proc = runtime.exec(cmd, EnvUtil.getEnvironmentVariablesForRuntimeExec(), directory);
// any error message?
StreamLogger errorLogger = new StreamLogger(proc.getErrorStream(), "Jar generator (stderr)");
// any output?
StreamLogger outputLogger = new StreamLogger(proc.getInputStream(), "Jar generator (stdout)");
// kick them off
new Thread(errorLogger).start();
new Thread(outputLogger).start();
proc.waitFor();
log.logDetailed("Jar generator", "command ["+cmd[0]+"] has finished");
// What's the exit status?
if (proc.exitValue()!=0)
{
log.logDetailed("Jar generator", "Exit status of jar command was "+proc.exitValue());
}
// close the streams
// otherwise you get "Too many open files, java.io.IOException" after a lot of iterations
try {
proc.getErrorStream().close();
proc.getInputStream().close();
} catch (IOException e) {
log.logDetailed("Jar generator", "Warning: Error closing streams: " + e.getMessage());
}
}
示例15: testTransformationDependencyList
import org.pentaho.di.core.util.EnvUtil; //导入依赖的package包/类
public void testTransformationDependencyList() throws Exception {
EnvUtil.environmentInit();
LogWriter.getInstance(LogWriter.LOG_LEVEL_BASIC);
StepLoader.init();
TransMeta transMeta = new TransMeta("test/org/pentaho/di/resource/trans/General - Change log processing.ktr"); //$NON-NLS-1$
List<ResourceReference> resourceReferences = transMeta.getResourceDependencies();
// printResourceReferences(resourceReferences);
assertEquals(2, resourceReferences.size());
ResourceReference genRef = null;
for (ResourceReference look : resourceReferences) {
if (look.getReferenceHolder().getTypeId().equals("TextFileInput")) {
genRef = look;
}
}
assertNotNull(genRef);
// System.out.println(genRef.toXml());
ResourceHolderInterface refHolder = genRef.getReferenceHolder();
assertEquals("TextFileInput", refHolder.getTypeId()); //$NON-NLS-1$
List<ResourceEntry> entries = genRef.getEntries();
assertEquals(1, entries.size());
ResourceEntry theEntry = entries.get(0);
assertEquals(ResourceType.FILE, theEntry.getResourcetype());
assertTrue(theEntry.getResource().endsWith("changelog.txt")); //$NON-NLS-1$
}