Examples of PersistenceManagerFactory


Examples of javax.jdo.PersistenceManagerFactory

    }

    /** */
    public void test() {
      Properties pmfProperties = loadPMF2Properties();
      PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
      PersistenceManager pm2 = pmf2.getPersistenceManager();
      Transaction tx2 = pm2.currentTransaction();
        pm = getPM();
      Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            tx2.begin();
            tx.commit();
            tx = null;
            tx2.commit();
            tx2 = null;
        }
        finally {
            cleanupPM(pm);
            pm = null;
            cleanupPM(pm2);
            pm2 = null;
            pmf2.close();
        }
    }
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

    public static PersistenceManagerFactory getPersistenceManagerFactory(
            Bundle bundle, Map properties) {

        ClassLoader oldLoader = pushContextClassLoader(bundle);
        try {
            PersistenceManagerFactory factory =
                    PersistenceManagerFactoryImpl.getPersistenceManagerFactory(
                            properties);
            return new OSGiPersistenceManagerFactory(bundle, factory);
        } finally {
            popContextClassLoader(oldLoader);
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

     * Return a Persistence Manager
     * @return a Persistence Manager
     */
    private synchronized PersistenceManager getPersistenceManager() {
        try {
            final PersistenceManagerFactory pmf =
                getPersistenceManagerFactory(Activator.getBundle());
            return pmf.getPersistenceManager();
        } catch (Throwable t) {
            throw new RuntimeException(t);
        }
    }
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

     * This is invoked when the proxy PM has close() invoked.
     */
    void clearPMProxyDelegate()
    {
        // TODO Is it safe to assume 'this' is actually the right PMF already?
        PersistenceManagerFactory pmf = getPMProxyDelegate().getPersistenceManagerFactory();
        String txnType = pmf.getTransactionType();
        if (TransactionType.RESOURCE_LOCAL.toString().equalsIgnoreCase(txnType))
        {
            // Close the PM and unset the thread-local
            getPMProxyDelegate().close();
            pmProxyThreadLocal.remove();
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

        else {
            connName = name;
            useDefault = false;
        }

        PersistenceManagerFactory pmf = (PersistenceManagerFactory)
            pmFactoriesByName.get(connName);
        if (pmf == null) {
            synchronized (this) {
                Properties useProps;
                if (useDefault) {
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

      //In case of the user specifies driver properties, the CF name is
      // removed
      p.remove(SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME);
    }

    PersistenceManagerFactory pmf =
      JDOHelper.getPersistenceManagerFactory(p);
    PMHolder pmHolder = new PMHolder(pmf);
    DatabaseImpl.initTestData(pmHolder);
  }
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

   * This method must be rewritten by the include your own tests as shown by the
   * class {@link ShowConcurrencyErrors ShowConcurrencyErrors}
   */
  public void doTest() throws JDOException, Exception {
    // get the persistence manager factory
    PersistenceManagerFactory pmf =
      JDOHelper.getPersistenceManagerFactory(p);
    logger.log(BasicLevel.INFO, "Show connection properties:\n\t" + pmf.getProperties());
  }
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

      ts[thread] = new Thread(new Runnable() {
        public void run() {
          String action = null;
          String returnStr = null;
          Iterator iter = null;
          PersistenceManagerFactory pmf =
            JDOHelper.getPersistenceManagerFactory(p);
          PMHolder pmHolder = new PMHolder(pmf);
          int j = 0;
          for (int i = 0; i < nbTx; i++) {
            logger.log(BasicLevel.INFO, "Start loop " + i);
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

            p.load(is);
        } catch (IOException e) {
            System.err.println(e.getMessage());
            System.exit(-1);
        }
        PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(p);

        String className = args[0];
        //System.out.println("Class to load: " + className);

        //Build a ClassLoader
        URL[] urls = new URL[args.length-1];
        for(int i=1; i<args.length; i++) {
            File f = new File(args[i]);
            if (!f.exists()) {
                System.err.println("Resource '" + args[i] + "' not availlable");
                System.exit(-1);
            }
            //System.out.println("Resource found: " + args[i]);
            try {
                urls[i-1] = f.toURL();
            } catch (MalformedURLException e) {
                System.err.println(e.getMessage());
                System.exit(-1);
            }
        }
        URLClassLoader ucl = new URLClassLoader(urls, cl);
        Class userClass = null;
        try {
            userClass = ucl.loadClass(className);
        } catch (ClassNotFoundException e) {
            System.err.println("Problem to load the class '" + className + "'");
            System.err.println(e.getMessage());
            System.exit(-1);
        }
        PersistenceManager pm = pmf.getPersistenceManager();
        pm.getObjectIdClass(userClass);
        System.out.println("Class '" + className
            + "' loaded successfully from the classpath:\n"
            + getClassPath(ucl));
        pm.close();
View Full Code Here

Examples of javax.jdo.PersistenceManagerFactory

 
  public void  testConcurrentPersistenceManagersSameClasses() {

    logger.log(BasicLevel.INFO, "testConcurrentPersistenceManagersSameClasses");
    Properties pmfProperties = loadPMF2Properties();
    PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
    PersistenceManager pm2 = pmf2.getPersistenceManager();
    logger.log(BasicLevel.DEBUG, "begin getTransactions");
    Transaction tx2 = pm2.currentTransaction();
    tx = getPM().currentTransaction();
    logger.log(BasicLevel.DEBUG, "begin initData");
    tx.begin();
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.