/** * Check if a metaTableKey is a FijiTableAnnotator meta table key for a column annotation. * * @param metaTableKey the meta table key to check. * @return whether the given meta table key is a FijiTableAnnotator meta table key for a column * annotation. */ private static boolean isKCAColumnMetaTableKey( final String metaTableKey ) { final int firstColonIndex = metaTableKey.indexOf(':'); final int lastPeriodIndex = metaTableKey.lastIndexOf('.'); return metaTableKey.startsWith(METATABLE_KEY_PREFIX) // a colon between the prefix and the last period indicates a qualified column. && ((firstColonIndex > METATABLE_KEY_PREFIX.length() && lastPeriodIndex > firstColonIndex) // nothing between the prefix and the last period indicates a table key. || firstColonIndex == -1 && lastPeriodIndex != (METATABLE_KEY_PREFIX.length())) // +1 to exclude the '.'. && isValidAnnotationKey(keyFromMetaTableKey(metaTableKey)); }
/** * Check if a metaTableKey is a FijiTableAnnotator meta table key for a table annotation. * * @param metaTableKey the meta table key to check. * @return whether the given meta table key is a FijiTableAnnotator meta table key for a table * annotation. */ private static boolean isKCATableMetaTableKey( final String metaTableKey ) { final int lastPeriodIndex = metaTableKey.lastIndexOf('.'); return metaTableKey.startsWith(METATABLE_KEY_PREFIX) // The last period should be just after the prefix. && lastPeriodIndex == (METATABLE_KEY_PREFIX.length()) && isValidAnnotationKey(keyFromMetaTableKey(metaTableKey)); }
/** {@inheritDoc} */ @Override public Map<String, String> getTableAnnotationsMatching( final String pattern ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (keyFromMetaTableKey(metaTableKey).matches(pattern)) { collectedAnnotations.put(annotationKey, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Map<String, String> getTableAnnotationsStartingWith( final String prefix ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (keyFromMetaTableKey(metaTableKey).startsWith(prefix)) { collectedAnnotations.put(annotationKey, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Map<String, String> getTableAnnotationsContaining( final String substring ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (keyFromMetaTableKey(metaTableKey).contains(substring)) { collectedAnnotations.put(annotationKey, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Map<FijiColumnName, Set<String>> removeAllColumnAnnotations() throws IOException { requireState(State.OPEN, "remove annotation"); final Map<FijiColumnName, Set<String>> removedAnnotationKeys = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey)) { final FijiColumnName column = columnFromMetaTableKey(metaTableKey); if (null != column) { final Set<String> removedKeysInColumn = removedAnnotationKeys.get(column); if (null != removedKeysInColumn) { removedKeysInColumn.add(keyFromMetaTableKey(metaTableKey)); } else { removedAnnotationKeys.put(column, Sets.newHashSet(keyFromMetaTableKey(metaTableKey))); } removeKV(metaTableKey); } } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Map<String, String> getAllTableAnnotations() throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { collectedAnnotations.put(keyFromMetaTableKey(metaTableKey), getKV(metaTableKey)); } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Set<String> removeAllTableAnnotations() throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { removedAnnotationKeys.add(keyFromMetaTableKey(metaTableKey)); removeKV(metaTableKey); } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Set<String> removeTableAnnotationsContaining( final String substring ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.contains(substring)) { removedAnnotationKeys.add(annotationKey); removeKV(metaTableKey); } } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Set<String> removeAllColumnAnnotations( final FijiColumnName column ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { removedAnnotationKeys.add(keyFromMetaTableKey(metaTableKey)); removeKV(metaTableKey); } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Map<String, String> getAllColumnAnnotations( final FijiColumnName column ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { collectedAnnotations.put(keyFromMetaTableKey(metaTableKey), getKV(metaTableKey)); } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Map<String, String> getColumnAnnotationsContaining( final FijiColumnName column, final String substring ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.contains(substring)) { collectedAnnotations.put(annotationKey, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Set<String> removeTableAnnotationsStartingWith( final String prefix ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.startsWith(prefix)) { removedAnnotationKeys.add(annotationKey); removeKV(metaTableKey); } } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Set<String> removeTableAnnotationsMatching( final String pattern ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCATableMetaTableKey(metaTableKey)) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.matches(pattern)) { removedAnnotationKeys.add(annotationKey); removeKV(metaTableKey); } } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Map<String, String> getColumnAnnotationsMatching( final FijiColumnName column, final String pattern ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.matches(pattern)) { collectedAnnotations.put(annotationKey, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Map<String, String> getColumnAnnotationsStartingWith( final FijiColumnName column, final String prefix ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<String, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.startsWith(prefix)) { collectedAnnotations.put(annotationKey, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Set<String> removeColumnAnnotationsStartingWith( final FijiColumnName column, final String prefix ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.startsWith(prefix)) { removedAnnotationKeys.add(annotationKey); removeKV(metaTableKey); } } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Set<String> removeColumnAnnotationsContaining( final FijiColumnName column, final String substring ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<String> removedAnnotationKeys = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(column, columnFromMetaTableKey(metaTableKey))) { final String annotationKey = keyFromMetaTableKey(metaTableKey); if (annotationKey.contains(substring)) { removedAnnotationKeys.add(annotationKey); removeKV(metaTableKey); } } } return removedAnnotationKeys; }
/** {@inheritDoc} */ @Override public Map<FijiColumnName, String> getColumnAnnotationsInFamily( final String family, final String exactKey ) throws IOException { requireState(State.OPEN, "get annotation"); final Map<FijiColumnName, String> collectedAnnotations = Maps.newHashMap(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey)) { final FijiColumnName column = columnFromMetaTableKey(metaTableKey); if (null != column && Objects.equal(family, column.getFamily()) && Objects.equal(exactKey, keyFromMetaTableKey(metaTableKey))) { collectedAnnotations.put(column, getKV(metaTableKey)); } } } return collectedAnnotations; }
/** {@inheritDoc} */ @Override public Set<FijiColumnName> removeColumnAnnotationsInFamily( final String family, final String exactKey ) throws IOException { requireState(State.OPEN, "remove annotation"); final Set<FijiColumnName> removedColumns = Sets.newHashSet(); for (String metaTableKey : keySet()) { if (isKCAColumnMetaTableKey(metaTableKey) && Objects.equal(exactKey, keyFromMetaTableKey(metaTableKey))) { final FijiColumnName column = columnFromMetaTableKey(metaTableKey); if (null != column && Objects.equal(family, column.getFamily())) { removedColumns.add(column); removeKV(metaTableKey); } } } return removedColumns; }