本文整理匯總了Java中org.pentaho.di.trans.Trans類的典型用法代碼示例。如果您正苦於以下問題:Java Trans類的具體用法?Java Trans怎麽用?Java Trans使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Trans類屬於org.pentaho.di.trans包,在下文中一共展示了Trans類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: iMessage
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
/**
* job動態監控
*
* @param job
* @param entity
* @throws KettleException
*/
private void iMessage(Trans trans, T entity, String exception) {
if (null != trans && null != entity) {
String title = entity.getName();
if (null != entity.getTid() && !"".equals(entity.getTid())) {
entity.setName(entity.getTid());
}
entity.setName(title);
String id = iMonitor(trans, entity);
entity.setId(id);
iLogging(trans, entity, exception);
if (trans.getErrors() > 0) {
iEmail(trans, entity, exception);
}
}
trans = null;
}
示例2: iLogging
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
/**
* 記錄job日誌信息
*
* @param job
* @param entity
* @throws KettleException
*/
private void iLogging(Trans trans, T entity, String exception) {
if (entity.isTest() || trans.getErrors() > 0) {
String logChannelId = trans.getLogChannelId();
// Log4jBufferAppender appender = CentralLogStore.getAppender();
String logText ="";// appender.getBuffer(logChannelId, true).toString();
// CentralLogStore.discardLines(logChannelId, true);
if (null == logText || "".equals(logText)) {
logText = exception;
}
KettleLogs log = new KettleLogs();
log.setId(ObjectID.id());
log.setMid(entity.getId());
log.setLogs(logText);
log.setCreator("Kettle");
log.setCreated(DateUtils.getTime24());
// service.iKettleLogsService.insert(log);
}
}
示例3: startTransformation
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
protected void startTransformation( Repository repository, IMetaStore metaStore, final StreamingService service ) {
try {
TransMeta transMeta = StreamingConst.loadTransMeta( repository, metaStore, service );
Trans trans = new Trans( transMeta );
String carteObjectId = UUID.randomUUID().toString();
trans.setContainerObjectId( carteObjectId );
if (service.getLogLevel()!=null) {
trans.setLogLevel(service.getLogLevel());
}
TransExecutionConfiguration transExecutionConfiguration = new TransExecutionConfiguration();
TransConfiguration transConfiguration = new TransConfiguration( transMeta, transExecutionConfiguration );
transformationMap.addTransformation( transMeta.getName(), carteObjectId, trans, transConfiguration );
trans.prepareExecution( null );
// Start the transformation
trans.startThreads();
// This transformation routinely never ends so we won't wait for it...
} catch ( Exception e ) {
throw new RuntimeException( "Unable to start transformation for streaming service '" + service.getName() + "'", e );
}
}
示例4: iLogging
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
/**
* 記錄job日誌信息
*
* @param job
* @param entity
* @throws KettleException
*/
private void iLogging(Trans trans, T entity, String exception) {
if (entity.isTest() || trans.getErrors() > 0) {
String logChannelId = trans.getLogChannelId();
Log4jBufferAppender appender = CentralLogStore.getAppender();
String logText = appender.getBuffer(logChannelId, true).toString();
CentralLogStore.discardLines(logChannelId, true);
if (null == logText || "".equals(logText)) {
logText = exception;
}
KettleLogs log = new KettleLogs();
log.setId(ObjectID.id());
log.setMid(entity.getId());
log.setLogs(logText);
log.setCreator("Kettle");
log.setCreated(DateUtils.getTime24());
// service.iKettleLogsService.insert(log);
}
}
示例5: iMonitor
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
/**
* 記錄job操作信息
*
* @param job
* @param entity
* @throws KettleException
*/
private String iMonitor(Trans trans, T entity) {
KettleResult result = new KettleResult();
result.setName(entity.getName());
result.setParams(JSONObject.fromObject(entity.getValue()).toString());
result.setStartTime(entity.getCreated());
result.setEndTime(DateUtils.getTime24());
result.setDeleted(String.valueOf(trans.getResult().getNrLinesDeleted()));
result.setInput(String.valueOf(trans.getResult().getNrLinesInput()));
result.setError(String.valueOf(trans.getErrors()));
result.setOutput(String.valueOf(trans.getResult().getNrLinesOutput()));
result.setRead(String.valueOf(trans.getResult().getNrLinesRead()));
result.setUpdated(String.valueOf(trans.getResult().getNrLinesUpdated()));
result.setWritten(String.valueOf(trans.getResult().getNrLinesWritten()));
result.setRetrieved(String.valueOf(trans.getResult()
.getNrFilesRetrieved()));
result.setRejected(String.valueOf(trans.getResult()
.getNrLinesRejected()));
result.setCreator("Kettle");
result.setCreated(DateUtils.getTime24());
result.setType("Running");
result.setHost(ServerUtils.getName() + ":" + ServerUtils.getHost());
if (entity.isTest()) {
result.setType("Testing");
}
return (String) service.iKettleResultService.insert(result);
}
示例6: iEmail
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
/**
* 郵件預警
*
* @param job
* @param entity
*/
private void iEmail(Trans trans, T entity, String exception) {
if (null != entity) {
String content = null;
if (null != trans.getResult().getLogText()
&& !"".equals(trans.getResult().getLogText())) {
content = trans.getResult().getLogText();
} else if (null != exception && !"".equals(exception)) {
content = exception;
}
if (null != content && !"".equals(content)) {
User u = new User();
u.setType("KETTLE");
u.setStatus(Constant.STATUS_ENABLED);
@SuppressWarnings("all")
List<User> list = (List<User>) service.iUserService
.selectByWhere(u);
if (null != list && list.size() > 0) {
for (User user : list) {
try {
Message.iMessage(Constant.MAIL_USERNAME,
Constant.MAIL_PASSWORD, Constant.MAIL_SMTP,
Integer.valueOf(Constant.MAIL_PORT),
Constant.MAIL_SENDER, user.getEmail(),
entity.getName(), content);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}
示例7: preview
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
private void preview() {
CassandraInputMeta oneMeta = new CassandraInputMeta();
getInfo(oneMeta, true);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(this.transMeta, oneMeta, this.wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(this.shell, this.props.getDefaultPreviewSize(),
BaseMessages.getString(PKG, "AutSoftCassandraInputDialog.EnterPreviewSize"),
BaseMessages.getString(PKG, "AutSoftCassandraInputDialog.NumberOfRowsToPreview"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(this.shell, previewMeta,
new String[]{this.wStepname.getText()}, new int[]{previewSize});
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if ((trans.getResult() != null) && (trans.getResult().getNrErrors() > 0L)) {
EnterTextDialog etd = new EnterTextDialog(this.shell,
BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"),
BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
} else {
PreviewRowsDialog prd = new PreviewRowsDialog(this.shell, this.transMeta, 0, this.wStepname.getText(),
progressDialog.getPreviewRowsMeta(this.wStepname.getText()),
progressDialog.getPreviewRows(this.wStepname.getText()), loggingText);
prd.open();
}
}
}
}
示例8: setVariableRootJob
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
/**
* 設置變量到根作業 <br/>
* @author jingma
* @param variableName 變量名
* @param variableValue 變量值
*/
public void setVariableRootJob(String variableName,String variableValue){
ku.setVariable(variableName, variableValue);
Trans trans = ku.getTrans();
while(trans.getParentTrans()!=null){
trans.setVariable(variableName, variableValue);
trans = trans.getParentTrans();
}
trans.setVariable(variableName, variableValue);
Job job = trans.getParentJob();
while(job!=null){
job.setVariable(variableName, variableValue);
job = job.getParentJob();
}
}
示例9: testExecuteTrans
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
@Test
public void testExecuteTrans() {
try {
Trans trans = KettleUtils.executeTrans("第一課作業", rep, false);
while (trans.isRunning()) {
System.out.println(trans.getStatus());
Thread.sleep(1000);
}
System.err.println(trans.getStatus());
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: getStep
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
@Override
public StepInterface getStep(StepMeta stepMeta,
StepDataInterface stepDataInterface, int cnr, TransMeta transMeta,
Trans trans) {
return new DOMConcatFields(stepMeta, stepDataInterface, cnr, transMeta,
trans);
}
示例11: init
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
public boolean init(StepMetaInterface smi, StepDataInterface sdi)
{
meta=(GPBulkLoaderMeta)smi;
data=(GPBulkLoaderData)sdi;
Trans trans = getTrans();
preview = trans.isPreview();
if (super.init(smi, sdi))
{
return true;
}
return false;
}
示例12: preview
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
private void preview()
{
IntuitivusSpreadsheetStepMeta meta = new IntuitivusSpreadsheetStepMeta();
getInfo(meta);
if (!meta.hasDataToConnect())
return;
boolean useDefinedOutput = fieldsTable.table.getItemCount() > 0;
meta.setAdoptOutput(useDefinedOutput);
String stepName = wStepname.getText();
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, meta, stepName);
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { stepName }, new int[] { Integer.MAX_VALUE });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled())
{
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0)
{
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"),
loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, stepName, progressDialog.getPreviewRowsMeta(stepName), progressDialog.getPreviewRows(stepName), loggingText);
prd.open();
}
示例13: executeTrans
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
protected void executeTrans(Trans trans) throws KettleException {
trans.prepareExecution(null);
trans.startThreads();
trans.waitUntilFinished();
}
示例14: preview
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
private void preview()
{
// Create the XML input step
GetSubFoldersMeta oneMeta = new GetSubFoldersMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname
.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), Messages.getString("GetSubFoldersDialog.PreviewSize.DialogTitle"), Messages.getString("GetSubFoldersDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0)
{
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta,
new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
if (!progressDialog.isCancelled())
{
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0)
{
EnterTextDialog etd = new EnterTextDialog(shell, Messages.getString("System.Dialog.Error.Title"), Messages.getString("GetSubFoldersDialog.ErrorInPreview.DialogMessage"), loggingText, true);
etd.setReadOnly();
etd.open();
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(),progressDialog.getPreviewRowsMeta(wStepname.getText()),
progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
}
示例15: FilesFromResult
import org.pentaho.di.trans.Trans; //導入依賴的package包/類
public FilesFromResult(StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr,
TransMeta transMeta, Trans trans)
{
super(stepMeta, stepDataInterface, copyNr, transMeta, trans);
meta = (FilesFromResultMeta) getStepMeta().getStepMetaInterface();
data = (FilesFromResultData) stepDataInterface;
}