jasco.runtime.inline
Class InlineJutta

java.lang.Object
  extended by jasco.runtime.cache.CombinedHooksFactory
      extended by jasco.runtime.inline.InlineJutta

public class InlineJutta
extends CombinedHooksFactory


Field Summary
 
Fields inherited from class jasco.runtime.cache.CombinedHooksFactory
classPool, DYNAMIC_CONTEXT, EMPTY_CONBINED_HOOKS, NO_CONTEXT, STATIC_CONTEXT
 
Constructor Summary
InlineJutta(javassist.CtClass clazz)
           
 
Method Summary
protected  java.lang.String accessField(java.lang.String field)
           
protected  void addField(java.lang.String f, javassist.CtClass clz)
           
protected  void addFieldClassInstance(javassist.CtClass fieldClass)
           
protected  boolean allHooksHaveSameArgs(java.util.Vector hooks, java.lang.String adviceType)
          Checks whether all hooks have the same expected jp args and jp return type
protected  void callbackGenerated()
           
protected  java.lang.String castAdviceArgs(java.lang.String adviceType, java.lang.String resultName)
           
protected  HookContextProperty computeAdviceContext(java.lang.String adviceType, java.util.Vector advices)
           
protected  void computeInit(java.util.Vector replaceVector, java.util.Vector genericReplaceVector, HookContextProperty requiredHooksContext, boolean testReplaces)
           
protected  java.lang.String computeThrowingExceptionType(java.util.Vector hooks, java.lang.String adviceType)
           
 java.lang.String defineOutput(JascoMethod newMethod, HookContextProperty requiredHooksContext)
           
protected  java.lang.String doReturn(java.lang.String var, boolean noReplace, HookContextProperty requiredHooksContext)
           
 void finalizeWeaving()
           
protected  javassist.CtMethod findReflectMethod(IHook hook, java.lang.String adviceType, boolean strictSelection)
          finds the most specific advice method, returns null if not existing method
 java.lang.String generateAdviceArgs(java.lang.String adviceType, java.util.Vector advices, boolean testReplaces)
           
protected  java.lang.String generateFactoryAspectsForDynamicHookElements(DynamicHookElement el, java.lang.String assignStartCode)
           
protected  java.lang.String generateFactoryInit(DynamicHookElement element, javassist.CtClass fieldClass, int index)
           
protected  java.lang.String generateInvokeInitCode(java.util.Vector replaceVector, HookContextProperty requiredHooksContext, boolean noReplace, boolean testReplaces)
           
protected  java.lang.String generateNonReplaceAdviceArgs(HookContextProperty requiredContext, java.lang.String adviceType, IHook hook)
           
protected  java.lang.String generateOriginalMethodInvokeNoReplace(JascoMethod method, HookContextProperty requiredHooksContext, boolean outputDefined)
           
protected  java.lang.String generateReplaceAdviceArgs(HookContextProperty requiredContext, java.lang.String adviceType, java.util.Vector hooks, boolean testReplaces)
           
protected  java.lang.String generateReplaceSequence(HookContextProperty requiredHooksContext, java.util.Vector replaceVector, boolean testReplaces, javassist.CtClass fieldClass, boolean outputDefined)
           
protected  java.lang.String getFieldClassName()
           
protected  java.lang.String getFieldClassVarName()
           
protected  JascoMethod getJascoMethod()
           
 MethodJoinpoint getJoinpoint()
           
protected  javassist.CtMethod getOrigMethod()
           
protected  java.lang.String getSimpleFieldClassName()
           
protected  java.lang.String getThisInstance()
           
protected  boolean hooksExactlyDefineArgs(java.util.Vector hooks, java.lang.String adviceType)
          prereq: all hooks have the same args and return type!!! checks whether hooks have the same return type and expected jp arguments as the jp method itself
protected  javassist.CtMethod initCtMethod(JascoMethod method)
           
 void initVars(JascoMethod originalMethod)
           
protected  boolean inlineReplaceCompilingPossible(java.util.Vector hooks, HookContextProperty requiredHooksContext, boolean testReplaces)
           
protected  boolean isCallbackGenerated()
           
protected  void makeFieldsStaticPublic(javassist.CtClass clazz)
           
protected  java.lang.String moreInvokeCode(IHook hook, java.lang.String accessHook, java.lang.String conditionboolean)
           
 void process(JascoMethod originalMethod, java.util.Vector orighooks, java.lang.ClassLoader loader)
           
protected  boolean requiresDefaultAround(java.util.Vector replaceVector, boolean testReplaces)
           
 boolean requiresInvocationThrowingReturning(java.lang.String adviceType, IHook theHook)
          only for returning/throwing advices, might be that there is no advice declared
protected  void saveInlineCode(java.util.Vector hooks, javassist.CtMethod method)
           
 
Methods inherited from class jasco.runtime.cache.CombinedHooksFactory
accessFieldHook, accessFieldHook, addCachedResult, addFieldImpl, checkForPredef, computeAfterThrowingExceptionType, computeAroundThrowingExceptionType, computeContext, generateAdviceArgs, generateCachedAspectJavassist, generateConstructorCode, generateInvokeCode, generateOriginalMethodInvoke, getCachedResult, getDefault, getFactoryName, getHookElementName, getHookName, getNextClassId, hasCustomNonCachableAspectFactories, setClearLinkedHooks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InlineJutta

public InlineJutta(javassist.CtClass clazz)
Method Detail

callbackGenerated

protected void callbackGenerated()

isCallbackGenerated

protected boolean isCallbackGenerated()

accessField

protected java.lang.String accessField(java.lang.String field)
Overrides:
accessField in class CombinedHooksFactory

getFieldClassName

protected java.lang.String getFieldClassName()

getSimpleFieldClassName

protected java.lang.String getSimpleFieldClassName()

getOrigMethod

protected javassist.CtMethod getOrigMethod()

getJascoMethod

protected JascoMethod getJascoMethod()

getJoinpoint

public MethodJoinpoint getJoinpoint()

initVars

public void initVars(JascoMethod originalMethod)
              throws java.lang.Exception
Throws:
java.lang.Exception

process

public void process(JascoMethod originalMethod,
                    java.util.Vector orighooks,
                    java.lang.ClassLoader loader)
             throws InlineCompilingFailed,
                    java.lang.Exception
Throws:
InlineCompilingFailed
java.lang.Exception

finalizeWeaving

public void finalizeWeaving()

computeInit

protected void computeInit(java.util.Vector replaceVector,
                           java.util.Vector genericReplaceVector,
                           HookContextProperty requiredHooksContext,
                           boolean testReplaces)
Overrides:
computeInit in class CombinedHooksFactory

saveInlineCode

protected void saveInlineCode(java.util.Vector hooks,
                              javassist.CtMethod method)

getFieldClassVarName

protected java.lang.String getFieldClassVarName()

addFieldClassInstance

protected void addFieldClassInstance(javassist.CtClass fieldClass)
                              throws java.lang.Exception
Throws:
java.lang.Exception

generateReplaceSequence

protected java.lang.String generateReplaceSequence(HookContextProperty requiredHooksContext,
                                                   java.util.Vector replaceVector,
                                                   boolean testReplaces,
                                                   javassist.CtClass fieldClass,
                                                   boolean outputDefined)
                                            throws java.lang.Exception
Overrides:
generateReplaceSequence in class CombinedHooksFactory
Throws:
java.lang.Exception

inlineReplaceCompilingPossible

protected boolean inlineReplaceCompilingPossible(java.util.Vector hooks,
                                                 HookContextProperty requiredHooksContext,
                                                 boolean testReplaces)

getThisInstance

protected java.lang.String getThisInstance()

generateInvokeInitCode

protected java.lang.String generateInvokeInitCode(java.util.Vector replaceVector,
                                                  HookContextProperty requiredHooksContext,
                                                  boolean noReplace,
                                                  boolean testReplaces)
                                           throws java.lang.Exception
Overrides:
generateInvokeInitCode in class CombinedHooksFactory
Throws:
java.lang.Exception

computeAdviceContext

protected HookContextProperty computeAdviceContext(java.lang.String adviceType,
                                                   java.util.Vector advices)

generateAdviceArgs

public java.lang.String generateAdviceArgs(java.lang.String adviceType,
                                           java.util.Vector advices,
                                           boolean testReplaces)
Overrides:
generateAdviceArgs in class CombinedHooksFactory

hooksExactlyDefineArgs

protected boolean hooksExactlyDefineArgs(java.util.Vector hooks,
                                         java.lang.String adviceType)
prereq: all hooks have the same args and return type!!! checks whether hooks have the same return type and expected jp arguments as the jp method itself

Parameters:
hooks -
adviceType -
Returns:

allHooksHaveSameArgs

protected boolean allHooksHaveSameArgs(java.util.Vector hooks,
                                       java.lang.String adviceType)
Checks whether all hooks have the same expected jp args and jp return type

Parameters:
hooks -
adviceType -
Returns:

requiresDefaultAround

protected boolean requiresDefaultAround(java.util.Vector replaceVector,
                                        boolean testReplaces)

generateReplaceAdviceArgs

protected java.lang.String generateReplaceAdviceArgs(HookContextProperty requiredContext,
                                                     java.lang.String adviceType,
                                                     java.util.Vector hooks,
                                                     boolean testReplaces)

castAdviceArgs

protected java.lang.String castAdviceArgs(java.lang.String adviceType,
                                          java.lang.String resultName)
Overrides:
castAdviceArgs in class CombinedHooksFactory

generateNonReplaceAdviceArgs

protected java.lang.String generateNonReplaceAdviceArgs(HookContextProperty requiredContext,
                                                        java.lang.String adviceType,
                                                        IHook hook)

findReflectMethod

protected javassist.CtMethod findReflectMethod(IHook hook,
                                               java.lang.String adviceType,
                                               boolean strictSelection)
finds the most specific advice method, returns null if not existing method

Parameters:
hook -
adviceType -
Returns:

computeThrowingExceptionType

protected java.lang.String computeThrowingExceptionType(java.util.Vector hooks,
                                                        java.lang.String adviceType)
Overrides:
computeThrowingExceptionType in class CombinedHooksFactory

defineOutput

public java.lang.String defineOutput(JascoMethod newMethod,
                                     HookContextProperty requiredHooksContext)
                              throws java.lang.Exception
Overrides:
defineOutput in class CombinedHooksFactory
Throws:
java.lang.Exception

generateOriginalMethodInvokeNoReplace

protected java.lang.String generateOriginalMethodInvokeNoReplace(JascoMethod method,
                                                                 HookContextProperty requiredHooksContext,
                                                                 boolean outputDefined)
                                                          throws java.lang.Exception
Overrides:
generateOriginalMethodInvokeNoReplace in class CombinedHooksFactory
Throws:
java.lang.Exception

doReturn

protected java.lang.String doReturn(java.lang.String var,
                                    boolean noReplace,
                                    HookContextProperty requiredHooksContext)
                             throws java.lang.Exception
Overrides:
doReturn in class CombinedHooksFactory
Throws:
java.lang.Exception

requiresInvocationThrowingReturning

public boolean requiresInvocationThrowingReturning(java.lang.String adviceType,
                                                   IHook theHook)
Description copied from class: CombinedHooksFactory
only for returning/throwing advices, might be that there is no advice declared

Overrides:
requiresInvocationThrowingReturning in class CombinedHooksFactory
Returns:

initCtMethod

protected javassist.CtMethod initCtMethod(JascoMethod method)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

makeFieldsStaticPublic

protected void makeFieldsStaticPublic(javassist.CtClass clazz)
                               throws java.lang.Exception
Throws:
java.lang.Exception

addField

protected void addField(java.lang.String f,
                        javassist.CtClass clz)
                 throws java.lang.Exception
Overrides:
addField in class CombinedHooksFactory
Throws:
java.lang.Exception

moreInvokeCode

protected java.lang.String moreInvokeCode(IHook hook,
                                          java.lang.String accessHook,
                                          java.lang.String conditionboolean)
Overrides:
moreInvokeCode in class CombinedHooksFactory

generateFactoryInit

protected java.lang.String generateFactoryInit(DynamicHookElement element,
                                               javassist.CtClass fieldClass,
                                               int index)
                                        throws java.lang.Exception
Overrides:
generateFactoryInit in class CombinedHooksFactory
Returns:
Throws:
java.lang.Exception

generateFactoryAspectsForDynamicHookElements

protected java.lang.String generateFactoryAspectsForDynamicHookElements(DynamicHookElement el,
                                                                        java.lang.String assignStartCode)
Overrides:
generateFactoryAspectsForDynamicHookElements in class CombinedHooksFactory