Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 16 package org.javabb.interceptor; 17 18 import org.aopalliance.intercept.MethodInterceptor; 19 import org.aopalliance.intercept.MethodInvocation; 20 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 import org.javabb.lucene.index.Indexer; 25 26 import org.javabb.vo.Post; 27 28 34 public class LuceneIndexerInterceptor implements MethodInterceptor { 35 36 protected static final Log logger = LogFactory 37 .getLog(LuceneIndexerInterceptor.class); 38 39 private Indexer indexer; 40 41 44 public LuceneIndexerInterceptor() { 45 46 } 48 49 52 public LuceneIndexerInterceptor(Indexer index) { 53 54 this.indexer = index; 55 56 } 57 58 61 public Indexer getIndexer() { 62 63 return indexer; 64 65 } 66 67 71 public void setIndexer(Indexer indexer) { 72 73 this.indexer = indexer; 74 75 } 76 77 82 public Object invoke(MethodInvocation invocation) throws Throwable { 83 84 Object [] params = invocation.getArguments(); 85 Object post = params[0]; 86 87 Object result = post; 88 89 if (post instanceof Post) { 90 91 Post postObj = (Post) post; 92 indexer.index(postObj); 93 94 result = invocation.proceed(); 95 96 } else { 97 98 } 100 101 return result; 102 103 } 104 105 }
| Popular Tags
|