List of usage examples for org.aspectj.lang ProceedingJoinPoint proceed
public Object proceed() throws Throwable;
From source file:at.ac.tuwien.infosys.jcloudscale.server.aspects.ServerRemoteObjectLoggingAspect.java
License:Apache License
@Around("execution(String at.ac.tuwien.infosys.jcloudscale.server.JCloudScaleServer.createNewCloudObject(..)) && args(classname, *, *)") public Object newCloudObjectDeployed(ProceedingJoinPoint jp, String classname) throws Throwable { log.info(String.format("Creating new cloud object of runtime type %s", classname)); Object ret = jp.proceed(); log.info(String.format("ID of new cloud object is %s", ret)); return ret;/*from w w w.ja v a 2s . com*/ }
From source file:at.ac.tuwien.infosys.jcloudscale.server.aspects.ServerRemoteObjectLoggingAspect.java
License:Apache License
@Around("execution(Object at.ac.tuwien.infosys.jcloudscale.utility.CgLibUtil.JCloudScaleReferenceHandler.intercept(..)) && args(object, method, *, *)") public Object referenceHandlerInvoked(ProceedingJoinPoint jp, Object object, Method method) throws Throwable { if (log.isLoggable(Level.INFO)) log.info(String.format("Starting to invoke callback on reference type %s (method %s)", object.getClass().getName(), method.getName())); Object ret = jp.proceed(); if (log.isLoggable(Level.INFO)) log.info(String.format("Received callback answer. Returned result was %s", ret)); return ret;//from www . ja v a 2s .c o m }
From source file:at.ac.tuwien.infosys.jcloudscale.server.aspects.StaticFieldAspect.java
License:Apache License
@Around("args(newval) && set(@at.ac.tuwien.infosys.jcloudscale.annotations.CloudGlobal static * *.*)") public void writeStaticValueToClient(ProceedingJoinPoint pjp, Object newval) throws Throwable { if (!JCloudScaleConfiguration.isServerContext()) { pjp.proceed(); return;//from ww w. jav a2s . c o m } try (IMQWrapper mq = JCloudScaleConfiguration.createMQWrapper()) { UUID corrId = UUID.randomUUID(); FieldSignature sig = (FieldSignature) pjp.getSignature(); Field field = sig.getField(); Object newValProcessed = JCloudScaleReferenceManager.getInstance().processField(field, newval); byte[] serialzed = SerializationUtil.serializeToByteArray(newValProcessed); SetStaticValueRequest req = new SetStaticValueRequest(); req.setField(field.getName()); req.setClassName(field.getDeclaringClass().getCanonicalName()); req.setValue(serialzed); mq.createQueueProducer( JCloudScaleConfiguration.getConfiguration().server().getStaticFieldWriteRequestQueueName()); mq.createTopicConsumer( JCloudScaleConfiguration.getConfiguration().server().getStaticFieldWriteResponseTopicName(), "JMSCorrelationID = '" + corrId.toString() + "'"); // we send request and wait for response to ensure that we in fact // changed the value before continuing. mq.requestResponse(req, corrId); } catch (JMSException | NamingException | IOException e) { e.printStackTrace(); log.severe("Could not write static field: " + e.getMessage()); } }
From source file:at.ac.tuwien.infosys.jcloudscale.server.aspects.StaticFieldAspect.java
License:Apache License
@Around("get(@at.ac.tuwien.infosys.jcloudscale.annotations.CloudGlobal static * *.*)") public Object readStaticValueFromClient(ProceedingJoinPoint pjp) throws Throwable { if (!JCloudScaleConfiguration.isServerContext()) return pjp.proceed(); Object returned = null;/*from ww w.j a va2 s. c o m*/ try (IMQWrapper mq = JCloudScaleConfiguration.createMQWrapper()) { FieldSignature sig = (FieldSignature) pjp.getSignature(); Field field = sig.getField(); GetStaticValueObject req = new GetStaticValueObject(); req.setClassName(field.getDeclaringClass().getCanonicalName()); req.setField(field.getName()); mq.createQueueProducer( JCloudScaleConfiguration.getConfiguration().server().getStaticFieldReadRequestQueueName()); UUID corrId = UUID.randomUUID(); mq.createTopicConsumer( JCloudScaleConfiguration.getConfiguration().server().getStaticFieldReadResponsesQueueName(), "JMSCorrelationID = '" + corrId.toString() + "'"); GetStaticValueReturnObject ret = (GetStaticValueReturnObject) mq.requestResponse(req, corrId); ClassLoader classLoader = field.getDeclaringClass().getClassLoader(); returned = SerializationUtil.getObjectFromBytes(ret.getValue(), classLoader); returned = JCloudScaleReferenceManager.getInstance().processField(field, returned); returned = CgLibUtil.replaceRefWithProxy(returned, classLoader); } catch (JCloudScaleException e) { // this should happen if the by-ref type did not have a default constructor e.printStackTrace(); throw e; } catch (JMSException | NamingException | TimeoutException | ClassNotFoundException | IOException e) { e.printStackTrace(); log.severe("Could not write static field: " + e.getMessage()); } return returned; }
From source file:at.irian.demo.jsfatwork.view.exception.UIExceptionInterceptor.java
License:Apache License
@Around("execution(public * at.irian.demo.jsfatwork.view.page..*.*(..))") public Object handleException(ProceedingJoinPoint pjp) throws Throwable { FacesContext facesContext = FacesContext.getCurrentInstance(); try {//from w w w.ja v a 2 s . c om return pjp.proceed(); } catch (UILockDownException le) { facesContext.getApplication().getNavigationHandler().handleNavigation(facesContext, null, "pages/lock"); this.messageBean.addMessage(FacesMessage.SEVERITY_FATAL, le.getMessage()); } catch (ServiceException se) { this.messageBean.addMessage(FacesMessage.SEVERITY_ERROR, se.getMessage()); return null; } catch (Throwable e) { handleExternalException(facesContext, e); } return null; }
From source file:at.irian.demo.jsfatwork.view.security.ViewControllerSecurityInterceptor.java
License:Apache License
@Around("execution(public * at.irian.demo.jsfatwork.view.page..*.prepareView())") public Object checkSecurityForPreRenderViewLogic(ProceedingJoinPoint pjp) throws Throwable { boolean accessPermitted = JsfUtils.performSecurityCheck(); if (accessPermitted) { return pjp.proceed(); }/* w w w . j av a 2 s. c om*/ return null; }
From source file:au.com.funkworks.jmp.MiniProfilerAspect.java
License:Open Source License
@Around("anyPublicMethod() && @annotation(profiler)") public Object profiler(ProceedingJoinPoint pjp, Profiler profiler) throws Throwable { String desc = profiler.value(); if (desc == null || desc.equals("")) { desc = pjp.getSignature().toShortString(); if (desc.endsWith("()")) { desc = desc.substring(0, desc.length() - 2); } else if (desc.endsWith("(..)")) { desc = desc.substring(0, desc.length() - 4); }// ww w.j a v a 2 s .c om } Step step = MiniProfiler.step(desc); try { return pjp.proceed(); } finally { step.close(); } }
From source file:au.id.wolfe.stormcloud.core.interceptor.DAOInterceptor.java
License:Apache License
@Around("execution(* au.id.wolfe.stormcloud.core.dao..*.*(..))") public Object logHibernateQueryTimes(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { final String targetClass = ClassUtils .getShortClassName(proceedingJoinPoint.getTarget().getClass().getName()); final String methodName = proceedingJoinPoint.getSignature().getName(); StopWatch stopWatch = new StopWatch(); stopWatch.start();//from ww w .j a v a 2 s. c om Object retVal = proceedingJoinPoint.proceed(); stopWatch.stop(); StringBuilder sb = new StringBuilder(); sb.append(targetClass).append(" - ").append(methodName).append(": ").append(stopWatch.getTime()) .append(" ms"); log.debug(sb.toString()); return retVal; }
From source file:au.org.utsoac.util.CallMonitoringAspect.java
License:Apache License
@Around("within(@org.springframework.stereotype.Repository *)") public Object invoke(ProceedingJoinPoint joinPoint) throws Throwable { if (this.enabled) { StopWatch sw = new StopWatch(joinPoint.toShortString()); sw.start("invoke"); try {/*from ww w .j a v a 2s. co m*/ return joinPoint.proceed(); } finally { sw.stop(); synchronized (this) { this.callCount++; this.accumulatedCallTime += sw.getTotalTimeMillis(); } } } else { return joinPoint.proceed(); } }
From source file:be.nille.jwt.aspect.JWTAspect.java
@Around(value = "@annotation(authorize)") public Object methodsAnnotatedWithAuthorized(final ProceedingJoinPoint joinPoint, Authorize authorize) throws Throwable { log.debug("in authorize pointcut"); Payload payload = verify();/* www . ja v a 2 s. c om*/ String expression = authorize.value(); expression = replacePlaceholdersInExpression(joinPoint, expression); evaluate(expression, payload); return joinPoint.proceed(); }