Package org.objectweb.speedo.mim.api

Examples of org.objectweb.speedo.mim.api.HomeItf


 
  // IMPLEMENTATION OF THE CacheEntryFactory INTERFACE //
  //---------------------------------------------------//

  public int getCachingStrategy(Object o) {
    HomeItf home = getHome(o);
    if (home == null) {
      return CACHING_STRATEGY_CACHED;
    } else {
      return home.isCacheable()
        ? CACHING_STRATEGY_CACHED
        : CACHING_STRATEGY_NO_CACHE;
    }
  }
View Full Code Here


   */
  public synchronized PClassMapping getPClassMapping(String className,
                             ClassLoader classLoader)
    throws PException {
    boolean debug = logger.isLoggable(BasicLevel.DEBUG);
    HomeItf pcm = (HomeItf) cn2pcm.get(className);
    if (pcm != null) {
      if (debug)
        logger.log(BasicLevel.DEBUG, "PClassMapping for class " + className
          + " is being configured:" + pcm);
      return pcm;
    }

    pcm = (HomeItf) mapper.lookup(className);
    if (pcm != null) {
      if (debug)
        logger.log(BasicLevel.DEBUG, "PClassMapping for class " + className
          + " already exist:" + pcm);
      return pcm;
    }

    // Creates the PClassMapping, its PBinder and the PNC
    if (debug) {
      logger.log(BasicLevel.DEBUG,
        "Looking for the PClassMapping of the class " + className);
    }
    String pcmcn = NamingRules.fqMappingName(className);
    try {
      pcm = (HomeItf) classLoader.loadClass(pcmcn).newInstance();
    } catch (Exception e) {
      throw new PException(e,
        "Impossible to instanciate the PClassMapping of the class "
        + className + ": " + pcmcn);
    }
    pcm.setTransactionalPersistenceManager(tpm);
    pcm.setPOManagerFactory(pmf);
    Properties classProperties = pcm.getClassProperties();
    if (debug) {
      logger.log(BasicLevel.DEBUG, "Jorm config:" + classProperties);
    }
    //Load the Jorm Meta information
    loadJormSpeedoMI(className, classProperties, classLoader);

    // Fetch the Binder
    PBinder binder = findPBinder(className, classLoader,
      classProperties.getProperty(JormPathHelper.getPath(className)));
    pcm.setPBinder(binder);
    binder.setPClassMapping(pcm);

    // Fetch the PNC of the class
    PNameCoder classPnc = findPNameManager(
      className, classLoader, pcm, classProperties.getProperty(JormPathHelper.getPath(className))
    );
    ((PClassMappingCtrl) pcm).setClassPNameCoder(classPnc);
    //Configure references (PNameCoder and GenClassMappping)
    RefConfig refConfig = new RefConfig(classProperties, classLoader);
    cn2pcm.put(className, pcm);//register the pcm in order to avoid double configuration
    pcm.configureRefFields(refConfig);
    cn2pcm.remove(className);
    if (debug) {
      logger.log(BasicLevel.DEBUG, "PClassMapping/PBinder/PNC created for the class " + className);
      logger.log(BasicLevel.DEBUG, "- pcm: " + pcm);
      logger.log(BasicLevel.DEBUG, "- binder: " + binder);
      logger.log(BasicLevel.DEBUG, "-pnc: " + classPnc);
    }
    // Maps the class
    mapper.map(null, pcm);
    pcm.configureRefFields(new GCMHomeConfig(pcm));   
        cpm.applyProperties(pcm);
    logger.log(BasicLevel.DEBUG, "Class " + className + " mapped");
    //Manage the cluster of classes
    PMapCluster cluster = mapper.getPMappingStructuresManager().getPMapCluster(className);
    if (cluster.isDefined()) { //cluster is full (all classes are mapped)
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.mim.api.HomeItf

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.