org.pentaho.di.core.logging.LogChannel Java Examples
The following examples show how to use
org.pentaho.di.core.logging.LogChannel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlaveServer.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public SlaveServer( String name, String hostname, String port, String username, String password, String proxyHostname, String proxyPort, String nonProxyHosts, boolean master, boolean ssl ) { this(); this.name = name; this.hostname = hostname; this.port = port; this.username = username; this.password = password; this.proxyHostname = proxyHostname; this.proxyPort = proxyPort; this.nonProxyHosts = nonProxyHosts; this.master = master; this.sslMode = ssl; initializeVariablesFrom( null ); this.log = new LogChannel( this ); }
Example #2
Source File: DialogHelper.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public static RepositoryObject selectRepositoryObject( String filter, LogChannel log ) { try { FileDialogOperation fileDialogOperation = new FileDialogOperation( FileDialogOperation.OPEN, FileDialogOperation.ORIGIN_OTHER ); if ( !Utils.isEmpty( filter ) ) { fileDialogOperation.setFilter( filter ); } ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonOpenSaveRepository.id, fileDialogOperation ); return (RepositoryObject) fileDialogOperation.getRepositoryObject(); } catch ( KettleException ke ) { // Ignore } return null; }
Example #3
Source File: SubjectDataBrowserDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public SubjectDataBrowserDialog( Shell parent, Map<String, RowMetaInterface> metaMap, Map<String, List<Object[]>> dataMap, String dialogTitle, String subjectMessage ) { this.parentShell = parent; this.metaMap = metaMap; this.dataMap = dataMap; this.dialogTitle = dialogTitle; this.subjectMessage = subjectMessage; props = PropsUI.getInstance(); subjects = metaMap.keySet().toArray( new String[metaMap.size()] ); Arrays.sort( subjects ); selectedSubject = ""; if ( !metaMap.isEmpty() ) { selectedSubject = subjects[0]; } this.log = new LogChannel( "Subject Data Browser Dialog" ); }
Example #4
Source File: Translator.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public static void main( String[] args ) { Display display = new Display(); LogChannelInterface log = new LogChannel( APP_NAME ); PropsUI.init( display, Props.TYPE_PROPERTIES_SPOON ); Translator translator = new Translator( display ); translator.open(); try { while ( !display.isDisposed() ) { if ( !display.readAndDispatch() ) { display.sleep(); } } } catch ( Throwable e ) { log.logError( "An unexpected error occurred : " + e.getMessage() ); log.logError( Const.getStackTracker( e ) ); } }
Example #5
Source File: StreamToTransNodeConverter.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public void convertPostRepoSave( RepositoryFile repositoryFile ) { if ( repositoryFile != null ) { try { Repository repo = connectToRepository(); if ( repo != null ) { TransMeta transMeta = repo.loadTransformation( new StringObjectId( repositoryFile.getId().toString() ), null ); ExtensionPointHandler.callExtensionPoint( new LogChannel( this ), KettleExtensionPoint.TransImportAfterSaveToRepo.id, transMeta ); } } catch ( Exception e ) { logger.error( KettleExtensionPoint.TransImportAfterSaveToRepo.id, e ); } } }
Example #6
Source File: Trans.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Sets the parent logging object. * * @param parent the new parent */ public void setParent( LoggingObjectInterface parent ) { this.parent = parent; this.log = new LogChannel( this, parent ); this.logLevel = log.getLogLevel(); if ( this.containerObjectId == null ) { this.containerObjectId = log.getContainerObjectId(); } if ( log.isDetailed() ) { log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.TransformationIsPreloaded" ) ); } if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, "Trans.Log.NumberOfStepsToRun", String.valueOf( transMeta.nrSteps() ), String.valueOf( transMeta.nrTransHops() ) ) ); } }
Example #7
Source File: MasterSlaveIT.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * This test check passing rows to sub-transformation executed on cluster * See PDI-10704 for details * @throws Exception */ public void runSubtransformationClustered() throws Exception { TransMeta transMeta = loadTransMetaReplaceSlavesInCluster( clusterGenerator, "test/org/pentaho/di/cluster/test-subtrans-clustered.ktr" ); TransExecutionConfiguration config = createClusteredTransExecutionConfiguration(); Result prevResult = new Result(); prevResult.setRows( getSampleRows() ); config.setPreviousResult( prevResult ); TransSplitter transSplitter = Trans.executeClustered( transMeta, config ); LogChannel logChannel = createLogChannel( "cluster unit test <runSubtransformationClustered>" ); long nrErrors = Trans.monitorClusteredTransformation( logChannel, transSplitter, null, 1 ); assertEquals( 0L, nrErrors ); String result = loadFileContent( transMeta, "${java.io.tmpdir}/test-subtrans-clustered.txt" ); assertEqualsIgnoreWhitespacesAndCase( "10", result ); }
Example #8
Source File: Trans.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Sets encoding of HttpServletResponse according to System encoding.Check if system encoding is null or an empty and * set it to HttpServletResponse when not and writes error to log if null. Throw IllegalArgumentException if input * parameter is null. * * @param response the HttpServletResponse to set encoding, mayn't be null */ public void setServletReponse( HttpServletResponse response ) { if ( response == null ) { throw new IllegalArgumentException( "HttpServletResponse cannot be null " ); } String encoding = System.getProperty( "KETTLE_DEFAULT_SERVLET_ENCODING", null ); // true if encoding is null or an empty (also for the next kin of strings: " ") if ( !StringUtils.isBlank( encoding ) ) { try { response.setCharacterEncoding( encoding.trim() ); response.setContentType( "text/html; charset=" + encoding ); } catch ( Exception ex ) { LogChannel.GENERAL.logError( "Unable to encode data with encoding : '" + encoding + "'", ex ); } } this.servletResponse = response; }
Example #9
Source File: Wsdl.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Find the specified operation in the WSDL definition. * * @param operationName * Name of operation to find. * @return A WsdlOperation instance, null if operation can not be found in WSDL. */ public WsdlOperation getOperation( String operationName ) throws KettleStepException { // is the operation in the cache? if ( _operationCache.containsKey( operationName ) ) { return _operationCache.get( operationName ); } Binding b = _port.getBinding(); PortType pt = b.getPortType(); Operation op = pt.getOperation( operationName, null, null ); if ( op != null ) { try { WsdlOperation wop = new WsdlOperation( b, op, _wsdlTypes ); // cache the operation _operationCache.put( operationName, wop ); return wop; } catch ( KettleException kse ) { LogChannel.GENERAL.logError( "Could not retrieve WSDL Operator for operation name: " + operationName ); throw new KettleStepException( "Could not retrieve WSDL Operator for operation name: " + operationName, kse ); } } return null; }
Example #10
Source File: EditRowsDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public EditRowsDialog( Shell parent, int style, String title, String message, RowMetaInterface rowMeta, List<Object[]> rowBuffer ) { this.title = title; this.message = message; this.rowBuffer = rowBuffer; this.rowMeta = rowMeta; this.parentShell = parent; this.style = ( style != SWT.None ) ? style : this.style; props = PropsUI.getInstance(); bounds = null; hscroll = -1; vscroll = -1; title = null; message = null; this.log = LogChannel.GENERAL; }
Example #11
Source File: TextFileCSVImportProgressDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Creates a new dialog that will handle the wait while we're finding out what tables, views etc we can reach in the * database. */ public TextFileCSVImportProgressDialog( Shell shell, TextFileInputMeta meta, TransMeta transMeta, InputStreamReader reader, int samples, boolean replaceMeta ) { this.shell = shell; this.meta = meta; this.reader = reader; this.samples = samples; this.replaceMeta = replaceMeta; this.transMeta = transMeta; message = null; debug = "init"; rownumber = 1L; this.log = new LogChannel( transMeta ); this.encodingType = EncodingType.guessEncodingType( reader.getEncoding() ); }
Example #12
Source File: SlaveServer.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public SlaveServer( Node slaveNode ) { this(); this.name = XMLHandler.getTagValue( slaveNode, "name" ); this.hostname = XMLHandler.getTagValue( slaveNode, "hostname" ); this.port = XMLHandler.getTagValue( slaveNode, "port" ); this.webAppName = XMLHandler.getTagValue( slaveNode, "webAppName" ); this.username = XMLHandler.getTagValue( slaveNode, "username" ); this.password = Encr.decryptPasswordOptionallyEncrypted( XMLHandler.getTagValue( slaveNode, "password" ) ); this.proxyHostname = XMLHandler.getTagValue( slaveNode, "proxy_hostname" ); this.proxyPort = XMLHandler.getTagValue( slaveNode, "proxy_port" ); this.nonProxyHosts = XMLHandler.getTagValue( slaveNode, "non_proxy_hosts" ); this.propertiesMasterName = XMLHandler.getTagValue( slaveNode, "get_properties_from_master" ); this.overrideExistingProperties = "Y".equalsIgnoreCase( XMLHandler.getTagValue( slaveNode, "override_existing_properties" ) ); this.master = "Y".equalsIgnoreCase( XMLHandler.getTagValue( slaveNode, "master" ) ); initializeVariablesFrom( null ); this.log = new LogChannel( this ); setSslMode( "Y".equalsIgnoreCase( XMLHandler.getTagValue( slaveNode, SSL_MODE_TAG ) ) ); Node sslConfig = XMLHandler.getSubNode( slaveNode, SslConfiguration.XML_TAG ); if ( sslConfig != null ) { setSslMode( true ); this.sslConfig = new SslConfiguration( sslConfig ); } }
Example #13
Source File: FileStreamTest.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Before public void before() throws IOException, KettleException { streamFile = temporaryFolder.newFile(); writer = new FileWriter( streamFile ); KettleEnvironment.init(); trans.setTransMeta( transMeta ); trans.setLog( new LogChannel( this ) ); streamMeta.setTransformationPath( getClass().getResource( "/subtrans.ktr" ).getPath() ); streamMeta.setBatchDuration( "5" ); streamMeta.setBatchSize( "1" ); streamMeta.setSourcePath( streamFile.getPath() ); when( stepMeta.getName() ).thenReturn( "mocked name" ); when( stepMeta.getStepMetaInterface() ).thenReturn( streamMeta ); when( transMeta.findStep( any() ) ).thenReturn( stepMeta ); }
Example #14
Source File: DataSetDialog.java From pentaho-pdi-dataset with Apache License 2.0 | 6 votes |
protected void viewData() { try { DataSet set = new DataSet(); getInfo( set ); verifySettings(); List<Object[]> setRows = set.getAllRows( LogChannel.UI ); RowMetaInterface setRowMeta = set.getSetRowMeta( false ); PreviewRowsDialog previewRowsDialog = new PreviewRowsDialog( shell, new Variables(), SWT.NONE, set.getName(), setRowMeta, setRows ); previewRowsDialog.open(); } catch ( Exception e ) { new ErrorDialog( shell, "Error", "Error previewing data from dataset table", e ); } }
Example #15
Source File: BeamPerspective.java From kettle-beam with Apache License 2.0 | 6 votes |
public XulTabAndPanel createTab() { try { XulTab tab = (XulTab) document.createElement( "tab" ); XulTabpanel panel = (XulTabpanel) document.createElement( "tabpanel" ); panel.setSpacing( 0 ); panel.setPadding( 0 ); tabs.addChild( tab ); panels.addChild( panel ); tabbox.setSelectedIndex( panels.getChildNodes().indexOf( panel ) ); tab.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange( PropertyChangeEvent evt ) { LogChannel.GENERAL.logBasic( "Property changed: " + evt.getPropertyName() + ", " + evt.toString() ); } } ); return new XulTabAndPanel( tab, panel ); } catch ( XulException e ) { e.printStackTrace(); } return null; }
Example #16
Source File: EditRowsDialog.java From pentaho-pdi-dataset with Apache License 2.0 | 6 votes |
public EditRowsDialog( Shell parent, int style, String title, String message, RowMetaInterface rowMeta, List<Object[]> rowBuffer ) { this.title = title; this.message = message; this.rowBuffer = rowBuffer; this.rowMeta = rowMeta; this.parentShell = parent; this.style = ( style != SWT.None ) ? style : this.style; props = PropsUI.getInstance(); bounds = null; hscroll = -1; vscroll = -1; title = null; message = null; this.log = LogChannel.GENERAL; }
Example #17
Source File: DataHandler.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override public void pluginAdded( Object serviceObject ) { PluginInterface plugin = (PluginInterface) serviceObject; String pluginName = plugin.getName(); try { DatabaseInterface databaseInterface = (DatabaseInterface) registry.loadClass( plugin ); databaseInterface.setPluginId( plugin.getIds()[ 0 ] ); databaseInterface.setName( pluginName ); databaseTypeAdded( pluginName, databaseInterface ); } catch ( KettleException e ) { Throwable t = e; if ( e.getCause() != null ) { t = e.getCause(); } System.out.println( "Could not create connection entry for " + pluginName + ". " + t.getClass().getName() ); LogChannel.GENERAL.logError( "Could not create connection entry for " + pluginName + ". " + t.getClass().getName() ); } }
Example #18
Source File: Neo4jPerspective.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 6 votes |
public XulTabAndPanel createTab() { try { XulTab tab = (XulTab) document.createElement( "tab" ); XulTabpanel panel = (XulTabpanel) document.createElement( "tabpanel" ); panel.setSpacing( 0 ); panel.setPadding( 0 ); tabs.addChild( tab ); panels.addChild( panel ); tabbox.setSelectedIndex( panels.getChildNodes().indexOf( panel ) ); tab.addPropertyChangeListener( new PropertyChangeListener() { @Override public void propertyChange( PropertyChangeEvent evt ) { LogChannel.GENERAL.logBasic( "Property changed: " + evt.getPropertyName() + ", " + evt.toString() ); } } ); return new XulTabAndPanel( tab, panel ); } catch ( XulException e ) { e.printStackTrace(); } return null; }
Example #19
Source File: PreviewRowsDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public PreviewRowsDialog( Shell parent, VariableSpace space, int style, String stepName, RowMetaInterface rowMeta, List<Object[]> rowBuffer, String loggingText ) { this.stepname = stepName; this.buffer = rowBuffer; this.loggingText = loggingText; this.rowMeta = rowMeta; this.variables = space; this.parentShell = parent; this.style = ( style != SWT.None ) ? style : this.style; this.dialogClosedListeners = new ArrayList<DialogClosedListener>(); props = PropsUI.getInstance(); bounds = null; hscroll = -1; vscroll = -1; title = null; message = null; this.log = new LogChannel( "Row Preview" ); }
Example #20
Source File: MailInputDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private boolean connect() { String errordescription = null; boolean retval = false; if ( mailConn != null && mailConn.isConnected() ) { retval = mailConn.isConnected(); } if ( !retval ) { String realserver = transMeta.environmentSubstitute( wServerName.getText() ); String realuser = transMeta.environmentSubstitute( wUserName.getText() ); String realpass = Utils.resolvePassword( transMeta, wPassword.getText() ); String realProxyUsername = transMeta.environmentSubstitute( wProxyUsername.getText() ); int realport = Const.toInt( transMeta.environmentSubstitute( wPort.getText() ), -1 ); try { mailConn = new MailConnection( LogChannel.UI, MailConnectionMeta.getProtocolFromString( wProtocol.getText(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realuser, realpass, wUseSSL.getSelection(), wUseProxy.getSelection(), realProxyUsername ); mailConn.connect(); retval = true; } catch ( Exception e ) { errordescription = e.getMessage(); } } if ( !retval ) { MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR ); mb.setMessage( BaseMessages.getString( PKG, "MailInput.Connected.NOK.ConnectionBad", wServerName.getText() ) + Const.CR + Const.NVL( errordescription, "" ) ); mb.setText( BaseMessages.getString( PKG, "MailInput.Connected.Title.Bad" ) ); mb.open(); } return ( mailConn.isConnected() ); }
Example #21
Source File: MissingEntryTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test public void testExecute() throws KettleJobException { MissingEntry entry = spy( new MissingEntry() ); when( entry.getLogChannel() ).thenReturn( mock( LogChannel.class ) ); entry.setName( "MissingTest" ); Result result = new Result(); result.setNrErrors( 0 ); result.setResult( true ); entry.execute( result, 0 ); assertEquals( 1, result.getNrErrors() ); assertEquals( false, result.getResult() ); }
Example #22
Source File: LifecycleSupport.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Instantiate the main plugin class types for the plugin type provided from the set of registered plugins via * {@link PluginRegistry}. * * @param pluginType * Type of plugin whose main class types should be instanticated * @return Set of plugin main class instances (a.k.a. plugins) */ static <T> Set<T> loadPlugins( Class<? extends PluginTypeInterface> pluginType, Class<T> mainPluginClass ) { Set<T> pluginInstances = new HashSet<T>(); List<PluginInterface> plugins = registry.getPlugins( pluginType ); for ( PluginInterface plugin : plugins ) { try { pluginInstances.add( registry.loadClass( plugin, mainPluginClass ) ); } catch ( Throwable e ) { LogChannel.GENERAL.logError( "Unexpected error loading class for plugin " + plugin.getName(), e ); } } return pluginInstances; }
Example #23
Source File: KettleLifecycleSupport.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void onEnvironmentShutdown() { for ( KettleLifecycleListener listener : kettleLifecycleListeners.keySet() ) { try { listener.onEnvironmentShutdown(); } catch ( Throwable t ) { // Log the error and continue invoking other listeners LogChannel.GENERAL.logError( BaseMessages.getString( PKG, "LifecycleSupport.ErrorInvokingKettleLifecycleListener", listener ), t ); } } }
Example #24
Source File: JobTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Before public void init() { mockedDataBase = mock( Database.class ); mockedJob = mock( Job.class ); mockedVariableSpace = mock( VariableSpace.class ); hasDatabasesInterface = mock( HasDatabasesInterface.class ); mockedJobMeta = mock( JobMeta.class ); mockedJobEntryCopy = mock( JobEntryCopy.class ); mockedJobEntrySpecial = mock( JobEntrySpecial.class ); mockedLogChannel = mock( LogChannel.class ); when( mockedJob.createDataBase( any( DatabaseMeta.class ) ) ).thenReturn( mockedDataBase ); }
Example #25
Source File: XulDatabaseExplorerController.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void onClose( XulComponent aSender, Status aReturnCode, Object aRetVal ) { if ( aReturnCode == Status.ACCEPT ) { try { this.limit = Integer.parseInt( aRetVal.toString() ); } catch ( NumberFormatException e ) { LogChannel.GENERAL.logError( "Error parsing string '" + aRetVal.toString() + "'", e ); } } }
Example #26
Source File: Translator.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public Translator( Display display ) { this.display = display; this.log = new LogChannel( APP_NAME ); this.props = PropsUI.getInstance(); clear(); unusedColor = display.getSystemColor( SWT.COLOR_YELLOW ); }
Example #27
Source File: JobEntryWriteToLog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public LogWriterObject( String subject, LoggingObjectInterface parent, LogLevel logLevel ) { this.subject = subject; this.parent = parent; this.logLevel = logLevel; this.writerLog = new LogChannel( this, parent ); this.containerObjectId = writerLog.getContainerObjectId(); }
Example #28
Source File: JobMeta.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Clears or reinitializes many of the JobMeta properties. */ @Override public void clear() { jobcopies = new ArrayList<JobEntryCopy>(); jobhops = new ArrayList<JobHopMeta>(); jobLogTable = JobLogTable.getDefault( this, this ); jobEntryLogTable = JobEntryLogTable.getDefault( this, this ); extraLogTables = new ArrayList<LogTableInterface>(); List<PluginInterface> plugins = PluginRegistry.getInstance().getPlugins( LogTablePluginType.class ); for ( PluginInterface plugin : plugins ) { try { LogTablePluginInterface logTablePluginInterface = (LogTablePluginInterface) PluginRegistry.getInstance() .loadClass( plugin ); if ( logTablePluginInterface.getType() == TableType.JOB ) { logTablePluginInterface.setContext( this, this ); extraLogTables.add( logTablePluginInterface ); } } catch ( Exception e ) { LogChannel.GENERAL.logError( "Error loading log table plugin with ID " + plugin.getIds()[0], e ); } } arguments = null; super.clear(); loopCache = new HashMap<String, Boolean>(); addDefaults(); jobStatus = -1; jobVersion = null; // setInternalKettleVariables(); Don't clear the internal variables for // ad-hoc jobs, it's ruins the previews // etc. log = LogChannel.GENERAL; }
Example #29
Source File: FTPSConnection.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public FTPSConnection( int connectionType, String hostname, int port, String username, String password, VariableSpace nameSpace ) { this.hostName = hostname; this.portNumber = port; this.userName = username; this.passWord = password; this.connectionType = connectionType; this.passiveMode = false; this.nameSpace = nameSpace; this.logger = new LogChannel( this ); }
Example #30
Source File: JobEntryBase.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Instantiates a new job entry base object. */ public JobEntryBase() { name = null; description = null; log = new LogChannel( this ); attributesMap = new HashMap<>(); extensionDataMap = new HashMap<>(); }