Package pt.webdetails.cpf.repository.api

Examples of pt.webdetails.cpf.repository.api.IReadAccess.fileExists()


    if ( bundle == null ) {

      try {
        IReadAccess access = CdfEngine.getPluginSystemReader( null );

        if ( access.fileExists( CdfConstants.GLOBAL_MESSAGES_PROPERTIES_FILE ) ) {
          InputStream in = access.getFileInputStream( CdfConstants.GLOBAL_MESSAGES_PROPERTIES_FILE );
          bundle = new PropertyResourceBundle( in );
          Messages.locales.put( locale, bundle );
        }
      } catch ( Exception e ) {
View Full Code Here


  private List<StaticDependenciesPackage> createDependenciesPackages( String dashboardType ) {
    IReadAccess reader = getContentAccess().getPluginSystemReader( BASE_DIR );
    String fileName = String.format( "resources.%s.properties", dashboardType );
    Properties dtProperties = new Properties( getBaseProperties() );
    if ( reader.fileExists( fileName ) ) {
      loadProperties( reader, fileName, dtProperties );
    }

    PathSet pathSet = new PathSet();
    addBaseDependencies( pathSet, dtProperties );
View Full Code Here

      for( String path : paths ){

        IReadAccess access = Utils.getAppropriateReadAccess( path );

        if( access != null && access.fileExists( path ) && access.fetchFile( path ).isDirectory() ){
          files.add( access.fetchFile( path ) );
        } else {
          logger.error( "Discarding path '" + path + "': file does not exist or isn't a directory." );
        }
      }
View Full Code Here

    for ( int i = 0; i < jsonFiles.length; i++ ) {
      final JSONObject template = new JSONObject();

      String imgResourcePath = resoureUrl+"unknown.png";

      if ( access.fileExists( jsonFiles[i].getName().replace( ".cdfde", ".png" ) ) ) {
        imgResourcePath = resoureUrl+jsonFiles[i].getName().replace( ".cdfde", ".png" );
      }

      template.put( "img", imgResourcePath );
      template.put( "type", type );
View Full Code Here

      // * /system/<plugin>/styles - no need to clear start info
      // * styles
      if (finalPath.startsWith("system/" + pluginId + "/"))
        finalPath = finalPath.substring(("system/" + pluginId + "/").length());

      if ( access.fileExists( finalPath ) && access.fetchFile( finalPath ).isDirectory() ) {
        style = new Style( access, finalPath, pluginId );
        styles.add( style );
      }
    }

View Full Code Here

  @Exposed( accessLevel = AccessLevel.PUBLIC )
  public void extEditor( final OutputStream out ) throws IOException {

    IReadAccess access = CdeEnvironment.getPluginSystemReader();

    if ( access.fileExists( EXTERNAL_EDITOR_PAGE ) ) {
      writeOut( out, IOUtils.toString( access.getFileInputStream( EXTERNAL_EDITOR_PAGE ) ) );
    } else {
      writeOut( out, "no external editor found in " + Utils.joinPath( getPluginDir(), EXTERNAL_EDITOR_PAGE ) );
    }
  }
View Full Code Here

  @Exposed( accessLevel = AccessLevel.PUBLIC )
  public void componentEditor( final OutputStream out ) throws IOException {

    IReadAccess access = CdeEnvironment.getPluginSystemReader();

    if ( access.fileExists( COMPONENT_EDITOR_PAGE ) ) {
      writeOut( out, IOUtils.toString( access.getFileInputStream( COMPONENT_EDITOR_PAGE ) ) );
    } else {
      writeOut( out, "no external editor found in " + Utils.joinPath( getPluginDir(), COMPONENT_EDITOR_PAGE ) );
    }
  }
View Full Code Here

    return this._widgetParameters.toArray( new String[ 0 ] );
  }

  public static DashboardWcdfDescriptor load( String wcdfFilePath ) throws IOException {
    IReadAccess readAccess = Utils.getSystemOrUserReadAccess( wcdfFilePath );
    if ( readAccess == null || !readAccess.fileExists( wcdfFilePath ) ) {
      return null;
    }

    Document wcdfDoc = null;
    try {
View Full Code Here

      String msg =
          sourceDashboardBaseMsgFile != null ? sourceDashboardBaseMsgFile.getName() : BASE_GLOBAL_MESSAGE_SET_FILENAME
              + ".properties";

      if ( systemReader.fileExists( msg ) ) {
        targetDashboardBaseMsgFile = systemReader.fetchFile( msg );
      }
    }
    return targetDashboardBaseMsgFile;
View Full Code Here

    // Read cache, cache item existed and it is valid?
    if ( cachedDash != null
      && cachedDash.getSourceDate().getTime() >= userAccess.getLastModified( cdeFilePath ) ) {
      // Check WCDF file date as well

      if ( !userAccess.fileExists( wcdf.getPath() ) ) {
        throw new ThingReadException( new FileNotFoundException( wcdf.getPath() ) );
      }

      if ( cachedDash.getSourceDate().getTime() >= userAccess.getLastModified( wcdf.getPath() ) ) {
        _logger.debug( "Cached Dashboard instance is valid, using it." );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.