Package pt.webdetails.cdf.dd.model.core.reader

Examples of pt.webdetails.cdf.dd.model.core.reader.ThingReadException


    {
      return _class.newInstance();
    }
    catch (InstantiationException ex)
    {
      throw new ThingReadException(ex);
    }
    catch (IllegalAccessException ex)
    {
      throw new ThingReadException(ex);
    }
  }
View Full Code Here


      throws ThingReadException {
    Document doc;
    try {
      doc = Utils.getDocFromFile( file, null );
    } catch ( Exception ex ) {
      ThingReadException ex2 = new ThingReadException( "Cannot read properties file '" + file + "'.", ex );
      if ( !this.continueOnError ) {
        throw ex2;
      }

      // log and move on
View Full Code Here

      }
    } catch ( Exception e ) {
      String msg = "Cannot read components file 'cde.xml'.";

      if ( !this.continueOnError ) {
        throw new ThingReadException( msg, e );
      }
      // log and move on
      logger.fatal( msg, e );
      return;
    }
View Full Code Here

      doc = Utils.getDocFromFile( file, null );
    } catch ( Exception ex ) {
      String msg = "Cannot read components file '" + file.getFullPath() + "'.";

      if ( !this.continueOnError ) {
        throw new ThingReadException( msg, ex );
      }
      // log and move on
      logger.fatal( msg, ex );
      return;
    }
View Full Code Here

    XmlAdhocComponentTypeReader<? extends ComponentType.Builder> reader = factory.getComponentTypeReader( className );
    if ( reader == null ) {
      String msg = "Failed to read component of class '" + className + "' and name " + name;
      if ( !this.continueOnError ) {
        throw new ThingReadException( msg );
      }
      // Just log and move on
      logger.fatal( msg );
    }
View Full Code Here

    boolean bypassCacheRead )
    throws ThingReadException {
    try {
      DashboardWcdfDescriptor wcdf = DashboardWcdfDescriptor.load( wcdfPath );
      if ( wcdf == null ) {
        throw new ThingReadException( new FileNotFoundException( wcdfPath ) );
      }

      return this.getDashboard( wcdf, bypassCacheRead );
    } catch ( IOException ex ) {
      throw new ThingReadException( "While reading dashboard.", ex );
    }
  }
View Full Code Here

    // NOTE: the cache is shared by all users.
    // The current user may not have access to a cache item previously
    // created by another user.
    IBasicFile cdeFile = Utils.getSystemOrUserReadAccess( cdeFilePath ).fetchFile( cdeFilePath );
    if ( cdeFile == null ) {
      throw new ThingReadException( new FileNotFoundException( cdeFilePath ) );
    }

    // 2. Get the Dashboard object
    return this.getDashboard( wcdf, cdeFilePath, bypassCacheRead );
  }
View Full Code Here

    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

    try {
      cdfdeDoc = openDashboardAsJXPathContext( wcdf );
    } catch ( FileNotFoundException ex ) {
      // File does not exist or
      // User has insufficient permissions
      throw new ThingReadException( "The CDFDE dashboard file does not exist.", ex );
    } catch ( IOException ex ) {
      throw new ThingReadException( "While accessing the CDFDE dashboard file.", ex );
    }

    // 2. Obtain a reader to read the dashboard file
    MetaModel metaModel = MetaModelManager.getInstance().getModel();
    CdfdeJsThingReaderFactory thingReaderFactory = new CdfdeJsThingReaderFactory( metaModel );
    IThingReader reader;
    try {
      reader = thingReaderFactory.getReader( KnownThingKind.Dashboard, null, null );
    } catch ( UnsupportedThingException ex ) {
      throw new ThingReadException( "While obtaining a reader for a dashboard.", ex );
    }

    // 3. Read it
    IThingReadContext readContext = new CdfdeJsReadContext( thingReaderFactory, wcdf, metaModel );
    Dashboard.Builder dashBuilder = (Dashboard.Builder) reader.read( readContext, cdfdeDoc, cdeFilePath );

    // 4. Build it
    try {
      return dashBuilder.build( metaModel );
    } catch ( ValidationException ex ) {
      throw new ThingReadException( "While building the read dashboard.", ex );
    }
  }
View Full Code Here

    {
      return _class.newInstance();
    }
    catch (InstantiationException ex)
    {
      throw new ThingReadException(ex);
    }
    catch (IllegalAccessException ex)
    {
      throw new ThingReadException(ex);
    }
  }
View Full Code Here

TOP

Related Classes of pt.webdetails.cdf.dd.model.core.reader.ThingReadException

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.