/** The mongodb ops. */ /* (non-Javadoc) * @see co.aurasphere.botmill.core.datastore.adapter.DataAdapter#setup() */ public void setup() { MongoCredential credential = MongoCredential.createCredential( ConfigurationUtils.getEncryptedConfiguration().getProperty("mongodb.username"), ConfigurationUtils.getEncryptedConfiguration().getProperty("mongodb.database"), ConfigurationUtils.getEncryptedConfiguration().getProperty("mongodb.password").toCharArray()); ServerAddress serverAddress = new ServerAddress( ConfigurationUtils.getEncryptedConfiguration().getProperty("mongodb.server"), Integer.valueOf(ConfigurationUtils.getEncryptedConfiguration().getProperty("mongodb.port"))); MongoClient mongoClient = new MongoClient(serverAddress, Arrays.asList(credential)); SimpleMongoDbFactory simpleMongoDbFactory = new SimpleMongoDbFactory(mongoClient, ConfigurationUtils.getEncryptedConfiguration().getProperty("mongodb.database")); MongoTemplate mongoTemplate = new MongoTemplate(simpleMongoDbFactory); this.source = (MongoOperations) mongoTemplate; }
/** * Builds the Fb bot config. * * @throws BotMillMissingConfigurationException * the bot mill missing configuration exception */ private void buildFbBotConfig() { FbBotMillContext.getInstance().setup( ConfigurationUtils.getEncryptedConfiguration().getProperty(FB_BOTMILL_PAGE_TOKEN), ConfigurationUtils.getEncryptedConfiguration().getProperty(FB_BOTMILL_VALIDATION_TOKEN)); } }
/** * Instantiates a new bot mill session. */ private BotMillSession() { // check the data adapter type from the properties. // map, hsql, mongodb, rdbms String dataAdapterType = ConfigurationUtils.getEncryptedConfiguration().getProperty("data.adapter.type"); if(dataAdapterType == null || dataAdapterType.equals("map")) { defineDataAdapter(DataAdapterType.MAP); }else if(dataAdapterType.equals("mongodb")){ defineDataAdapter(DataAdapterType.MONGODB); }else if(dataAdapterType.equals("hsql")) { defineDataAdapter(DataAdapterType.HSQL); }else if(dataAdapterType.equals("rdbms")) { defineDataAdapter(DataAdapterType.RBDMS); }else { logger.info("No Data Adapter Type specified on the botmill.properties, defaulting to Map"); defineDataAdapter(DataAdapterType.MAP); } }