Package com.db4o

Examples of com.db4o.EmbeddedObjectContainer


    getDbTrans().setComplete();
    getDbTrans().endTrans();
    dao.getObjectContainer().close();
    final EmbeddedConfiguration c = injector.getInstance(EmbeddedConfiguration.class);
    final URI db4oUri = injector.getInstance(Key.get(URI.class, Db4oFile.class));
    final EmbeddedObjectContainer oc = Db4oEmbedded.openFile(c, db4oUri.getPath());
    dao.setObjectContainer(oc);
    ((Db4oTrans) getDbTrans()).setObjectContainer(oc);
    ((Db4oEntityFactory) getEntityFactory()).setObjectContainer(oc);
    getDbTrans().startTrans();
    final IEntity eloaded = dao.load(e.entityClass(), e.getId());
View Full Code Here


    }
  }

  @Override
  public void clearData() {
    EmbeddedObjectContainer container = createDbSession();
    log.info("Killing db4o session for: " + dbFile);
    try {
      clearData(container);
    }
    finally {
View Full Code Here

  public void create() {
    File f = getHandle();
    if(f.exists()) return;
    log.info("Creating db4o db: " + f.getPath());
    f = null;
    EmbeddedObjectContainer db = null;
    try {
      db = createDbSession();
    }
    finally {
      killDbSession(db);
View Full Code Here

    }
  }

  @Override
  public void addData() {
    EmbeddedObjectContainer dbSession = null;
    try {
      log.info("Stubbing db4o db: " + dbFile);
      dbSession = createDbSession();
      addData(dbSession);
    }
View Full Code Here

  @Override
  protected void beforeMethod() {
    super.beforeMethod();
    // reset data
    //Db4oDbShell dbShell = (Db4oDbShell) getDbShell();
    EmbeddedObjectContainer dbSession = injector.getInstance(EmbeddedObjectContainer.class);
    Db4oDbShell.clearData(dbSession);
    //dbShell.addData(dbSession);
  }
View Full Code Here

 
  @Override
  protected void afterClass() {
    super.afterClass();
    // kill db4o's object container
    EmbeddedObjectContainer db4oSession = injector.getInstance(EmbeddedObjectContainer.class);
    while(!db4oSession.close()) {};
  }
View Full Code Here

    while(!db4oSession.close()) {};
  }

  public void test() {
    // stub the db (presumes the db file does NOT exist)
    EmbeddedObjectContainer db4oSession = injector.getInstance(EmbeddedObjectContainer.class);
    Db4oDbShell dbShell = (Db4oDbShell) getDbShell();
    dbShell.create();
    dbShell.addData(db4oSession)// IMPT: this is critical to avoid db file locked exception!

    // subsequent access test
    // kill db4o's object container
    while(!db4oSession.close()) {};
    injector = null;
    db4oSession = null;
    buildTestInjector();
   
    Db4oEntityDao dao = (Db4oEntityDao) injector.getInstance(IEntityDao.class);
View Full Code Here

   
    // instantiate db4o
    log.info("Starting up db4o session..");
    Provider<PlatformTransactionManager> tm = injector.getProvider(PlatformTransactionManager.class);
    tm.get(); // this forces db4o to boot
    EmbeddedObjectContainer oc = injector.getInstance(EmbeddedObjectContainer.class);
    sce.getServletContext().setAttribute(EmbeddedObjectContainer.class.getName(), oc);
    log.info("Db4o session started");
   
    // create app and persist contexts
    AppContext ac = injector.getInstance(AppContext.class);
View Full Code Here

  public void contextDestroyed(ServletContextEvent sce) {
    log.info("shutting down smbiz app..");
   
    // db4o shutdown
    log.info("Shutting down db4o session..");
    EmbeddedObjectContainer oc = (EmbeddedObjectContainer) sce.getServletContext().getAttribute(EmbeddedObjectContainer.class.getName());
    if(oc != null) {
      oc.close();
      log.info("Db4o session closed");
    }
    else {
      log.info("No Db4o session found in servlet context");
    }
View Full Code Here

TOP

Related Classes of com.db4o.EmbeddedObjectContainer

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.