/** * Gets the repository directory. * * @return the repository directory * @see org.pentaho.di.core.logging.LoggingObjectInterface#getRepositoryDirectory() */ @Override public RepositoryDirectoryInterface getRepositoryDirectory() { if ( transMeta == null ) { return null; } return transMeta.getRepositoryDirectory(); }
private String getRepositoryRelativePath( String path ) { String parentPath = this.transMeta.getRepositoryDirectory().getPath(); if ( path.startsWith( parentPath ) ) { path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" ); } return path; } }
protected String getRepositoryRelativePath( String path ) { String parentPath = this.transMeta.getRepositoryDirectory().getPath(); if ( path.startsWith( parentPath ) ) { path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" ); } return path; }
/** * Gets the repository directory path and name of the transformation. * * @return The repository directory path plus the name of the transformation */ public String getPathAndName() { if ( getRepositoryDirectory().isRoot() ) { return getRepositoryDirectory().getPath() + getName(); } else { return getRepositoryDirectory().getPath() + RepositoryDirectory.DIRECTORY_SEPARATOR + getName(); } }
public void widgetSelected( SelectionEvent arg0 ) { RepositoryDirectoryInterface directoryFrom = transMeta.getRepositoryDirectory(); RepositoryDirectoryInterface rd = RepositoryDirectoryUI.chooseDirectory( shell, rep, directoryFrom ); if ( rd == null ) { return; } // We need to change this in the repository as well!! // We do this when the user pressed OK newDirectory = rd; wDirectory.setText( rd.getPath() ); } } );
private Trans createLegacyTrans() { try { return new Trans( transMeta, spoon.rep, transMeta.getName(), transMeta.getRepositoryDirectory().getPath(), transMeta.getFilename() ); } catch ( KettleException e ) { throw new RuntimeException( e ); } }
private boolean isTransOpened( String id, String path, String name ) { List<TransMeta> openedTransFiles = getSpoon().delegates.trans.getTransformationList(); for ( TransMeta t : openedTransFiles ) { if ( t.getObjectId() != null && id.equals( t.getObjectId().getId() ) || ( path.equals( t.getRepositoryDirectory().getPath() ) && name.equals( t.getName() ) ) ) { return true; } } return false; }
private void isFileOpenedInFolder( String path ) throws KettleException { List<TransMeta> openedTransFiles = getSpoon().delegates.trans.getTransformationList(); for ( TransMeta t : openedTransFiles ) { if ( t.getRepositoryDirectory().getPath() != null && ( t.getRepositoryDirectory().getPath() + "/" ).startsWith( path + "/" ) ) { throw new KettleTransException(); } } List<JobMeta> openedJobFiles = getSpoon().delegates.jobs.getJobList(); for ( JobMeta j : openedJobFiles ) { if ( j.getRepositoryDirectory().getPath() != null && ( j.getRepositoryDirectory().getPath() + "/" ).startsWith( path + "/" ) ) { throw new KettleJobException(); } } }
public VariableSpace resolveCurrentDirectory( ObjectLocationSpecificationMethod specificationMethod, VariableSpace parentVariables, Repository repository, StepMeta stepMeta, String filename ) { RepositoryDirectoryInterface directory = null; if ( repository != null && specificationMethod.equals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ) && stepMeta != null && stepMeta.getParentTransMeta() != null && stepMeta.getParentTransMeta().getRepositoryDirectory() != null ) { directory = stepMeta.getParentTransMeta().getRepositoryDirectory(); } else if ( repository == null && stepMeta != null && stepMeta.getParentTransMeta() != null ) { filename = stepMeta.getParentTransMeta().getFilename(); } else if ( stepMeta != null && stepMeta.getParentTransMeta() != null && repository != null && specificationMethod.equals( ObjectLocationSpecificationMethod.FILENAME ) ) { // we're using FILENAME but we are connected to a repository directory = stepMeta.getParentTransMeta().getRepositoryDirectory(); } else if ( stepMeta != null && stepMeta.getParentTransMeta() != null && filename == null ) { filename = stepMeta.getParentTransMeta().getFilename(); } return resolveCurrentDirectory( parentVariables, directory, filename ); }
private void selectRepositoryTrans() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log ); try { if ( repositoryObject != null ) { loadRepositoryTrans( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), mappingTransMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + mappingTransMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void selectRepositoryTrans() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log ); try { if ( repositoryObject != null ) { loadRepositoryTrans( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), mappingTransMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + mappingTransMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "MappingDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "MappingDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void selectRepositoryTrans() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log ); try { if ( repositoryObject != null ) { loadRepositoryTrans( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), mappingTransMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + mappingTransMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SimpleMappingDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "SimpleMappingDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void selectRepositoryTrans() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log ); try { if ( repositoryObject != null ) { loadRepositoryTrans( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils.getPath( transMeta.getRepositoryDirectory().getPath(), executorTransMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + executorTransMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "TransExecutorDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "TransExecutorDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void selectRepositoryTrans() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log ); try { if ( repositoryObject != null ) { loadRepositoryTrans( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), injectTransMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + injectTransMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void getByReferenceData( RepositoryElementMetaInterface transInf ) { String path = DialogUtils.getPath( transMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); }
private void selectRepositoryJob() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.kjb", log ); try { if ( repositoryObject != null ) { loadRepositoryJob( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), executorJobMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + executorJobMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void getByReferenceData( ObjectId transObjectId ) { try { RepositoryObject transInf = repository.getObjectInformation( transObjectId, RepositoryObjectType.TRANSFORMATION ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); } catch ( KettleException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Title" ), BaseMessages.getString( PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Message" ), e ); } }
private void getByReferenceData( ObjectId transObjectId ) { try { RepositoryObject transInf = repository.getObjectInformation( transObjectId, RepositoryObjectType.TRANSFORMATION ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); } catch ( KettleException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Title" ), BaseMessages.getString( PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Message" ), e ); } }
private void getByReferenceData( ObjectId jobObjectId ) { try { RepositoryObject jobInf = repository.getObjectInformation( jobObjectId, RepositoryObjectType.JOB ); String path = DialogUtils.getPath( transMeta.getRepositoryDirectory().getPath(), jobInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( jobInf.getName(), "" ); wPath.setText( fullPath ); } catch ( KettleException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobEntryJobDialog.Exception.UnableToReferenceObjectId.Title" ), BaseMessages.getString( PKG, "JobEntryJobDialog.Exception.UnableToReferenceObjectId.Message" ), e ); } }
private void getByReferenceData( ObjectId transObjectId ) { try { if ( repository == null ) { throw new KettleException( BaseMessages.getString( PKG, "MappingDialog.Exception.NotConnectedToRepository.Message" ) ); } RepositoryObject transInf = repository.getObjectInformation( transObjectId, RepositoryObjectType.TRANSFORMATION ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); } catch ( KettleException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "MappingDialog.Exception.UnableToReferenceObjectId.Title" ), BaseMessages.getString( PKG, "MappingDialog.Exception.UnableToReferenceObjectId.Message" ), e ); } }