Examples of JormManager


Examples of org.objectweb.jorm.metainfo.lib.JormManager

   * (non null value is required)
   */
  private void loadJormSpeedoMI(String className,
              Properties classProperties,
              ClassLoader classLoader) {
    JormManager m = (JormManager) mapper.getMetaInfoManager();
    synchronized (m) {
      if (m.getClass(className) != null) {
        return;
      }
      //deserialize the JMI from the file
      Set mos = null;
      String fn = classProperties.getProperty(Object2StringSerializer.DESC_FILE_NAME_PROP);
      try {
        mos = (Set) Object2StringSerializer.deserialize(fn, classLoader, logger);
      } catch (Exception e) {
        throw personality.newRuntimeException("Impossible to load the jorm meta " +
          "information for the class '" + className + "' from the file '"
          + fn + "' (You must use the same Speedo version for the"
          + " enhancement and for the runtime): ", e);
      }

      //insert the Jorm meta object into the Jorm MI mamager
      for (Iterator it = mos.iterator(); it.hasNext();) {
        Object o = it.next();
        if (o instanceof BasicClass) {
          BasicClass c = (BasicClass) o;
          Package s = m.createPackage(((Package) c.getParent()).getName());
          s.addClass(c);
          c.setParent(s);
          c.setLogger(m.getLogger());
          logger.log(BasicLevel.DEBUG,
            "Jorm Meta Object Class " + c.getFQName() + " loaded");
        } else if (o instanceof BasicCompositeName) {
          BasicCompositeName cn = (BasicCompositeName) o;
          Package s = m.createPackage(((Package) cn.getParent()).getName());
          s.addCompositeName(cn);
          cn.setLogger(m.getLogger());
          logger.log(BasicLevel.DEBUG,
            "Jorm Meta Object CompositeName " + cn.getFQName() + " loaded");
        } else if (o instanceof SpeedoSequenceItf) {
          //add the sequence to the sequence manager of the pmf
          pmf.getSequenceManager().addSequence(o);
          logger.log(BasicLevel.DEBUG,
            "Speedo Meta Object Sequence " + o + " loaded");
        } else if (o instanceof SpeedoIndex) {
          //SpeedoIndex si = (SpeedoIndex) o;
          //TODO handle speedo index
        } else
          throw new SpeedoRuntimeException("Umanaged Jorm/Speedo Meta Object " + o);
      }
      if (m.getClass(className) == null) {
        throw new SpeedoRuntimeException(
          "Internal ERROR: No meta information found about the persistent class '"
          + className + "' in the file '" + fn + "'.");
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.