Package com.google.code.morphia

Examples of com.google.code.morphia.Morphia


    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public Morphia createInstance(){
        Morphia morphia = new Morphia();
        MorphiaValidation morphiaValidation = new MorphiaValidation();
        morphiaValidation.applyTo(morphia);
        return morphia.mapPackage(packageName);
    }
View Full Code Here


    @BeforeClass
    public void initDB() throws Exception {
        connection = new Mongo("127.0.0.1");

        morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);

        ds = morphia.createDatastore(connection, "rhqtest");
    }
View Full Code Here

    @BeforeClass
    public void initDB() throws Exception {
        connection = new Mongo("127.0.0.1");

        morphia = new Morphia()
            .map(MongoDBChangeSet.class)
            .map(MongoDBChangeSetEntry.class)
            .map(MongoDBFile.class);

        ds = morphia.createDatastore(connection, "rhqtest");
View Full Code Here

    }

    @Override
    public void initialize(ServerPluginContext context) throws Exception {
        connection = new Mongo("127.0.0.1");
        morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);
        ds = morphia.createDatastore(connection, "rhq");
        changeSetDAO =  new ChangeSetDAO(morphia, connection, "rhq");
        fileDAO = new FileDAO(ds.getDB());

        // Note that a write concern of SAFE does not cause the write operation
View Full Code Here

  private String packageName;

  @Override
  public Morphia getObject() throws Exception {
    final Morphia morphia = new Morphia();
    if (!"".equals(this.packageName)) {
      morphia.mapPackage(this.packageName);
    }
    return morphia;
  }
View Full Code Here

        return Morphia.class;
    }

    @Override
    protected Morphia createInstance() throws Exception {
        Morphia m = new Morphia();

        // lightweight wrapper around the JSR303 API Validation Extension
        new MorphiaValidation().applyTo(m);

        if (mapPackages != null) {
            for (String packageName : mapPackages) {
                m.mapPackage(packageName, ignoreInvalidClasses);
            }
        }
        if (mapClasses != null) {
            for (String entityClass : mapClasses) {
                m.map(Class.forName(entityClass));
            }
        }
        return m;
    }
View Full Code Here

    try {
      MorphiaObject.mongo = new Mongo("127.0.0.1", 27017);
    } catch (UnknownHostException e) {
      e.printStackTrace();
    }
    MorphiaObject.morphia = new Morphia();
    MorphiaObject.datastore = MorphiaObject.morphia.createDatastore(MorphiaObject.mongo, "test");
    MorphiaObject.datastore.ensureIndexes();  
    MorphiaObject.datastore.ensureCaps()

    Logger.debug("** Morphia datastore: " + MorphiaObject.datastore.getDB());
View Full Code Here

      String port = (String) context.getBean("port");
      String mongoUserName = (String) context.getBean("mongoUserName");
      String mongoUserPassword = (String) context.getBean("mongoUserPassword");
      Boolean isAuthenticated = (Boolean) context.getBean("isAuthenticated");
      Mongo jpy = (Mongo) context.getBean("jpy");
      Morphia morphia = (Morphia) context.getBean("morphia");
      ProductDao productDao = (ProductDao) context.getBean("productDao");
      log.info(productDao.toString());
    } catch(Exception exc) {
      log.error("Failed load context!!!");
    }
View Full Code Here

 
  static Morphia MORPHIA;
 
  public static Morphia getMorphia(){
    if(MORPHIA == null){
      MORPHIA = new Morphia();
      MORPHIA.map(TestObject.class);
    }
    return MORPHIA;
  }
View Full Code Here

            }
        }
        loggerRegistered_ = false;
        MorphiaLoggerFactory.reset();
        MorphiaLoggerFactory.registerLogger(loggerClazz);
        morphia_ = new Morphia();
        loggerRegistered_ = true;
        ds_ = morphia_.createDatastore(mongo_, dbName);
        dataStores_.put(dbName, ds_);

        String uploadCollection = c.getProperty("morphia.collection.upload", "uploads");
View Full Code Here

TOP

Related Classes of com.google.code.morphia.Morphia

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.