Package org.pentaho.platform.api.repository2.unified

Examples of org.pentaho.platform.api.repository2.unified.IUnifiedRepository


  @Test
  public void testWriteBinary() throws IOException {
    final String fileName = "test.bin";
    final String filePath = publicDirPath + "/" + fileName;
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // simulate request for publicDir
    RepositoryFile publicDir =
        new RepositoryFile.Builder( "123", ClientRepositoryPaths.getPublicFolderName() ).folder( true ).build();
    doReturn( publicDir ).when( repo ).getFile( publicDirPath );
    mp.defineInstance( IUnifiedRepository.class, repo );
View Full Code Here


  }

  @Test( expected = FileNotFoundException.class )
  public void testReadNonExistentPath() throws IOException {
    final String filePath = ClientRepositoryPaths.getPublicFolderPath() + "/doesnotexist";
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // simulate path does not exist
    doReturn( null ).when( repo ).getFile( filePath );
    mp.defineInstance( IUnifiedRepository.class, repo );

    RepositoryFileReader reader = new RepositoryFileReader( filePath );
View Full Code Here

  @Test( expected = FileNotFoundException.class )
  public void testReadNonExistentFile() throws IOException {
    final String fileName = "doesnotexist";
    final String filePath = publicDirPath + "/" + fileName;
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // simulate file does not exist
    doReturn( null ).when( repo ).getFile( filePath );
    mp.defineInstance( IUnifiedRepository.class, repo );

    RepositoryFileReader reader = new RepositoryFileReader( createFile( fileName ) );
View Full Code Here

    reader.close();
  }

  @Test( expected = FileNotFoundException.class )
  public void testReadDirectoryPath() throws IOException {
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // simulate file exists but is a directory
    doReturn( new RepositoryFile.Builder( "123", ClientRepositoryPaths.getPublicFolderName() ).folder( true ).build() )
        .when( repo ).getFile( ClientRepositoryPaths.getPublicFolderPath() );
    mp.defineInstance( IUnifiedRepository.class, repo );
View Full Code Here

    reader.close();
  }

  @Test( expected = FileNotFoundException.class )
  public void testWriteDirectory() throws IOException {
    IUnifiedRepository repo = mock( IUnifiedRepository.class );
    // simulate file exists but is a directory
    doReturn( new RepositoryFile.Builder( "123", ClientRepositoryPaths.getPublicFolderName() ).folder( true ).build() )
        .when( repo ).getFile( ClientRepositoryPaths.getPublicFolderPath() );
    mp.defineInstance( IUnifiedRepository.class, repo );
View Full Code Here

import java.io.UnsupportedEncodingException;

public class RepositoryFileReader extends InputStreamReader {

  protected static String getEncoding( RepositoryFile file ) throws FileNotFoundException {
    IUnifiedRepository repository = PentahoSystem.get( IUnifiedRepository.class );
    SimpleRepositoryFileData fileData = repository.getDataForRead( file.getId(), SimpleRepositoryFileData.class );
    return fileData.getEncoding();
  }
View Full Code Here

    SimpleRepositoryFileData fileData = repository.getDataForRead( file.getId(), SimpleRepositoryFileData.class );
    return fileData.getEncoding();
  }

  protected static String getEncoding( String path ) throws FileNotFoundException {
    IUnifiedRepository repository = PentahoSystem.get( IUnifiedRepository.class );
    RepositoryFile file = ( new RepositoryFileInputStream( path ) ).getFile();
    SimpleRepositoryFileData fileData = repository.getDataForRead( file.getId(), SimpleRepositoryFileData.class );
    return fileData.getEncoding();
  }
View Full Code Here

    SimpleRepositoryFileData fileData = repository.getDataForRead( file.getId(), SimpleRepositoryFileData.class );
    return fileData.getEncoding();
  }

  protected static String getEncoding( Serializable id ) throws FileNotFoundException {
    IUnifiedRepository repository = PentahoSystem.get( IUnifiedRepository.class );
    RepositoryFile file = ( new RepositoryFileInputStream( id ) ).getFile();
    SimpleRepositoryFileData fileData = repository.getDataForRead( file.getId(), SimpleRepositoryFileData.class );
    return fileData.getEncoding();
  }
View Full Code Here

        RepositoryFileOutputStream outputStream = (RepositoryFileOutputStream) getOutputStream( null );
        if ( ( outputStream.autoCreateUniqueFileName ) && !( outputStream.flushed ) ) {
          throw new FileNotFoundException( "File not yet versioned." );
        }
        if ( inputStream == null ) {
          IUnifiedRepository repository = PentahoSystem.get( IUnifiedRepository.class );
          RepositoryFile repositoryFile = repository.getFile( outputStream.path );
          if ( ( repositoryFile == null ) || repositoryFile.isFolder() ) {
            throw new FileNotFoundException();
          }
          return new RepositoryFileInputStream( repositoryFile );
        }
View Full Code Here

    boolean success = false;

    try {

      IUnifiedRepository unifiedRepository = PentahoSystem.get( IUnifiedRepository.class, null );
      RepositoryFile file = unifiedRepository.getFile( path );
     
      CdfHttpServletRequestWrapper request = new CdfHttpServletRequestWrapper( httpServletRequest );
      if( params != null ){
        Iterator<String> it = params.keySet().iterator();
        while( it.hasNext() ){
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.IUnifiedRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.