springpython.aop
index
/home/gturnquist/spring-python-1.0.x/src/springpython/aop/__init__.py

Copyright 2006-2008 SpringSource (http://springsource.com), All Rights Reserved
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
    http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

 
Package Contents
       
utils

 
Classes
       
__builtin__.object
AopProxy
MethodInterceptor
FinalInterceptor
PerformanceMonitorInterceptor
MethodInvocation
MethodMatcher
Pointcut
RegexpMethodPointcutAdvisor(Pointcut, MethodMatcher, MethodInterceptor)
ProxyFactory
ProxyFactoryObject(ProxyFactory, AopProxy)

 
class AopProxy(__builtin__.object)
    AopProxy acts like the target object by dispatching all method calls to the target through a MethodInvocation.
The MethodInvocation object actually deals with potential "around" advice, referred to as interceptors. Attribute
lookups are not intercepted, but instead fetched from the actual target object.
 
  Methods defined here:
__getattr__(self, name)
If any of the parameters are local objects, they are immediately retrieved. Callables cause the dispatch method
to be return, which forwards callables through the interceptor stack. Target attributes are retrieved directly from
the target object.
__init__(self, target, interceptors)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class FinalInterceptor(MethodInterceptor)
    Final interceptor is always at the bottom of interceptor stack.
It executes the actual target method on the instance.
 
 
Method resolution order:
FinalInterceptor
MethodInterceptor
__builtin__.object

Methods defined here:
__init__(self)
invoke(self, invocation)

Data descriptors inherited from MethodInterceptor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MethodInterceptor(__builtin__.object)
    Interface defining "around" advice.
 
  Methods defined here:
invoke(self, invocation)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MethodInvocation(__builtin__.object)
    Encapsulation of invoking a method on a proxied service. It iterates throgh the list of interceptors by using
a generator.
 
  Methods defined here:
__call__(self, *args, **kwargs)
This method converts this from being a stored object into a callable class. This is effectively like a metaclass
that dispatches calls to proceed through a stack of interceptors.
__getattr__(self, name)
This only deals with method invocations. Attributes are dealt with by the AopProxy, and don't every reach this
block of code.
__init__(self, instance, method_name, args, kwargs, interceptors)
dump_interceptors(self, level=20)
DEBUG: Method used to dump the stack of interceptors in order of execution.
getInterceptor(self)
This is a generator to proceed through the stack of interceptors. By using generator convention, code may
proceed in a nested fashion, versus a for-loop which would act in a chained fashion.
proceed(self)
This is the method every interceptor should call in order to continue down the chain of interceptors.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MethodMatcher(__builtin__.object)
    Interface defining how to apply aspects based on methods.
 
  Methods defined here:
matches_method_and_target(self, method, targetClass, args)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class PerformanceMonitorInterceptor(MethodInterceptor)
    
Method resolution order:
PerformanceMonitorInterceptor
MethodInterceptor
__builtin__.object

Methods defined here:
__init__(self, prefix=None, level=10)
invoke(self, invocation)

Data descriptors inherited from MethodInterceptor:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Pointcut(__builtin__.object)
    Interface defining where to apply an aspect.
 
  Methods defined here:
class_filter(self)
method_matcher(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ProxyFactory(__builtin__.object)
    This object helps to build AopProxy objects programmatically. It allows configuring advice and target objects.
Then it will produce an AopProxy when needed. To use similar behavior in an IoC environment, see ProxyFactoryObject.
 
  Methods defined here:
__init__(self, target=None, interceptors=None)
__setattr__(self, name, value)
getProxy(self)
Generate an AopProxy given the current target and list of interceptors. Any changes to the factory after
proxy creation do NOT propagate to the proxies.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ProxyFactoryObject(ProxyFactory, AopProxy)
    This class acts as both a ProxyFactory to build and an AopProxy. It makes itself look like the target object.
Any changes to the target and list of interceptors is immediately seen when using this as a proxy.
 
 
Method resolution order:
ProxyFactoryObject
ProxyFactory
AopProxy
__builtin__.object

Methods defined here:
__init__(self, target=None, interceptors=None)
__str__(self)

Methods inherited from ProxyFactory:
__setattr__(self, name, value)
getProxy(self)
Generate an AopProxy given the current target and list of interceptors. Any changes to the factory after
proxy creation do NOT propagate to the proxies.

Data descriptors inherited from ProxyFactory:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from AopProxy:
__getattr__(self, name)
If any of the parameters are local objects, they are immediately retrieved. Callables cause the dispatch method
to be return, which forwards callables through the interceptor stack. Target attributes are retrieved directly from
the target object.

 
class RegexpMethodPointcutAdvisor(Pointcut, MethodMatcher, MethodInterceptor)
    This is a combination PointCut/MethodMatcher/MethodInterceptor. It allows associating one or more
defined advices with a set of regular expression patterns.
 
 
Method resolution order:
RegexpMethodPointcutAdvisor
Pointcut
MethodMatcher
MethodInterceptor
__builtin__.object

Methods defined here:
__init__(self, advice=None, patterns=None)
__setattr__(self, name, value)
If "advice", make sure it is a list. Anything else, pass through to simple assignment.
Also, if "patterns", initialize the regular expression parsers.
init_patterns(self)
Precompile the regular expression pattern matcher list.
invoke(self, invocation)
Compares "class.method" against regular expression pattern and if it passes, it will
pass through to the chain of interceptors. Otherwise, bypass interceptors and invoke class
method directly.
matches_method_and_target(self, method, target_class, args)
Iterate through all patterns, checking for a match. Calls the pattern matcher against "class.method_name".
matches_pattern(self, method_name, pointcut_pattern)
Uses a pre-built dictionary of regular expression patterns to check for a matcch.

Methods inherited from Pointcut:
class_filter(self)
method_matcher(self)

Data descriptors inherited from Pointcut:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)