@Override public boolean hasNext() { while ((delegate == null || !delegate.hasNext()) && (providers.hasNext())) { final QueueItemAuthenticatorProvider provider = providers.next(); if (provider == null) { continue; } delegate = new ArrayList<QueueItemAuthenticator>(provider.getAuthenticators()).iterator(); } return delegate != null && delegate.hasNext(); }
protected Iterator<String> listKeys(Path path) throws IOException { ArrayList<String> ret = new ArrayList<String>(); FileStatus[] files = _fs.listStatus(new Path[]{path}); if (files != null) { for (FileStatus sub : files) { try { ret.add(sub.getPath().getName().toString()); } catch (IllegalArgumentException e) { //Ignored the file did not match LOG.debug("Found an unexpected file in {} {}", path, sub.getPath().getName()); } } } return ret.iterator(); }
@Test public void testUnsecure() throws ZooKeeperConnectionException, IOException { Configuration conf = HBaseConfiguration.create(); conf.set(Superusers.SUPERUSER_CONF_KEY, "user1"); String node = "/hbase/testUnsecure"; ZKWatcher watcher = new ZKWatcher(conf, node, null, false); List<ACL> aclList = ZKUtil.createACL(watcher, node, false); assertEquals(1, aclList.size()); assertTrue(aclList.contains(Ids.OPEN_ACL_UNSAFE.iterator().next())); }
public MessageAck[] getAcks() { ArrayList<Object> list = new ArrayList<Object>(); for (Iterator<TxOperation> iter = operations.iterator(); iter.hasNext();) { TxOperation op = iter.next(); if (op.operationType == TxOperation.REMOVE_OPERATION_TYPE) { list.add(op.data); } } MessageAck rc[] = new MessageAck[list.size()]; list.toArray(rc); return rc; }
protected Iterator<LocalFsBlobStoreFile> listBlobStoreFiles(File path) throws IOException { ArrayList<LocalFsBlobStoreFile> ret = new ArrayList<LocalFsBlobStoreFile>(); File[] files = path.listFiles(); if (files != null) { for (File sub : files) { try { ret.add(new LocalFsBlobStoreFile(sub.getParentFile(), sub.getName())); } catch (IllegalArgumentException e) { //Ignored the file did not match LOG.warn("Found an unexpected file in {} {}", path, sub.getName()); } } } return ret.iterator(); }
private ArrayList<JniSection> getNativeCodeBodies (String classFile) { ArrayList<JniSection> sections = getComments(classFile); Iterator<JniSection> iter = sections.iterator(); while (iter.hasNext()) { JniSection section = iter.next(); if (section.getNativeCode().startsWith("JNI")) iter.remove(); if (section.getNativeCode().startsWith("-{")) iter.remove(); if (!CustomIgnoreTag.isEmpty() && section.getNativeCode().startsWith(CustomIgnoreTag)) iter.remove(); } return sections; }
@Test public void testSecuritySingleSuperuser() throws ZooKeeperConnectionException, IOException { Configuration conf = HBaseConfiguration.create(); conf.set(Superusers.SUPERUSER_CONF_KEY, "user1"); String node = "/hbase/testSecuritySingleSuperuser"; ZKWatcher watcher = new ZKWatcher(conf, node, null, false); List<ACL> aclList = ZKUtil.createACL(watcher, node, true); assertEquals(2, aclList.size()); // 1+1, since ACL will be set for the creator by default assertTrue(aclList.contains(new ACL(Perms.ALL, new Id("sasl", "user1")))); assertTrue(aclList.contains(Ids.CREATOR_ALL_ACL.iterator().next())); }
public Message[] getMessages() { ArrayList<Object> list = new ArrayList<Object>(); for (Iterator<TxOperation> iter = operations.iterator(); iter.hasNext();) { TxOperation op = iter.next(); if (op.operationType == TxOperation.ADD_OPERATION_TYPE) { list.add(op.data); } } Message rc[] = new Message[list.size()]; list.toArray(rc); return rc; }
protected Iterator<BlobStoreFile> listBlobStoreFiles(Path path) throws IOException { ArrayList<BlobStoreFile> ret = new ArrayList<BlobStoreFile>(); FileStatus[] files = _fs.listStatus(new Path[]{path}); if (files != null) { for (FileStatus sub : files) { try { ret.add(new HdfsBlobStoreFile(sub.getPath().getParent(), sub.getPath().getName(), _hadoopConf)); } catch (IllegalArgumentException e) { //Ignored the file did not match LOG.warn("Found an unexpected file in {} {}", path, sub.getPath().getName()); } } } return ret.iterator(); }
private ArrayList<JniSection> getNativeCodeBodies (String classFile) { ArrayList<JniSection> sections = getComments(classFile); Iterator<JniSection> iter = sections.iterator(); while (iter.hasNext()) { JniSection section = iter.next(); if (section.getNativeCode().startsWith("JNI")) iter.remove(); if (section.getNativeCode().startsWith("-{")) iter.remove(); if (!CustomIgnoreTag.isEmpty() && section.getNativeCode().startsWith(CustomIgnoreTag)) iter.remove(); } return sections; }
private synchronized void refreshMeasurements() { ArrayList<Measurement> newMeasurements = new ArrayList<Measurement>(); Iterator<Measurement> iterator = mMeasurements.iterator(); while (iterator.hasNext()) { Measurement measurement = iterator.next(); if (SystemClock.elapsedRealtime() - measurement.timestamp < sampleExpirationMilliseconds ) { newMeasurements.add(measurement); } } mMeasurements = newMeasurements; Collections.sort(mMeasurements); }
protected Iterator<LocalFsBlobStoreFile> listBlobStoreFiles(File path) throws IOException { ArrayList<LocalFsBlobStoreFile> ret = new ArrayList<LocalFsBlobStoreFile>(); File[] files = path.listFiles(); if (files != null) { for (File sub: files) { try { ret.add(new LocalFsBlobStoreFile(sub.getParentFile(), sub.getName())); } catch (IllegalArgumentException e) { //Ignored the file did not match LOG.warn("Found an unexpected file in {} {}",path, sub.getName()); } } } return ret.iterator(); }
protected String getExpressionSetSummary(java.util.ArrayList<Integer> list) { if (list.contains(NO_SPEC)) { return "?"; } if (list.contains(ALL_SPEC)) { return "*"; } StringBuilder buf = new StringBuilder(); Iterator<Integer> itr = list.iterator(); boolean first = true; while (itr.hasNext()) { Integer iVal = itr.next(); String val = iVal.toString(); if (!first) { buf.append(","); } buf.append(val); first = false; } return buf.toString(); }
public void addMetric(MetricData data) { Iterator<MetricData> it = metricData.iterator(); while (it.hasNext()) { MetricData temp = it.next(); if (temp.metricName.equals(data.metricName)) { // System.out.println("Not adding same metric again......"+temp.metricName); return; } } metricData.add(data); }