Search in sources :

Example 1 with NotifyDataAdpater

use of com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater in project uavstack by uavorg.

the class HealthManager method buildDataStores.

private void buildDataStores(IConfigurationManager icm) {
    // log
    String logKey = MonitorDataFrame.MessageType.Log.toString();
    // monitor
    String monitorKey = MonitorDataFrame.MessageType.Monitor.toString();
    // profile
    String profileKey = MonitorDataFrame.MessageType.Profile.toString();
    // notification
    String notifyKey = MonitorDataFrame.MessageType.Notification.toString();
    // nodeinfo
    String nodeinfoKey = MonitorDataFrame.MessageType.NodeInfo.toString();
    String caching = icm.getFeatureConfiguration(this.feature, logKey + ".ds.cache");
    String maxResultSize = icm.getFeatureConfiguration(this.feature, logKey + ".ds.maxResultSize");
    String reverse = icm.getFeatureConfiguration(this.feature, logKey + ".ds.reverse");
    String psize = icm.getFeatureConfiguration(this.feature, logKey + ".ds.pagesize");
    Map<String, Object> lctx = new HashMap<String, Object>();
    lctx.put(DataStoreProtocol.HBASE_QUERY_CACHING, caching);
    lctx.put(DataStoreProtocol.HBASE_QUERY_MAXRESULTSIZE, maxResultSize);
    lctx.put(DataStoreProtocol.HBASE_QUERY_REVERSE, DataConvertHelper.toBoolean(Boolean.valueOf(reverse), true));
    lctx.put(DataStoreProtocol.HBASE_QUERY_PAGESIZE, DataConvertHelper.toLong(Long.valueOf(psize), 3000));
    // build log ds
    buildDataStore(icm, logKey, DataStoreType.HBASE, new LogDataAdapter(), lctx);
    Map<String, Object> mctx = new HashMap<String, Object>();
    mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXPERROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.maxPerRoute"), 10));
    mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.maxRoute"), 50));
    mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_SOTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.soTimeout"), 5000));
    mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_CONNTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.connTimeout"), 5000));
    mctx.put(DataStoreProtocol.OPENTSDB_CLIENT_REQTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, monitorKey + ".ds.reqTimeout"), 5000));
    // build monitor ds
    buildDataStore(icm, monitorKey, DataStoreType.OPENTSDB, new MonitorDataAdapter(), mctx);
    // build profile ds
    buildDataStore(icm, profileKey, DataStoreType.MONGODB, new ProfileDataAdpater(), null);
    // build notify ds
    buildDataStore(icm, notifyKey, DataStoreType.MONGODB, new NotifyDataAdpater(), null);
    Map<String, Object> nctx = new HashMap<String, Object>();
    nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXPERROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.maxPerRoute"), 10));
    nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_MAXROUTE, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.maxRoute"), 50));
    nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_SOTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.soTimeout"), 5000));
    nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_CONNTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.connTimeout"), 5000));
    nctx.put(DataStoreProtocol.OPENTSDB_CLIENT_REQTIMEOUT, DataConvertHelper.toInt(icm.getFeatureConfiguration(this.feature, nodeinfoKey + ".ds.reqTimeout"), 5000));
    // build nodeinfo ds
    buildDataStore(icm, nodeinfoKey, DataStoreType.OPENTSDB, new NodeInfoDataAdapter(), nctx);
}
Also used : MonitorDataAdapter(com.creditease.uav.feature.healthmanager.datastore.adaptors.MonitorDataAdapter) NotifyDataAdpater(com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater) HashMap(java.util.HashMap) NodeInfoDataAdapter(com.creditease.uav.feature.healthmanager.datastore.adaptors.NodeInfoDataAdapter) LogDataAdapter(com.creditease.uav.feature.healthmanager.datastore.adaptors.LogDataAdapter) ProfileDataAdpater(com.creditease.uav.feature.healthmanager.datastore.adaptors.ProfileDataAdpater)

Example 2 with NotifyDataAdpater

use of com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater in project uavstack by uavorg.

the class DoTestNotifyData4Mongo method testquerytNotifyMongoDB.

@SuppressWarnings("rawtypes")
public static void testquerytNotifyMongoDB() {
    String query = DataStoreUnitTest.getData(queryJson);
    DataStoreMsg request = new DataStoreMsg();
    request.put(DataStoreProtocol.MONGO_QUERY_SQL, query.toString());
    request.put(DataStoreProtocol.MONGO_COLLECTION_NAME, HealthManagerConstants.MONGO_COLLECTION_NOTIFY);
    DataStoreConnection obj = new DataStoreConnection(userName, password, dbName, serverlist, DataStoreType.MONGODB);
    AbstractDataStore store = DataStoreFactory.getInstance().build(HealthManagerConstants.DataStore_Notification, obj, new NotifyDataAdpater(), "");
    store.start();
    @SuppressWarnings("unchecked") List<Object> list = store.doQuery(request);
    store.stop();
    DataStoreUnitTest.printTestResult("testquerytNotifyMongoDB", list, query);
}
Also used : DataStoreConnection(com.creditease.uav.datastore.api.DataStoreConnection) NotifyDataAdpater(com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater) DataStoreMsg(com.creditease.uav.datastore.api.DataStoreMsg) AbstractDataStore(com.creditease.uav.datastore.core.AbstractDataStore)

Example 3 with NotifyDataAdpater

use of com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater in project uavstack by uavorg.

the class DoTestNotifyData4Mongo method testInsertNotifyMongoDB.

@SuppressWarnings({ "rawtypes" })
public static void testInsertNotifyMongoDB() {
    DataStoreMsg msg = new DataStoreMsg();
    // MongoDBHandler
    String rawData = DataStoreUnitTest.getData(insertJson);
    msg.put(MonitorDataFrame.MessageType.Notification.toString(), rawData);
    msg.put(DataStoreProtocol.MONGO_COLLECTION_NAME, HealthManagerConstants.MONGO_COLLECTION_NOTIFY);
    DataStoreConnection obj = new DataStoreConnection(userName, password, dbName, serverlist, DataStoreType.MONGODB);
    AbstractDataStore store = DataStoreFactory.getInstance().build(HealthManagerConstants.DataStore_Notification, obj, new NotifyDataAdpater(), "");
    store.start();
    boolean rst = store.doInsert(msg);
    store.stop();
    DataStoreUnitTest.printTestResult("testInsertNotifyMongoDB", rst);
}
Also used : DataStoreConnection(com.creditease.uav.datastore.api.DataStoreConnection) NotifyDataAdpater(com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater) DataStoreMsg(com.creditease.uav.datastore.api.DataStoreMsg) AbstractDataStore(com.creditease.uav.datastore.core.AbstractDataStore)

Aggregations

NotifyDataAdpater (com.creditease.uav.feature.healthmanager.datastore.adaptors.NotifyDataAdpater)3 DataStoreConnection (com.creditease.uav.datastore.api.DataStoreConnection)2 DataStoreMsg (com.creditease.uav.datastore.api.DataStoreMsg)2 AbstractDataStore (com.creditease.uav.datastore.core.AbstractDataStore)2 LogDataAdapter (com.creditease.uav.feature.healthmanager.datastore.adaptors.LogDataAdapter)1 MonitorDataAdapter (com.creditease.uav.feature.healthmanager.datastore.adaptors.MonitorDataAdapter)1 NodeInfoDataAdapter (com.creditease.uav.feature.healthmanager.datastore.adaptors.NodeInfoDataAdapter)1 ProfileDataAdpater (com.creditease.uav.feature.healthmanager.datastore.adaptors.ProfileDataAdpater)1 HashMap (java.util.HashMap)1