Package org.jfree.report

Examples of org.jfree.report.ReportDataFactoryException


      }
      return (ReportData) data;
    }
    catch (Exception e)
    {
      throw new ReportDataFactoryException
              ("Unable to instantiate class for non static call.");
    }
  }
View Full Code Here


      final ClassLoader classLoader = getClassLoader();
      final Class c = classLoader.loadClass(className);
      final Object o = c.newInstance();
      if (o == null)
      {
        throw new ReportDataFactoryException
                ("Unable to instantiate class for non static call.");
      }
      final Object data = m.invoke(o, params);
      if (data instanceof TableModel)
      {
        return new TableReportData((TableModel) data);
      }
      return (ReportData) data;
    }
    catch (ReportDataFactoryException rdfe)
    {
      throw rdfe;
    }
    catch (Exception e)
    {
      throw new ReportDataFactoryException
              ("Something went terribly wrong: ", e);
    }
  }
View Full Code Here

          throws ReportDataFactoryException
  {
    final int parameterEndIdx = query.lastIndexOf(')');
    if (parameterEndIdx < parameterStartIdx)
    {
      throw new ReportDataFactoryException("Malformed query: " + query);
    }
    final String parameterText =
            query.substring(parameterStartIdx + 1, parameterEndIdx);
    final CSVTokenizer tokenizer = new CSVTokenizer(parameterText);
    final int size = tokenizer.countTokens();
View Full Code Here

  {
    ClassLoader classLoader = getClassLoader();

    if (classLoader == null)
    {
      throw new ReportDataFactoryException("No classloader!");
    }
    try
    {
      Class c = classLoader.loadClass(className);
      if (Modifier.isAbstract(c.getModifiers()))
      {
        throw new ReportDataFactoryException("Abstract class cannot be handled!");
      }

      Method[] methods = c.getMethods();
      for (int i = 0; i < methods.length; i++)
      {
        final Method method = methods[i];
        if (Modifier.isPublic(method.getModifiers()) == false)
        {
          continue;
        }
        if (method.getName().equals(methodName) == false)
        {
          continue;
        }
        final Class returnType = method.getReturnType();
        if (method.getParameterTypes().length != paramCount)
        {
          continue;
        }
        if (TableModel.class.isAssignableFrom(returnType) ||
            ReportData.class.isAssignableFrom(returnType))
        {
          return method;
        }
      }
    }
    catch (ClassNotFoundException e)
    {
      throw new ReportDataFactoryException("No such Class", e);
    }
    throw new ReportDataFactoryException("No such Method: " + className + "#" + methodName);
  }
View Full Code Here

          throws ReportDataFactoryException
  {
    ClassLoader classLoader = getClassLoader();
    if (classLoader == null)
    {
      throw new ReportDataFactoryException("No classloader!");
    }

    try
    {
      Class c = classLoader.loadClass(className);
      if (TableModel.class.isAssignableFrom(c) == false &&
          ReportData.class.isAssignableFrom(c) == false)
      {
        throw new ReportDataFactoryException("The specified class must be either a TableModel or a ReportData implementation.");
      }
      if (Modifier.isAbstract(c.getModifiers()))
      {
        throw new ReportDataFactoryException("The specified class cannot be instantiated: it is abstract.");
      }

      Constructor[] methods = c.getConstructors();
      for (int i = 0; i < methods.length; i++)
      {
        final Constructor method = methods[i];
        if (Modifier.isPublic(method.getModifiers()) == false)
        {
          continue;
        }
        if (method.getParameterTypes().length != paramCount)
        {
          continue;
        }
        return method;
      }
    }
    catch (ClassNotFoundException e)
    {
      throw new ReportDataFactoryException("No such Class", e);
    }
    throw new ReportDataFactoryException
        ("There is no constructor in class " + className +
            " that accepts " + paramCount + " parameters.");
  }
View Full Code Here

          throws ReportDataFactoryException
  {
    ClassLoader classLoader = getClassLoader();
    if (classLoader == null)
    {
      throw new ReportDataFactoryException("No classloader!");
    }

    try
    {
      Class c = classLoader.loadClass(className);
      if (Modifier.isAbstract(c.getModifiers()))
      {
        throw new ReportDataFactoryException("The specified class cannot be instantiated: it is abstract.");
      }

      Constructor[] methods = c.getConstructors();
      for (int i = 0; i < methods.length; i++)
      {
        final Constructor method = methods[i];
        if (Modifier.isPublic(method.getModifiers()) == false)
        {
          continue;
        }
        if (method.getParameterTypes().length != paramCount)
        {
          continue;
        }
        return method;
      }
    }
    catch (ClassNotFoundException e)
    {
      throw new ReportDataFactoryException("No such Class", e);
    }
    throw new ReportDataFactoryException
        ("There is no constructor in class " + className +
            " that accepts " + paramCount + " parameters.");
  }
View Full Code Here

      }
    }
    catch (DataSourceException e)
    {
      e.printStackTrace();
      throw new ReportDataFactoryException("Failed to query data", e);
    }
  }
View Full Code Here

      }
    }
    catch (DataSourceException e)
    {
      e.printStackTrace();
      throw new ReportDataFactoryException("Failed to query data", e);
    }
  }
View Full Code Here

            String message = dse.getMessage();
            if (message.length() == 0)
            {
                message = "Failed to create report data wrapper";
            }
            throw new ReportDataFactoryException(message, dse);
        }
        catch (org.jfree.report.DataSourceException e)
        {
            String message = e.getMessage();
            if (message.length() == 0)
            {
                message = "Failed to query data";
            }
            throw new ReportDataFactoryException(message);
        }
    }
View Full Code Here

TOP

Related Classes of org.jfree.report.ReportDataFactoryException

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.