Package org.objectweb.speedo.mim.api

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


            throw new JDOUserException("DeletePersistent " +
                "must be called in an active transaction");
        }
        boolean mustLoad = DeleteCallback.class.isAssignableFrom(pc);
        if (!mustLoad) {
            HomeItf home;
            try {
                home = (HomeItf) jf.getPClassMapping(pc);
            } catch (PException e) {
                throw new JDOException("", e);
            }
            mustLoad = home.hasInstanceLifeCycleListeners();
            if (!mustLoad) {
                //TODO: manage cascade delete
            }
        }
        if (mustLoad) {
View Full Code Here


            if (listenersCol == null) {
                listenersCol = new ArrayList();           
                class2listeners.put(classes[i], listenersCol);
            }
            listenersCol.add(l);
            HomeItf sh = null;
            try {
                sh = (HomeItf) jormFactory.getPClassMapping(classes[i]);
            } catch (PException e) {
            }
            if (sh == null) {
                logger.log(BasicLevel.WARN, "Class '" + classes[i].getName()
                        + "' is not recongnized as a persistent class. The listener will not receiver event, but it is registerd.");
            } else {
                sh.addInstanceLifeCycleListener(l);
            }
        }
    }
View Full Code Here

            for (Iterator iter = classes.iterator(); iter.hasNext();) {
                Class clazz = (Class) iter.next();
                List listenersCol = (List) class2listeners.get(clazz);
                if (listenersCol != null) {
                    if (listenersCol.remove(l)) {
                        HomeItf sh = null;
                        try {
                            sh = (HomeItf) jormFactory.getPClassMapping(clazz);
                        } catch (PException e) {
                        }
                        if (sh != null) {
                            sh.removeInstanceLifeCycleListener(l);
                        }
                       
                    }
                }
            }
View Full Code Here

            PNameField pnf = (PNameField) f;
            if (pnf.isClassPName() && !pnf.isInGenClass()) {
                //Add prefeched fields
                ClassExtent ce = (ClassExtent) pnf.getQueryTree();
                String prefetchedClassName = ce.getJormName();
                HomeItf sh = (HomeItf) mapper.lookup(prefetchedClassName);
                if (sh.getPrefetchOnQuery()) {
                    qec.pcm = sh;
                    JormQueryTreeHelper.addPrefetchFields(ce, qt, top,
                                qd.getIncludeSubClasses());
                    qec.pnIndex = top.getTupleStructure().getSize() + 1;
                }
View Full Code Here

    //check for the use of the userCache
        if (qd.result == null && qd.variables == null) {
            //no variable used and the result is the candidate class
            Map field2value = new HashMap();
            if (getFieldComparaison(sp.getQueryFilter(), field2value)) {
                HomeItf sh = null;
                try {
                    sh = (HomeItf) jf.getPClassMapping(
                            qd.candidateClass.getName(),
                            classLoader);
                } catch (PException e) {
                    //never happen
                }
                userCache = sh.getUserCache(field2value.keySet());
                if (userCache != null) {
                    userCacheIndexes = new Operand[field2value.size()];
                    String[] ifs = userCache.getIndexFieldNames();
                    for (int i = 0; i < ifs.length; i++) {
                        userCacheIndexes[i] = (Operand) field2value.get(ifs[i]);
View Full Code Here

      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);
      } catch (PException e) {
        logger.log(BasicLevel.WARN,
            "Impossible to fetch the Home of the class '"
View Full Code Here

      }
      //Iterator over each konwn class to apply property if the pattern match
      for (int i = 0; i < classNames.length; i++) {
        if (prop.patternOnField) {
          //Fetch list of fields belong the class
          HomeItf sh = (HomeItf) mapper.lookup(classNames[i]);
            //TODO: provide in HomeItf (PClassMapping maybe) a new method
          // returning the list of persistent field.
          String[] fieldNames = new String[0]; //sh.get ...
            for (int j = 0; j < fieldNames.length; j++) {
              //build the path from the class name and the field name
              String path = classNames[i] + FIELD_SEP + fieldNames[j];
              if (prop.match(path)) {
                //The path matches
                HomeItf subHome;
                try {
                  //Try to find the home of the gen clas if the field
                  // corresponds to a genclass reference
                  subHome = (HomeItf) sh.getGenClassMapping(fieldNames[i]);
                } catch (UnsupportedOperationException e) {
                  //The field is not a reference to gen class
                  subHome = sh;
                }
                //apply the property on the home
                  prop.applyProperty(subHome);
              }
        }
        } else if (prop.match(classNames[i])) {
          //the property is not for a field and matches to the class name
          String path = classNames[i];
          //find the home corresponding to the class name
             HomeItf sh = (HomeItf) mapper.lookup(path);
        //apply the property on the home
          prop.applyProperty(sh);
        }
    }
    }
View Full Code Here

    if (o == null) {
      logger.log(BasicLevel.WARN, "Impossible to find the home: null object");
      return null;
    } else if (o instanceof PersistentObjectItf) {
            PersistentObjectItf po =(PersistentObjectItf) o;
      HomeItf h = po.speedoGetHome();
      if (h == null) {
                if (o instanceof SpeedoGenClassPO) {
                    PName pn = po.getPName();
                    if (pn == null) {
                        h = (HomeItf) ((PBinder) pn.getPNameManager()).getBinderClassMapping();
View Full Code Here

    }
  }


  public boolean isObjectSharing(Object o) {
    HomeItf home = getHome(o);
    return home == null || home.isShareable();
  }
View Full Code Here

      if (logger.isLoggable(BasicLevel.DEBUG)) {
          logger.log(BasicLevel.DEBUG, "Entry unbound from the cache: \n\tid: "
              + event.getCeIdentifier());
      }
      PName pn = (PName) event.getCeIdentifier();
      HomeItf sh = (HomeItf)
              ((PBinder) pn.getPNameManager()).getBinderClassMapping();
      sh.userCacheEntryUnbound(pn);
  }
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.