Package com.db4o.reflect.jdk

Examples of com.db4o.reflect.jdk.JdkReflector


  private com.db4o.config.Configuration getNewDatabaseConfiguration() {
    final com.db4o.config.Configuration cfg = Db4o.newConfiguration();
   
    // Required config options:
   
    cfg.reflectWith(new JdkReflector(getPluginClassLoader())); // Needed because the node uses it's own classloader for plugins
    cfg.exceptionsOnNotStorable(true); // Notify us if we tried to store a class which db4o won't store
    cfg.activationDepth(1); // TODO: Optimization: Check whether 0 is better. All database code was written to also work with 0.
    cfg.updateDepth(1); // This must not be changed: We only activate(this, 1) before store(this).
    Logger.normal(this, "Default activation depth: " + cfg.activationDepth());
        cfg.automaticShutDown(false); // The shutdown hook does auto-commit() but we want to rollback(), we MUST NOT commit half-finished transactions
View Full Code Here


  final private static boolean DEBUG_OUTPUT_ENABLED = false;
  final private static int DEBUG_OUTPUT_LEVEL = 4;

  public EmbeddedConfiguration createDefaultConfiguration() {
    EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration();
    configuration.common().reflectWith(new JdkReflector(this.getClass().getClassLoader()));
    configuration.common().add(new TransparentPersistenceSupport());
    configuration.common().objectClass(RequestLogRecord.class).objectField("requestId").indexed(true);
    configuration.common().objectClass(RequestLogRecord.class).objectField("requestOrigin").indexed(true);
    configuration.common().objectClass(RequestLogRecord.class).objectField("hostname").indexed(true);
    configuration.common().objectClass(RequestLogRecord.class).objectField("requestMethod").indexed(true);
View Full Code Here

      logger.log(Level.FINE, "Opening connection to db4o database...");
      myself = new DataStore();
      // accessLocalServer
      // Please see Wiki for more information on the ServerConfiguration.
      ServerConfiguration config = Db4oClientServer.newServerConfiguration();
      config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));
      config.common().objectClass(User.class).storeTransientFields(true); // Enables data persistence for passwords

      //Connect to the Database
      server = Db4oClientServer.openServer(config, WPI_TNG_DB, PORT);
      server.grantAccess(DB4oUser,DB4oPass);
View Full Code Here

   * @param Model to save
   */
  public <T> boolean save(T aModel){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    theDB.store(aModel);
    System.out.println("Stored " + aModel);
    logger.log(Level.FINE, "Saving model [" + aModel + "]");
    theDB.commit();
View Full Code Here

   * @param Model to save
   */
  public <T> boolean save(T aModel, Project aProject){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    ((Model) aModel).setProject(aProject); //Sets the model's project to the given project
    theDB.store(aModel);
    System.out.println("Stored " + aModel);
    logger.log(Level.FINE, "Saving model [" + aModel + "]");
View Full Code Here

     *  aFieldName - this should be the suffix of the getter. So for getID you would make this field be "ID"
     */

    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    logger.log(Level.FINE, "Attempting Database Retrieve...");

    Method[] allMethods = anObjectQueried.getMethods();
    Method methodToBeSaved = null;
View Full Code Here

     *  aFieldName - this should be the suffix of the getter. So for getID you would make this field be "ID"
     */

    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    logger.log(Level.FINE, "Attempting Database Retrieve...");
    Method[] allMethods = anObjectQueried.getMethods();
    Method methodToBeSaved = null;
    for(Method m: allMethods){//Cycles through all of the methods in the class anObjectQueried
View Full Code Here

   * @return a List of all of the objects of the given class
   */
  public <T> List<T> retrieveAll(T aSample){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    List<T> result = theDB.queryByExample(aSample.getClass());
    System.out.println("retrievedAll: "+result);
    theDB.commit();

View Full Code Here

   * @return a List of all of the objects of the given class
   */
  public <T> List<Model> retrieveAll(T aSample, Project aProject){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    ArrayList<Model> result = new ArrayList<Model>();
    List<Model> allResults = theDB.queryByExample(aSample.getClass());
    for(Model theModel : allResults) {
      if(theModel.getProject() != null &&
View Full Code Here

   * @return The object being deleted
   */
  public <T> T delete(T aTNG){
    // Please see Wiki for more information on the ServerConfiguration.
    ClientConfiguration config = Db4oClientServer.newClientConfiguration();
    config.common().reflectWith(new JdkReflector(Thread.currentThread().getContextClassLoader()));

    logger.log(Level.FINE, "Database Delete Attempt...");
    //ObjectContainer client = server.openClient();
    ObjectSet<T> result = theDB.queryByExample(aTNG);
    T found = (T) result.next();
View Full Code Here

TOP

Related Classes of com.db4o.reflect.jdk.JdkReflector

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.