本文整理汇总了Java中co.aurasphere.botmill.core.internal.util.ConfigurationUtils类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationUtils类的具体用法?Java ConfigurationUtils怎么用?Java ConfigurationUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationUtils类属于co.aurasphere.botmill.core.internal.util包,在下文中一共展示了ConfigurationUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BotMillSession
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* 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);
}
}
示例2: setup
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/** 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;
}
示例3: setup
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
@Before
public void setup() {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password"); // can be sourced out
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
botDefinitions.add(new AnnotatedDomain());
ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
ConfigurationBuilder.getInstance().setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
.setManuallySendReadReceipts(false).setReceiveDeliveryReceipts(false).setReceiveIsTyping(true)
.setReceiveReadReceipts(false)
.setStaticKeyboard(KeyboardBuilder.getInstance().addResponse(MessageFactory.createTextResponse("BODY"))
.setType(KeyboardType.SUGGESTED).buildKeyboard())
.buildConfiguration();
}
示例4: setup
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Setup.
*/
@Before
public void setup() {
ConfigurationUtils.loadEncryptedConfigurationProperties();
List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
botDefinitions.add(new AnnotatedDomain());
ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
NetworkUtils.postJsonConfig(ConfigurationBuilder.getInstance()
.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot").setManuallySendReadReceipts(false)
.setReceiveDeliveryReceipts(false).setReceiveIsTyping(true).setReceiveReadReceipts(false)
.setStaticKeyboard(KeyboardBuilder.getInstance()
.addResponse(MessageFactory.createTextResponse("BODY"))
.setType(KeyboardType.SUGGESTED).buildKeyboard())
.buildConfiguration());
}
示例5: setup
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Setup.
*/
@Before
public void setup() {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password"); // can be sourced out
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
botDefinitions.add(new AnnotatedDomain());
ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
ConfigurationBuilder.getInstance()
.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
.setManuallySendReadReceipts(false)
.setReceiveDeliveryReceipts(false)
.setReceiveIsTyping(true)
.setReceiveReadReceipts(false)
.setStaticKeyboard(
KeyboardBuilder.getInstance()
.addResponse(MessageFactory.createTextResponse("BODY"))
.setType(KeyboardType.SUGGESTED).buildKeyboard())
.buildConfiguration();
}
示例6: setup
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Setup.
*/
@Before
public void setup() {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password"); // can be sourced out
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
botDefinitions.add(new AnnotatedDomain());
ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
ConfigurationBuilder.getInstance()
.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
.setManuallySendReadReceipts(false)
.setReceiveDeliveryReceipts(false)
.setReceiveIsTyping(true)
.setReceiveReadReceipts(false)
.buildConfiguration();
}
示例7: setUp
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Sets the up.
*/
@Before
public void setUp() {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password"); // can be sourced out
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
botDefinitions.add(new AnnotatedDomain());
ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
ConfigurationBuilder.getInstance()
.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
.setManuallySendReadReceipts(false)
.setReceiveDeliveryReceipts(false)
.setReceiveIsTyping(true)
.setReceiveReadReceipts(false)
.buildConfiguration();
}
示例8: setUp
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
@Before
public void setUp() {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password"); // can be sourced out
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDefinitions = new ArrayList<BotDefinition>();
botDefinitions.add(new AnnotatedDomain());
ConfigurationUtils.setBotDefinitionInstance(botDefinitions);
ConfigurationBuilder.getInstance()
.setWebhook("https://kik-bot-021415.herokuapp.com/kikbot")
.setManuallySendReadReceipts(false)
.setReceiveDeliveryReceipts(false)
.setReceiveIsTyping(true)
.setReceiveReadReceipts(false)
.buildConfiguration();
}
示例9: defineBehaviour
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
public void defineBehaviour() {
ConfigurationUtils.loadEncryptedConfigurationProperties(); // loads the annotated encryption class.
ConfigurationUtils.loadBotDefinitions(); // loads the annotated bot.
addActionFrame(new MessageEvent(MESSAGE_TO_SEND), new AutoReply() {
@Override
public FbBotMillResponse createResponse(MessageEnvelope envelope) {
return ReplyFactory
.addGenericTemplate()
.addElement(
"A simple Button Template with a Buy Button")
.addButton(
ButtonFactory
.createBuyButton("buy_button_payload")
.setPaymentSummary("USD",
PaymentType.FIXED_AMOUNT,
"BotMill.io")
.addPriceLabel("A price label", "2")
.setTestPayment(true)
.addRequestedUserInfo(
RequestedUserInfo.CONTACT_PHONE)
.build()).endElement().build(envelope);
}
});
}
示例10: main
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
public static void main(String[] args) {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password"); // can be sourced out
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDef = new ArrayList<BotDefinition>();
botDef.add(new AnnotatedTemplatedBehaviourTest());
ConfigurationUtils.loadBotConfig();
ConfigurationUtils.setBotDefinitionInstance(botDef);
for(int i=0;i<10;i++) {
new Thread(new Runnable() {
String json = "{\"sender\":{\"id\":\"1158621824216736\"},\"recipient\":{\"id\":\"1226565047419159\"},\"timestamp\":1490832021661,\"message\":{\"mid\":\"mid.$cAAUPCFn4ymdhTcignVbHH3rzpKd_\",\"seq\":844819,\"text\":\"Hi!\"}}";
MessageEnvelope envelope = FbBotMillJsonUtils.fromJson(json, MessageEnvelope.class);
@Override
public void run() {
try {
IncomingToOutgoingMessageHandler.getInstance().process(envelope);
}catch(Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
示例11: init
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Initializes the BotMill servlet. The initialization will try to load the
* classes implementing {@link BotDefinition} in the classpath. If the
* classes are found and correctly loaded, the method
* {@link BotDefinition#defineBehaviour()} is called for each configuration.
*/
@Override
public void init() {
ConfigurationUtils.loadEncryptedConfigurationProperties();
ConfigurationUtils.loadConfigurationFile();
ConfigurationUtils.loadBotConfig();
ConfigurationUtils.loadBotDefinitions();
logger.info("BotMill servlet started.");
}
示例12: buildSession
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
public Session buildSession(String identifier) {
// check if it already has a session entry.
try {
PreparedStatement preparedStatement = this.source.prepareStatement(
"SELECT * FROM " +
ConfigurationUtils.getConfiguration().getProperty("hsql.table.prefix") +
"_SESSION "
+ "WHERE "
+ " IDENTIFIER = ?");
preparedStatement.setString(1, identifier);
ResultSet rs = preparedStatement.executeQuery();
Session session = new Session();
if(rs.getRow() == 0) { // meaning, no record. Create one.
PreparedStatement createRecord = this.source.prepareStatement(
"INSERT INTO " +
ConfigurationUtils.getConfiguration().getProperty("hsql.table.prefix") +
"_SESSION(IDENTIFIER) "
+ "VALUES(?) ");
createRecord.setString(1, identifier);
createRecord.executeQuery();
buildSession(identifier);
}else {
session.setIdentifier(rs.getString(0));
if(!rs.getString(1).equals("")) {
session.addKeyValuePair(JsonUtils.fromJson(rs.getString(1), KeyValuePair.class));
}
return session;
}
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
示例13: testEncryption
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Test encryption.
*/
@Test
public void testEncryption() {
System.out.println(ConfigurationUtils.getEncryptedConfiguration().getProperty("kik.user.name"));
System.out.println(ConfigurationUtils.getEncryptedConfiguration().getProperty("kik.api.key"));
assertEquals("botmill", ConfigurationUtils.getEncryptedConfiguration().getProperty("kik.user.name"));
}
示例14: testEncryptionCustom
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Test encryption custom.
*/
@Test
public void testEncryptionCustom() {
System.out.println(ConfigurationUtils.getEncryptedConfiguration().getProperty("kik.user.1"));
System.out.println(ConfigurationUtils.getEncryptedConfiguration().getProperty("kik.api.2"));
System.out.println(ConfigurationUtils.getEncryptedConfiguration().getProperty("data.strategy"));
assertEquals("botmill", ConfigurationUtils.getEncryptedConfiguration().getProperty("kik.user.name"));
}
示例15: EncryptionSampleTest
import co.aurasphere.botmill.core.internal.util.ConfigurationUtils; //导入依赖的package包/类
/**
* Instantiates a new encryption sample test.
*/
public EncryptionSampleTest() {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
enc.setPassword("password");
ConfigurationUtils.setEncryptedPropertiesEncryptor(enc);
// load a custom properties.
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill_custom.properties");
}