public static boolean inProcess() { boolean inProcess = false; boolean remoteDiServer = BooleanUtils.toBoolean( PentahoSystem.getSystemSetting( REMOTE_DI_SERVER_INSTANCE, "false" ) ); //$NON-NLS-1$ if ( "true".equals( PentahoSystem.getSystemSetting( SINGLE_DI_SERVER_INSTANCE, "true" ) ) ) { //$NON-NLS-1$ //$NON-NLS-2$ inProcess = true; } else if ( !remoteDiServer && PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() != null ) { inProcess = true; } return inProcess; } }
public InputSource resolveDTDEntity( final String publicId, final String systemId ) throws IOException { int idx = systemId.lastIndexOf( '/' ); String dtdName = systemId.substring( idx + 1 ); String fullPath = PentahoSystem.getApplicationContext().getSolutionPath( "system/dtd/" + dtdName ); //$NON-NLS-1$ File theFile = new File( fullPath ); if ( theFile.canRead() ) { InputStream xslIS = new BufferedInputStream( new FileInputStream( theFile ) ); InputSource source = new InputSource( xslIS ); return source; } return null; }
applicationContext.addEntryPointHandler( hUtil ); applicationContext.addExitPointHandler( hUtil ); String configPath = applicationContext.getSolutionPath( hibernateConfigurationFile ); File cfgFile = new File( configPath ); if ( cfgFile.exists() ) {
public static String getSystemInput( final String inputName, final IRuntimeContext context ) { int i = TemplateUtil.SystemInputs.indexOf( inputName ); switch ( i ) { case 0: { // User return context.getSession().getName(); } case 1: { // Relative URL return PentahoRequestContextHolder.getRequestContext().getContextPath(); } case 2: { // Solution return PentahoSystem.getApplicationContext().getSolutionPath( "" ); //$NON-NLS-1$ } case 3: { // Fully Qualified Server URL return PentahoSystem.getApplicationContext().getFullyQualifiedServerURL(); } } return null; }
String path = PentahoSystem.getApplicationContext().getSolutionPath( relativePath ); File pathDir = new File( path ); File tempDir = new File( PentahoSystem.getApplicationContext().getSolutionPath( "system/tmp" ) ); if ( tempDir.exists() == false ) { tempDir.mkdir(); file = PentahoSystem.getApplicationContext().createTempFile( session, filename, ".tmp", true ); //$NON-NLS-1$ } else { file = new File( path + File.separatorChar + filename );
public boolean startup( IPentahoSession session ) { IApplicationContext applicationContext = PentahoSystem.getApplicationContext(); applicationContext.addEntryPointHandler( this ); applicationContext.addExitPointHandler( this ); return true; }
public AuditFileEntry() { File auditDir = new File( PentahoSystem.getApplicationContext().getFileOutputPath( AuditFileEntry.auditDirPath ) ); if ( !auditDir.exists() ) { auditDir.mkdirs(); } else if ( !auditDir.isDirectory() ) { Logger.error( this, Messages.getInstance().getErrorString( "AUDFILEENT.ERROR_0001_AUDIT_PATH_NOT_DIRECTORY", AuditFileEntry.auditDirPath ) ); //$NON-NLS-1$ return; } AuditFileEntry.auditFile = new File( auditDir, AuditFileEntry.auditFileName ); if ( "\\t".equals( AuditFileEntry.ID_SEPARATOR ) ) { //$NON-NLS-1$ AuditFileEntry.ID_SEPARATOR = "\t"; //$NON-NLS-1$ } }
String filePathWithoutExtension = null; try { File file = PentahoSystem.getApplicationContext().createTempFile( getSession(), fileNamePrefix, extension, true ); fileName = file.getName(); filePathWithoutExtension = solutionDir + fileName.substring( 0, fileName.indexOf( '.' ) ); IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext(); setXslProperty( "baseUrl", requestContext.getContextPath() ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ setXslProperty( "fullyQualifiedServerUrl", PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ Element root = result.addElement( "widget" ); //$NON-NLS-1$ root.addElement( "title" ).setText( title ); //$NON-NLS-1$
private void addCatalog( String catName, String catConnectStr, IPentahoSession session ) { IMondrianCatalogService mondrianCatalogService = PentahoSystem.get( IMondrianCatalogService.class, "IMondrianCatalogService", session ); //$NON-NLS-1$ String dsUrl = PentahoSystem.getApplicationContext().getBaseUrl(); if ( !dsUrl.endsWith( "/" ) ) { //$NON-NLS-1$ dsUrl += "/"; //$NON-NLS-1$ } dsUrl += "Xmla"; //$NON-NLS-1$ MondrianCatalog cat = new MondrianCatalog( catName, catConnectStr, "", new MondrianSchema( catName, new ArrayList<MondrianCube>() ) ); mondrianCatalogService.addCatalog( cat, true, session ); }
/** * @return String that represents the file path to a temporary file */ protected String[] createTempFile() { // create temporary file names String solutionDir = "system/tmp/"; //$NON-NLS-1$ String fileNamePrefix = "tmp_chart_"; //$NON-NLS-1$ String extension = ".png"; //$NON-NLS-1$ String fileName = null; String filePathWithoutExtension = null; try { File file = PentahoSystem.getApplicationContext().createTempFile( getSession(), fileNamePrefix, extension, true ); fileName = file.getName(); filePathWithoutExtension = solutionDir + fileName.substring( 0, fileName.indexOf( '.' ) ); } catch ( IOException e ) { getLogger().error( Messages.getInstance().getErrorString( "AbstractChartComponent.ERROR_0001_CANT_CREATE_TEMP_CHART" ), e ); //$NON-NLS-1$ } String[] value = new String[2]; value[AbstractChartComponent.FILENAME_INDEX] = fileName; value[AbstractChartComponent.FILENAME_WITHOUT_EXTENSION_INDEX] = filePathWithoutExtension; return value; }
/** * Create a String containing the complete path to the system folder in the repository, and append the parameter * <code>path</code> to it. * * @param path * String containing the path of a file relative to the system folder in the repository * @return String containing the path */ protected String getAbsolutePath( final String path ) { return PentahoSystem.getApplicationContext().getSolutionPath( "system" + File.separator + path ); //$NON-NLS-1$ }
protected OutputStream getOutputStream( String testName, String extension ) { OutputStream outputStream = null; try { String tmpDir = PentahoSystem.getApplicationContext().getFileOutputPath( "test/tmp" ); //$NON-NLS-1$ File file = new File( tmpDir ); file.mkdirs(); String path = PentahoSystem.getApplicationContext().getFileOutputPath( "test/tmp/" + testName + extension ); //$NON-NLS-1$ outputStream = new FileOutputStream( path ); } catch ( FileNotFoundException e ) { // ignored } return outputStream; }
parameters.put( "baseUrl", PentahoSystem.getApplicationContext().getBaseUrl() ); //$NON-NLS-1$ parameters.put( "actionUrl", this.getUrlFactory().getActionUrlBuilder().getUrl() ); //$NON-NLS-1$ parameters.put( "displayUrl", this.getUrlFactory().getDisplayUrlBuilder().getUrl() ); //$NON-NLS-1$
String filePathWithoutExtension = null; try { File file = PentahoSystem.getApplicationContext().createTempFile( getSession(), fileNamePrefix, extension, true ); fileName = file.getName(); filePathWithoutExtension = solutionDir + fileName.substring( 0, fileName.indexOf( '.' ) );
public InputSource resolveEntity( final String publicId, final String systemId ) throws SAXException, IOException { int idx = systemId.lastIndexOf( '/' ); String dtdName = systemId.substring( idx + 1 ); String fullPath = PentahoSystem.getApplicationContext().getSolutionPath( "system/dtd/" + dtdName ); //$NON-NLS-1$ File theFile = new File( fullPath ); if ( theFile.canRead() ) { InputStream xslIS = new BufferedInputStream( new FileInputStream( theFile ) ); InputSource source = new InputSource( xslIS ); return source; } return null; }
+ "<description>" + SINGLE_DI_SERVER_INSTANCE + "</description>" //$NON-NLS-1$ //$NON-NLS-2$ + "<repository_location_url>" + PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() + "</repository_location_url>" //$NON-NLS-1$ //$NON-NLS-2$ + "<version_comment_mandatory>N</version_comment_mandatory>" //$NON-NLS-1$
protected InputStream getInputStreamFromOutput( String testName, String extension ) { String path = PentahoSystem.getApplicationContext().getFileOutputPath( "test/tmp/" + testName + extension ); //$NON-NLS-1$ File f = new File( path ); if ( f.exists() ) { try { FileInputStream fis = new FileInputStream( f ); return fis; } catch ( Exception ignored ) { return null; } } else { return null; } }
protected String getRelativeSolutionPath() { String relativePath = PentahoSystem.getSystemSetting( "file-upload-defaults/relative-path", String.valueOf( FileUtils.DEFAULT_RELATIVE_UPLOAD_FILE_PATH ) ); //$NON-NLS-1$ return PentahoSystem.getApplicationContext().getSolutionPath( relativePath ); }
public BasePentahoRequestContext( String contextPath ) { super(); if ( contextPath != null ) { String draftPath = contextPath + ( contextPath.endsWith( SLASH ) ? EMPTY : SLASH ); this.contextPath = draftPath.replaceAll( "(?<!^http:)(/){2,}", SLASH ); } else { String path = PentahoSystem.getApplicationContext().getFullyQualifiedServerURL(); this.contextPath = path + ( path != null && path.endsWith( SLASH ) ? EMPTY : SLASH ); } }
protected InputStream getInputStreamFromOutput( String solnPath, String testName, String extension ) { String path = PentahoSystem.getApplicationContext().getFileOutputPath( solnPath + "test/tmp/" + testName + extension ); //$NON-NLS-1$ File f = new File( path ); if ( f.exists() ) { try { FileInputStream fis = new FileInputStream( f ); return fis; } catch ( Exception ignored ) { return null; } } else { return null; } }