本文整理汇总了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;
}