Java Code Examples for org.pentaho.di.core.Const#replace()
The following examples show how to use
org.pentaho.di.core.Const#replace() .
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: KettleFileRepository.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private String calcDirectoryName( RepositoryDirectoryInterface dir ) { StringBuilder directory = new StringBuilder(); String baseDir = repositoryMeta.getBaseDirectory(); baseDir = Const.replace( baseDir, "\\", "/" ); directory.append( baseDir ); if ( !baseDir.endsWith( "/" ) ) { directory.append( "/" ); } if ( dir != null ) { String path = calcRelativeElementDirectory( dir ); if ( path.startsWith( "/" ) ) { directory.append( path.substring( 1 ) ); } else { directory.append( path ); } if ( !path.endsWith( "/" ) ) { directory.append( "/" ); } } return directory.toString(); }
Example 2
Source File: SlaveServer.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public String constructUrl( String serviceAndArguments ) throws UnsupportedEncodingException { String realHostname = null; String proxyHostname = null; lock.readLock().lock(); try { realHostname = environmentSubstitute( hostname ); proxyHostname = environmentSubstitute( getProxyHostname() ); } finally { lock.readLock().unlock(); } if ( !Utils.isEmpty( proxyHostname ) && realHostname.equals( "localhost" ) ) { realHostname = "127.0.0.1"; } if ( !StringUtils.isBlank( webAppName ) ) { serviceAndArguments = "/" + environmentSubstitute( getWebAppName() ) + serviceAndArguments; } String result = ( isSslMode() ? HTTPS : HTTP ) + "://" + realHostname + getPortSpecification() + serviceAndArguments; result = Const.replace( result, " ", "%20" ); return result; }
Example 3
Source File: KettleVFS.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public static String getFilename( FileObject fileObject ) { FileName fileName = fileObject.getName(); String root = fileName.getRootURI(); if ( !root.startsWith( "file:" ) ) { return fileName.getURI(); // nothing we can do about non-normal files. } if ( root.startsWith( "file:////" ) ) { return fileName.getURI(); // we'll see 4 forward slashes for a windows/smb network share } if ( root.endsWith( ":/" ) ) { // Windows root = root.substring( 8, 10 ); } else { // *nix & OSX root = ""; } String fileString = root + fileName.getPath(); if ( !"/".equals( Const.FILE_SEPARATOR ) ) { fileString = Const.replace( fileString, "/", Const.FILE_SEPARATOR ); } return fileString; }
Example 4
Source File: AccessInputMeta.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public static String getFilename( FileObject fileObject ) { FileName fileName = fileObject.getName(); String root = fileName.getRootURI(); if ( !root.startsWith( "file:" ) ) { return fileName.getURI(); } if ( root.endsWith( ":/" ) ) { root = root.substring( 8, 10 ); } else { root = root.substring( 7, root.length() - 1 ); } String fileString = root + fileName.getPath(); if ( !"/".equals( Const.FILE_SEPARATOR ) ) { fileString = Const.replace( fileString, "/", Const.FILE_SEPARATOR ); } return fileString; }
Example 5
Source File: RepositoryExplorerDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private String fixFileName( String filename ) { filename = filename.replace( '/', '_' ); // do something with illegal file name chars if ( !( "/".equals( Const.FILE_SEPARATOR ) ) ) { filename = Const.replace( filename, Const.FILE_SEPARATOR, "_" ); } return filename; }
Example 6
Source File: TextFileInputDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public String massageFieldName( final String fieldName ) { // Replace all spaces and hyphens (-) with underscores (_) String massagedFieldName = fieldName; massagedFieldName = Const.replace( massagedFieldName, " ", "_" ); massagedFieldName = Const.replace( massagedFieldName, "-", "_" ); return massagedFieldName; }
Example 7
Source File: HttpUtil.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments, boolean isSecure ) throws UnsupportedEncodingException { String realHostname = space.environmentSubstitute( hostname ); if ( !StringUtils.isEmpty( webAppName ) ) { serviceAndArguments = "/" + space.environmentSubstitute( webAppName ) + serviceAndArguments; } String protocol = isSecure ? PROTOCOL_SECURE : PROTOCOL_UNSECURE; String retval = protocol + "://" + realHostname + getPortSpecification( space, port ) + serviceAndArguments; retval = Const.replace( retval, " ", "%20" ); return retval; }