/** * Replace the current chain with the new one * * @param chain * the new chain */ public void setChain ( final Collection<ChainProcessEntry> chain ) { if ( chain == null ) { this.chain = new CopyOnWriteArraySet<ChainProcessEntry> (); } else { final Set<ChainProcessEntry> newChain = new CopyOnWriteArraySet<ChainProcessEntry> ( chain ); this.chain = newChain; } process (); }
public void addChainElement ( final EnumSet<IODirection> when, final ChainItem item ) { if ( this.chain.add ( new ChainProcessEntry ( when, item ) ) ) { process (); } }
public void addChainElement ( final IODirection when, final ChainItem item ) { if ( this.chain.add ( new ChainProcessEntry ( EnumSet.of ( when ), item ) ) ) { process (); } }
public void removeChainElement ( final EnumSet<IODirection> when, final ChainItem item ) { int n = 0; for ( final Iterator<ChainProcessEntry> i = this.chain.iterator (); i.hasNext (); ) { final ChainProcessEntry entry = i.next (); if ( entry.getWhen ().equals ( when ) ) { if ( entry.getWhat () == item ) { i.remove (); n++; } } } if ( n > 0 ) { process (); } }
protected WriteAttributeResults processSetAttributes ( final Map<String, Variant> attributes, final OperationParameters operationParameters ) { final WriteAttributeResults writeAttributeResults = new WriteAttributeResults (); for ( final ChainProcessEntry chainEntry : this.chain ) { final ChainItem chainItem = chainEntry.getWhat (); final WriteAttributeResults partialResult = chainItem.setAttributes ( attributes ); if ( partialResult != null ) { for ( final Map.Entry<String, WriteAttributeResult> entry : partialResult.entrySet () ) { if ( entry.getValue ().isError () ) { attributes.remove ( entry.getKey () ); } writeAttributeResults.put ( entry.getKey (), entry.getValue () ); } } } process (); return handleUnhandledAttributes ( writeAttributeResults, attributes ); }