use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class MonitorManager method getEventSourceNamesByAdapters.
/**
* Returns a list of names of throwers that can throw at least one of the events in the list.
* Used by EditTrigger to populate sources-listbox.
*/
public List getEventSourceNamesByAdapters(String[] adapters) {
List result = new ArrayList();
for (int j = 0; j < adapters.length; j++) {
IAdapter adapter = findAdapterByName(adapters[j]);
if (adapter != null) {
List sources = (List) throwersByAdapter.get(adapter);
if (sources != null) {
for (int i = 0; i < sources.size(); i++) {
EventThrowing source = (EventThrowing) sources.get(i);
String adapterName = source.getAdapter() != null ? source.getAdapter().getName() : "";
result.add(adapterName + " / " + source.getEventSourceName());
}
}
}
}
Collections.sort(result);
return result;
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class MonitorManager method getAdapterNamesByEventCodes.
public List getAdapterNamesByEventCodes(List eventCodes) {
List result = new ArrayList();
for (int i = 0; i < eventCodes.size(); i++) {
String eventCode = (String) eventCodes.get(i);
List adapters = (List) adaptersByEvent.get(eventCode);
for (Iterator it = adapters.iterator(); it.hasNext(); ) {
IAdapter adapter = (IAdapter) it.next();
if (!result.contains(adapter.getName())) {
result.add(adapter.getName());
}
}
}
Collections.sort(result);
return result;
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class MonitorManager method getAdapterNames.
public List getAdapterNames() {
List result = new ArrayList();
for (Iterator it = eventsByAdapter.keySet().iterator(); it.hasNext(); ) {
IAdapter adapter = (IAdapter) it.next();
result.add(adapter.getName());
}
Collections.sort(result);
return result;
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class MonitorManager method getAdapterNamesBySources.
public List getAdapterNamesBySources(List throwers) {
List result = new ArrayList();
for (int i = 0; i < throwers.size(); i++) {
EventThrowing thrower = (EventThrowing) throwers.get(i);
List adapters = (List) adaptersByThrowers.get(thrower);
for (Iterator it = adapters.iterator(); it.hasNext(); ) {
IAdapter adapter = (IAdapter) it.next();
if (!result.contains(adapter.getName())) {
result.add(adapter.getName());
}
}
}
Collections.sort(result);
return result;
}
use of nl.nn.adapterframework.core.IAdapter in project iaf by ibissource.
the class MonitorManager method registerEventNotificationListener.
public void registerEventNotificationListener(Trigger trigger, List eventCodes, Map adapterFilters, boolean filterOnLowerLevelObjects, boolean filterExclusive) throws MonitorException {
boolean performFiltering = adapterFilters != null;
for (Iterator eventIt = eventCodes.iterator(); eventIt.hasNext(); ) {
String eventCode = (String) eventIt.next();
if (traceReconfigure && log.isDebugEnabled())
log.debug("registerEventNotificationListener1() for event [" + eventCode + "]");
List eventAdapterList = (List) adaptersByEvent.get(eventCode);
if (eventAdapterList == null) {
log.warn("registerEventNotificationListener1() event [" + eventCode + "] is not registered by any adapter, ignoring...");
} else {
List eventThrowersList = (List) throwersByEvent.get(eventCode);
for (Iterator adapterIt = eventAdapterList.iterator(); adapterIt.hasNext(); ) {
IAdapter adapter = (IAdapter) adapterIt.next();
String adaptername = adapter.getName();
AdapterFilter adapterFilter = null;
boolean adapterInFilter = false;
if (performFiltering) {
adapterFilter = (AdapterFilter) adapterFilters.get(adaptername);
adapterInFilter = (adapterFilter != null);
}
boolean adapterNeedsRegistering = // if not filtered, always register
!performFiltering || // register all that pass on the adapterlevel
(adapterInFilter != filterExclusive) || // further evaluation required for lower levels
(filterOnLowerLevelObjects && adapterInFilter);
if (traceReconfigure && log.isDebugEnabled())
log.debug("registerEventNotificationListener1() for event [" + eventCode + "] adapter [" + adaptername + "] adapterNeedsRegistering [" + adapterNeedsRegistering + "]");
if (adapterNeedsRegistering) {
// when we are here, some (or all of) adapter's objects must be registered
List adapterThrowerList = (List) throwersByAdapter.get(adapter);
for (Iterator throwerIt = adapterThrowerList.iterator(); throwerIt.hasNext(); ) {
EventThrowing candidate = (EventThrowing) throwerIt.next();
if (eventThrowersList.contains(candidate)) {
// this subelement of the adapter can throw the event that we are looking for
// now do final evaluation.
// filtering out can only be on lower level
boolean candiateMustBeRegistered = // otherwise registriation allways required
!performFiltering || !filterOnLowerLevelObjects || !adapterInFilter || (adapterFilter.getSubObjectList().contains(candidate.getEventSourceName()) != filterExclusive);
if (traceReconfigure && log.isDebugEnabled())
log.debug("registerEventNotificationListener1() for event [" + eventCode + "] adapter [" + adaptername + "] candidate [" + candidate.getEventSourceName() + "] candiateMustBeRegistered [" + candiateMustBeRegistered + "]");
if (candiateMustBeRegistered) {
registerEventNotificationListener(trigger, eventCode, candidate);
}
}
}
}
}
}
}
}
Aggregations