Package org.objectweb.jorm.api

Examples of org.objectweb.jorm.api.PException


                if (longGenMgr == null) {
                  //if not already registered, create it
                  try {
                    longGenMgr = (LongGenMgr) Class.forName(getLongGenMgrName()).newInstance();
                  } catch (Exception e) {
                    throw new PException(e, "Cannot create LongGenMgr (probably a ClassLoader problem): " + getLongGenMgrName());
                  }
                  ((LongGenMgr) longGenMgr).init(mapper, PClassMapping.CREATE_STRUCTURE_IF_NEEDED);
                  //  and register it
                  LongGenMgrRegistry.registerLonGenMgr((LongGenMgr)longGenMgr);
                }
              } 
            }
            //create the long gen and associate it to the sequence
            s.setLongGen(((LongGenMgr) longGenMgr).getLongGen(s.getName()));
          } else {
            //else, use rdb_sequence_long_gen
            if (mapperRdb != null) {
              if (s.getLongGen() == null) {
                RdbSequenceLongGen rdbLongGen = new RdbSequenceLongGen(mapperRdb, s.datastoreName, false);
                if(s.start != null) {
                  rdbLongGen.setSequenceStart(s.start);
                }
                if(s.increment != null) {
                  rdbLongGen.setSequenceIncrement(s.increment);
                }
                if(s.cache != null) {
                  rdbLongGen.setSequenceStart(s.cache);
                }
                //create it
                Object conn = mapperRdb.getConnection();
                rdbLongGen.createSequence(conn);
                //and associate it to the sequence
                s.setLongGen(rdbLongGen);
                //close the connection
                mapperRdb.closeConnection(conn);
              }
            } else {
              throw new PException("Problem while init the sequence "
                      + ((SpeedoSequence)sequence).getName() + ": "
                  + "a rdb sequence has been defined in a jdo file and no rdb is linked to the application.");
            }
          }
        } catch (Exception e) {
          throw new PException(e, "Problem while init the sequence " + ((SpeedoSequence)sequence).getName());
      }
      }
    }
View Full Code Here


        getBinderClassMapping().getPMapper().closeConnection(c);
      } else if (c instanceof ConnectionHolder) {
        try {
          ((ConnectionHolder) c).releaseCHConnection();
        } catch (PersistenceException e) {
          throw new PException(e, "Problem with Perseus connection releasing.");
        }
      }
    }

    if (cache != null) {
      synchronized (cache) {
        if (cache.lookup(pn) != null) {
          throw new PExceptionExistingName("[" + getClassName()
                           + "]: an object has been already export with the same identifier");
        }
        try {
          cache.fix(cache.bind(pn, pb));
        } catch (CacheException e) {
          throw new PException(e, "[" + getClassName()
                      + "]: problem with cache management");
        }
      }
    }
    pb.setPName(pn);
View Full Code Here

    String jormConf = classProperties.getProperty(path);
    if (jormConf != null) {
      return (PNamingContext) findPNameManager(
        className, clazz.getClassLoader(), pcm, jormConf);
    } else {
      throw new PException(
        "Impossible to find the PNamingContext for the class "
        + className);
    }
  }
View Full Code Here

    }
    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);
View Full Code Here

   * (non null value is required).
   * @return the Class object (never null)
   */
  private Class getClass(String classname, ClassLoader cl) throws PException {
    if (cl == null) {
      throw new PException("Impossible to load the class "
        + classname + " without a classLoader(" + cl + ")");
    }
    try {
      return cl.loadClass(classname);
    } catch (Exception e) {
      throw new PException(e, "Impossible to load the class '"
        + classname + "' with the class loader :" + cl);
    }
  }
View Full Code Here

   */
  public synchronized PBinder findPBinder(String className,
                      ClassLoader classLoader,
                      String hints) throws PException {
    if (hints == null || hints.length() == 0)
      throw new PException(
        "Impossible to get the PNamingContext of the class " + className
        + ": Specified binder class is not valid: " + hints);
    PBinder binder = (PBinder) binders.get(className);
    if (binder != null)
      return binder;
View Full Code Here

TOP

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

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.