public AggregateListener[] getAggregateListenerInstances() { if (aggregateListenerPlugins.get() == null) aggregateListenerPlugins.instantiate(AggregateListener.class, this); return (AggregateListener[]) aggregateListenerPlugins.get(); }
public String getFilterListeners() { return filterListenerPlugins.getString(); }
/** * The plugin properties. */ public void setProperties(String[] props) { if (props == null) props = EMPTY; _props = props; set(null, true); valueChanged(); }
/** * Set partitions from a String configuration. * * @param parts a String of the form <code>(p1, p2, p3)</code> where p1, p2 etc. itself are plug-in strings * for individual Data Cache configuration. */ public void setPartitions(String parts) { _partProperties.clear(); parsePartitionProperties(parts); PluginListValue partitions = new PluginListValue("partitions"); String[] types = (String[])Array.newInstance(String.class, _partProperties.size()); Arrays.fill(types, _type.getName()); partitions.setClassNames(types); partitions.setProperties(_partProperties.toArray(new String[_partProperties.size()])); DataCache[] array = (DataCache[])partitions.instantiate(_type, conf); for (DataCache part : array) { if (part.getName() == null) throw new UserException(_loc.get("partition-cache-null-partition", parts)); if (_partitions.containsKey(part.getName())) throw new UserException(_loc.get("partition-cache-duplicate-partition", part.getName(), parts)); if (part.getName().equals(DataCache.NAME_DEFAULT)) throw new UserException(_loc.get("partition-cache-default-partition", part.getName(), parts)); _partitions.put(part.getName(), part); } }
public void setInstrument(String instrument) { _instrumentValues = new PluginListValue("Instrument"); if (getInstrumentAliases() != null) { _instrumentValues.setAliases(getInstrumentAliases()); } _instrumentValues.setString(instrument); Instrument[] instruments = (Instrument[])_instrumentValues.instantiate(Instrument.class, _config); for (Instrument inst : instruments) { inst.setProvider(this); _instruments.put(inst.getName(), inst); } }
str = getDefault(); if (StringUtils.isEmpty(str)) { _names = EMPTY; _props = EMPTY; set(null, true); valueChanged(); return; String clsName; for(String s : plugins) { clsName = unalias(Configurations.getClassName(s)); if (clsName != null) { names.add(clsName); set(null, true); valueChanged();
/** * Instantiate the plugins as instances of the given class. */ public Object instantiate(Class<?> elemType, Configuration conf, boolean fatal) { Object[] ret; if (_names.length == 0) ret = (Object[]) Array.newInstance(elemType, 0); else { ret = (Object[]) Array.newInstance(elemType, _names.length); for (int i = 0; i < ret.length; i++) { ret[i] = newInstance(_names[i], elemType, conf, fatal); Configurations.configureInstance(ret[i], conf, _props[i], getProperty()); } } set(ret, true); return ret; }
public void setFilterListeners(String filterListeners) { filterListenerPlugins.setString(filterListeners); }
filterListenerPlugins.setInstantiatingGetter("getFilterListenerInstances"); aggregateListenerPlugins.setInstantiatingGetter("getAggregateListenerInstances"); instrumentationProviders.setAliases(aliases); instrumentationProviders.setInstantiatingGetter("getInstrumentationInstances");
public void setFilterListeners(FilterListener[] listeners) { filterListenerPlugins.set(listeners); }
/** * Initializes all providers defined for the specified configuration. */ public void initialize(OpenJPAConfiguration conf, PluginListValue pluginVal) { InstrumentationProvider[] providers = (InstrumentationProvider[])pluginVal.instantiate(InstrumentationProvider.class, conf); _providers.addAll(Arrays.asList(providers)); }
/** * Add the given value to the set of configuration properties. */ public PluginListValue addPluginList(String property) { PluginListValue val = new PluginListValue(property); addValue(val); return val; }
protected void objectChanged() { Object[] vals = (Object[]) get(); if (vals == null || vals.length == 0) _names = EMPTY; else { _names = new String[vals.length]; for (int i = 0; i < vals.length; i++) _names[i] = (vals[i] == null) ? null : vals[i].getClass().getName(); } _props = EMPTY; }
/** * Override to recognize aliases of the class name without the attached * properties string. */ public String getString() { if (_names.length == 0) return null; StringBuffer buf = new StringBuffer(); for (int i = 0; i < _names.length; i++) { if (i > 0) buf.append(", "); buf.append(Configurations.getPlugin(alias(_names[i]), (i<_props.length) ? _props[i] : null)); } if (buf.length() == 0) return null; return buf.toString(); }
.setInstantiatingGetter("getFilterListenerInstances"); .setInstantiatingGetter("getAggregateListenerInstances");
/** * Set partitions from a String configuration. * * @param parts a String of the form <code>(p1, p2, p3)</code> where p1, p2 etc. itself are plug-in strings * for individual Data Cache configuration. */ public void setPartitions(String parts) { _partProperties.clear(); parsePartitionProperties(parts); PluginListValue partitions = new PluginListValue("partitions"); String[] types = (String[])Array.newInstance(String.class, _partProperties.size()); Arrays.fill(types, _type.getName()); partitions.setClassNames(types); partitions.setProperties(_partProperties.toArray(new String[_partProperties.size()])); DataCache[] array = (DataCache[])partitions.instantiate(_type, conf); for (DataCache part : array) { if (part.getName() == null) throw new UserException(_loc.get("partition-cache-null-partition", parts)); if (_partitions.containsKey(part.getName())) throw new UserException(_loc.get("partition-cache-duplicate-partition", part.getName(), parts)); if (part.getName().equals(DataCache.NAME_DEFAULT)) throw new UserException(_loc.get("partition-cache-default-partition", part.getName(), parts)); _partitions.put(part.getName(), part); } }
public void setInstrument(String instrument) { _instrumentValues = new PluginListValue("Instrument"); if (getInstrumentAliases() != null) { _instrumentValues.setAliases(getInstrumentAliases()); } _instrumentValues.setString(instrument); Instrument[] instruments = (Instrument[])_instrumentValues.instantiate(Instrument.class, _config); for (Instrument inst : instruments) { inst.setProvider(this); _instruments.put(inst.getName(), inst); } }
str = getDefault(); if (StringUtils.isEmpty(str)) { _names = EMPTY; _props = EMPTY; set(null, true); valueChanged(); return; for (int i = 0; i < plugins.size(); i++) { str = (String) plugins.get(i); clsName = unalias(Configurations.getClassName(str)); if (clsName != null) { names.add(clsName); set(null, true); valueChanged();
/** * Instantiate the plugins as instances of the given class. */ public Object instantiate(Class<?> elemType, Configuration conf, boolean fatal) { Object[] ret; if (_names.length == 0) ret = (Object[]) Array.newInstance(elemType, 0); else { ret = (Object[]) Array.newInstance(elemType, _names.length); for (int i = 0; i < ret.length; i++) { ret[i] = newInstance(_names[i], elemType, conf, fatal); Configurations.configureInstance(ret[i], conf, _props[i], getProperty()); } } set(ret, true); return ret; }
public void setInstrumentation(String providers) { instrumentationProviders.setString(providers); }