Package org.objectweb.jorm.api

Examples of org.objectweb.jorm.api.PClassMapping


  }
 
  protected Object speedoPersist(PersistentObjectItf po, Map map)
    throws PException, PersistenceException {
    //initialize the PBinding of the persistent object
    PClassMapping pcm;
    if (po instanceof SpeedoGenClassPO) {
      pcm = jf.getGenClassMapping(
        ((SpeedoGenClassPO) po).speedoGetGenClassId());
      //Assign the PBinding
      ((SpeedoGenClassPO) po).speedoSetPBinding(pcm.createPBinding());
      if (po instanceof Loggable) {
        ((Loggable) po).setLogger(logger);
      }
    } else {
      pcm = jf.getPClassMapping(po.getClass());
View Full Code Here


            logger.log(BasicLevel.DEBUG, "Extent nodes: " + extents.size());
        }
        for (Iterator it = extents.iterator(); it.hasNext();) {
            JormExtent je = (JormExtent) it.next();
            try {
                PClassMapping pcm = jf.getPClassMapping(
                        JormPathHelper.getOriginClass(je.getJormName()),
                        classLoader);
                if (debug) {
                    logger.log(BasicLevel.DEBUG,
                            "JormExtent: " + je + " / pcm=" + pcm);
                }
                je.setPMapper(pcm.getPMapper(), pcm.getProjectName());
            } catch (PException e) {
                throw new SpeedoException(
                        "Error while fetching PClassPMapping of the class "
                        + je.getJormName(), e);
            }
View Full Code Here

        sourceclassName, refFieldName, genClassNames);
      String hints = (String) classProperties.get(cn);
      logger.log(BasicLevel.DEBUG, "getGenClassMapping(" + cn + ")");
      logger.log(BasicLevel.DEBUG, "\thints=" + hints);
      try {
        PClassMapping gcm = (PClassMapping)
          Class.forName(getGCMClassName(mapper.getMapperName())).newInstance();
        logger.log(BasicLevel.DEBUG, "\tgcm=" + gcm);
        PBinder pb = findPBinder(cn, classLoader,hints);
        logger.log(BasicLevel.DEBUG, "\tbinder=" + pb);
        gcm.setPBinder(pb);
        pb.setPClassMapping(gcm);
        return gcm;
      } catch (Exception e) {
        throw new SpeedoRuntimeException(e.getMessage(), e);
      }
View Full Code Here

                        String destclassName) {
      String cn = JormPathHelper.getPath(
        sourceclassName, refFieldName, genClassNames);
      String hints = (String) classProperties.get(cn);
      try {
        PClassMapping gcm = (PClassMapping)
          Class.forName(getGCMClassName(mapper.getMapperName())).newInstance();
        logger.log(BasicLevel.DEBUG, "getGenClassMapping(" + cn + ")");
        logger.log(BasicLevel.DEBUG, "\tgcm=" + gcm);
        PBinder pb = findPBinder(cn, classLoader, hints);
        logger.log(BasicLevel.DEBUG, "\tbinder=" + pb);
        gcm.setPBinder(pb);
        pb.setPClassMapping(gcm);
        PNamingContext pnc = getPNamingContext(destclassName, classLoader);
        logger.log(BasicLevel.DEBUG, "\tpnc=" + pnc);
        ((PClassMappingCtrl) gcm).setPNameCoder(pnc);
        return gcm;
View Full Code Here

        return pcm.getPNameCoder(refFieldName);
    }
    public PClassMapping getGenClassMapping(String sourceclassName,
        String refFieldName,
        String[] genClassNames) {
      PClassMapping gcm = pcm.getGenClassMapping(refFieldName);
      gcm = newGenClassHome(gcm, tpm, pmf,
              sourceclassName + "#" + refFieldName);
      gcm.getPBinder().setPClassMapping(gcm);
      logger.log(BasicLevel.DEBUG, "Insert the home=" + gcm);
      cpm.applyProperties((HomeItf) gcm);
        return gcm;
    }     
View Full Code Here

    }     
    public PClassMapping getGenClassMapping(String sourceclassName,
        String refFieldName,
        String[] genClassNames,
        String destclassName) {
      PClassMapping gcm = pcm.getGenClassMapping(refFieldName);
      gcm = newGenClassHome(gcm, tpm, pmf,
              sourceclassName + "#" + refFieldName);
      gcm.getPBinder().setPClassMapping(gcm);
      logger.log(BasicLevel.DEBUG, "Insert the home=" + gcm);
      try {
        HomeItf refHome = (HomeItf) getPClassMapping(
            destclassName, pcm.getClass().getClassLoader());
        cpm.applyProperties((HomeItf) gcm, refHome);
View Full Code Here

            home.setPrefetchOnGenClass(BooleanHelper.parse(str, true));
        }
  }
  public void applyDefault(HomeItf gcHome, HomeItf refHome, Properties props, Logger l) {
    if (gcHome instanceof AbstractGenClassHome) {
      PClassMapping gcm = ((AbstractGenClassHome) gcHome).getRealPClassMapping();
      if (gcm instanceof RdbGenClassProp) {
        if (refHome instanceof RdbPrefetchablePCM) {
          ((RdbGenClassProp) gcm).setPrefetchElementPCM(
              (RdbPrefetchablePCM) refHome);
        }
View Full Code Here

   * persistent object
   * @param pn the identifier of the object
   */
  private void activePO(PersistentObjectItf sp, PName pn) {
    //fetch the PClassMapping
    PClassMapping pcm = null;
    if (pn != null && (pn.getPNameManager() instanceof PBinder)) {
      pcm = ((PBinder) pn.getPNameManager()).getBinderClassMapping();
    }
    if (sp instanceof SpeedoGenClassPO) {
      if (((SpeedoGenClassPO) sp).speedoGetPBinding() == null) {
        if (pcm == null)  {
          pcm = jf.getGenClassMapping(
              ((SpeedoGenClassPO) sp).speedoGetGenClassId());
        }
        //Assign the PBinding
        try {
          ((SpeedoGenClassPO) sp).speedoSetPBinding(pcm.createPBinding());
        } catch (PException e) {
          throw personality.newRuntimeException("Impossible to initialize the delegate PBinding of the genclass", e);
        }
        if (sp instanceof Loggable) {
          ((Loggable) sp).setLogger(logger);
View Full Code Here

          + "\n\tpn=" + pn
          + "\n\tpn.pnc=" + (pn.getPNameManager() != null ? pn.getPNameManager() : null));
      }
      className = type.getJormName();
      int idx = className.indexOf(JormPathHelper.SEP);
      PClassMapping pcm = ((PBinder) pn.getPNameManager())
          .getBinderClassMapping();
      PersistentObjectItf sp = null;
      if ((pcm instanceof AbstractGenClassHome) && idx != -1) {
        // This is a Generic class
        className = getGCClassName(className.substring(0, idx));
        sp = (PersistentObjectItf) Class.forName(className).newInstance();
      } else {
        if (pcm != null) {
          className = pcm.getClassName();
        }
        ClassLoader cl = jf.getClassLoader(className);
        if (cl == null) {
          cl = oid.getClass().getClassLoader();
          if (cl == null) {
View Full Code Here

  // IMPLEMENTATION OF THE JormFactory INTERFACE //
  //---------------------------------------------//

  public PBinder getPBinder(Class clazz) throws PException {
    String clName = clazz.getName();
    PClassMapping pcm = mapper.lookup(clName);
    if (pcm != null)
      return pcm.getPBinder();
    return getPClassMapping(clazz).getPBinder();
  }
View Full Code Here

TOP

Related Classes of org.objectweb.jorm.api.PClassMapping

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.