Package org.apache.derby.iapi.services.loader

Examples of org.apache.derby.iapi.services.loader.ClassInspector


      thenElseList.setParameterDescriptor(dts);
    }

    /* The then and else expressions must be type compatible */
    ClassInspector cu = getClassFactory().getClassInspector();

    /*
    ** If it is comparable, then we are ok.  Note that we
    ** could in fact allow any expressions that are convertible()
    ** since we are going to generate a cast node, but that might
    ** be confusing to users...
    */

    // RESOLVE DJDOI - this looks wrong, why should the then expression
    // be comparable to the then expression ??
    if (! thenExpression.getTypeServices().
       comparable(elseExpression.getTypeServices(), false, getClassFactory()) &&
      ! cu.assignableTo(thenExpression.getTypeId().getCorrespondingJavaTypeName(),
                elseExpression.getTypeId().getCorrespondingJavaTypeName()) &&
      ! cu.assignableTo(elseExpression.getTypeId().getCorrespondingJavaTypeName(),
                thenExpression.getTypeId().getCorrespondingJavaTypeName()))
    {
      throw StandardException.newException(SQLState.LANG_NOT_TYPE_COMPATIBLE,
            thenExpression.getTypeId().getSQLTypeName(),
            elseExpression.getTypeId().getSQLTypeName()
View Full Code Here


  public void boot(boolean create, Properties startParams)
    throws StandardException
  {

    classInspector = new ClassInspector(this);

    //
    //The ClassFactory runs per service (database) mode (booted as a service module after AccessFactory).
    //If the code that booted
    //us needs a per-database classpath then they pass in the classpath using
View Full Code Here

      }
    }
    else
    {
      /* At least 1 type is not a system built-in type */
      ClassInspector    cu = cf.getClassInspector();

      TypeId thisCompType = (TypeId) thisType;
      TypeId otherCompType = (TypeId) otherType;

      if (cu.assignableTo(thisCompType.getCorrespondingJavaTypeName(),
                  otherCompType.getCorrespondingJavaTypeName()))
      {
        higherType = otherDTS;
      }
      else
      {
        if (SanityManager.DEBUG)
            SanityManager.ASSERT(
              cu.assignableTo(otherCompType.getCorrespondingJavaTypeName(),
                  thisCompType.getCorrespondingJavaTypeName()),
              otherCompType.getCorrespondingJavaTypeName() +
              " expected to be assignable to " +
              thisCompType.getCorrespondingJavaTypeName());

View Full Code Here

  public void boot(boolean create, Properties startParams)
    throws StandardException
  {

    classInspector = new ClassInspector(this);

    //
    //The ClassFactory runs per service (database) mode (booted as a service module after AccessFactory).
    //If the code that booted
    //us needs a per-database classpath then they pass in the classpath using
View Full Code Here

  String verifyClassExist(String javaClassName, boolean convertCase)
    throws StandardException
  {
    /* Verify that the class exists */

    ClassInspector classInspector = getClassFactory().getClassInspector();

    /* We first try to resolve the javaClassName as a class.  If that
     * fails then we try to resolve it as a class alias.
     */

    Throwable reason = null;
    boolean foundMatch = false;
    try {

      foundMatch = classInspector.accessible(javaClassName);

    } catch (ClassNotFoundException cnfe) {

      reason = cnfe;
    }
View Full Code Here

  public JavaValueNode bindExpression(FromList fromList, SubqueryList subqueryList,
    Vector aggregateVector)
      throws StandardException
  {
    ClassInspector classInspector = getClassFactory().getClassInspector();


    if (((getCompilerContext().getReliability() & CompilerContext.INTERNAL_SQL_ILLEGAL) != 0)
      || !javaClassName.startsWith("java.sql.")) {

      throw StandardException.newException(SQLState.LANG_SYNTAX_ERROR, javaClassName + "::" + fieldName);
    }

    javaClassName = verifyClassExist(javaClassName, ! classNameDelimitedIdentifier);

    /*
    ** Find the field that is public.
    */
    field = classInspector.findPublicField(javaClassName,
                    fieldName,
                    true);
    /* Get the field type */
     setJavaTypeName( classInspector.getType(field) );

    return this;

  }
View Full Code Here

      thenElseList.setParameterDescriptor(dts);
    }

    /* The then and else expressions must be type compatible */
    ClassInspector cu = getClassFactory().getClassInspector();

    /*
    ** If it is comparable, then we are ok.  Note that we
    ** could in fact allow any expressions that are convertible()
    ** since we are going to generate a cast node, but that might
    ** be confusing to users...
    */

    // RESOLVE DJDOI - this looks wrong, why should the then expression
    // be comparable to the then expression ??
    if (! thenExpression.getTypeCompiler().
       comparable(elseExpression.getTypeId(), false, getClassFactory()) &&
      ! cu.assignableTo(thenExpression.getTypeId().getCorrespondingJavaTypeName(),
                elseExpression.getTypeId().getCorrespondingJavaTypeName()) &&
      ! cu.assignableTo(elseExpression.getTypeId().getCorrespondingJavaTypeName(),
                thenExpression.getTypeId().getCorrespondingJavaTypeName()))
    {
      throw StandardException.newException(SQLState.LANG_NOT_TYPE_COMPATIBLE,
            thenExpression.getTypeId().getSQLTypeName(),
            elseExpression.getTypeId().getSQLTypeName()
View Full Code Here

    /* Built-in types need no checking */
    if (!dataTypeServices.getTypeId().userType())
      return;

    ClassInspector classInspector = getClassFactory().getClassInspector();

    columnTypeName =
      dataTypeServices.getTypeId().getCorrespondingJavaTypeName();




    /* User type - We first check for the columnTypeName as a java class.
     * If that fails, then we treat it as a class alias.
     */

    boolean foundMatch = false;
    Throwable reason = null;
    try {
      foundMatch = classInspector.accessible(columnTypeName);
    } catch (ClassNotFoundException cnfe) {
      reason = cnfe;
    }

    if (!foundMatch)
    {
      throw StandardException.newException(SQLState.LANG_TYPE_DOESNT_EXIST, reason, columnTypeName,
                                name);
    }

    if (! classInspector.assignableTo(columnTypeName,
                      "java.io.Serializable"&&
            // Before Java2, SQLData is not defined, assignableTo call returns false
            ! classInspector.assignableTo(columnTypeName,"java.sql.SQLData"))
        {
      getCompilerContext().addWarning(
        StandardException.newWarning(SQLState.LANG_TYPE_NOT_SERIALIZABLE, columnTypeName,
                                 name));
    }
View Full Code Here

      thenElseList.setParameterDescriptor(dts);
    }

    /* The then and else expressions must be type compatible */
    ClassInspector cu = getClassFactory().getClassInspector();

    /*
    ** If it is comparable, then we are ok.  Note that we
    ** could in fact allow any expressions that are convertible()
    ** since we are going to generate a cast node, but that might
    ** be confusing to users...
    */

    // RESOLVE DJDOI - this looks wrong, why should the then expression
    // be comparable to the then expression ??
    if (! thenExpression.getTypeServices().
       comparable(elseExpression.getTypeServices(), false, getClassFactory()) &&
      ! cu.assignableTo(thenExpression.getTypeId().getCorrespondingJavaTypeName(),
                elseExpression.getTypeId().getCorrespondingJavaTypeName()) &&
      ! cu.assignableTo(elseExpression.getTypeId().getCorrespondingJavaTypeName(),
                thenExpression.getTypeId().getCorrespondingJavaTypeName()))
    {
      throw StandardException.newException(SQLState.LANG_NOT_TYPE_COMPATIBLE,
            thenExpression.getTypeId().getSQLTypeName(),
            elseExpression.getTypeId().getSQLTypeName()
View Full Code Here

    *
    *  @return  the Classes of our parameters
    */
  public  Class[]  getMethodParameterClasses()
  {
    ClassInspector ci = getClassFactory().getClassInspector();

    Class[]  parmTypeClasses = new Class[methodParms.length];
    for (int i = 0; i < methodParms.length; i++)
    {
      String className = methodParameterTypes[i];
      try
      {
        parmTypeClasses[i] = ci.getClass(className);
      }
      catch (ClassNotFoundException cnfe)
      {
        /* We should never get this exception since we verified
         * that the classes existed at bind time.  Just return null.
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.loader.ClassInspector

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.