FileDocCategorySizeDatePackage
MediaManiaApp.javaAPI DocExample1598Wed Dec 25 16:12:54 GMT 2002com.mediamania

MediaManiaApp

public abstract class MediaManiaApp extends Object

Fields Summary
protected PersistenceManagerFactory
pmf
protected PersistenceManager
pm
protected Transaction
tx
Constructors Summary
protected MediaManiaApp()

        try {
            InputStream propertyStream = new FileInputStream("jdo.properties");
            Properties jdoproperties = new Properties();
            jdoproperties.load(propertyStream);
            jdoproperties.putAll(getPropertyOverrides());
            pmf = JDOHelper.getPersistenceManagerFactory(jdoproperties);
            pm = pmf.getPersistenceManager();
            tx = pm.currentTransaction();
        } catch(Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    
Methods Summary
public abstract voidexecute()

public voidexecuteTransaction()

        try {
            tx.begin();
            execute();
            tx.commit();
        } catch (Throwable exception){
            exception.printStackTrace(System.err);
            if (tx.isActive()) tx.rollback();
        }
    
public javax.jdo.PersistenceManagergetPersistenceManager()

        return pm;
    
protected static java.util.MapgetPropertyOverrides()

        return new HashMap();