@Test public void testFilter1() throws Throwable { ISOMsg m = new ISOMsg("testStatefulFilterMti"); m.setDirection(1); ISOMsg result = new StatefulFilter().filter(new NACChannel(), m, new LogEvent()); assertSame(m, result, "result"); }
public ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt) throws ISOFilter.VetoException { int[] key = getKey(); String keyPrefix = getKeyPrefix(); if (keyPrefix == null) throw new NullPointerException("key prefix can not be null"); StringBuilder b = new StringBuilder(keyPrefix); for (int aKey : key) { b.append("|"); b.append(m.getString(aKey)); } String skey = b.toString(); if(m.getDirection() == getMatchDirection()){ int[] savedFields = getSavedFields(); ISOMsg saved = (ISOMsg)( savedFields != null && savedFields.length != 0 ? m.clone(savedFields) : m.clone()); int[] ignoredFields = getIgnoredFields(); if (ignoredFields != null) saved.unset(ignoredFields); getSpace().out(skey, saved, getTimeout()); return m; } else { ISOMsg saved = (ISOMsg)getSpace().inp(skey); if (saved == null && isVetoUnmatched()) throw new VetoException("unmatched iso message"); else if(saved != null) { if (!isOverwriteOriginalFields()) m.merge(saved); else { saved.merge(m); m = saved; } } return m; } }
StatefulFilter implements ISOFilter, Configurable { public ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt) throws ISOFilter.VetoException { int[] key = getKey(); String keyPrefix = getKeyPrefix(); if (keyPrefix == null) throw new NullPointerException("key prefix can not be null"); StringBuilder b = new StringBuilder(keyPrefix); for (int aKey : key) { b.append("|"); b.append(m.getString(aKey)); } String skey = b.toString(); if(m.getDirection() == getMatchDirection()){ int[] savedFields = getSavedFields(); ISOMsg saved = (ISOMsg)( savedFields != null && savedFields.length != 0 ? m.clone(savedFields) : m.clone()); int[] ignoredFields = getIgnoredFields(); if (ignoredFields != null) saved.unset(ignoredFields); getSpace().out(skey, saved, getTimeout()); return m; } else { ISOMsg saved = (ISOMsg)getSpace().inp(skey); if (saved == null && isVetoUnmatched()) throw new VetoException("unmatched iso message"); else if(saved != null) { if (!isOverwriteOriginalFields()) m.merge(saved); else { saved.merge(m); m = saved; } } return m; } } }
StatefulFilter implements ISOFilter, Configurable { public ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt) throws ISOFilter.VetoException { int[] key = getKey(); String keyPrefix = getKeyPrefix(); if (keyPrefix == null) throw new NullPointerException("key prefix can not be null"); StringBuilder b = new StringBuilder(keyPrefix); for (int aKey : key) { b.append("|"); b.append(m.getString(aKey)); } String skey = b.toString(); if(m.getDirection() == getMatchDirection()){ int[] savedFields = getSavedFields(); ISOMsg saved = (ISOMsg)( savedFields != null && savedFields.length != 0 ? m.clone(savedFields) : m.clone()); int[] ignoredFields = getIgnoredFields(); if (ignoredFields != null) saved.unset(ignoredFields); getSpace().out(skey, saved, getTimeout()); return m; } else { ISOMsg saved = (ISOMsg)getSpace().inp(skey); if (saved == null && isVetoUnmatched()) throw new VetoException("unmatched iso message"); else if(saved != null) { if (!isOverwriteOriginalFields()) m.merge(saved); else { saved.merge(m); m = saved; } } return m; } } StatefulFilter(); }
StatefulFilter implements ISOFilter, Configurable { public ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt) throws ISOFilter.VetoException { int[] key = getKey(); String keyPrefix = getKeyPrefix(); if (keyPrefix == null) throw new NullPointerException("key prefix can not be null"); StringBuilder b = new StringBuilder(keyPrefix); for (int aKey : key) { b.append("|"); b.append(m.getString(aKey)); } String skey = b.toString(); if(m.getDirection() == getMatchDirection()){ int[] savedFields = getSavedFields(); ISOMsg saved = (ISOMsg)( savedFields != null && savedFields.length != 0 ? m.clone(savedFields) : m.clone()); int[] ignoredFields = getIgnoredFields(); if (ignoredFields != null) saved.unset(ignoredFields); getSpace().out(skey, saved, getTimeout()); return m; } else { ISOMsg saved = (ISOMsg)getSpace().inp(skey); if (saved == null && isVetoUnmatched()) throw new VetoException("unmatched iso message"); else if(saved != null) { if (!isOverwriteOriginalFields()) m.merge(saved); else { saved.merge(m); m = saved; } } return m; } } StatefulFilter(); String getKeyPrefix(); void setKeyPrefix(String keyPrefix); void setConfiguration(Configuration cfg); void setSpace(String uri); ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt); boolean isVetoUnmatched(); void setVetoUnmatched(boolean vetoUnmatched); int getMatchDirection(); void setMatchDirection(int matchDirection); int getIgnoredField(int index); int[] getIgnoredFields(); void setIgnoredField(int index, int ignoredFields); void setIgnoredFields(int[] ignoredFields); int getSavedField(int index); int[] getSavedFields(); void setSavedField(int index, int savedFields); void setSavedFields(int[] savedFields); int getKey(int index); int[] getKey(); void setKey(int index, int key); void setKey(int[] key); long getTimeout(); void setTimeout(long timeout); boolean isOverwriteOriginalFields(); void setOverwriteOriginalFields(boolean overwriteOriginalFields); }
StatefulFilter implements ISOFilter, Configurable { public ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt) throws ISOFilter.VetoException { int[] key = getKey(); String keyPrefix = getKeyPrefix(); if (keyPrefix == null) throw new NullPointerException("key prefix can not be null"); StringBuilder b = new StringBuilder(keyPrefix); for (int aKey : key) { b.append("|"); b.append(m.getString(aKey)); } String skey = b.toString(); if(m.getDirection() == getMatchDirection()){ int[] savedFields = getSavedFields(); ISOMsg saved = (ISOMsg)( savedFields != null && savedFields.length != 0 ? m.clone(savedFields) : m.clone()); int[] ignoredFields = getIgnoredFields(); if (ignoredFields != null) saved.unset(ignoredFields); getSpace().out(skey, saved, getTimeout()); return m; } else { ISOMsg saved = (ISOMsg)getSpace().inp(skey); if (saved == null && isVetoUnmatched()) throw new VetoException("unmatched iso message"); else if(saved != null) { if (!isOverwriteOriginalFields()) m.merge(saved); else { saved.merge(m); m = saved; } } return m; } } StatefulFilter(); String getKeyPrefix(); void setKeyPrefix(String keyPrefix); void setConfiguration(Configuration cfg); void setSpace(String uri); ISOMsg filter(ISOChannel iSOChannel, ISOMsg m, LogEvent evt); boolean isVetoUnmatched(); void setVetoUnmatched(boolean vetoUnmatched); int getMatchDirection(); void setMatchDirection(int matchDirection); int getIgnoredField(int index); int[] getIgnoredFields(); void setIgnoredField(int index, int ignoredFields); void setIgnoredFields(int[] ignoredFields); int getSavedField(int index); int[] getSavedFields(); void setSavedField(int index, int savedFields); void setSavedFields(int[] savedFields); int getKey(int index); int[] getKey(); void setKey(int index, int key); void setKey(int[] key); long getTimeout(); void setTimeout(long timeout); boolean isOverwriteOriginalFields(); void setOverwriteOriginalFields(boolean overwriteOriginalFields);  }