Package com.alvazan.orm.api.base

Examples of com.alvazan.orm.api.base.NoSqlEntityManagerFactory


     
    Map<String, Object> properties = new HashMap<String, Object>();
    Bootstrap.createAndAddBestCassandraConfiguration(properties , "", bean.getKeyspace(), bean.getSeeds());
    properties.put(Bootstrap.AUTO_CREATE_KEY, "create");
   
    NoSqlEntityManagerFactory factory = Bootstrap.create(storeType, properties);
    new PlayOrm(factory).start();
  }
View Full Code Here


        List<Class> classEmbeddables = Play.classloader.getAnnotatedClasses(NoSqlEmbeddable.class);
        classes.addAll(classEmbeddables);
        if (classes.isEmpty())
            return;
        else if (NoSql.getEntityManagerFactory() != null) {
          NoSqlEntityManagerFactory factory = NoSql.getEntityManagerFactory();
          factory.rescan(classes, Play.classloader);
          return;
        }

        Class<?> clazz = null;
        try {
      clazz = Class.forName("nosql.NoSqlConfigImpl");
      if(NoSqlConfig.class.isAssignableFrom(clazz)) {
        NoSqlConfig config = (NoSqlConfig) clazz.newInstance();
        config.configure(PROPS);
      } else {
        log.warn("We found a class="+clazz+" to use to configure playorm but it did not implement NoSqlConfig interface so we can't use it");
      }
     
    } catch (ClassNotFoundException e) {
      log.info("nosql.NoSqlConfigImpl not found so not instantiating and calling configure to do custom configuration of playorm");
      //ignore then
    } catch (InstantiationException e) {
      log.warn("Exception, could not instantiate="+clazz, e);
    } catch (IllegalAccessException e) {
      log.warn("Exception, could not instantiate="+clazz, e);
    }

    PROPS.put(Bootstrap.LIST_OF_EXTRA_CLASSES_TO_SCAN_KEY, classes);
    PROPS.put(Bootstrap.AUTO_CREATE_KEY, "create");

    for (java.util.Map.Entry<Object, Object> entry : Play.configuration.entrySet()) {
      PROPS.put((String) entry.getKey(), entry.getValue());
    }
       
        if (log.isInfoEnabled())
      log.info("Initializing PlayORM...");

        NoSqlEntityManagerFactory factory = Bootstrap.create(PROPS, Play.classloader);
        NoSql.setEntityManagerFactory(factory);
        CassandraAppender.setFactory(factory);
  }
View Full Code Here

    else if (storeType == DbTypeEnum.HBASE) {
      Bootstrap.createAndAddBestHBaseConfiguration(properties ,"", bean.getKeyspace(), bean.getSeeds());
    }
    properties.put(Bootstrap.AUTO_CREATE_KEY, "create");

    NoSqlEntityManagerFactory factory = Bootstrap.create(storeType, properties);
    new PlayOrm(factory).start();
  }
View Full Code Here

    if(spiImpl != null && spiImpl instanceof NoSqlRawSession) {
      temp = (NoSqlRawSession) spiImpl;
    }
   
    Injector injector = Guice.createInjector(new ProductionBindings(type, temp));
    NoSqlEntityManagerFactory factory = injector.getInstance(NoSqlEntityManagerFactory.class);

    Named named = Names.named("logger");
    Key<NoSqlRawSession> key = Key.get(NoSqlRawSession.class, named);
    NoSqlRawSession inst = injector.getInstance(key);
    inst.start(properties);
View Full Code Here

  public void onApplicationStart() {
        List<Class> classes = Play.classloader.getAnnotatedClasses(NoSqlEntity.class);
        if (classes.isEmpty())
            return;
        else if (NoSql.getEntityManagerFactory() != null) {
          NoSqlEntityManagerFactory factory = NoSql.getEntityManagerFactory();
          factory.rescan(classes, Play.classloader);
          return;
        }
       
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(Bootstrap.LIST_OF_EXTRA_CLASSES_TO_SCAN_KEY, classes);
        props.put(Bootstrap.AUTO_CREATE_KEY, "create");
       
        for(java.util.Map.Entry<Object, Object> entry : Play.configuration.entrySet()) {
          props.put((String) entry.getKey(), entry.getValue());
        }
       
        log.info("Initializing PlayORM...");

        NoSqlEntityManagerFactory factory = Bootstrap.create(props, Play.classloader);
        NoSql.setEntityManagerFactory(factory);
        CassandraAppender.setFactory(factory);
  }
View Full Code Here

     
    Map<String, Object> properties = new HashMap<String, Object>();
    Bootstrap.createAndAddBestCassandraConfiguration(properties , "", bean.getKeyspace(), bean.getSeeds());
    properties.put(Bootstrap.AUTO_CREATE_KEY, "create");
   
    NoSqlEntityManagerFactory factory = Bootstrap.create(storeType, properties);
    new PlayOrm(factory).start();
  }
View Full Code Here

    if(spiImpl != null && spiImpl instanceof NoSqlRawSession) {
      temp = (NoSqlRawSession) spiImpl;
    }
   
    Injector injector = Guice.createInjector(new ProductionBindings(type, temp));
    NoSqlEntityManagerFactory factory = injector.getInstance(NoSqlEntityManagerFactory.class);

    Named named = Names.named("logger");
    Key<NoSqlRawSession> key = Key.get(NoSqlRawSession.class, named);
    NoSqlRawSession inst = injector.getInstance(key);
    inst.start(properties);
View Full Code Here

    logEveryN = logEveryNRows;
    //BEFORE Timer, let's get setup first
    Map<String, Object> props = new HashMap<String, Object>();
    props.put(Bootstrap.AUTO_CREATE_KEY, "create");
    Bootstrap.createAndAddBestCassandraConfiguration(props, clusterName, "PlayOrmPerfTest", host);
    NoSqlEntityManagerFactory factory = Bootstrap.create(DbTypeEnum.CASSANDRA, props, null, null);
    DboTableMeta table = setupMetaData(numColumns, factory);
   
    timer.schedule(new StopTask(), timeInMinutes*1000);
   
    for(int i = 0; i < NUM_THREADS; i++) {
View Full Code Here

     
    Map<String, Object> properties = new HashMap<String, Object>();
    Bootstrap.createAndAddBestCassandraConfiguration(properties , "", bean.getKeyspace(), bean.getSeeds());
    properties.put(Bootstrap.AUTO_CREATE_KEY, "create");
   
    NoSqlEntityManagerFactory factory = Bootstrap.create(storeType, properties);
    new PlayOrm(factory).start();
  }
View Full Code Here

    Object factoryObj = properties.get(MonitorServiceFactory.NOSQL_MGR_FACTORY);
    if(factoryObj == null)
      throw new IllegalArgumentException("NOSQL_MGR_FACTORY is required and must be set");
    else if(!(factoryObj instanceof NoSqlEntityManagerFactory))
      throw new IllegalArgumentException("NOSQL_MGR_FACTORY is not an instance of NoSqlEntityManagerFactory");
    NoSqlEntityManagerFactory factory = (NoSqlEntityManagerFactory) factoryObj;
    impl.setFactory(factory);
    return impl;
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.base.NoSqlEntityManagerFactory

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.