public ObserversV1(Environment env, Map<Column, org.apache.fluo.api.config.ObserverSpecification> strongObservers, Map<Column, org.apache.fluo.api.config.ObserverSpecification> weakObservers) { this.env = env; this.strongObservers = strongObservers; this.weakObservers = weakObservers; this.aliases = new HashMap<>(); for (Entry<Column, org.apache.fluo.api.config.ObserverSpecification> e : Iterables .concat(strongObservers.entrySet(), weakObservers.entrySet())) { org.apache.fluo.api.config.ObserverSpecification observerConfig = e.getValue(); try { String alias = Class.forName(observerConfig.getClassName()).asSubclass(Observer.class).getSimpleName(); aliases.put(e.getKey(), alias); } catch (ClassNotFoundException e1) { throw new RuntimeException(e1); } } }
public ObserversV1(Environment env, Map<Column, org.apache.fluo.api.config.ObserverSpecification> strongObservers, Map<Column, org.apache.fluo.api.config.ObserverSpecification> weakObservers) { this.env = env; this.strongObservers = strongObservers; this.weakObservers = weakObservers; this.aliases = new HashMap<>(); for (Entry<Column, org.apache.fluo.api.config.ObserverSpecification> e : Iterables .concat(strongObservers.entrySet(), weakObservers.entrySet())) { org.apache.fluo.api.config.ObserverSpecification observerConfig = e.getValue(); try { String alias = Class.forName(observerConfig.getClassName()).asSubclass(Observer.class).getSimpleName(); aliases.put(e.getKey(), alias); } catch (ClassNotFoundException e1) { throw new RuntimeException(e1); } } }
@Deprecated private void addObserver(ObserverSpecification oconf, int next) { Map<String, String> params = oconf.getConfiguration().toMap(); StringBuilder paramString = new StringBuilder(); for (java.util.Map.Entry<String, String> pentry : params.entrySet()) { paramString.append(','); paramString.append(pentry.getKey()); paramString.append('='); paramString.append(pentry.getValue()); } setProperty(OBSERVER_PREFIX + "" + next, oconf.getClassName() + paramString); }
@Deprecated private void addObserver(ObserverSpecification oconf, int next) { Map<String, String> params = oconf.getConfiguration().toMap(); StringBuilder paramString = new StringBuilder(); for (java.util.Map.Entry<String, String> pentry : params.entrySet()) { paramString.append(','); paramString.append(pentry.getKey()); paramString.append('='); paramString.append(pentry.getValue()); } setProperty(OBSERVER_PREFIX + "" + next, oconf.getClassName() + paramString); }
private static void serializeObservers(DataOutputStream dos, Map<Column, org.apache.fluo.api.config.ObserverSpecification> colObservers) throws IOException { // TODO use a human readable serialized format like json Set<Entry<Column, org.apache.fluo.api.config.ObserverSpecification>> es = colObservers.entrySet(); WritableUtils.writeVInt(dos, colObservers.size()); for (Entry<Column, org.apache.fluo.api.config.ObserverSpecification> entry : es) { ColumnUtil.writeColumn(entry.getKey(), dos); dos.writeUTF(entry.getValue().getClassName()); Map<String, String> params = entry.getValue().getConfiguration().toMap(); WritableUtils.writeVInt(dos, params.size()); for (Entry<String, String> pentry : params.entrySet()) { dos.writeUTF(pentry.getKey()); dos.writeUTF(pentry.getValue()); } } }
private static void serializeObservers(DataOutputStream dos, Map<Column, org.apache.fluo.api.config.ObserverSpecification> colObservers) throws IOException { // TODO use a human readable serialized format like json Set<Entry<Column, org.apache.fluo.api.config.ObserverSpecification>> es = colObservers.entrySet(); WritableUtils.writeVInt(dos, colObservers.size()); for (Entry<Column, org.apache.fluo.api.config.ObserverSpecification> entry : es) { ColumnUtil.writeColumn(entry.getKey(), dos); dos.writeUTF(entry.getValue().getClassName()); Map<String, String> params = entry.getValue().getConfiguration().toMap(); WritableUtils.writeVInt(dos, params.size()); for (Entry<String, String> pentry : params.entrySet()) { dos.writeUTF(pentry.getKey()); dos.writeUTF(pentry.getValue()); } } }
try { observer = Class.forName(observerConfig.getClassName()).asSubclass(Observer.class).newInstance(); observer.init(new ObserverContext(env, observerConfig.getConfiguration())); } catch (RuntimeException e) { "Mismatch between configured column and class column " + observerConfig.getClassName() + " " + col + " " + observer.getObservedColumn().getColumn());
try { observer = Class.forName(observerConfig.getClassName()).asSubclass(Observer.class).newInstance(); observer.init(new ObserverContext(env, observerConfig.getConfiguration())); } catch (RuntimeException e) { "Mismatch between configured column and class column " + observerConfig.getClassName() + " " + col + " " + observer.getObservedColumn().getColumn());
Observer observer; try { observer = Class.forName(ospec.getClassName()).asSubclass(Observer.class).newInstance(); } catch (ClassNotFoundException e1) { throw new FluoException("Observer class '" + ospec.getClassName() + "' was not " + "found. Check for class name misspellings or failure to include " + "the observer jar.", e1); } catch (InstantiationException | IllegalAccessException e2) { throw new FluoException( "Observer class '" + ospec.getClassName() + "' could not be created.", e2); observer.init(new ObserverContext(config.getAppConfiguration(), oc)); } catch (Exception e) { throw new FluoException("Observer '" + ospec.getClassName() + "' could not be initialized", e);
Observer observer; try { observer = Class.forName(ospec.getClassName()).asSubclass(Observer.class).newInstance(); } catch (ClassNotFoundException e1) { throw new FluoException("Observer class '" + ospec.getClassName() + "' was not " + "found. Check for class name misspellings or failure to include " + "the observer jar.", e1); } catch (InstantiationException | IllegalAccessException e2) { throw new FluoException( "Observer class '" + ospec.getClassName() + "' could not be created.", e2); observer.init(new ObserverContext(config.getAppConfiguration(), oc)); } catch (Exception e) { throw new FluoException("Observer '" + ospec.getClassName() + "' could not be initialized", e);