@Override public Map<String, String> parseConfig(String[] arguments) throws ParseException { CommandLine cmd = parse(arguments); return parseCommand(cmd); }
public AbstractConfigOptionParser() { parser = parser(); //options = options(); }
@GET @Produces(MediaType.APPLICATION_JSON) public EagleServiceSelfCheckAPIEntity selfCheck(){ EagleServiceSelfCheckAPIEntity entity = new EagleServiceSelfCheckAPIEntity(); entity.setHbaseZookeeperQuorum(EagleConfigFactory.load().getZKQuorum()); entity.setHbaseZookeeperClientPort(EagleConfigFactory.load().getZKPort()); entity.setEnv(EagleConfigFactory.load().getEnv()); return entity; } }
public long getTimestampFromDate(String dateStr) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_PATTERN); sdf.setTimeZone(EagleConfigFactory.load().getTimeZone()); Date d = sdf.parse(dateStr); return d.getTime(); }
/** * Check if audit is required based on the service names and audit configuration. * @param serviceName: Name of the service call. * @return */ private boolean isAuditingRequired (String serviceName) { if (EagleConfigFactory.load().isServiceAuditingEnabled() // As per jira EAGLE-47, HBase operation level audit is done only for Policy, Site and DataSource definitions. && ("AlertDefinitionService".equals(serviceName) || "AlertDataSourceService".equals(serviceName))) { return true; } return false; }
/** * get storage class by type configured as eagle.storage.type from eagle configuration: config.properties * * @return DataStorage instance * @throws IllegalDataStorageTypeException */ public static synchronized DataStorage getDataStorageByEagleConfig(boolean cache) throws IllegalDataStorageTypeException { String storageType = EagleConfigFactory.load().getStorageType(); if (!cache) { return newDataStorage(storageType); } if (singletonStorageInstance == null) { if (storageType == null) { LOG.error(EAGLE_STORAGE_TYPE + " is null, trying default data storage: " + DEFAULT_DATA_STORAGE_TYPE); storageType = DEFAULT_DATA_STORAGE_TYPE; } singletonStorageInstance = newDataStorage(storageType); } return singletonStorageInstance; }
public void setUp(){ client = new EagleServiceClientImpl("localhost", EagleConfigFactory.load().getServicePort()); }
private EagleConfigFactory() { init(); if (this.getStorageType() == null || this.getStorageType().equalsIgnoreCase("hbase")) { this.pool = new HTablePool(this.hbaseConf, 10); } }
public CommandLine parse(String[] arguments) throws ParseException { return this.parser.parse(this.options(), arguments); } }
@GET @Produces(MediaType.APPLICATION_JSON) public EagleServiceSelfCheckAPIEntity selfCheck(){ EagleServiceSelfCheckAPIEntity entity = new EagleServiceSelfCheckAPIEntity(); entity.setHBaseZookeeperQuorum(EagleConfigFactory.load().getZKQuorum()); entity.setHBaseZookeeperClientPort(EagleConfigFactory.load().getZKPort()); entity.setEnv(EagleConfigFactory.load().getEnv()); return entity; } }
static long createTimeStamp(int year, int month, int date, int hourOfDay, int minute, int second) { GregorianCalendar gc = new GregorianCalendar(); gc.clear(); gc.set(year, month, date, hourOfDay, minute, second); gc.setTimeZone(EagleConfigFactory.load().getTimeZone()); return gc.getTime().getTime(); }
/** * Check if audit is required based on the service names and audit configuration. * * @param serviceName: Name of the service call. * @return */ private boolean isAuditingRequired(String serviceName) { if (EagleConfigFactory.load().isServiceAuditingEnabled() // As per jira EAGLE-47, HBase operation level audit is done only for Policy, Site and DataSource definitions. && ("AlertDefinitionService".equals(serviceName) || "AlertDataSourceService".equals(serviceName))) { return true; } return false; }
@Override public void open() throws IOException { try { tbl = EagleConfigFactory.load().getHTable(this.table); // LOGGER.info("HBase table " + table + " audo reflush is " + (tbl.isAutoFlush() ? "enabled" : // "disabled")); } catch (Exception ex) { LOG.error("Cannot create htable", ex); throw new IOException(ex); } }
@Override public void open() throws IOException { try{ tbl = EagleConfigFactory.load().getHTable(this.table); // LOGGER.info("HBase table " + table + " audo reflush is " + (tbl.isAutoFlush() ? "enabled" : "disabled")); }catch(Exception ex){ LOG.error("Cannot create htable", ex); throw new IOException(ex); } }