java/ch/wlkl/javaExamples/ExJdo.java

package ch.wlkl.javaExamples;
/* import jdo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
import static ch.wlkl.env.Env.implement;
import java.io.*;
import java.util.*;

/*
 * 
 * @author walter
 */
public class ExJdo {
    
    public ExJdo() {  
        implement("import JDO");
    }/*
    PersistenceManagerFactory pmFact = null;
    
    PersistenceManager getPersistenceManager(boolean cre) {
        if (pmFact == null) { 
            try {
                String li; //  = System.setProperty("user.dir", "d:\\javadata");
                // System.out.println("setProperty from " + li + " to " +
                // System.getProperty("user.dir"));
                BufferedReader bf = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("cmd.exe /C cd").getInputStream()));
                while (null != (li = bf.readLine()))
                    System.out.println("ecec in: " + li); 
                
                Properties props = new Properties();
                if (cre)
                    props.setProperty("javax.jdo.option.ConnectionCreate", "true");
                String pkg = getClass().getPackage().getName();
                pkg = pkg == null || pkg.trim().equals("") ? "" : pkg + '/';
                InputStream is = ClassLoader.getSystemResourceAsStream(pkg + "jdo.properties");
                props.load(is);
                pmFact = JDOHelper.getPersistenceManagerFactory(props);
                if (pmFact == null)  throw new Exception("pmFact null");
            } catch (Exception ex) {
                System.out.println("getPersistanceManager Exception " + ex + ", cause " + ex.getCause());
            }
        }
        return pmFact.getPersistenceManager();
    }
    
    void create() {
        try {
            PersistenceManager pm = getPersistenceManager(true);
            Transaction tx = pm.currentTransaction();
            tx.begin();
            tx.commit();
            pm.close();
        } catch  (Exception ex) {
            System.out.println("create Exception " + ex + ", cause " + ex.getCause());
        }
    }
    
    public static void main(String[] args) {
        new Ex(args, new String [] {"create"}).invokeMethods(new ExJdo());
    }
    */
}