Tabnine Logo
Invocation.getAdvisor
Code IndexAdd Tabnine to your IDE (free)

How to use
getAdvisor
method
in
org.jboss.aop.joinpoint.Invocation

Best Java code snippets using org.jboss.aop.joinpoint.Invocation.getAdvisor (Showing top 19 results out of 315)

origin: org.jboss.ejb3/jboss-ejb3-core

@SuppressWarnings("unchecked")
public static <C extends EJBContainer> C getEJBContainer(Invocation invocation)
{
 // Because of Sun JDK we must cast it to something, or else there will be
 // no upper bound.
 return (C) EJBContainer.getEJBContainer(invocation.getAdvisor());
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

protected <C> C getContainer(Invocation invocation)
{
 return (C) AbstractContainer.getContainer(invocation.getAdvisor());
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

protected <A extends Annotation> A getAnnotation(Invocation invocation, Method method, Class<A> annotationType)
{
 Advisor advisor = invocation.getAdvisor();
 A annotation = annotationType.cast(advisor.resolveAnnotation(method, annotationType));
 if(annotation == null)
   annotation = annotationType.cast(advisor.resolveAnnotation(annotationType));
 return annotation;
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

private static TransactionAttributeType getTxType(Invocation invocation)
{
 // Use the method tx attribute if we're invoking a business method, else the bean attribute
 Method method = null;
 if(invocation instanceof MethodInvocation)
   method = ((MethodInvocation) invocation).getActualMethod();
 return getTxType(invocation.getAdvisor(), method);
}
origin: org.jboss.ejb3/jboss-ejb3-core

/**
* Sets the TCCL to the classloader of the container so
* that the invocation happens in the context of the 
* container's classloader. Finally upon return resets
* the TCCL to the previous classloader. 
*/
public Object invoke(Invocation invocation) throws Throwable
{
 assert invocation instanceof EJBContainerInvocation : "Unexpected invocation type " + invocation.getClass()
    + " - expected " + EJBContainerInvocation.class;
 // get hold of the EJBContainer from the invocation
 EJBContainer ejbContainer = EJBContainer.getEJBContainer(invocation.getAdvisor());
 
 ClassLoader ejbContainerClassloader = ejbContainer.getClassloader();
 ClassLoader previousClassLoader = Thread.currentThread().getContextClassLoader();
 // TODO: Review for security manager privileged blocks
 try
 {
   // Set the TCCL to the EJBContainer's classloader
   Thread.currentThread().setContextClassLoader(ejbContainerClassloader);
   // move on
   return invocation.invokeNext();
 }
 finally
 {
   // reset to original TCCL 
   Thread.currentThread().setContextClassLoader(previousClassLoader);
 }
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

private static void check(String publicMethod, String specReferenceTxAttr)
{
 // getRollbackOnly is not allowed during construction and injection EJB 3 4.4.1 and EJB 3 4.5.2
 Invocation currentInvocation = CurrentInvocation.getCurrentInvocation();
 if(currentInvocation == null)
   throw new IllegalStateException("It's not allowed to do " + publicMethod + " during construction and injection");
 Advisor advisor = currentInvocation.getAdvisor();
 String containerName = advisor.getName();
 // EJB1.1 11.6.1: Must throw IllegalStateException if BMT
 TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
 if (type != TransactionManagementType.CONTAINER)
   throw new IllegalStateException("Container " + containerName + ": it is illegal to call " + publicMethod + " from BMT: " + type);
 if(isLifecycleCallback(currentInvocation))
   throw new IllegalStateException(containerName + ": " + publicMethod + " not allowed during lifecycle callbacks (EJB3 4.4.1 & 4.5.2)");
 // TODO: we should really ask a TxType object to handle getRollbackOnly()
 if(getTxType(currentInvocation) == TransactionAttributeType.SUPPORTS)
   throw new IllegalStateException(containerName + ": " + publicMethod + " not allowed with TransactionAttributeType.SUPPORTS (" + specReferenceTxAttr + ")");
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

  protected static <T extends Annotation> T resolveAnnotation(Invocation invocation, Class<?> cls, Class<T> annotationType)
  {
   return ExtendedAdvisorHelper.getExtendedAdvisor(invocation.getAdvisor(), invocation.getTargetObject()).resolveAnnotation(cls, annotationType);
  }
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

public static UserTransaction getUserTransaction(BeanContext<?> ctx)
{
 Invocation invocation = CurrentInvocation.getCurrentInvocation();
 
 // TODO: also not allowed during construction
 
 if(InvocationHelper.isInjection(invocation))
   throw new IllegalStateException("getUserTransaction() not allowed during injection (EJB3 4.4.1 & 4.5.2)");
 
 Advisor advisor = invocation.getAdvisor();
 TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
 if (type != TransactionManagementType.BEAN) throw new IllegalStateException("Container " + advisor.getName() + ": it is illegal to inject UserTransaction into a CMT bean");
 return new UserTransactionImpl();   
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

  /**
  * Checks if the passed exception is an application exception. If yes, then throws back the
  * exception as-is. Else, wraps the exception in a {@link EJBException} and throws the EJBException
  *
  * @param ex The exception to handle
  * @param invocation The invocation
  * @throws Exception Either the passed exception or an EJBException
  */
  protected void handleException(Invocation invocation, Exception ex) throws Exception
  {
   if (ex == null)
   {
     return;
   }
   ApplicationException ae = (ApplicationException) invocation.getAdvisor().resolveAnnotation(ApplicationException.class);
   // it's an application exception, so just throw it back as-is
   if (ae != null)
   {
     throw ex;
   }
   if (ex instanceof EJBException)
   {
     throw (EJBException) ex;
   }
   else
   {
     throw new EJBException(ex);
   }
  }
}
origin: org.jboss.ejb3/jboss-ejb3-core

  /**
  * @see org.jboss.aop.advice.Interceptor#invoke(org.jboss.aop.joinpoint.Invocation)
  */
  public Object invoke(Invocation invocation) throws Throwable
  {
   EJBContainer container = EJBContainer.getEJBContainer(invocation.getAdvisor());
   
   Lock lock = container.getInvocationLock();
   
   // We intentionally do not use tryLock() since it does not respect lock fairness
   if (!lock.tryLock(0, TimeUnit.SECONDS))
   {
     throw new DispatcherConnectException("EJB container is not completely started, or is stopped.");
   }
   
   try
   {
     return invocation.invokeNext();
   }
   finally
   {
     lock.unlock();
   }
  }
}
origin: org.jboss.aop/jboss-aop

  public Object visit(ASTCFlow node, Object data)
  {
   AspectManager manager = null;
   if (invocation.getAdvisor() == null)
     manager = AspectManager.instance();
   else
     manager = invocation.getAdvisor().getManager();
   CFlowStack cflow = manager.getCFlowStack(node.getPointcutName());
   
   //Use the current advisor to guess the classloader
   ClassLoader cl = invocation.getAdvisor().getClassLoader();
   if (cl == null)
   {
     //Fall back to context classloader if null
     cl = SecurityActions.getContextClassLoader();
   }
   
   if (cflow != null) return new Boolean(cflow.matches(getStack(), cl));

   DynamicCFlow dcflow = manager.getDynamicCFlow(node.getPointcutName(), cl);
   return new Boolean(dcflow.shouldExecute(invocation));
  }
}
origin: org.jboss.aop/jboss-aop

private InstanceAdvisor getInstanceAdvisor(Invocation invocation, Object targetObject)
{
 if (targetObject instanceof Advised)
 {
   Advised advised = (Advised) targetObject;
   return advised._getInstanceAdvisor();
 }
 Advisor advisor = invocation.getAdvisor();
 if (advisor != null)
 {
   if (advisor instanceof InstanceAdvisor)
   {
    return (InstanceAdvisor) advisor;
   }
   if (advisor instanceof ClassProxyContainer && 
      invocation instanceof ContainerProxyMethodInvocation)
   {
    ContainerProxyMethodInvocation pi = (ContainerProxyMethodInvocation)invocation;
    return pi.getProxy().getInstanceAdvisor();
   }
 }
 return null;
}
origin: org.jboss.aop/jboss-aop

private InstanceAdvisor getInstanceAdvisor(Invocation invocation, Object targetObject)
{
 if (targetObject instanceof Advised)
 {
   Advised advised = (Advised) targetObject;
   return advised._getInstanceAdvisor();
 }
 Advisor advisor = invocation.getAdvisor();
 if (advisor == null)
 {
   return null;
 }
 if (advisor instanceof InstanceAdvisor)
 {
   return (InstanceAdvisor) advisor;
 }
 if (advisor instanceof ClassProxyContainer && invocation instanceof ContainerProxyMethodInvocation)
 {
   ContainerProxyMethodInvocation pi = (ContainerProxyMethodInvocation)invocation;
   return pi.getProxy().getInstanceAdvisor();
 }
 return null;
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

public Object handleInvocation(Invocation invocation) throws Throwable
{
 assert tm.getTransaction() == null : "can't handle BMT transaction, there is a transaction active";
 
 String ejbName = invocation.getAdvisor().getName();
 boolean exceptionThrown = false;
 try
 {
   return invocation.invokeNext();
 }
 catch (Exception ex)
 {
   exceptionThrown = true;
   checkStatelessDone(invocation, ejbName, ex);
   throw ex;
 }
 finally
 {
   try
   {
    if (!exceptionThrown) checkStatelessDone(invocation, ejbName, null);
   }
   finally
   {
    tm.suspend();
   }
 }
}
origin: org.jboss.aop/jboss-aop

public Object invoke(Invocation invocation) throws Throwable
{
 if (lazyInterceptor == null)
 {
   synchronized (this)
   {
    if (lazyInterceptor == null)
    {
      if (factory.getType().isGeneratedOnly())
      {
       lazyInterceptor = new GeneratedOnlyInterceptor(factory.getName(), factory); 
      }
      else
      {
       lazyInterceptor = create(invocation.getAdvisor(), getJoinpoint(invocation));
       if (lazyInterceptor == null)
       {
         lazyInterceptor = EMPTY_INTERCEPTOR;
       }
      }
    }
   }
 }
 return lazyInterceptor.invoke(invocation);
}
origin: org.jboss.ejb3/jboss-ejb3-transactions

String ejbName = invocation.getAdvisor().getName();
origin: org.jboss.aop/jboss-aop

Advisor advisor = invocation.getAdvisor();
if (advisor == null)
origin: org.jboss.aop/jboss-aop

Advisor advisor = invocation.getAdvisor();
if (advisor == null)
origin: org.jboss.ejb3/jboss-ejb3-core

final Advisor advisor = invocation.getAdvisor();
final EJBContainer ejbContainer = EJBContainer.getEJBContainer(advisor);
if (ejbContainer instanceof ServiceContainer || ejbContainer instanceof MessagingContainer)
org.jboss.aop.joinpointInvocationgetAdvisor

Popular methods of Invocation

  • invokeNext
    Invoke on the next interceptor in the chain. If this is already the end of the chain, reflection wil
  • getMetaData
    This method resolves untyped metadata based on the context of the invocation. It iterates through it
  • getTargetObject
  • addResponseAttachment
  • copy
    Copies complete state of Invocation object so that it could possibly be reused in a spawned thread.
  • getInterceptors
  • getResponseContextInfo
  • getWrapper
    Get a wrapper invocation object that can insert a new chain of interceptors at runtime to the invoca
  • setResponseContextInfo
  • setTargetObject

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JPanel (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now