@Before("methodExecution()") public void entryTrace(JoinPoint jp) { this.lastEntry = jp.toString(); } }
@Override public void before(Method method, Object[] args, @Nullable Object target) throws Throwable { JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint(); assertTrue("Method named in toString", jp.toString().contains(method.getName()));
@After("pointcut()") public void doAfter(JoinPoint joinPoint) { LOGGER.info("doAfter():{}", joinPoint.toString()); }
@Override public void before(Method method, Object[] args, @Nullable Object target) throws Throwable { // makeEncSJP, although meant for computing the enclosing join point, // it serves our purpose here JoinPoint.StaticPart aspectJVersionJp = Factory.makeEncSJP(method); JoinPoint jp = AbstractAspectJAdvice.currentJoinPoint(); assertEquals(aspectJVersionJp.getSignature().toLongString(), jp.getSignature().toLongString()); assertEquals(aspectJVersionJp.getSignature().toShortString(), jp.getSignature().toShortString()); assertEquals(aspectJVersionJp.getSignature().toString(), jp.getSignature().toString()); assertEquals(aspectJVersionJp.toLongString(), jp.toLongString()); assertEquals(aspectJVersionJp.toShortString(), jp.toShortString()); assertEquals(aspectJVersionJp.toString(), jp.toString()); } });
@Override public String toString() { return this.joinpoint.toString(); } @Override
@Override public String toString() { return this.joinpoint.toString(); } @Override
@Before("call(* java.nio.Buffer.*(..))") public void buffer_all(JoinPoint thisJoinPoint) { config.logger.finest(thisJoinPoint.toString()); } /*
public static AbstractAudit.ExceptionFactory latencyURL(ReactiveAudit config, final JoinPoint thisJoinPoint, URL url) { ReactiveAuditException e; String s = url.toExternalForm(); CharSequence msg = null; if (config.isDebug()) { config.logger.finest(thisJoinPoint.toString() + " with " + url); msg = url.toString(); } final boolean fileEx=(s.startsWith("jar:file:") || s.startsWith("file:")); final CharSequence fmsg=msg; return new AbstractAudit.ExceptionFactory() { public ReactiveAuditException lazyException() { return fileEx ? FactoryException.newFile(LOW, thisJoinPoint, fmsg) : FactoryException.newNetwork(MEDIUM, thisJoinPoint, fmsg); } }; } }
@Before("call(* java.io.PrintWriter.print(..))") public void print(JoinPoint thisJoinPoint) { Writer writer = (Writer) thisJoinPoint.getTarget(); if (config.isDebug()) { config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, writer); }
@Before("call(* java.io.PrintWriter.format(..))") public void format(JoinPoint thisJoinPoint) { Writer writer = (Writer) thisJoinPoint.getTarget(); if (config.isDebug()) { config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, writer); }
@Before("call(* java.io.PrintWriter.println(..))") public void println(JoinPoint thisJoinPoint) { Writer writer = (Writer) thisJoinPoint.getTarget(); if (config.isDebug()) { config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, writer); }
@Before("call(* java.io.PrintWriter.printf(..))") public void printf(JoinPoint thisJoinPoint) { Writer writer = (Writer) thisJoinPoint.getTarget(); if (config.isDebug()) { config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, writer); }
@Before("call(* java.io.Writer.append(..))") public void append(JoinPoint thisJoinPoint) { if (config.isDebug()) { Writer writer = (Writer) thisJoinPoint.getTarget(); config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, (Writer) thisJoinPoint.getTarget()); }
@Before("call(* java.io.OutputStream.write(..))") public void write(JoinPoint thisJoinPoint) { OutputStream out = (OutputStream) thisJoinPoint.getTarget(); if (config.isDebug()) { config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(out)); } latency(HIGH, thisJoinPoint, (OutputStream) thisJoinPoint.getTarget()); }
@Before("call(* java.io.InputStream+.read(..))") public void read(JoinPoint thisJoinPoint) { if (config.isDebug()) { InputStream in = (InputStream) thisJoinPoint.getTarget(); config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(in)); } latency(HIGH, thisJoinPoint, (InputStream) thisJoinPoint.getTarget()); }
@Before("call(* java.io.Reader+.read(..))") public void read(JoinPoint thisJoinPoint) { if (config.isDebug()) { Reader reader = (Reader) thisJoinPoint.getTarget(); config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(reader)); } latency(HIGH, thisJoinPoint, (Reader) thisJoinPoint.getTarget()); }
@Before("call(* java.io.Writer.write(..))") public void write(JoinPoint thisJoinPoint) { if (config.isDebug()) { Writer writer = (Writer) thisJoinPoint.getTarget(); config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, (Writer) thisJoinPoint.getTarget()); }
@Before("call(* java.io.Writer.flush(..))") public void flush(JoinPoint thisJoinPoint) { if (config.isDebug()) { Writer writer = (Writer) thisJoinPoint.getTarget(); config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(HIGH, thisJoinPoint, (Writer) thisJoinPoint.getTarget()); }
@Before("call(* java.io.Writer.close())") public void close(JoinPoint thisJoinPoint) { if (config.isDebug()) { Writer writer = (Writer) thisJoinPoint.getTarget(); config.logger.finest( thisJoinPoint.toString() + " with " + FileTools.dumpChain(writer)); } latency(LOW, thisJoinPoint, (Writer) thisJoinPoint.getTarget()); }