public void open() throws IOException { if (isOpen) { return; // silently return } try { tbl = EagleConfigFactory.load().getHTable(this.table); } catch (RuntimeException ex) { throw new IOException(ex); } isOpen = true; }
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(); }
private LdapService(){ EagleConfig manager = EagleConfigFactory.load(); securityPrincipal = manager.getConfig().getString(SECURITY_PRINCIPAL_CONFIG_NAME); securityCredentials = manager.getConfig().getString(SECURITY_CREDENTIALS_CONFIG_NAME); String ldapServer = manager.getConfig().getString(LDAP_SERVER_CONFIG_NAME); if(LOG.isDebugEnabled()) LOG.debug(SECURITY_PRINCIPAL_CONFIG_NAME+":"+securityPrincipal); ldapCerts = manager.getConfig().getString(LDAP_CERTS_CONFIG_NAME); if(ldapCerts == null) { ldapCerts = LdapService.class.getClassLoader().getResource(DEFAULT_LDAP_CERTS_FILE_NAME).getPath();
@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; } }
tbl = EagleConfigFactory.load().getHTable(ed.getTable()); } catch (RuntimeException ex) { throw new IOException(ex); s1.setFilter(filter); int cs = EagleConfigFactory.load().getHBaseClientScanCacheSize(); s1.setCaching(cs);
aggregateCondition.setTimeSeries(this.timeSeries); aggregateCondition.setIntervalMS(this.intervalmin * 60 * 1000); if (EagleConfigFactory.load().isCoprocessorEnabled()) { return new GenericCoprocessorAggregateQuery(this.serviceName, this.searchCondition,
if(EagleConfigFactory.load().isTableNamePrefixedWithEnvironment()){ tableName = EagleConfigFactory.load().getEnv() + "_" + tableName;
private List<Scan> buildScans() { final ArrayList<Scan> result = new ArrayList<Scan>(indexRowkeys.size()); for (byte[] rowkey : indexRowkeys) { Scan s = new Scan(); s.setStartRow(rowkey); // In rowkey the tag key/value is sorted by the hash code of the key, so MAX_TAG_VALUE_BYTES is // enough as the end key final byte[] stopRowkey = ByteUtil.concat(rowkey, MAX_TAG_VALUE_BYTES); s.setStopRow(stopRowkey); // TODO the # of cached rows should be minimum of (pagesize and 100) int cs = EagleConfigFactory.load().getHBaseClientScanCacheSize(); s.setCaching(cs); // TODO not optimized for all applications s.setCacheBlocks(true); // scan specified columnfamily for all qualifiers s.addFamily(indexDef.getEntityDefinition().getColumnFamily().getBytes()); result.add(s); } return result; }
@Override public void readAsStream() throws Exception { // populate listeners to all readers for (EntityCreationListener l : listeners) { for (GenericEntityStreamReader r : readers) { r.register(l); } } List<Future<Void>> futures = new ArrayList<Future<Void>>(); for (GenericEntityStreamReader r : readers) { SingleReader reader = new SingleReader(r); Future<Void> readFuture = EagleConfigFactory.load().getExecutor().submit(reader); futures.add(readFuture); } // join threads and check exceptions for (Future<Void> future : futures) { try { future.get(); } catch (Exception ex) { LOG.error("Error in read", ex); throw ex; } } }
return; // silently return try { tbl = EagleConfigFactory.load().getHTable(_ed.getTable()); } catch (RuntimeException ex) { throw new IOException(ex); s1.setFilter(filter); int cs = EagleConfigFactory.load().getHBaseClientScanCacheSize(); s1.setCaching(cs);
@QueryParam("metricName") String metricName, @QueryParam("verbose") Boolean verbose) { if(!EagleConfigFactory.load().isCoprocessorEnabled()) return listQueryWithoutCoprocessor(query,startTime,endTime,pageSize,startRowkey,treeAgg,timeSeries,intervalmin,top,filterIfMissing,parallel,metricName,verbose);
@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; } }
if (EagleConfigFactory.load().isTableNamePrefixedWithEnvironment()) { tableName = EagleConfigFactory.load().getEnv() + "_" + tableName;
private List<Scan> buildScans() { final ArrayList<Scan> result = new ArrayList<Scan>(indexRowkeys.size()); for (byte[] rowkey : indexRowkeys) { Scan s = new Scan(); s.setStartRow(rowkey); // In rowkey the tag key/value is sorted by the hash code of the key, so MAX_TAG_VALUE_BYTES is enough as the end key final byte[] stopRowkey = ByteUtil.concat(rowkey, MAX_TAG_VALUE_BYTES); s.setStopRow(stopRowkey); // TODO the # of cached rows should be minimum of (pagesize and 100) int cs = EagleConfigFactory.load().getHBaseClientScanCacheSize(); s.setCaching(cs); // TODO not optimized for all applications s.setCacheBlocks(true); // scan specified columnfamily for all qualifiers s.addFamily(indexDef.getEntityDefinition().getColumnFamily().getBytes()); result.add(s); } return result; }
@Override public void readAsStream() throws Exception{ // populate listeners to all readers for(EntityCreationListener l : _listeners){ for(GenericEntityStreamReader r : readers){ r.register(l); } } List<Future<Void>> futures = new ArrayList<Future<Void>>(); for(GenericEntityStreamReader r : readers){ SingleReader reader = new SingleReader(r); Future<Void> readFuture = EagleConfigFactory.load().getExecutor().submit(reader); futures.add(readFuture); } // join threads and check exceptions for(Future<Void> future : futures){ try{ future.get(); }catch(Exception ex){ LOG.error("Error in read", ex); throw 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); } }
Date date = new Date(startTime); SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd%20HH:mm:ss"); dateFormatter.setTimeZone(EagleConfigFactory.load().getTimeZone()); String timeString = dateFormatter.format(date); sb.append("&startTime=").append(timeString);
@QueryParam("metricName") String metricName, @QueryParam("verbose") Boolean verbose) { if(!EagleConfigFactory.load().isCoprocessorEnabled()) return listQueryWithoutCoprocessor(query,startTime,endTime,pageSize,startRowkey,treeAgg,timeSeries,intervalmin,top,filterIfMissing,parallel,metricName,verbose);
private LdapService() { EagleConfig manager = EagleConfigFactory.load(); securityPrincipal = manager.getConfig().getString(SECURITY_PRINCIPAL_CONFIG_NAME); securityCredentials = manager.getConfig().getString(SECURITY_CREDENTIALS_CONFIG_NAME); String ldapServer = manager.getConfig().getString(LDAP_SERVER_CONFIG_NAME); if (LOG.isDebugEnabled()) { LOG.debug(SECURITY_PRINCIPAL_CONFIG_NAME + ":" + securityPrincipal); ldapCerts = manager.getConfig().getString(LDAP_CERTS_CONFIG_NAME); if (ldapCerts == null) { ldapCerts = LdapService.class.getClassLoader().getResource(DEFAULT_LDAP_CERTS_FILE_NAME).getPath();
@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); } }