Search in sources :

Example 1 with IAdapter

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;
}
Also used : ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 2 with IAdapter

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;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 3 with IAdapter

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;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 4 with IAdapter

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;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) IAdapter(nl.nn.adapterframework.core.IAdapter)

Example 5 with IAdapter

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);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) IAdapter(nl.nn.adapterframework.core.IAdapter)

Aggregations

IAdapter (nl.nn.adapterframework.core.IAdapter)54 Adapter (nl.nn.adapterframework.core.Adapter)16 ArrayList (java.util.ArrayList)15 IOException (java.io.IOException)14 Iterator (java.util.Iterator)13 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)11 Configuration (nl.nn.adapterframework.configuration.Configuration)10 List (java.util.List)9 IReceiver (nl.nn.adapterframework.core.IReceiver)9 PipeLineResult (nl.nn.adapterframework.core.PipeLineResult)9 ReceiverBase (nl.nn.adapterframework.receivers.ReceiverBase)8 LinkedList (java.util.LinkedList)7 IListener (nl.nn.adapterframework.core.IListener)7 PipeRunException (nl.nn.adapterframework.core.PipeRunException)7 HashMap (java.util.HashMap)6 Path (javax.ws.rs.Path)6 Produces (javax.ws.rs.Produces)6 IbisManager (nl.nn.adapterframework.configuration.IbisManager)6 Message (nl.nn.adapterframework.stream.Message)6 RolesAllowed (javax.annotation.security.RolesAllowed)5