Package org.objectweb.speedo.api

Examples of org.objectweb.speedo.api.SpeedoException


    } else {
        //The identifier is mapped over a persistent field
        lidname = pkField.name;
      lid = mibh.getPrimitiveField(sc.jormclass, lidname);
      if (lid == null) {
        throw new SpeedoException(
          mibh.getErrorMessage(sc, sc.jormclass, null)
          + " Impossible to get the field '" + lidname + "'");
      }
    }
        Manager manager = mibh.getManager(jc);
        CompositeName cn = getLongIdCompositeName(manager);
    NameRef nr = nd.createNameRef(cn);
    nr.addProjection(getLongIdLid(), lid.getName());
    if (sc.jormclass.getSuperClasses().isEmpty()) {
      // define the inheritance filter permiting to determine the class
      // since an identifier (some bits are reserved for class
      // identification)
      Expression expr = new Round(new DivideBy(
        new BasicParameterOperand(getFieldType(), getLongIdLid()),
        getBasicOperand()));
      try {
        expr.compileExpression();
      } catch (ExpressionException e) {
        throw new SpeedoException("Impossible to compile the filter of longid naming", e);
      }
      sc.jormclass.setInheritanceFilter(nd, expr);
        // assign a default value to each sub classes. The real value
      // is computed at runtime from the database content.
      assignDummyKeyToFamilly(sc.jormclass, nd);
View Full Code Here


        }
      }
    }
    if (al != null) {
      al.add(sf);
      throw new SpeedoException(
        "Impossible to use an auto incremented identifier if " +
        "several fields have been marked as primary-key " + al
        + " in the class '" + tsc.getFQName() + "'.");
    }
    if (sf != null) {
        String t = sf.type();
       
      if (!checkFieldType(t)) {
        throw new SpeedoException(
          "Impossible to use an auto incremented identifier: " +
          "the field type of '" + sf.name + "' is '" + sf.type()
          + "' and '" + getFieldType().getJavaName()
          + "' is expected (class '"
          + tsc.getFQName() + "'.");
View Full Code Here

        } else {
            className = Util.type(Type.getType(type));
        }
        SpeedoClass sc = moClass.getSpeedoClassFromContext(className);
        if (sc == null) {
            throw new SpeedoException("No persistent class '" + className + "' found: " + getSourceDesc());
        }
        return (SpeedoField) sc.fields.get(fieldName);
    }
View Full Code Here

        if (classname == null) {
            throw new NullPointerException("class name not defined");
        }
        Class theClass = jmiManager.getClass(classname);
        if (theClass == null) {
            throw new SpeedoException
                ("Class '" + classname +
                 "' has not been declared in the jorm meta information");
        }
        ClassExtent ext = new ClassExtent(theClass, alias, Field.PNAMENAME, false);
        if (classname.equals(this.curClass)) {
View Full Code Here

     * The PersistenceManager is set (even if there was a previous definition
     * of a PersistenceManager.
     */
    public synchronized void compile() throws SpeedoException, MedorException, ExpressionException {
        if (status == UNDEFINED)
            throw new SpeedoException("Impossible to compile an undefined query");
        if (status == COMPILED)
            return;
    long timeToCompile = System.currentTimeMillis();
        boolean debug = logger.isLoggable(BasicLevel.DEBUG);
        // create a speedoQL object with a filter string
      String filter = qd.filter;
      filter = '(' + filter + ')';
        // create representations of the parameters list and the variable
        // list
        toHashtableParams(qd.parameters, ";,");
        toHashtableVars(qd.variables, ";,");
        Manager miManager = mapper.getMetaInfoManager();
        if (miManager == null)
            throw new SpeedoException(
                    "A non null Meta information manager is needed");
        try {
          jf.getPClassMapping(
              qd.candidateClass.getName(),
          classLoader);
        } catch (Exception e) {
      throw new SpeedoException(e);
    }
        SimpleNode node = null;
        try {
            node = new SpeedoQL(new CharArrayReader(filter.toCharArray())).SpeedoQL();
        } catch (ParseException e) {
            throw new SpeedoException(
                    "Impossible to parse the filter and to create AST", e);
        }
        SpeedoQLVariableVisitor sqvv = new SpeedoQLVariableVisitor(
                node, miManager, varParserlogger, hparams, hvars, qd.order,
                qd.candidateClass.getName(), qd.includeSubClasses);
View Full Code Here

          logger.log(BasicLevel.DEBUG, "Composite PName : assign a KFPNC for the class" + targetClass.jormclass.getFQName() + ".");
          sb.append(NamingRules.kfpncName(ancestor.getFQName()));
        }
      } catch (Exception e) {
        logger.log(BasicLevel.ERROR, "Error while retrieving the inheritance filter of the namedef:" + nd.toString());
        throw new SpeedoException("Error while retrieving the inheritance filter of the namedef:" + nd.toString(), e);
      }
      className = ancestor.getFQName();
    }
    sb.append(HINTS_SEP);
    sb.append(className);
View Full Code Here

        String className = p.getPersonalityClassName(
                "org.objectweb.speedo.metadata", "Defaults");
    try {
      defaults = (SpeedoDefaults) Class.forName(className).newInstance();
    } catch (InstantiationException e) {
      throw new SpeedoException(
          "Cannot create object for Speedo defaults with class: "
                    + className, e);
    } catch (IllegalAccessException e) {
      throw new SpeedoException(
          "Cannot create object for Speedo defaults with class: "
                    + className, e);
    } catch (ClassNotFoundException e) {
      throw new SpeedoException(
          "Cannot create object for Speedo defaults with class: "
                    + className, e);
    }
  }
View Full Code Here

    } catch (Throwable e) {
      String msg = "Merged class '" + gc.classToWrite
                + "' cannot be loaded: " + e.getMessage();
      logger.log(BasicLevel.ERROR, msg, e);
            if (e instanceof Exception) {
                throw new SpeedoException(msg, (Exception) e);
            } else {
                throw new SpeedoException(msg);
            }
    }
  }
View Full Code Here

      if (remove) {
        f.delete();
      }
      return jclass;
    } catch (IOException e) {
      throw new SpeedoException("Error during loading " + filename, e);
    }
  }
View Full Code Here

      outputFile.createNewFile();
      FileOutputStream fos = new FileOutputStream(outputFile);
      fos.write(jclass.toByteArray());
      fos.close();
    } catch (IOException e) {
      throw new SpeedoException("Cannot write " + filename, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.api.SpeedoException

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.