Package org.pentaho.reporting.libraries.xmlns.parser

Examples of org.pentaho.reporting.libraries.xmlns.parser.ParseException


  protected void startParsing(final Attributes attrs) throws SAXException
  {
    targetType = attrs.getValue(getUri(), "target-type");
    if (targetType == null)
    {
      throw new ParseException("Mandatory attribute 'target-type' is missing.", getLocator());
    }
    final String href = attrs.getValue(getUri(), "href");
    if (href == null)
    {
      throw new ParseException("Mandatory attribute 'href' is missing.", getLocator());
    }

    try
    {
      final ResourceManager resourceManager = getRootHandler().getResourceManager();
      final ResourceKey key = resourceManager.deriveKey(getRootHandler().getSource(), href);
      final Resource resource = resourceManager.create(key, null, MasterReport.class);
      report = (MasterReport) resource.getResource();
    }
    catch (ResourceException re)
    {
      throw new ParseException("Mandatory attribute 'href' is not pointing to a valid report.", re, getLocator());
    }
  }
View Full Code Here


      try
      {
        int index = Integer.parseInt(key);
        if (index < 0)
        {
          throw new ParseException("Failed to parse array index", getLocator());
        }
       
        list.ensureCapacity(index);
        while (list.size() < (index + 1))
        {
          list.add(null);
        }
        list.set(index, ObjectConverterFactory.convert(componentType, value, getLocator()));
      }
      catch (NumberFormatException nfe)
      {
        throw new ParseException("Failed to parse array index", getLocator());
      }
    }
    retval = list.toArray();
  }
View Full Code Here

    if ("MQL".equals(connectionType))
    {
      if (xmiDefinitionFile == null)
      {
        throw new ParseException("Required property 'xmiDefinitionFile' is missing");
      }

      final PmdDataFactory dataFactory = new PmdDataFactory();
      dataFactory.setXmiFile(xmiDefinitionFile);
      for (int i = 0; i < queries.size(); i++)
      {
        final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
        dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
      }

      final String queryNameProperty = result.getProperty("queryString");
      if (queryNameProperty != null)
      {
        dataFactory.setQuery("default", queryNameProperty);
      }
      this.dataFactory = dataFactory;
    }
    else if ("XQuery".equals(connectionType))
    {
      if (xQueryDataFile == null)
      {
        throw new ParseException("Required property 'xQueryDataFile' is missing");
      }
      final XPathDataFactory dataFactory = new XPathDataFactory();
      dataFactory.setXqueryDataFile(xQueryDataFile);
      for (int i = 0; i < queries.size(); i++)
      {
        final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
        dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
      }

      final String queryNameProperty = result.getProperty("queryString");
      if (queryNameProperty != null)
      {
        dataFactory.setQuery("default", queryNameProperty);
      }
      this.dataFactory = dataFactory;
    }
    else if ("JNDI".equals(connectionType))
    {
      if (selectedJNDIDataSourceReadHandler == null)
      {
        throw new ParseException("Required element 'selectedJNDIDataSourceReadHandler' is missing");
      }

      if (useMondrianCubeDefinition)
      {
        if (mondrianCubeDefinition == null)
        {
          throw new ParseException("Required property 'mondrianCubeDefinitionFile' is missing");
        }

        final LegacyBandedMDXDataFactory dataFactory = new LegacyBandedMDXDataFactory();
        dataFactory.setCubeFileProvider(new DefaultCubeFileProvider(mondrianCubeDefinition));
        dataFactory.setJdbcUser(selectedJNDIDataSourceReadHandler.getUsername());
        dataFactory.setJdbcPassword(selectedJNDIDataSourceReadHandler.getPassword());
        dataFactory.setDesignTimeName(selectedJNDIDataSourceReadHandler.getJndiName());

        final DriverDataSourceProvider driverDataSourceProvider = new DriverDataSourceProvider();
        driverDataSourceProvider.setDriver(selectedJNDIDataSourceReadHandler.getDriverClass());
        driverDataSourceProvider.setUrl(selectedJNDIDataSourceReadHandler.getConnectionString());
        dataFactory.setDataSourceProvider(driverDataSourceProvider);
        for (int i = 0; i < queries.size(); i++)
        {
          final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
          dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
        }

        final String queryNameProperty = result.getProperty("queryString");
        if (queryNameProperty != null)
        {
          dataFactory.setQuery("default", queryNameProperty);
        }
        this.dataFactory = dataFactory;
      }
      else
      {
        final DriverConnectionProvider drc = new DriverConnectionProvider();
        drc.setUrl(selectedJNDIDataSourceReadHandler.getConnectionString());
        drc.setDriver(selectedJNDIDataSourceReadHandler.getDriverClass());
        drc.setProperty("user", selectedJNDIDataSourceReadHandler.getUsername());
        drc.setProperty("password", selectedJNDIDataSourceReadHandler.getPassword());
        drc.setProperty("::pentaho-reporting::name", selectedJNDIDataSourceReadHandler.getJndiName());

        final SQLReportDataFactory dataFactory = new SQLReportDataFactory(drc);
        for (int i = 0; i < queries.size(); i++)
        {
          final QueryReadHandler handler = (QueryReadHandler) queries.get(i);
          dataFactory.setQuery(handler.getQueryName(), handler.getQuery());
        }

        final String queryNameProperty = result.getProperty("queryString");
        if (queryNameProperty != null)
        {
          dataFactory.setQuery("default", queryNameProperty);
        }
        this.dataFactory = dataFactory;
      }
    }
    else
    {
      throw new ParseException("Required Property 'connectionType' is missing", getLocator());
    }

  }
View Full Code Here

  protected void startParsing(final Attributes attrs) throws SAXException
  {
    queryName = attrs.getValue(getUri(), "queryName");
    if (queryName == null)
    {
      throw new ParseException("Attribute 'queryName' must be given");
    }

    className = attrs.getValue(getUri(), "className");
    if (className == null)
    {
      throw new ParseException("Attribute 'className' must be given");
    }

    methodName = attrs.getValue(getUri(), "methodName");
    if (methodName == null)
    {
      throw new ParseException("Attribute 'methodName' must be given");
    }
  }
View Full Code Here

  {
    if ("rect".equals(type))
    {
      if (coordinates.length != 4)
      {
        throw new ParseException("Rect-shape needs four coordinate-values", getLocator());
      }
      return new RectangleImageMapEntry(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
    }
    if ("circle".equals(type))
    {
      if (coordinates.length != 3)
      {
        throw new ParseException("Circle-shape needs three coordinate-values", getLocator());
      }
      return new CircleImageMapEntry(coordinates[0], coordinates[1], coordinates[2]);
    }
    if ("poly".equals(type))
    {
      if ((coordinates.length % 2) != 0)
      {
        throw new ParseException("Polygon-shape needs an even number of coordinate-values", getLocator());
      }
      return new PolygonImageMapEntry(coordinates);
    }

    if ("default".equals(type))
    {
      return new DefaultImageMapEntry();
    }

    if (coordinates.length != 4)
    {
      throw new ParseException("Implied Rect-shape needs four coordinate-values", getLocator());
    }
    return new RectangleImageMapEntry(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
  }
View Full Code Here

      return ret;
    }
    catch (final NumberFormatException nfe)
    {
      // re-throw the exception
      throw new ParseException("Unable to convert array-text to real array.", getLocator());
    }
  }
View Full Code Here

  {
    super.startParsing(attrs);
    propertyName = attrs.getValue(getUri(), "name");
    if (propertyName == null)
    {
      throw new ParseException("Required attribute 'name' is null.", getLocator());
    }
  }
View Full Code Here

  {
    super.startParsing(attrs);
    queryName = attrs.getValue(getUri(), "queryName");
    if (queryName == null)
    {
      throw new ParseException("QueryName is required", getLocator());
    }
  }
View Full Code Here

  protected void doneParsing() throws SAXException
  {
    super.doneParsing();
    if (query == null)
    {
      throw new ParseException("Query is not there", getLocator());
    }
  }
View Full Code Here

    final Properties result1 = getResult();
    final String filePath = result1.getProperty("filePath");

    if (filePath == null)
    {
      throw new ParseException("There was no subreport file specified.", getLocator());
    }

    final Map parameters = deriveParseParameters();
    parameters.put(new FactoryParameterKey(ReportParserUtil.HELPER_OBJ_REPORT_NAME), null);
    parameters.put(new FactoryParameterKey
        (ReportParserUtil.INCLUDE_PARSING_KEY), ReportParserUtil.INCLUDE_PARSING_VALUE);
    try
    {
      subReport = (SubReport) performExternalParsing(filePath, SubReport.class, parameters);
    }
    catch (ResourceLoadingException e)
    {
      throw new ParseException("The specified subreport was not found or could not be loaded.", e, getLocator());
    }

    final String query = result1.getProperty("query");
    subReport.setQuery(query);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.parser.ParseException

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.