signature:
public class AbstractProfileMBeanImpl { /** * Logic to execute after invoking a cmp setter method on the mbean
 * @ throws ManagementException */
protected void afterSetCmpField ( ) throws ManagementException { } }

implementation: if ( logger . isDebugEnabled ( ) ) { logger . debug ( "afterSetCmpField() on profile with name " + profileName + " of table " + profileTable . getProfileTableName ( ) ) ; } try { sleeContainer . getTransactionManager ( ) . suspend ( ) ; } catch ( Throwable e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; }


signature:
public class AbstractProfileMBeanImpl { /** * Logic to execute before invoking a cmp getter method on the mbean
 * @ return true if the method initiated or resumed a transaction
 * @ throws ManagementException */
protected boolean beforeGetCmpField ( ) throws ManagementException { } }

implementation: if ( logger . isDebugEnabled ( ) ) { logger . debug ( "beforeGetCmpField() on profile with name " + profileName + " of table " + profileTable . getProfileTableName ( ) ) ; } return beforeNonSetCmpField ( ) ;


signature:
public class AbstractProfileMBeanImpl { /** * Logic to execute after invoking a cmp getter method on the mbean
 * @ param activatedTransaction if the method beforeGetCmpField ( ) initiated or resumed a transaction
 * @ throws ManagementException */
protected void afterGetCmpField ( boolean activatedTransaction ) throws ManagementException { } }

implementation: if ( logger . isDebugEnabled ( ) ) { logger . debug ( "afterGetCmpField( activatedTransaction = " + activatedTransaction + " ) on profile with name " + profileName + " of table " + profileTable . getProfileTableName ( ) ) ; } afterNonSetCmpField ( activatedTransaction ) ;


signature:
public class AbstractProfileMBeanImpl { /** * Logic to execute before invoking a management method on the mbean
 * @ return true if the method initiated or resumed a transaction
 * @ throws ManagementException */
protected boolean beforeManagementMethodInvocation ( ) throws ManagementException { } }

implementation: if ( logger . isDebugEnabled ( ) ) { logger . debug ( "beforeManagementMethodInvocation() on profile with name " + profileName + " of table " + profileTable . getProfileTableName ( ) ) ; } jndiManagement = sleeContainer . getJndiManagement ( ) ; jndiManagement . pushJndiContext ( profileTable . getProfileSpecificationComponent ( ) ) ; return beforeNonSetCmpField ( ) ;


signature:
public class AbstractProfileMBeanImpl { /** * Logic to execute after invoking a management method on the mbean
 * @ param activatedTransaction if the method beforeManagementMethodInvocation ( ) initiated or resumed a transaction
 * @ throws ManagementException */
protected void afterManagementMethodInvocation ( boolean activatedTransaction ) throws ManagementException { } }

implementation: if ( logger . isDebugEnabled ( ) ) { logger . debug ( "afterManagementMethodInvocation( activatedTransaction = " + activatedTransaction + " ) on profile with name " + profileName + " of table " + profileTable . getProfileTableName ( ) ) ; } afterNonSetCmpField ( activatedTransaction ) ; jndiManagement . popJndiContext ( ) ;


signature:
public class AbstractProfileMBeanImpl { /** * Handles a { @ link Throwable } , which was the result of a management method invocation
 * @ param t
 * @ throws ProfileImplementationException
 * @ throws InvalidStateException
 * @ throws ManagementException */
protected void throwableOnManagementMethodInvocation ( Throwable t ) throws ProfileImplementationException , InvalidStateException , ManagementException { } }

implementation:
if ( t instanceof ProfileImplementationException ) { throw ( ProfileImplementationException ) t ; } else if ( t instanceof InvalidStateException ) { throw ( InvalidStateException ) t ; } else if ( t instanceof ReadOnlyProfileException ) { throw new InvalidStateException ( t . getMessage ( ) ) ; } else if ( t instanceof ManagementException ) { throw ( ManagementException ) t ; } else if ( t instanceof RuntimeException ) { try { getProfileObject ( ) . invalidateObject ( ) ; sleeContainer . getTransactionManager ( ) . setRollbackOnly ( ) ; } catch ( Throwable e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } throw new ProfileImplementationException ( t ) ; } else { // checked exception
throw new ProfileImplementationException ( t ) ; }


signature:
public class EventContextImpl { /** * / * ( non - Javadoc )
 * @ see javax . slee . EventContext # suspendDelivery ( int ) */
public void suspendDelivery ( int arg0 ) throws IllegalArgumentException , IllegalStateException , TransactionRequiredLocalException , SLEEException { } }

implementation: suspensionHandlerLazyInit ( ) ; suspensionHandler . suspendDelivery ( arg0 ) ;


signature:
public class EventContextImpl { /** * / * ( non - Javadoc )
 * @ see org . mobicents . slee . container . event . EventContext # eventProcessingFailed ( javax . slee . resource . FailureReason ) */
public void eventProcessingFailed ( FailureReason reason ) { } }

implementation:
if ( data . getFailedCallback ( ) != null ) { try { data . getFailedCallback ( ) . eventProcessingFailed ( reason ) ; } catch ( Throwable e ) { // ignore
} } canceled ( ) ;


signature:
public class EventContextImpl { /** * / * ( non - Javadoc )
 * @ see org . mobicents . slee . container . event . EventContext # eventProcessingSucceed ( ) */
public void eventProcessingSucceed ( boolean sbbProcessedEvent ) { } }

implementation:
if ( data . getSucceedCallback ( ) != null ) { data . getSucceedCallback ( ) . eventProcessingSucceed ( sbbProcessedEvent ) ; // ensure failed never gets called , even if event is refired
data . unsetFailedCallback ( ) ; }


signature:
public class EventContextImpl { /** * / * ( non - Javadoc )
 * @ see org . mobicents . slee . container . event . EventContext # unreferencedCallbackRequiresTransaction ( ) */
public boolean routedRequiresTransaction ( ) { } }

implementation: final EventUnreferencedCallback unreferencedCallback = data . getUnreferencedCallback ( ) ; if ( unreferencedCallback == null ) { return false ; } else { return unreferencedCallback . requiresTransaction ( ) ; }


signature:
public class ResourceAdaptorEntityNotification { /** * Get a JMX Object Name property string that uniquely identifies the specified
 * resource adaptor entity , suitable for inclusion in the Object Name of a Usage
 * MBean . This method makes use of the { @ link ObjectName # quote } < / code > method
 * to ensure that the resource adaptor entity name is valid for inclusion as property
 * values in an Object Name .
 * This method can be used as follows to manually construct a complete Object Name
 * for a Usage MBean :
 * < br > < ul > < code >
 * ObjectName name = new ObjectName ( < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link javax . slee . usage . UsageMBean # BASE _ OBJECT _ NAME } + " , " + < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link javax . slee . usage . UsageMBean # USAGE _ PARAMETER _ SET _ NAME _ KEY } + " = " + ObjectName . quote ( paramSetName ) + " , " & nbsp ; / / optional < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link javax . slee . usage . UsageMBean # NOTIFICATION _ SOURCE _ KEY } + " = " + { @ link # USAGE _ NOTIFICATION _ TYPE ResourceAdaptorEntityNotification . USAGE _ NOTIFICATION _ TYPE } + " , " + < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link # getUsageMBeanProperties ( String ) ResourceAdaptorEntityNotification . getUsageMBeanProperties ( entityName ) } < br >
 * < / code > < / ul >
 * @ param entityName the name of the resource adaptor entity .
 * @ return an Object Name property string that uniquely identifies the resource
 * adaptor entity .
 * @ throws NullPointerException if < code > entityName < / code > is < code > null < / code > . */
public static String getUsageMBeanProperties ( String entityName ) { } }

implementation: if ( entityName == null ) throw new NullPointerException ( "entityName is null" ) ; return RESOURCE_ADAPTOR_ENTITY_NAME_KEY + '=' + ObjectName . quote ( entityName ) ;


signature:
public class ResourceAdaptorEntityNotification { /** * Compare this notification source with the specified object for order .
 * Returns a negative integer , zero , or a positive integer if this object
 * is less than , equal to , or greater than the specified object .
 * If < code > obj < / code > is a < code > ResourceAdaptorEntityNotification < / code > ,
 * order is determined by comparing the encapsulated resource adaptor entity
 * name . Otherwise , if < code > obj < / code > is a < code > NotificationSource < / code > ,
 * ordering is determined by comparing the class name of this class with the
 * class name of < code > obj < / code > .
 * @ param obj the object to compare this with .
 * @ return a negative integer , zero , or a positive integer if this notification
 * source is considered less than , equal to , or greater than the
 * specified object .
 * @ throws ClassCastException if < code > obj < / code > does not implement the
 * { @ link NotificationSource } interface .
 * @ see Comparable # compareTo ( Object ) */
public int compareTo ( Object obj ) { } }

implementation:
// can ' t compare with null
if ( obj == null ) throw new NullPointerException ( "obj is null" ) ; if ( obj == this ) return 0 ; if ( obj instanceof ResourceAdaptorEntityNotification ) { // compare the entity name
ResourceAdaptorEntityNotification that = ( ResourceAdaptorEntityNotification ) obj ; return this . entityName . compareTo ( that . entityName ) ; } else { return super . compareTo ( TYPE , obj ) ; }


signature:
public class SbbNotification { /** * Get a JMX Object Name property string that uniquely identifies the specified
 * service and SBB , suitable for inclusion in the Object Name of a Usage MBean .
 * This method makes use of the { @ link ObjectName # quote } < / code > method to ensure
 * that the component identifier attributes are valid for inclusion as property
 * values in an Object Name .
 * This method can be used as follows to manually construct a complete Object Name
 * for a Usage MBean :
 * < br > < ul > < code >
 * ObjectName name = new ObjectName ( < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link javax . slee . usage . UsageMBean # BASE _ OBJECT _ NAME } + " , " + < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link javax . slee . usage . UsageMBean # USAGE _ PARAMETER _ SET _ NAME _ KEY } + " = " + ObjectName . quote ( paramSetName ) + " , " & nbsp ; / / optional < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link javax . slee . usage . UsageMBean # NOTIFICATION _ SOURCE _ KEY } + " = " + { @ link # USAGE _ NOTIFICATION _ TYPE SbbNotification . USAGE _ NOTIFICATION _ TYPE } + " , " + < br >
 * & nbsp ; & nbsp ; & nbsp ; & nbsp ; { @ link # getUsageMBeanProperties ( ServiceID , SbbID ) SbbNotification . getUsageMBeanProperties ( service , sbb ) } < br >
 * < / code > < / ul >
 * @ param service the component identifier of the service .
 * @ param sbb the component identifier of the SBB .
 * @ return an Object Name property string that uniquely identifies the specified
 * service and SBB components .
 * @ throws NullPointerException if either argument is < code > null < / code > . */
public static String getUsageMBeanProperties ( ServiceID service , SbbID sbb ) { } }

implementation: if ( service == null ) throw new NullPointerException ( "service is null" ) ; if ( sbb == null ) throw new NullPointerException ( "sbb is null" ) ; StringBuffer buf = new StringBuffer ( ) ; buf . append ( SERVICE_NAME_KEY ) . append ( '=' ) . append ( ObjectName . quote ( service . getName ( ) ) ) . append ( ',' ) ; buf . append ( SERVICE_VENDOR_KEY ) . append ( '=' ) . append ( ObjectName . quote ( service . getVendor ( ) ) ) . append ( ',' ) ; buf . append ( SERVICE_VERSION_KEY ) . append ( '=' ) . append ( ObjectName . quote ( service . getVersion ( ) ) ) . append ( ',' ) ; buf . append ( SBB_NAME_KEY ) . append ( '=' ) . append ( ObjectName . quote ( sbb . getName ( ) ) ) . append ( ',' ) ; buf . append ( SBB_VENDOR_KEY ) . append ( '=' ) . append ( ObjectName . quote ( sbb . getVendor ( ) ) ) . append ( ',' ) ; buf . append ( SBB_VERSION_KEY ) . append ( '=' ) . append ( ObjectName . quote ( sbb . getVersion ( ) ) ) ; return buf . toString ( ) ;


signature:
public class SbbNotification { /** * Compare this notification source with the specified object for order .
 * Returns a negative integer , zero , or a positive integer if this object
 * is less than , equal to , or greater than the specified object .
 * If < code > obj < / code > is an < code > SbbNotification < / code > , order is determined
 * by comparing first the encapsulated service component identifier and then ,
 * if the service component identifiers are equal , the encapsulated SBB
 * component identifier . Otherwise , if < code > obj < / code > is a
 * < code > NotificationSource < / code > , ordering is determined by comparing the
 * class name of this class with the class name of < code > obj < / code > .
 * @ param obj the object to compare this with .
 * @ return a negative integer , zero , or a positive integer if this notification
 * source is considered less than , equal to , or greater than the
 * specified object .
 * @ throws ClassCastException if < code > obj < / code > does not implement the
 * { @ link NotificationSource } interface .
 * @ see Comparable # compareTo ( Object ) */
public int compareTo ( Object obj ) { } }

implementation:
// can ' t compare with null
if ( obj == null ) throw new NullPointerException ( "obj is null" ) ; if ( obj == this ) return 0 ; if ( obj instanceof SbbNotification ) { // compare the service id then the sbb id
SbbNotification that = ( SbbNotification ) obj ; int serviceComparison = this . service . compareTo ( that . service ) ; return serviceComparison != 0 ? serviceComparison : this . sbb . compareTo ( that . sbb ) ; } else { return super . compareTo ( TYPE , obj ) ; }


signature:
public class DeployableUnitImpl { /** * Returns an unmodifiable set with all { @ link AbstractSleeComponent } s of the
 * deployable unit .
 * @ return */
public Set < SleeComponent > getDeployableUnitComponents ( ) { } }

implementation: Set < SleeComponent > result = new HashSet < SleeComponent > ( ) ; result . addAll ( getEventTypeComponents ( ) . values ( ) ) ; result . addAll ( getLibraryComponents ( ) . values ( ) ) ; result . addAll ( getProfileSpecificationComponents ( ) . values ( ) ) ; result . addAll ( getResourceAdaptorComponents ( ) . values ( ) ) ; result . addAll ( getResourceAdaptorTypeComponents ( ) . values ( ) ) ; result . addAll ( getSbbComponents ( ) . values ( ) ) ; result . addAll ( getServiceComponents ( ) . values ( ) ) ; return Collections . unmodifiableSet ( result ) ;


signature:
public class DeployableUnitImpl { /** * deletes the whole path , going through directories
 * @ param path */
private void deletePath ( File path ) { } }

implementation: if ( path . isDirectory ( ) ) { File [ ] files = path . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { deletePath ( file ) ; } } } path . delete ( ) ;


signature:
public class DeployableUnitImpl { /** * Returns the { @ link DeployableUnitDescriptor } for this deployable unit .
 * @ return */
public javax . slee . management . DeployableUnitDescriptor getSpecsDeployableUnitDescriptor ( ) { } }

implementation: Set < ComponentID > componentIDs = new HashSet < ComponentID > ( ) ; for ( SleeComponent component : getDeployableUnitComponents ( ) ) { componentIDs . add ( component . getComponentID ( ) ) ; } return new DeployableUnitDescriptor ( getDeployableUnitID ( ) , date , componentIDs . toArray ( new ComponentID [ 0 ] ) ) ;


signature:
public class ActivityEndEventUnreferencedCallback { /** * / * ( non - Javadoc )
 * @ see org . mobicents . slee . container . event . EventUnreferencedCallback # eventUnreferenced ( ) */
public void eventUnreferenced ( ) { } }

implementation: ActivityContextImpl ac = factory . getActivityContext ( ach ) ; if ( ac != null ) { ac . activityEnded ( ) ; }


signature:
public class ProfileTableActivityContextHandle { /** * ( non - Javadoc )
 * @ see java . io . Externalizable # readExternal ( java . io . ObjectInput ) */
@ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } }

implementation: this . activityHandle = new ProfileTableActivityHandleImpl ( in . readUTF ( ) , ( Address ) in . readObject ( ) ) ;


signature:
public class ProfileTableActivityContextHandle { /** * ( non - Javadoc )
 * @ see java . io . Externalizable # writeExternal ( java . io . ObjectOutput ) */
@ Override public void writeExternal ( ObjectOutput out ) throws IOException { } }

implementation: out . writeUTF ( activityHandle . getProfileTable ( ) ) ; out . writeObject ( activityHandle . getClusterLocalAddress ( ) ) ;


signature:
public class ConcreteUsageNotificationManagerMBeanGenerator { /** * Create a constructor . This method simply records the input parameters in
 * appropriately named fields .
 * @ param
 * @ param classes */
private void createConstructor ( CtClass concreteClass , CtClass usageMBeanInterface , CtClass notificationSource , CtClass usageComponent ) throws Exception { } }

implementation: CtConstructor ctCons = new CtConstructor ( new CtClass [ ] { usageMBeanInterface , notificationSource , usageComponent } , concreteClass ) ; ctCons . setBody ( "{ super($1,$2,$3); }" ) ; concreteClass . addConstructor ( ctCons ) ;


signature:
public class CongestionControlConfiguration { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . jmx . CongestionControlConfigurationMBean # setMinFreeMemoryToTurnOn ( int ) */
public void setMinFreeMemoryToTurnOn ( int minFreeMemoryToTurnOn ) throws IllegalArgumentException { } }

implementation: if ( minFreeMemoryToTurnOn < 0 || minFreeMemoryToTurnOn > 100 ) { throw new IllegalArgumentException ( "param value must be within 0 - 100%" ) ; } this . minFreeMemoryToTurnOn = minFreeMemoryToTurnOn ; if ( congestureControl != null ) { congestureControl . configurationUpdate ( ) ; }


signature:
public class CongestionControlConfiguration { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . jmx . CongestionControlConfigurationMBean # setMinFreeMemoryToTurnOff ( int ) */
public void setMinFreeMemoryToTurnOff ( int minFreeMemoryToTurnOff ) throws IllegalArgumentException { } }

implementation: if ( minFreeMemoryToTurnOff < 0 || minFreeMemoryToTurnOff > 100 ) { throw new IllegalArgumentException ( "param value must be within 0 - 100%" ) ; } this . minFreeMemoryToTurnOff = minFreeMemoryToTurnOff ; if ( congestureControl != null ) { congestureControl . configurationUpdate ( ) ; }


signature:
public class CongestionControlConfiguration { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . jmx . CongestionControlConfigurationMBean # setPeriodBetweenChecks ( int ) */
public void setPeriodBetweenChecks ( int periodBetweenChecks ) throws IllegalArgumentException { } }

implementation: if ( periodBetweenChecks < 0 ) { throw new IllegalArgumentException ( "param value must not be negative" ) ; } this . periodBetweenChecks = periodBetweenChecks ; if ( congestureControl != null ) { congestureControl . configurationUpdate ( ) ; }


signature:
public class ConcreteSbbGenerator { /** * Generate the concrete sbb Class
 * @ return the concrete sbb class */
public void generateConcreteSbb ( ) throws DeploymentException { } }

implementation:
String sbbAbstractClassName = sbbComponent . getAbstractSbbClass ( ) . getName ( ) ; String sbbConcreteClassName = ConcreteClassGeneratorUtils . getSbbConcreteClassName ( sbbAbstractClassName ) ; sbbConcreteClass = pool . makeClass ( sbbConcreteClassName ) ; try { try { sbbAbstractClass = pool . get ( sbbAbstractClassName ) ; } catch ( NotFoundException nfe ) { throw new DeploymentException ( nfe . getMessage ( ) , nfe ) ; } generateAbstractSbbClassInfo ( ) ; try { ConcreteClassGeneratorUtils . createInterfaceLinks ( sbbConcreteClass , new CtClass [ ] { pool . get ( SbbConcrete . class . getName ( ) ) } ) ; } catch ( NotFoundException nfe ) { throw new DeploymentException ( nfe . getMessage ( ) , nfe ) ; } ConcreteClassGeneratorUtils . createInheritanceLink ( sbbConcreteClass , sbbAbstractClass ) ; abstractMethods = ClassUtils . getAbstractMethodsFromClass ( sbbAbstractClass ) ; superClassesAbstractMethods = ClassUtils . getSuperClassesAbstractMethodsFromClass ( sbbAbstractClass ) ; try { createFields ( new CtClass [ ] { pool . get ( SbbEntity . class . getName ( ) ) , pool . get ( SbbObjectState . class . getName ( ) ) } ) ; CtClass [ ] parameters = new CtClass [ ] { pool . get ( SbbEntity . class . getName ( ) ) } ; createSbbEntityGetterAndSetter ( sbbConcreteClass ) ; createDefaultUsageParameterGetter ( sbbConcreteClass ) ; createNamedUsageParameterGetter ( sbbConcreteClass ) ; createDefaultConstructor ( ) ; createConstructorWithParameter ( parameters ) ; } catch ( NotFoundException nfe ) { logger . error ( "Constructor With Parameter not created" ) ; throw new DeploymentException ( "Constructor not created." , nfe ) ; } SbbAbstractClassDescriptor mSbbAbstractClass = sbbComponent . getDescriptor ( ) . getSbbAbstractClass ( ) ; createCMPAccessors ( mSbbAbstractClass . getCmpFields ( ) ) ; createGetChildRelationsMethod ( mSbbAbstractClass . getChildRelationMethods ( ) . values ( ) ) ; createGetProfileCMPMethods ( mSbbAbstractClass . getProfileCMPMethods ( ) . values ( ) ) ; createFireEventMethods ( sbbComponent . getDescriptor ( ) . getEventEntries ( ) . values ( ) ) ; // GetUsageParametersMethod [ ] usageParameters =
// sbbDeploymentDescriptor . getUsageParametersMethods ( ) ;
// if the activity context interface has been defined in the
// descriptor
// file
// then generates the concrete class of the activity context
// interface
// and implements the narrow method
if ( sbbComponent . getDescriptor ( ) . getSbbActivityContextInterface ( ) != null ) { Class < ? > activityContextInterfaceClass = null ; try { activityContextInterfaceClass = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( sbbComponent . getDescriptor ( ) . getSbbActivityContextInterface ( ) ) ; } catch ( ClassNotFoundException e2 ) { String s = "Error creating constructor -  class not found" ; logger . error ( s , e2 ) ; throw new DeploymentException ( s , e2 ) ; } // Check the activity context interface for illegal method
// names .
Method [ ] methods = activityContextInterfaceClass . getMethods ( ) ; ArrayList < String > allSetters = new ArrayList < String > ( ) ; ArrayList < String > missingSetters = new ArrayList < String > ( ) ; if ( methods != null ) { for ( int i = 0 ; i < methods . length ; i ++ ) { if ( ! methods [ i ] . getDeclaringClass ( ) . getName ( ) . equals ( javax . slee . ActivityContextInterface . class . getName ( ) ) && ! methods [ i ] . getDeclaringClass ( ) . getName ( ) . equals ( ActivityContextInterfaceExt . class . getName ( ) ) ) { String methodName = methods [ i ] . getName ( ) ; // setters should have a single parameter and should
// return void type .
if ( methodName . startsWith ( "set" ) ) { Class < ? > [ ] args = methods [ i ] . getParameterTypes ( ) ; // setter should only have one argument
if ( args . length != 1 ) throw new DeploymentException ( "Setter method '" + methodName + "' should only have one argument." ) ; // setter return type should be void
Class < ? > returnClass = methods [ i ] . getReturnType ( ) ; if ( ! returnClass . equals ( Void . TYPE ) ) throw new DeploymentException ( "Setter method '" + methodName + "' return type should be void." ) ; allSetters . add ( methodName ) ; } else if ( methodName . startsWith ( "get" ) ) { Class < ? > [ ] args = methods [ i ] . getParameterTypes ( ) ; // getter should have no parameters .
if ( args != null && args . length != 0 ) throw new DeploymentException ( "Getter method '" + methodName + "' should have no parameters." ) ; // getter return type should not be void
if ( methods [ i ] . getReturnType ( ) . equals ( Void . TYPE ) ) throw new DeploymentException ( "Getter method '" + methodName + "' return type cannot be void." ) ; String setterName = methodName . replaceFirst ( "get" , "set" ) ; try { activityContextInterfaceClass . getMethod ( setterName , methods [ i ] . getReturnType ( ) ) ; } catch ( NoSuchMethodException nsme ) { missingSetters . add ( setterName ) ; } } else { throw new DeploymentException ( "Invalid method '" + methodName + "' in SBB Activity Context Interface." ) ; } } } // Check if the missing setters aren ' t defined with
// different arg
for ( String setter : missingSetters ) if ( allSetters . contains ( setter ) ) throw new DeploymentException ( "Getter argument type and" + " setter return type for attribute '" + setter . replaceFirst ( "set" , "" ) . toLowerCase ( ) + "' must be the same." ) ; } /* * CtMethod [ ] abstractClassMethods =
 * sbbAbstractClass . getDeclaredMethods ( ) ;
 * for ( int i = 0 ; i < abstractClassMethods . length ; i + + ) {
 * CtMethod ctMethod = abstractClassMethods [ i ] ; if ( !
 * Modifier . isAbstract ( ctMethod . getModifiers ( ) ) ) {
 * this . createMethodWrapper ( sbbConcreteClass , ctMethod ) ; } } */
// check if the concrete class has already been generated .
// if that the case , the guess is that the concrete class is a
// safe
// one
// and so it is not generated again
// avoid also problems of class already loaded from the class
// loader
CtClass activityContextInterface = null ; try { activityContextInterface = pool . get ( activityContextInterfaceClass . getName ( ) ) ; createField ( activityContextInterface , "sbbActivityContextInterface" ) ; this . createSetActivityContextInterfaceMethod ( activityContextInterface ) ; ConcreteActivityContextInterfaceGenerator concreteActivityContextInterfaceGenerator = new ConcreteActivityContextInterfaceGenerator ( activityContextInterfaceClass . getName ( ) , deployDir , pool ) ; Class < ? > concreteActivityContextInterfaceClass = concreteActivityContextInterfaceGenerator . generateActivityContextInterfaceConcreteClass ( ) ; createGetSbbActivityContextInterfaceMethod ( activityContextInterface , concreteActivityContextInterfaceClass ) ; // set the concrete activity context interface class in
// the
// descriptor
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "SETTING ACI concrete class  " + concreteActivityContextInterfaceClass + " in " + sbbComponent ) ; } sbbComponent . setActivityContextInterfaceConcreteClass ( concreteActivityContextInterfaceClass ) ; } catch ( NotFoundException nfe ) { logger . error ( "Narrow Activity context interface method and " + "activity context interface concrete class not created" ) ; throw new DeploymentException ( nfe . getMessage ( ) , nfe ) ; } finally { /* * if ( activityContextInterface ! = null ) {
 * activityContextInterface . detach ( ) ; } */
} } // if the sbb local object has been defined in the descriptor file
// then generates the concrete class of the sbb local object
// and implements the narrow method
Class < ? > sbbLocalInterfaceClass = sbbComponent . getSbbLocalInterfaceClass ( ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Sbb Local Object interface :" + sbbLocalInterfaceClass ) ; } if ( sbbLocalInterfaceClass != null && ! sbbLocalInterfaceClass . getName ( ) . equals ( "javax.slee.SbbLocalObject" ) ) { try { pool . get ( sbbLocalInterfaceClass . getName ( ) ) ; ConcreteSbbLocalObjectGenerator concreteSbbLocalObjectGenerator = new ConcreteSbbLocalObjectGenerator ( sbbLocalInterfaceClass . getName ( ) , sbbAbstractClassName , this . deployDir , pool ) ; Class < ? > concreteSbbLocalObjectClass = concreteSbbLocalObjectGenerator . generateSbbLocalObjectConcreteClass ( ) ; // set the sbb Local object class in the descriptor
sbbComponent . setSbbLocalInterfaceConcreteClass ( concreteSbbLocalObjectClass ) ; } catch ( NotFoundException nfe ) { String s = "sbb Local Object concrete class not created for interface " + sbbLocalInterfaceClass . getName ( ) ; throw new DeploymentException ( s , nfe ) ; } } // if there is no interface defined in the descriptor for sbb local
// object
// then the slee implementation is taken
else { try { sbbComponent . setSbbLocalInterfaceClass ( SbbLocalObject . class ) ; sbbComponent . setSbbLocalInterfaceConcreteClass ( SbbLocalObjectImpl . class ) ; } catch ( Exception e ) { throw new DeploymentException ( e . getMessage ( ) , e ) ; } } try { sbbConcreteClass . writeFile ( deployDir ) ; // @ @ 2.4 + - > 3.4 +
// pool . writeFile ( sbbConcreteClassName , deployPath ) ;
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Concrete Class " + sbbConcreteClassName + " generated in the following path " + deployDir ) ; } } catch ( Exception e ) { String s = "Error generating concrete class" ; throw new DeploymentException ( s , e ) ; } Class < ? > clazz = null ; try { clazz = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( sbbConcreteClassName ) ; } catch ( ClassNotFoundException e1 ) { String s = "What the heck?! Could not find generated class. Is it under the chair?" ; throw new DeploymentException ( s , e1 ) ; } // set the concrete class in the descriptor
sbbComponent . setConcreteSbbClass ( clazz ) ; } finally { if ( sbbConcreteClass != null ) { sbbConcreteClass . defrost ( ) ; } } // uh uh
if ( sbbComponent . getConcreteSbbClass ( ) == null ) { throw new DeploymentException ( "concrete sbb class generation failed and I don't know why, bug bug ?!? :)" ) ; }


signature:
public class ConcreteSbbGenerator { /** * Generates info that indicates if a method from { @ link Sbb } interface
 * should be invoked or not , in runtime . */
private void generateAbstractSbbClassInfo ( ) { } }

implementation:
CtClass sbbClass = null ; try { sbbClass = pool . get ( Sbb . class . getName ( ) ) ; } catch ( NotFoundException e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } AbstractSbbClassInfo abstractSbbClassInfo = sbbComponent . getAbstractSbbClassInfo ( ) ; for ( CtMethod sbbClassMethod : sbbClass . getDeclaredMethods ( ) ) { for ( CtMethod sbbAbstractClassMethod : sbbAbstractClass . getMethods ( ) ) { if ( sbbAbstractClassMethod . getName ( ) . equals ( sbbClassMethod . getName ( ) ) && sbbAbstractClassMethod . getSignature ( ) . equals ( sbbClassMethod . getSignature ( ) ) ) { // match , save info
abstractSbbClassInfo . setInvokeInfo ( sbbAbstractClassMethod . getMethodInfo ( ) . getName ( ) , ! sbbAbstractClassMethod . isEmpty ( ) ) ; break ; } } }


signature:
public class ConcreteSbbGenerator { /** * Creates a constructor with parameters < BR >
 * For every parameter a field of the same class is created in the concrete
 * class And each field is gonna be initialized with the corresponding
 * parameter
 * @ param parameters
 * the parameters of the constructor to add
 * @ throws DeploymentException */
protected void createConstructorWithParameter ( CtClass [ ] parameters ) throws DeploymentException { } }

implementation:
CtConstructor constructorWithParameter = new CtConstructor ( parameters , sbbConcreteClass ) ; String constructorBody = "{" + "this();" ; /* * for ( int i = 0 ; i < parameters . length ; i + + ) { String parameterName =
 * parameters [ i ] . getName ( ) ; parameterName =
 * parameterName . substring ( parameterName . lastIndexOf ( " . " ) + 1 ) ; String
 * firstCharLowerCase = parameterName . substring ( 0 , 1 ) . toLowerCase ( ) ;
 * parameterName = firstCharLowerCase . concat ( parameterName
 * . substring ( 1 ) ) ;
 * int paramNumber = i + 1 ; constructorBody + = parameterName + " = $ " +
 * paramNumber + " ; " ; } */
constructorBody += "this.setSbbEntity($1);" ; constructorBody += "}" ; try { sbbConcreteClass . addConstructor ( constructorWithParameter ) ; constructorWithParameter . setBody ( constructorBody ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "ConstructorWithParameter created" ) ; } } catch ( CannotCompileException e ) { throw new DeploymentException ( e . getMessage ( ) , e ) ; }


signature:
public class ConcreteSbbGenerator { /** * Create a default constructor on the Sbb Concrete Class
 * @ throws DeploymentException */
protected void createDefaultConstructor ( ) throws DeploymentException { } }

implementation:
CtConstructor defaultConstructor = new CtConstructor ( null , sbbConcreteClass ) ; // We need a " do nothing " constructor because the
// convergence name creation method may need to actually
// create the object instance to run the method that
// creates the convergence name .
String constructorBody = "{ }" ; try { defaultConstructor . setBody ( constructorBody ) ; sbbConcreteClass . addConstructor ( defaultConstructor ) ; logger . trace ( "DefaultConstructor created" ) ; } catch ( CannotCompileException e ) { throw new DeploymentException ( e . getMessage ( ) , e ) ; }


signature:
public class ConcreteSbbGenerator { /** * Create a default usage parameter getter and setter .
 * @ param sbbConcrete
 * @ throws DeploymentException */
private void createDefaultUsageParameterGetter ( CtClass sbbConcrete ) throws DeploymentException { } }

implementation:
String methodName = "getDefaultSbbUsageParameterSet" ; CtMethod method = ( CtMethod ) abstractMethods . get ( methodName ) ; if ( method == null ) { method = ( CtMethod ) superClassesAbstractMethods . get ( methodName ) ; } if ( method != null ) { try { // copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod . copy ( method , sbbConcreteClass , null ) ; // create the method body
String concreteMethodBody = "{ return ($r)" + SbbAbstractMethodHandler . class . getName ( ) + ".getDefaultSbbUsageParameterSet(sbbEntity); }" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + methodName + " , body = " + concreteMethodBody ) ; } concreteMethod . setBody ( concreteMethodBody ) ; sbbConcreteClass . addMethod ( concreteMethod ) ; } catch ( CannotCompileException cce ) { throw new SLEEException ( "Cannot compile method " + method . getName ( ) , cce ) ; } }


signature:
public class ConcreteSbbGenerator { /** * Create a method to retrive the entity from the SbbObject .
 * @ param sbbConcrete
 * @ throws DeploymentException */
private void createSbbEntityGetterAndSetter ( CtClass sbbConcrete ) throws DeploymentException { } }

implementation: try { CtMethod getSbbEntity = CtNewMethod . make ( "public " + SbbEntity . class . getName ( ) + " getSbbEntity() { return this.sbbEntity; }" , sbbConcrete ) ; getSbbEntity . setModifiers ( Modifier . PUBLIC ) ; sbbConcrete . addMethod ( getSbbEntity ) ; CtMethod setSbbEntity = CtNewMethod . make ( "public void setSbbEntity ( " + SbbEntity . class . getName ( ) + " sbbEntity )" + "{" + "this.sbbEntity = sbbEntity;" + "}" , sbbConcrete ) ; setSbbEntity . setModifiers ( Modifier . PUBLIC ) ; sbbConcrete . addMethod ( setSbbEntity ) ; } catch ( Exception e ) { throw new DeploymentException ( e . getMessage ( ) , e ) ; }


signature:
public class ConcreteSbbGenerator { /** * Create the cmp field setters and getters
 * @ param cmps
 * the description of the cmp fields
 * @ throws DeploymentException */
protected void createCMPAccessors ( Collection < CMPFieldDescriptor > cmps ) throws DeploymentException { } }

implementation:
for ( CMPFieldDescriptor cmp : cmps ) { String fieldName = cmp . getCmpFieldName ( ) ; // Set the first char of the accessor to UpperCase to follow the
// javabean requirements
fieldName = fieldName . substring ( 0 , 1 ) . toUpperCase ( ) + fieldName . substring ( 1 ) ; String getterMethodName = "get" + fieldName ; CtMethod getterMethod = ( CtMethod ) abstractMethods . get ( getterMethodName ) ; if ( getterMethod == null ) { getterMethod = ( CtMethod ) this . superClassesAbstractMethods . get ( getterMethodName ) ; } if ( getterMethod == null ) { throw new SLEEException ( "can't find abstract method " + getterMethodName ) ; } // generate the acessor method name sufix from type
String getterHandlerMethodName = "getCMPFieldOfType" ; boolean getterHandlerMethodNeedResultCast = false ; String setterHandlerMethodName = "setCMPFieldOfType" ; try { CtClass ctClassCmpType = getterMethod . getReturnType ( ) ; if ( ctClassCmpType . isPrimitive ( ) ) { // boolean , byte , char , short , int , long , float , double
String ctClassCmpTypeName = ctClassCmpType . getName ( ) ; if ( ctClassCmpTypeName . equals ( boolean . class . getName ( ) ) ) { getterHandlerMethodName += "Boolean" ; } else if ( ctClassCmpTypeName . equals ( byte . class . getName ( ) ) ) { getterHandlerMethodName += "Byte" ; } else if ( ctClassCmpTypeName . equals ( char . class . getName ( ) ) ) { getterHandlerMethodName += "Char" ; } else if ( ctClassCmpTypeName . equals ( short . class . getName ( ) ) ) { getterHandlerMethodName += "Short" ; } else if ( ctClassCmpTypeName . equals ( int . class . getName ( ) ) ) { getterHandlerMethodName += "Integer" ; } else if ( ctClassCmpTypeName . equals ( long . class . getName ( ) ) ) { getterHandlerMethodName += "Long" ; } else if ( ctClassCmpTypeName . equals ( float . class . getName ( ) ) ) { getterHandlerMethodName += "Float" ; } else if ( ctClassCmpTypeName . equals ( double . class . getName ( ) ) ) { getterHandlerMethodName += "Double" ; } else { throw new SLEEException ( "unexpected primitive type " + ctClassCmpTypeName ) ; } getterHandlerMethodNeedResultCast = true ; setterHandlerMethodName += "PrimitiveOrUnknown" ; } else { // aci , event context , sbb local object , profile local object , Boolean , Byte , Char , Short , Integer , Long , Float , Double , unknown , array , enum , annotation
if ( ! ctClassCmpType . isArray ( ) && ! ctClassCmpType . isEnum ( ) && ! ctClassCmpType . isAnnotation ( ) ) { // aci , event context , sbb local object , profile local object , Boolean , Byte , Char , Short , Integer , Long , Float , Double , unknown
Class < ? > classCmpType = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( ctClassCmpType . getName ( ) ) ; if ( javax . slee . ActivityContextInterface . class . isAssignableFrom ( classCmpType ) ) { getterHandlerMethodName += "ActivityContextInterface" ; setterHandlerMethodName += "ActivityContextInterface" ; } else if ( EventContext . class . isAssignableFrom ( classCmpType ) ) { getterHandlerMethodName += "EventContext" ; setterHandlerMethodName += "EventContext" ; } else if ( ProfileLocalObject . class . isAssignableFrom ( classCmpType ) ) { getterHandlerMethodName += "ProfileLocalObject" ; setterHandlerMethodName += "ProfileLocalObject" ; } else if ( SbbLocalObject . class . isAssignableFrom ( classCmpType ) ) { getterHandlerMethodName += "SbbLocalObject" ; setterHandlerMethodName += "SbbLocalObject" ; } else { // Boolean , Byte , Char , Short , Integer , Long , Float , Double , unknown
if ( this . initializeReferenceDataTypesWithNull ) { getterHandlerMethodName += "Unknown" ; getterHandlerMethodNeedResultCast = true ; } else { // initialized with 0
String ctClassCmpTypeName = ctClassCmpType . getName ( ) ; if ( ctClassCmpTypeName . equals ( Boolean . class . getName ( ) ) ) { getterHandlerMethodName += "Boolean" ; } else if ( ctClassCmpTypeName . equals ( Byte . class . getName ( ) ) ) { getterHandlerMethodName += "Byte" ; } else if ( ctClassCmpTypeName . equals ( Character . class . getName ( ) ) ) { getterHandlerMethodName += "Char" ; } else if ( ctClassCmpTypeName . equals ( Short . class . getName ( ) ) ) { getterHandlerMethodName += "Short" ; } else if ( ctClassCmpTypeName . equals ( Integer . class . getName ( ) ) ) { getterHandlerMethodName += "Integer" ; } else if ( ctClassCmpTypeName . equals ( Long . class . getName ( ) ) ) { getterHandlerMethodName += "Long" ; } else if ( ctClassCmpTypeName . equals ( Float . class . getName ( ) ) ) { getterHandlerMethodName += "Float" ; } else if ( ctClassCmpTypeName . equals ( Double . class . getName ( ) ) ) { getterHandlerMethodName += "Double" ; } else { getterHandlerMethodName += "Unknown" ; getterHandlerMethodNeedResultCast = true ; } } setterHandlerMethodName += "PrimitiveOrUnknown" ; } } else { // array , enum , annotation = = same as unknown
getterHandlerMethodName += "Unknown" ; getterHandlerMethodNeedResultCast = true ; setterHandlerMethodName += "PrimitiveOrUnknown" ; } } } catch ( Exception cce ) { throw new SLEEException ( "Cannot determine the cmp type for cmp field named " + fieldName , cce ) ; } try { // copy method from abstract to concrete class
CtMethod concreteGetterMethod = CtNewMethod . copy ( getterMethod , sbbConcreteClass , null ) ; // create the method body
// FIXED : NPE when accessing not initialized CMP
// see https : / / github . com / RestComm / jain - slee / issues / 87
String concreteGetterMethodBody = "{ " + "if (sbbEntity == null) " + "    throw new TransactionRequiredLocalException(\"Cannot get CMP field. SBB entity is null\");" + "return " + ( getterHandlerMethodNeedResultCast ? "($r)" : "" ) + SbbAbstractMethodHandler . class . getName ( ) + "." + getterHandlerMethodName + "(sbbEntity,\"" + cmp . getCmpFieldName ( ) + "\");" + " }" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + getterMethodName + " , body = " + concreteGetterMethodBody ) ; } concreteGetterMethod . setBody ( concreteGetterMethodBody ) ; sbbConcreteClass . addMethod ( concreteGetterMethod ) ; } catch ( Exception cce ) { throw new SLEEException ( "Cannot compile method " + getterMethod . getName ( ) , cce ) ; } String setterMethodName = "set" + fieldName ; CtMethod setterMethod = ( CtMethod ) abstractMethods . get ( setterMethodName ) ; if ( setterMethod == null ) { setterMethod = ( CtMethod ) this . superClassesAbstractMethods . get ( setterMethodName ) ; } if ( setterMethod == null ) { throw new SLEEException ( "can't find abstract method " + setterMethodName ) ; } try { // copy method from abstract to concrete class
CtMethod concreteSetterMethod = CtNewMethod . copy ( setterMethod , sbbConcreteClass , null ) ; // create the method body
// FIXED : NPE when accessing not initialized CMP
// see https : / / github . com / RestComm / jain - slee / issues / 87
String concreteSetterMethodBody = "{ " + "if (sbbEntity == null) " + "    throw new TransactionRequiredLocalException(\"Cannot set CMP field. SBB entity is null\");" + SbbAbstractMethodHandler . class . getName ( ) + "." + setterHandlerMethodName + "(sbbEntity,\"" + cmp . getCmpFieldName ( ) + "\",$1); }" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + setterMethodName + " , body = " + concreteSetterMethodBody ) ; } concreteSetterMethod . setBody ( concreteSetterMethodBody ) ; sbbConcreteClass . addMethod ( concreteSetterMethod ) ; } catch ( CannotCompileException cce ) { throw new SLEEException ( "Cannot compile method " + getterMethod . getName ( ) , cce ) ; } }


signature:
public class ConcreteSbbGenerator { /** * Create the implementation of the fire event methods
 * @ param mEventEntries
 * the set of fire event */
protected void createFireEventMethods ( Collection < EventEntryDescriptor > mEventEntries ) { } }

implementation:
if ( mEventEntries == null ) return ; for ( EventEntryDescriptor mEventEntry : mEventEntries ) { if ( mEventEntry . isFired ( ) ) { String methodName = "fire" + mEventEntry . getEventName ( ) ; CtMethod method = ( CtMethod ) abstractMethods . get ( methodName ) ; if ( method == null ) { method = ( CtMethod ) superClassesAbstractMethods . get ( methodName ) ; } if ( method != null ) { try { // copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod . copy ( method , sbbConcreteClass , null ) ; // create the method body
String concreteMethodBody = "{" ; concreteMethodBody += getEventTypeIDInstantionString ( mEventEntry ) ; concreteMethodBody += SbbAbstractMethodHandler . class . getName ( ) + ".fireEvent(sbbEntity,eventTypeID" ; for ( int i = 0 ; i < method . getParameterTypes ( ) . length ; i ++ ) { concreteMethodBody += ",$" + ( i + 1 ) ; } concreteMethodBody += ");}" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + methodName + " , body = " + concreteMethodBody ) ; } concreteMethod . setBody ( concreteMethodBody ) ; sbbConcreteClass . addMethod ( concreteMethod ) ; } catch ( Exception e ) { throw new SLEEException ( "Cannot compile method " + method . getName ( ) , e ) ; } } } }


signature:
public class ConcreteSbbGenerator { /** * Create the get child relation method ( this method redirects the call to a
 * child relation interceptor )
 * @ param childRelations
 * the childRelations method to add to the concrete class */
protected void createGetChildRelationsMethod ( Collection < GetChildRelationMethodDescriptor > childRelations ) { } }

implementation:
if ( childRelations == null ) return ; for ( GetChildRelationMethodDescriptor childRelation : childRelations ) { String methodName = childRelation . getChildRelationMethodName ( ) ; CtMethod method = ( CtMethod ) abstractMethods . get ( methodName ) ; if ( method == null ) { method = ( CtMethod ) superClassesAbstractMethods . get ( methodName ) ; } if ( method != null ) { try { // copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod . copy ( method , sbbConcreteClass , null ) ; // create the method body
String concreteMethodBody = "{ return " + SbbAbstractMethodHandler . class . getName ( ) + ".getChildRelation(sbbEntity,\"" + methodName + "\"); }" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + methodName + " , body = " + concreteMethodBody ) ; } concreteMethod . setBody ( concreteMethodBody ) ; sbbConcreteClass . addMethod ( concreteMethod ) ; } catch ( CannotCompileException cce ) { throw new SLEEException ( "Cannot compile method " + method . getName ( ) , cce ) ; } } }


signature:
public class ConcreteSbbGenerator { /** * Create the get profile CMP method ( this method redirects the call to a
 * profile cmp interceptor )
 * @ param cmpProfiles
 * the CMP Profiles method to add to the concrete class */
protected void createGetProfileCMPMethods ( Collection < GetProfileCMPMethodDescriptor > cmpProfiles ) { } }

implementation:
if ( cmpProfiles == null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "no CMP Profile method implementation to generate." ) ; } return ; } for ( GetProfileCMPMethodDescriptor cmpProfile : cmpProfiles ) { String methodName = cmpProfile . getProfileCmpMethodName ( ) ; CtMethod method = ( CtMethod ) abstractMethods . get ( methodName ) ; if ( method == null ) method = ( CtMethod ) superClassesAbstractMethods . get ( methodName ) ; if ( method != null ) try { // copy method from abstract to concrete class
CtMethod concreteMethod = CtNewMethod . copy ( method , sbbConcreteClass , null ) ; // create the method body
String concreteMethodBody = "{ return " + SbbAbstractMethodHandler . class . getName ( ) + ".getProfileCMPMethod(sbbEntity,\"" + methodName + "\",$1); }" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Generated method " + methodName + " , body = " + concreteMethodBody ) ; } concreteMethod . setBody ( concreteMethodBody ) ; sbbConcreteClass . addMethod ( concreteMethod ) ; } catch ( CannotCompileException cce ) { throw new SLEEException ( "Cannot compile method " + method . getName ( ) , cce ) ; } }


signature:
public class ConcreteSbbGenerator { /** * Create the narrow method to get the activity context interface
 * @ param activityContextInterface
 * the activity context interface return type of the narrow
 * method
 * @ param concreteActivityContextInterfaceClass
 * @ throws DeploymentException */
protected void createGetSbbActivityContextInterfaceMethod ( CtClass activityContextInterface , Class < ? > concreteActivityContextInterfaceClass ) throws DeploymentException { } }

implementation: String methodToAdd = "public " + activityContextInterface . getName ( ) + " asSbbActivityContextInterface(javax.slee.ActivityContextInterface aci) {" + "if(aci==null)" + "     throw new " + IllegalStateException . class . getName ( ) + "(\"Passed argument can not be of null value.\");" + " if(sbbEntity == null || sbbEntity.getSbbObject().getState() != " + SbbObjectState . class . getName ( ) + ".READY) { throw new " + IllegalStateException . class . getName ( ) + "(\"Cannot call asSbbActivityContextInterface\"); } " + "else if ( aci instanceof " + concreteActivityContextInterfaceClass . getName ( ) + ") return aci;" + "else return  new " + concreteActivityContextInterfaceClass . getName ( ) + " ( (" + ActivityContextInterface . class . getName ( ) + ") $1, " + "sbbEntity.getSbbComponent());" + "}" ; CtMethod methodTest ; try { methodTest = CtNewMethod . make ( methodToAdd , sbbConcreteClass ) ; sbbConcreteClass . addMethod ( methodTest ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Method " + methodToAdd + " added" ) ; } } catch ( CannotCompileException e ) { throw new DeploymentException ( e . getMessage ( ) , e ) ; }


signature:
public class CompositeQueryExpression { /** * Add a query expression to this composite expression .
 * @ param expr the expression to add .
 * @ throws NullPointerException if < code > expr < / code > is < code > null < / code > .
 * @ throws IllegalArgumentException if adding the query expression to this
 * composite expression would generate a cyclic expression . */
protected final void add ( QueryExpression expr ) throws NullPointerException , IllegalArgumentException { } }

implementation:
if ( expr == null ) throw new NullPointerException ( "expr is null" ) ; // check for cycles
if ( expr instanceof CompositeQueryExpression ) { ( ( CompositeQueryExpression ) expr ) . checkForCycles ( this ) ; } else if ( expr instanceof Not ) { ( ( Not ) expr ) . checkForCycles ( this ) ; } // no cycles , so add the expression to the list
exprs . add ( expr ) ;


signature:
public class CompositeQueryExpression { /** * Check whether the specified expression contains a reference , either direct
 * or indirect , to this expression .
 * @ param expr the expression to check and possibly recurse through .
 * @ throws IllegalArgumentException if a cyclic expression is detected . */
void checkForCycles ( QueryExpression expr ) throws IllegalArgumentException { } }

implementation:
// is the expression argument equal to this ?
if ( expr == this ) throw new IllegalArgumentException ( "Cyclic expression detected" ) ; // recurse through all nested expressions that are composite expressions
for ( int i = 0 ; i < exprs . size ( ) ; i ++ ) { QueryExpression nested = ( QueryExpression ) exprs . get ( i ) ; if ( nested instanceof CompositeQueryExpression ) { ( ( CompositeQueryExpression ) nested ) . checkForCycles ( expr ) ; } else if ( nested instanceof Not ) { ( ( Not ) nested ) . checkForCycles ( expr ) ; } }


signature:
public class NonSerializableFactory { /** * Place an object into the NonSerializableFactory namespace for subsequent
 * access by getObject . There cannot be an already existing binding for key .
 * @ param key the name to bind target under . This should typically be the
 * name that will be used to bind target in the JNDI namespace , but it does
 * not have to be .
 * @ param target the non - Serializable object to bind .
 * @ throws javax . naming . NameAlreadyBoundException thrown if key already exists in the
 * NonSerializableFactory map */
public static synchronized void bind ( String key , Object target ) throws NameAlreadyBoundException { } }

implementation: if ( wrapperMap . containsKey ( key ) == true ) throw new NameAlreadyBoundException ( key + " already exists in the NonSerializableFactory map" ) ; wrapperMap . put ( key , target ) ;


signature:
public class NonSerializableFactory { /** * Remove a binding from the NonSerializableFactory map .
 * @ param key the key into the NonSerializableFactory map to remove .
 * @ throws javax . naming . NameNotFoundException thrown if key does not exist in the
 * NonSerializableFactory map */
public static void unbind ( String key ) throws NameNotFoundException { } }

implementation: if ( wrapperMap . remove ( key ) == null ) throw new NameNotFoundException ( key + " was not found in the NonSerializableFactory map" ) ;


signature:
public class NonSerializableFactory { /** * Remove a binding from the NonSerializableFactory map .
 * @ param name the name for the key into NonSerializableFactory map to remove .
 * The key is obtained as name . toString ( ) .
 * @ throws javax . naming . NameNotFoundException thrown if key does not exist in the
 * NonSerializableFactory map */
public static void unbind ( Name name ) throws NameNotFoundException { } }

implementation: String key = name . toString ( ) ; if ( wrapperMap . remove ( key ) == null ) throw new NameNotFoundException ( key + " was not found in the NonSerializableFactory map" ) ;


signature:
public class NonSerializableFactory { /** * A convience method that simplifies the process of rebinding a
 * non - zerializable object into a JNDI context . This version binds the
 * target object into the default IntitialContext using name path .
 * @ param name the name to use as JNDI path name . The key into the
 * NonSerializableFactory map is obtained from the toString ( ) value of name .
 * The name parameter cannot be a 0 length name .
 * Any subcontexts between the root and the name must exist .
 * @ param target the non - Serializable object to bind .
 * @ throws javax . naming . NamingException thrown on failure to rebind key into ctx . */
public static synchronized void rebind ( Name name , Object target ) throws NamingException { } }

implementation: rebind ( name , target , false ) ;


signature:
public class NonSerializableFactory { /** * - - - End ObjectFactory interface methods */
private static Context createSubcontext ( Context ctx , Name name ) throws NamingException { } }

implementation:
Context subctx = ctx ; for ( int pos = 0 ; pos < name . size ( ) ; pos ++ ) { String ctxName = name . get ( pos ) ; try { subctx = ( Context ) ctx . lookup ( ctxName ) ; } catch ( NameNotFoundException e ) { subctx = ctx . createSubcontext ( ctxName ) ; } // The current subctx will be the ctx for the next name component
ctx = subctx ; } return subctx ;


signature:
public class LogServiceImpl { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . console . client . log . LogService # activateLogger ( java . lang . String ) */
public void setLoggerLevel ( String loggerName , String level ) throws ManagementConsoleException { } }

implementation: sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . setLoggerLevel ( loggerName , level ) ;


signature:
public class LogServiceImpl { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . console . client . log . LogService # fetchLoggerInfo ( java . lang . String ) */
public LoggerInfo fetchLoggerInfo ( String loggerName ) throws ManagementConsoleException { } }

implementation:
if ( ! sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getLoggerNames ( null ) . contains ( loggerName ) ) sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . addLogger ( loggerName , Level . OFF ) ; int handlerNum = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . numberOfHandlers ( loggerName ) ; String _name = loggerName ; String _level = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getLoggerLevel ( loggerName ) ; boolean _parent = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getUseParentHandlersFlag ( loggerName ) ; String _filter = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getLoggerFilterClassName ( loggerName ) ; HandlerInfo [ ] hInfos = new HandlerInfo [ handlerNum ] ; for ( int i = 0 ; i < handlerNum ; i ++ ) { String _formatterClass = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getGenericHandlerFormatterClassName ( loggerName , i ) ; String _filterClass = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getGenericHandlerFilterClassName ( loggerName , i ) ; String _h_level = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getGenericHandlerLevel ( loggerName , i ) ; String _h_name = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getHandlerName ( loggerName , i ) ; String _h_className = sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . getHandlerClassName ( loggerName , i ) ; // Add fetch for other options
HandlerInfo hi = new HandlerInfo ( i , ( _h_name == null ? "" : _h_name ) , _filterClass , _formatterClass , _h_className , _h_level , new HashMap ( ) ) ; hInfos [ i ] = hi ; } return new LoggerInfo ( _parent , _name , _filter , _level , hInfos ) ;


signature:
public class LogServiceImpl { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . console . client . log . LogService # setUseParentHandlers ( java . lang . String , boolean ) */
public void setUseParentHandlers ( String loggerName , boolean value ) throws ManagementConsoleException { } }

implementation: sleeConnection . getSleeManagementMBeanUtils ( ) . getLogManagementMBeanUtils ( ) . setUseParentHandlersFlag ( loggerName , value ) ;


signature:
public class TraceFacilityImpl { /** * ( non - Javadoc )
 * @ see
 * javax . slee . facilities . TraceFacility # getTraceLevel ( javax . slee . ComponentID ) */
public Level getTraceLevel ( ComponentID componentId ) throws NullPointerException , UnrecognizedComponentException , FacilityException { } }

implementation: checkComponentID ( componentId ) ; return this . traceLevelTable . get ( componentId ) . getLevel ( ) ;


signature:
public class TraceFacilityImpl { /** * ( non - Javadoc )
 * @ see
 * javax . slee . facilities . TraceFacility # createTrace ( javax . slee . ComponentID ,
 * javax . slee . facilities . Level , java . lang . String , java . lang . String , long ) */
public void createTrace ( ComponentID componentId , Level level , String messageType , String message , long timeStamp ) throws NullPointerException , IllegalArgumentException , UnrecognizedComponentException , FacilityException { } }

implementation:
if ( log . isDebugEnabled ( ) ) { log . debug ( "createTrace: " + componentId + " level = " + level + " messageType " + messageType + " message " + message + " timeStamp " + timeStamp ) ; } checkComponentID ( componentId ) ; MTraceLevel tl = this . traceLevelTable . get ( componentId ) ; this . notificationTypes . add ( messageType ) ; if ( tl == null ) throw new UnrecognizedComponentException ( "Could not find " + componentId ) ; Level lev = tl . getLevel ( ) ; int seqno = tl . getSeqno ( ) ; if ( lev . isOff ( ) ) return ; // Check if we should log this message .
// if ( level . isHigherLevel ( lev ) ) {
if ( ! lev . isHigherLevel ( level ) ) { TraceNotification traceNotification = new TraceNotification ( traceMBeanImpl , messageType , componentId , level , message , null , seqno , timeStamp ) ; this . traceMBeanImpl . sendNotification ( traceNotification ) ; }


signature:
public class DeployableUnitWrapper { /** * Private - - - - - */
private void gatherInfoFromURL ( URL url ) throws MalformedURLException { } }

implementation:
// Weird VFS behavior . . . returns jar : file : . . . jar ! /
if ( url . getProtocol ( ) . equals ( "jar" ) ) { this . url = new URL ( url . getFile ( ) . replaceFirst ( "!/" , "/" ) ) ; } else { this . url = url ; } this . fullPath = this . url . getFile ( ) ; this . fileName = getFileNameInternal ( fullPath ) ;


signature:
public class RemoteEventWrapper { /** * ( non - Javadoc )
 * @ see java . io . Externalizable # writeExternal ( java . io . ObjectOutput ) */
@ Override public void writeExternal ( ObjectOutput out ) throws IOException { } }

implementation:
if ( this . serializedEvent == null ) { throw new IOException ( "No serialized event set." ) ; } // add id ?
out . writeInt ( this . serializedEvent . length ) ; out . write ( this . serializedEvent ) ; out . flush ( ) ;


signature:
public class RemoteEventWrapper { /** * ( non - Javadoc )
 * @ see java . io . Externalizable # readExternal ( java . io . ObjectInput ) */
@ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } }

implementation: int len = in . readInt ( ) ; this . serializedEvent = new byte [ len ] ; in . readFully ( serializedEvent ) ;


signature:
public class NullActivityImpl { /** * ( non - Javadoc )
 * @ see javax . slee . nullactivity . NullActivity # endActivity ( ) */
public void endActivity ( ) throws TransactionRequiredLocalException , SLEEException { } }

implementation:
// Check if in valid context .
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "NullActivity.endActivity()" ) ; } sleeContainer . getTransactionManager ( ) . mandateTransaction ( ) ; sleeContainer . getActivityContextFactory ( ) . getActivityContext ( new NullActivityContextHandle ( handle ) ) . endActivity ( ) ;


signature:
public class Not { /** * Check whether the specified expression contains a reference , either direct
 * or indirect , to this expression .
 * @ param expr the expression to check and possibly recurse through .
 * @ throws IllegalArgumentException if a cyclic expression is detected . */
void checkForCycles ( QueryExpression expr ) throws IllegalArgumentException { } }

implementation:
// is the expression argument equal to this ?
if ( expr == this ) throw new IllegalArgumentException ( "Cyclic expression detected" ) ; // recurse through nested expression if it ' s a composite expression
QueryExpression nested = this . expr ; if ( nested instanceof CompositeQueryExpression ) { ( ( CompositeQueryExpression ) nested ) . checkForCycles ( expr ) ; } else if ( nested instanceof Not ) { ( ( Not ) nested ) . checkForCycles ( expr ) ; }


signature:
public class SbbAbstractClassDecorator { /** * Decorate the abstract sbb Class
 * @ return the decorated sbb abstract class */
public boolean decorateAbstractSbb ( ) throws DeploymentException { } }

implementation:
ClassPool pool = component . getClassPool ( ) ; String sbbAbstractClassName = component . getDescriptor ( ) . getSbbAbstractClass ( ) . getSbbAbstractClassName ( ) ; try { sbbAbstractClass = pool . get ( sbbAbstractClassName ) ; } catch ( NotFoundException nfe ) { throw new DeploymentException ( "Could not find Abstract Sbb Class: " + sbbAbstractClassName , nfe ) ; } // populate the list of concrete methods . It will be needed by the
// decorating methods .
concreteMethods = new HashMap ( ) ; CtMethod [ ] methods = sbbAbstractClass . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { int mods = methods [ i ] . getModifiers ( ) ; if ( ! Modifier . isAbstract ( mods ) && ! Modifier . isNative ( mods ) ) { concreteMethods . put ( methods [ i ] . getName ( ) + methods [ i ] . getSignature ( ) , methods [ i ] ) ; } } decorateENCBindCalls ( ) ; decorateNewThreadCalls ( ) ; if ( isAbstractSbbClassDecorated ) { try { String deployDir = component . getDeploymentDir ( ) . getAbsolutePath ( ) ; sbbAbstractClass . writeFile ( deployDir ) ; sbbAbstractClass . detach ( ) ; // the file on disk is now in sync with the latest in - memory version
if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Modified Abstract Class " + sbbAbstractClass . getName ( ) + " generated in the following path " + deployDir ) ; } // } catch ( NotFoundException e ) {
// String s = " Error writing modified abstract sbb class " ;
// logger . error ( s , e ) ;
// throw new DeploymentException ( s , e ) ;
} catch ( Throwable e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } finally { sbbAbstractClass . defrost ( ) ; } return true ; } else { return false ; }


signature:
public class SbbLocalObjectInterceptor { /** * Invokers for the simple types */
public void invokeAndReturnvoid ( SbbConcrete proxy , String methodName , Object [ ] args , Class < ? > [ ] argTypes ) throws Exception { } }

implementation: invokeAndReturnObject ( proxy , methodName , args , argTypes ) ;


signature:
public class ConcreteActivityContextInterfaceFactoryGenerator { /** * Create a constructor . This method simply records the input parameters in
 * appropriately named fields .
 * @ param
 * @ param classes */
private void createConstructor ( CtClass concreteClass , CtClass sleeContainerClass , CtClass resourceAdaptorTypeIDClass ) throws Exception { } }

implementation: CtConstructor ctCons = new CtConstructor ( new CtClass [ ] { sleeContainerClass , resourceAdaptorTypeIDClass } , concreteClass ) ; ctCons . setBody ( "{ super($1,$2); }" ) ; concreteClass . addConstructor ( ctCons ) ;


signature:
public class ActivityManagementMBeanImpl { /** * ( non - Javadoc )
 * @ see org . mobicents . slee . container . management . jmx . ActivityManagementMBeanImplMBean # setTimeBetweenLivenessQueries ( long ) */
public void setTimeBetweenLivenessQueries ( long set ) { } }

implementation: acFactory . getConfiguration ( ) . setTimeBetweenLivenessQueries ( set ) ; if ( set == 0 ) { cancelLivenessQuery ( ) ; } else { if ( scheduledFuture == null ) { scheduleLivenessQuery ( ) ; } }


signature:
public class ActivityManagementMBeanImpl { /** * - - - OPERATIONS */
public void endActivity ( ActivityContextHandle ach ) throws ManagementException { } }

implementation:
// Again this is tx method
logger . info ( "Trying to stop null activity[" + ach + "]!!" ) ; ActivityContext ac = acFactory . getActivityContext ( ach ) ; if ( ac == null ) { logger . debug ( "There is no ac associated with given acID[" + ach + "]!!" ) ; throw new ManagementException ( "Can not find AC for given ID[" + ach + "], try again!!!" ) ; } if ( ac . getActivityContextHandle ( ) . getActivityType ( ) == ActivityType . NULL ) { logger . debug ( "Scheduling activity end for acID[" + ach + "]" ) ; NullActivity nullActivity = ( NullActivity ) ac . getActivityContextHandle ( ) . getActivityObject ( ) ; if ( nullActivity != null ) { nullActivity . endActivity ( ) ; } } else { logger . debug ( "AC is not null activity context" ) ; throw new IllegalArgumentException ( "Given ID[" + ach + "] does not point to NullActivity" ) ; }


signature:
public class ActivityManagementMBeanImpl { /** * This is main place where SLEE is accessed . This functions lists AC in
 * various different ways . It can either return Object [ ] of arrays
 * representing AC of simple Object [ ] that in fact contains String objects
 * representing IDs of Activity Contexts
 * @ param listIDsOnly -
 * tells to list only its , if this is true , second boolean flag
 * is ignored . Return value is Object [ ] { String , String , . . . . }
 * @ param inDetails -
 * Tells whether sub - arrays containing name bindings , attached
 * sbb entities should be passed , or only value representing
 * their length . If true arrays are passed , if false , only
 * values .
 * @ param criteria -
 * Critteria to search by - if this is different than
 * { @ link ActivityManagementMBeanImplMBean . LIST _ BY _ NO _ CRITERIA }
 * next parameter has to have value .
 * @ param comparisonCriteria -
 * this has to contain String representation of criteria ac
 * should be looked by : SbbEID , RA Entity Name , SbbID or
 * activity class name - like getClass ( ) . getName ( ) .
 * @ return
 * < ul >
 * < li > Object [ ] { Stirng , String } < / li >
 * < li > Object [ ] = { @ link # retrieveActivityContextDetails ( ) } , { @ link # retrieveActivityContextDetails ( ) } , . . . .
 * < / li >
 * < / ul > */
private Object [ ] listWithCriteria ( boolean listIDsOnly , boolean inDetails , int criteria , String comparisonCriteria ) { } }

implementation:
logger . info ( "Listing with criteria[" + criteria + "] with details[" + inDetails + "] only IDS[" + listIDsOnly + "]" ) ; Iterator < ActivityContextHandle > it = this . acFactory . getAllActivityContextsHandles ( ) . iterator ( ) ; ArrayList < Object > lst = new ArrayList < Object > ( ) ; // Needed by LIST _ BY _ SBBID
HashMap < SbbEntityID , SbbID > sbbEntityIdToSbbID = new HashMap < SbbEntityID , SbbID > ( ) ; while ( it . hasNext ( ) ) { ActivityContextHandle achOrig = it . next ( ) ; // JmxActivityContextHandle ach = ActivityContextHandleSerializer . encode ( achOrig ) ;
ActivityContextImpl ac = this . acFactory . getActivityContext ( achOrig ) ; if ( ac == null ) { continue ; } Object activity = achOrig . getActivityObject ( ) ; if ( activity != null ) { String acId = ac . getStringID ( ) ; String acSource = achOrig . getActivityType ( ) == ActivityType . RA ? ( ( ResourceAdaptorActivityContextHandle ) achOrig ) . getResourceAdaptorEntity ( ) . getName ( ) : "" ; switch ( criteria ) { case LIST_BY_ACTIVITY_CLASS : if ( ! activity . getClass ( ) . getCanonicalName ( ) . equals ( comparisonCriteria ) ) { ac = null ; // we dont want this one here
} break ; case LIST_BY_RAENTITY : if ( achOrig . getActivityType ( ) == ActivityType . RA ) { if ( ! acSource . equals ( comparisonCriteria ) ) ac = null ; } else ac = null ; break ; case LIST_BY_SBBENTITY : for ( SbbEntityID sbbEntityID : ac . getSbbAttachmentSet ( ) ) { if ( sbbEntityID . toString ( ) . equals ( comparisonCriteria ) ) { break ; } } ac = null ; break ; case LIST_BY_SBBID : ComponentIDPropertyEditor propertyEditor = new ComponentIDPropertyEditor ( ) ; propertyEditor . setAsText ( comparisonCriteria ) ; SbbID idBeingLookedUp = ( SbbID ) propertyEditor . getValue ( ) ; boolean match = false ; SbbID implSbbID = null ; for ( SbbEntityID sbbEntityID : ac . getSbbAttachmentSet ( ) ) { if ( sbbEntityIdToSbbID . containsKey ( sbbEntityID ) ) { implSbbID = sbbEntityIdToSbbID . get ( sbbEntityID ) ; } else { SbbEntity sbbe = sbbEntityFactory . getSbbEntity ( sbbEntityID , false ) ; if ( sbbe == null ) { continue ; } implSbbID = sbbe . getSbbId ( ) ; sbbEntityIdToSbbID . put ( sbbEntityID , implSbbID ) ; } if ( ! implSbbID . equals ( idBeingLookedUp ) ) { match = false ; continue ; } else { match = true ; break ; } } if ( ! match ) { ac = null ; } break ; case LIST_BY_NO_CRITERIA : break ; default : continue ; } if ( ac == null ) continue ; // Now we have to check - if we want only IDS
Object singleResult = null ; if ( ! listIDsOnly ) { logger . debug ( "Adding AC[" + acId + "]" ) ; Object [ ] o = getDetails ( ac ) ; if ( ! inDetails ) { // This is stupid , but can save some bandwith , not sure if
// we
// should care . But Console is java script , and
// sometimes that can be pain , so lets ease it
o [ SBB_ATTACHMENTS ] = Integer . toString ( ( ( Object [ ] ) o [ SBB_ATTACHMENTS ] ) . length ) ; o [ NAMES_BOUND_TO ] = Integer . toString ( ( ( Object [ ] ) o [ NAMES_BOUND_TO ] ) . length ) ; o [ TIMERS_ATTACHED ] = Integer . toString ( ( ( Object [ ] ) o [ TIMERS_ATTACHED ] ) . length ) ; o [ DATA_PROPERTIES ] = Integer . toString ( ( ( Object [ ] ) o [ DATA_PROPERTIES ] ) . length ) ; } singleResult = o ; } else { singleResult = acId ; } lst . add ( singleResult ) ; } } if ( lst . isEmpty ( ) ) return null ; logger . info ( "RETURN SIZE[" + lst . size ( ) + "]" ) ; Object [ ] ret = new Object [ lst . size ( ) ] ; ret = lst . toArray ( ret ) ; return ret ;


signature:
public class ActivityManagementMBeanImpl { /** * FIXME uncomment code when everything is commited
 * This method should be run in tx */
@ SuppressWarnings ( "rawtypes" ) private Object [ ] getDetails ( ActivityContextImpl ac ) { } }

implementation:
logger . debug ( "Retrieveing details for acID[" + ac . getActivityContextHandle ( ) + "]" ) ; Object [ ] o = new Object [ ARRAY_SIZE ] ; ActivityContextHandle achOrig = ac . getActivityContextHandle ( ) ; // JmxActivityContextHandle ach = ActivityContextHandleSerializer . encode ( achOrig ) ;
String acId = ac . getStringID ( ) ; o [ ActivityManagementMBeanImplMBean . AC_ID ] = acId ; logger . debug ( "======[getDetails][" + o [ ActivityManagementMBeanImplMBean . AC_ID ] + "][" + ac . hashCode ( ) + "]" ) ; if ( achOrig . getActivityType ( ) == ActivityType . RA ) { o [ RA ] = ( ( ResourceAdaptorActivityContextHandle ) achOrig ) . getResourceAdaptorEntity ( ) . getName ( ) ; } o [ ACTIVITY_CLASS ] = achOrig . getActivityObject ( ) . getClass ( ) . getName ( ) ; logger . debug ( "======[getDetails][ACTIVITY_CLASS][" + o [ ACTIVITY_CLASS ] + "]" ) ; // Date d = new Date ( ac . getLastAccessTime ( ) ) ;
// o [ LAST _ ACCESS _ TIME ] = d ;
o [ LAST_ACCESS_TIME ] = ac . getLastAccessTime ( ) + "" ; logger . debug ( "======[getDetails][LAST_ACCESS_TIME][" + o [ LAST_ACCESS_TIME ] + "][" + new Date ( Long . parseLong ( ( String ) o [ LAST_ACCESS_TIME ] ) ) + "]" ) ; Set < SbbEntityID > sbbAttachmentSet = ac . getSbbAttachmentSet ( ) ; String [ ] tmp = new String [ sbbAttachmentSet . size ( ) ] ; Iterator < ? > it = sbbAttachmentSet . iterator ( ) ; int counter = 0 ; while ( it . hasNext ( ) ) { tmp [ counter ++ ] = it . next ( ) . toString ( ) ; } o [ SBB_ATTACHMENTS ] = tmp ; Set < String > nameBindindsSet = ac . getNamingBindings ( ) ; tmp = new String [ nameBindindsSet . size ( ) ] ; tmp = nameBindindsSet . toArray ( tmp ) ; o [ NAMES_BOUND_TO ] = tmp ; Set < TimerID > attachedTimersSet = ac . getAttachedTimers ( ) ; tmp = new String [ attachedTimersSet . size ( ) ] ; it = attachedTimersSet . iterator ( ) ; counter = 0 ; while ( it . hasNext ( ) ) { tmp [ counter ++ ] = ( ( TimerID ) it . next ( ) ) . toString ( ) ; } o [ TIMERS_ATTACHED ] = tmp ; Map m = ac . getDataAttributes ( ) ; tmp = new String [ m . size ( ) ] ; it = m . keySet ( ) . iterator ( ) ; counter = 0 ; while ( it . hasNext ( ) ) { Object k = it . next ( ) ; Object v = m . get ( k ) ; tmp [ counter ++ ] = k + "=" + v ; } o [ DATA_PROPERTIES ] = tmp ; return o ;


signature:
public class ActivityManagementMBeanImpl { /** * not exist ? */
public Object [ ] retrieveActivityContextIDByActivityType ( String fullQualifiedActivityClassName ) { } }

implementation: logger . info ( "Retrieving AC by activity class name[" + fullQualifiedActivityClassName + "]" ) ; return listWithCriteria ( true , true , LIST_BY_ACTIVITY_CLASS , fullQualifiedActivityClassName ) ;


signature:
public class SbbActivityContextInterfaceImpl { /** * Computes the real aci data field name
 * @ param fieldName
 * @ return */
private String getRealFieldName ( String fieldName ) { } }

implementation:
String realFieldName = sbbComponent . getDescriptor ( ) . getActivityContextAttributeAliases ( ) . get ( fieldName ) ; if ( realFieldName == null ) { // not there then it has no alias , lets set one based on sbb id
realFieldName = sbbComponent . getSbbID ( ) . toString ( ) + "." + fieldName ; final Map < String , String > aliases = sbbComponent . getDescriptor ( ) . getActivityContextAttributeAliases ( ) ; synchronized ( aliases ) { aliases . put ( fieldName , realFieldName ) ; } } return realFieldName ;


signature:
public class SbbActivityContextInterfaceImpl { /** * Sets an sbb aci data field value
 * @ param fieldName
 * @ param value */
public void setFieldValue ( String fieldName , Object value ) { } }

implementation: String realFieldName = getRealFieldName ( fieldName ) ; aciImpl . getActivityContext ( ) . setDataAttribute ( realFieldName , value ) ;


signature:
public class SbbActivityContextInterfaceImpl { /** * Retrieves an sbb aci data field value
 * @ param fieldName
 * @ param returnType
 * @ return */
public Object getFieldValue ( String fieldName , Class < ? > returnType ) { } }

implementation: String realFieldName = getRealFieldName ( fieldName ) ; Object value = aciImpl . getActivityContext ( ) . getDataAttribute ( realFieldName ) ; if ( value == null ) { if ( returnType . isPrimitive ( ) ) { if ( returnType . equals ( Integer . TYPE ) ) { return Integer . valueOf ( 0 ) ; } else if ( returnType . equals ( Boolean . TYPE ) ) { return Boolean . FALSE ; } else if ( returnType . equals ( Long . TYPE ) ) { return Long . valueOf ( 0 ) ; } else if ( returnType . equals ( Double . TYPE ) ) { return Double . valueOf ( 0 ) ; } else if ( returnType . equals ( Float . TYPE ) ) { return Float . valueOf ( 0 ) ; } } } return value ;


signature:
public class SleeConnectionImpl { /** * / * ( non - Javadoc )
 * @ see javax . slee . connection . SleeConnection # fireEvent ( java . lang . Object , javax . slee . EventTypeID , javax . slee . connection . ExternalActivityHandle , javax . slee . Address ) */
public void fireEvent ( Object event , EventTypeID eventType , ExternalActivityHandle activityHandle , Address address ) throws NullPointerException , UnrecognizedActivityException , UnrecognizedEventException , ResourceException { } }

implementation: if ( service == null ) { throw new ResourceException ( "Connection is in closed state" ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "fireEvent(event=" + event + ",eventType=" + eventType + ",activityHandle=" + activityHandle + ",address=" + address + ")" ) ; } this . service . fireEvent ( event , eventType , activityHandle , address ) ;


signature:
public class SleeConnectionImpl { /** * / * ( non - Javadoc )
 * @ see javax . slee . connection . SleeConnection # getEventTypeID ( java . lang . String , java . lang . String , java . lang . String ) */
public EventTypeID getEventTypeID ( String name , String vendor , String version ) throws UnrecognizedEventException , ResourceException { } }

implementation: if ( service == null ) { throw new ResourceException ( "Connection is in closed state" ) ; } return service . getEventTypeID ( name , vendor , version ) ;


signature:
public class MobicentsSleeConnectionFactoryImpl { /** * / * ( non - Javadoc )
 * @ see javax . slee . connection . SleeConnectionFactory # getConnection ( ) */
public SleeConnection getConnection ( ) throws ResourceException { } }

implementation:
// this method is listed as MBean method , upon lookup in jmx console it will create connection , its a possible leak
// with list .
synchronized ( connectionList ) { SleeConnectionImpl conn ; if ( connectionList . size ( ) > 0 ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Using connection from pool." ) ; } conn = ( SleeConnectionImpl ) connectionList . remove ( 0 ) ; conn . start ( this . service ) ; } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Creating new connection." ) ; } conn = new SleeConnectionImpl ( this . service , this ) ; } return conn ; }


signature:
public class ProfileObjectImpl { /** * Invoked from pool .
 * @ param profileContext */
public void setProfileContext ( ProfileContextImpl profileContext ) { } }

implementation: if ( logger . isTraceEnabled ( ) ) { logger . trace ( "[setProfileContext] " + this ) ; } if ( profileContext == null ) { throw new NullPointerException ( "Passed context must not be null." ) ; } if ( state != ProfileObjectState . DOES_NOT_EXIST ) { throw new IllegalStateException ( "Wrong state: " + this . state + ",on profile set context operation, for profile table: " + this . profileTable . getProfileTableName ( ) + " with specification: " + this . profileTable . getProfileSpecificationComponent ( ) . getProfileSpecificationID ( ) ) ; } this . profileContext = profileContext ; this . profileContext . setProfileObject ( this ) ; if ( profileConcreteClassInfo . isInvokeSetProfileContext ( ) ) { final ClassLoader oldClassLoader = SleeContainerUtils . getCurrentThreadClassLoader ( ) ; try { final ClassLoader cl = this . profileTable . getProfileSpecificationComponent ( ) . getClassLoader ( ) ; if ( System . getSecurityManager ( ) != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; return null ; } } ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; } try { if ( isSlee11 ) { try { profileConcrete . setProfileContext ( profileContext ) ; } catch ( RuntimeException e ) { runtimeExceptionOnProfileInvocation ( e ) ; } } } catch ( Exception e ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Exception encountered while setting profile context for profile table: " + this . profileTable . getProfileTableName ( ) + " with specification: " + this . profileTable . getProfileSpecificationComponent ( ) . getProfileSpecificationID ( ) , e ) ; } } finally { if ( System . getSecurityManager ( ) != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; return null ; } } ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; } } } state = ProfileObjectState . POOLED ;


signature:
public class ProfileObjectImpl { /** * initialize state from default profile */
private void profileInitialize ( String profileName ) { } }

implementation:
if ( logger . isTraceEnabled ( ) ) { logger . trace ( "[profileInitialize] " + this + " , profileName = " + profileName ) ; } if ( this . state != ProfileObjectState . POOLED ) { throw new SLEEException ( this . toString ( ) ) ; } if ( profileName == null ) { // default profile creation
// create instance of entity
profileEntity = profileEntityFramework . getProfileEntityFactory ( ) . newInstance ( profileTable . getProfileTableName ( ) , null ) ; // change state
this . state = ProfileObjectState . PROFILE_INITIALIZATION ; // invoke life cycle method on profile
if ( profileConcreteClassInfo . isInvokeProfileInitialize ( ) ) { try { profileConcrete . profileInitialize ( ) ; } catch ( RuntimeException e ) { runtimeExceptionOnProfileInvocation ( e ) ; } } } else { // load the default profile entity
if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Copying state from default profile on object " + this ) ; } profileEntity = cloneEntity ( profileTable . getDefaultProfileEntity ( ) ) ; profileEntity . setProfileName ( profileName ) ; } // mark entity as dirty and for creation
profileEntity . create ( ) ; profileEntity . setDirty ( true ) ;


signature:
public class ProfileObjectImpl { /** * Invoked when pool removes object */
public void unsetProfileContext ( ) { } }

implementation: if ( logger . isTraceEnabled ( ) ) { logger . trace ( "[unsetProfileContext] " + this ) ; } if ( state == ProfileObjectState . POOLED && profileConcreteClassInfo . isInvokeUnsetProfileContext ( ) ) { final ClassLoader oldClassLoader = SleeContainerUtils . getCurrentThreadClassLoader ( ) ; try { final ClassLoader cl = profileTable . getProfileSpecificationComponent ( ) . getClassLoader ( ) ; if ( System . getSecurityManager ( ) != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; return null ; } } ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( cl ) ; } if ( isSlee11 ) { try { profileConcrete . unsetProfileContext ( ) ; } catch ( RuntimeException e ) { runtimeExceptionOnProfileInvocation ( e ) ; } } profileContext . setProfileObject ( null ) ; state = ProfileObjectState . DOES_NOT_EXIST ; } finally { if ( System . getSecurityManager ( ) != null ) { AccessController . doPrivileged ( new PrivilegedAction < Object > ( ) { public Object run ( ) { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; return null ; } } ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; } } }


signature:
public class ProfileObjectImpl { /** * Retrieves the local representation for this profile object
 * @ return */
public ProfileLocalObject getProfileLocalObject ( ) { } }

implementation: final Class < ? > profileLocalObjectConcreteClass = profileTable . getProfileSpecificationComponent ( ) . getProfileLocalObjectConcreteClass ( ) ; ProfileLocalObject profileLocalObject = null ; if ( profileLocalObjectConcreteClass == null ) { profileLocalObject = new ProfileLocalObjectImpl ( this ) ; } else { try { profileLocalObject = ( ProfileLocalObject ) profileLocalObjectConcreteClass . getConstructor ( ProfileObjectImpl . class ) . newInstance ( this ) ; } catch ( Throwable e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } } return profileLocalObject ;


signature:
public class ProfileObjectImpl { /** * Fires a profile added or updated event if the profile object state is ready and the persistent state is dirty */
public void fireAddOrUpdatedEventIfNeeded ( ) { } }

implementation:
if ( state == ProfileObjectState . READY ) { if ( profileEntity . isDirty ( ) ) { // check the table fires events and the object is not assigned to a default profile
if ( profileTable . doesFireEvents ( ) && profileEntity . getProfileName ( ) != null && profileTable . getSleeContainer ( ) . getSleeState ( ) == SleeState . RUNNING ) { // Fire a Profile Added or Updated Event
ActivityContext ac = profileTable . getActivityContext ( ) ; AbstractProfileEvent event = null ; if ( profileEntity . isCreate ( ) ) { if ( persisted ) { event = new ProfileAddedEventImpl ( profileEntity , profileTable . getProfileManagement ( ) ) ; persisted = false ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "firing profile added event for profile named " + profileEntity ) ; } } else { return ; } } else { event = new ProfileUpdatedEventImpl ( profileEntitySnapshot , profileEntity , profileTable . getProfileManagement ( ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "firing profile updated event for profile named " + profileEntity ) ; } } ac . fireEvent ( event . getEventTypeID ( ) , event , event . getProfileAddress ( ) , null , null , null , null ) ; } } }


signature:
public class ProfileObjectImpl { /** * Retrieves the profile cmp slee 1.0 wrapper for this profile object
 * @ return */
public AbstractProfileCmpSlee10Wrapper getProfileCmpSlee10Wrapper ( ) { } }

implementation: if ( profileCmpSlee10Wrapper == null ) { try { profileCmpSlee10Wrapper = ( AbstractProfileCmpSlee10Wrapper ) profileTable . getProfileSpecificationComponent ( ) . getProfileCmpSlee10WrapperClass ( ) . getConstructor ( ProfileObjectImpl . class ) . newInstance ( this ) ; } catch ( Throwable e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } } return profileCmpSlee10Wrapper ;


signature:
public class ServiceActivityContextHandle { /** * ( non - Javadoc )
 * @ see java . io . Externalizable # readExternal ( java . io . ObjectInput ) */
@ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { } }

implementation: final ServiceID serviceID = new ServiceID ( in . readUTF ( ) , in . readUTF ( ) , in . readUTF ( ) ) ; activityHandle = new ServiceActivityHandleImpl ( serviceID ) ;


signature:
public class ServiceActivityContextHandle { /** * ( non - Javadoc )
 * @ see java . io . Externalizable # writeExternal ( java . io . ObjectOutput ) */
@ Override public void writeExternal ( ObjectOutput out ) throws IOException { } }

implementation: final ServiceID serviceID = activityHandle . getServiceID ( ) ; out . writeUTF ( serviceID . getName ( ) ) ; out . writeUTF ( serviceID . getVendor ( ) ) ; out . writeUTF ( serviceID . getVersion ( ) ) ;


signature:
public class LibraryComponentImpl { /** * Retrieves the JAIN SLEE specs descriptor
 * @ return */
public javax . slee . management . LibraryDescriptor getSpecsDescriptor ( ) { } }

implementation: if ( specsDescriptor == null ) { final LibraryID [ ] libraryIDs = descriptor . getLibraryRefs ( ) . toArray ( new LibraryID [ descriptor . getLibraryRefs ( ) . size ( ) ] ) ; final JarDescriptor [ ] jars = descriptor . getJars ( ) . toArray ( new JarDescriptor [ descriptor . getJars ( ) . size ( ) ] ) ; String [ ] libraryJars = new String [ jars . length ] ; int i = 0 ; for ( JarDescriptor jar : jars ) { libraryJars [ i ++ ] = jar . getJarName ( ) ; } specsDescriptor = new javax . slee . management . LibraryDescriptor ( getLibraryID ( ) , getDeployableUnit ( ) . getDeployableUnitID ( ) , getDeploymentUnitSource ( ) , libraryIDs , libraryJars ) ; } return specsDescriptor ;


signature:
public class ClassGeneratorUtils { /** * Creates a class with the desired name and linked to the mentioned interfaces .
 * @ param className
 * @ param interfaces
 * @ return
 * @ throws Exception */
public static CtClass createClass ( String className , String [ ] interfaces ) throws Exception { } }

implementation: if ( className == null ) { throw new NullPointerException ( "Class name cannot be null" ) ; } CtClass clazz = classPool . makeClass ( className ) ; if ( interfaces != null && interfaces . length > 0 ) { clazz . setInterfaces ( classPool . get ( interfaces ) ) ; } return clazz ;


signature:
public class ClassGeneratorUtils { /** * Create the links with possible interfaces
 * @ param concreteClass
 * @ param interfaces */
public static void createInterfaceLinks ( CtClass concreteClass , String [ ] interfaceNames ) { } }

implementation: if ( interfaceNames != null && interfaceNames . length > 0 ) { try { for ( String interfaceName : interfaceNames ) { boolean found = false ; for ( CtClass existingInterfaces : concreteClass . getInterfaces ( ) ) { if ( existingInterfaces . getName ( ) . equals ( interfaceName ) ) found = true ; } if ( ! found ) concreteClass . addInterface ( classPool . get ( interfaceName ) ) ; } } catch ( NotFoundException e ) { e . printStackTrace ( ) ; } }


signature:
public class ClassGeneratorUtils { /** * Create the inheritance link with the absract class provided by the developer
 * @ param concreteClass the concrete class to which to add the inheritance link
 * @ param superClass the superClass to set */
public static void createInheritanceLink ( CtClass concreteClass , String superClassName ) { } }

implementation: if ( superClassName != null && superClassName . length ( ) >= 0 ) { try { concreteClass . setSuperclass ( classPool . get ( superClassName ) ) ; } catch ( CannotCompileException e ) { e . printStackTrace ( ) ; } catch ( NotFoundException e ) { e . printStackTrace ( ) ; } }


signature:
public class ClassGeneratorUtils { /** * Adds a field of the desired type to the declaring class .
 * @ param fieldType
 * @ param fieldName
 * @ param declaringClass
 * @ return
 * @ throws CannotCompileException */
public static CtField addField ( CtClass fieldType , String fieldName , CtClass declaringClass ) throws CannotCompileException { } }

implementation: return addField ( fieldType , fieldName , declaringClass , Modifier . PRIVATE ) ;


signature:
public class ClassGeneratorUtils { /** * Adds a field of the desired type to the declaring class .
 * @ param fieldType
 * @ param fieldName
 * @ param declaringClass
 * @ return
 * @ throws CannotCompileException */
public static CtField addField ( CtClass fieldType , String fieldName , CtClass declaringClass , int modifier ) throws CannotCompileException { } }

implementation: return addField ( fieldType , fieldName , declaringClass , modifier , null ) ;


signature:
public class ClassGeneratorUtils { /** * Adds a field of the desired type to the declaring class .
 * @ param fieldType
 * @ param fieldName
 * @ param declaringClass
 * @ param modifier
 * @ return
 * @ throws CannotCompileException */
public static CtField addField ( CtClass fieldType , String fieldName , CtClass declaringClass , int modifier , String initializerExpr ) throws CannotCompileException { } }

implementation: CtField field = new CtField ( fieldType , decapitalize ( fieldName ) , declaringClass ) ; field . setModifiers ( modifier ) ; if ( initializerExpr != null ) { declaringClass . addField ( field , CtField . Initializer . byExpr ( initializerExpr ) ) ; } else { declaringClass . addField ( field ) ; } return field ;


signature:
public class ClassGeneratorUtils { /** * Generates a getter for the field ( get < FieldName > ) and adds it to the declaring class .
 * @ param field
 * @ param interceptorAccess
 * @ return
 * @ throws NotFoundException
 * @ throws CannotCompileException */
public static CtMethod generateGetter ( CtField field , String interceptorAccess ) throws NotFoundException , CannotCompileException { } }

implementation: String getterName = "get" + capitalize ( field . getName ( ) ) ; CtMethod getter = CtNewMethod . getter ( getterName , field ) ; if ( interceptorAccess != null ) getter . setBody ( interceptorAccess + "." + getterName + "($$);" ) ; field . getDeclaringClass ( ) . addMethod ( getter ) ; return getter ;


signature:
public class ClassGeneratorUtils { /** * Generates a setter for the field ( get < FieldName > ) and adds it to the declaring class .
 * @ param field
 * @ return
 * @ throws NotFoundException
 * @ throws CannotCompileException */
public static CtMethod generateSetter ( CtField field , String interceptorAccess ) throws NotFoundException , CannotCompileException { } }

implementation: String setterName = "set" + capitalize ( field . getName ( ) ) ; CtMethod setter = CtNewMethod . setter ( setterName , field ) ; if ( interceptorAccess != null ) setter . setBody ( interceptorAccess + "." + setterName + "($$);" ) ; field . getDeclaringClass ( ) . addMethod ( setter ) ; return setter ;


signature:
public class ClassGeneratorUtils { /** * Generates getter and setter for the field ( get / set < FieldName > ) and adds them to the declaring class .
 * @ param field
 * @ throws NotFoundException
 * @ throws CannotCompileException */
public static void generateGetterAndSetter ( CtField field , String interceptorAccess ) throws NotFoundException , CannotCompileException { } }

implementation: generateGetter ( field , interceptorAccess ) ; generateSetter ( field , interceptorAccess ) ;


signature:
public class ClassGeneratorUtils { /** * Adds the selected annotation to the Object , along with the specified memberValues .
 * @ param annotation the FQDN of the annotation
 * @ param memberValues the member values HashMap ( name = value )
 * @ param toAnnotate the object to be annotated */
public static void addAnnotation ( String annotation , LinkedHashMap < String , Object > memberValues , Object toAnnotate ) { } }

implementation: if ( toAnnotate instanceof CtClass ) { CtClass classToAnnotate = ( CtClass ) toAnnotate ; ClassFile cf = classToAnnotate . getClassFile ( ) ; ConstPool cp = cf . getConstPool ( ) ; AnnotationsAttribute attr = ( AnnotationsAttribute ) cf . getAttribute ( AnnotationsAttribute . visibleTag ) ; if ( attr == null ) { attr = new AnnotationsAttribute ( cp , AnnotationsAttribute . visibleTag ) ; } Annotation a = new Annotation ( annotation , cp ) ; if ( memberValues != null ) { addMemberValuesToAnnotation ( a , cp , memberValues ) ; } attr . addAnnotation ( a ) ; cf . addAttribute ( attr ) ; } else if ( toAnnotate instanceof CtMethod ) { CtMethod methodToAnnotate = ( CtMethod ) toAnnotate ; MethodInfo mi = methodToAnnotate . getMethodInfo ( ) ; ConstPool cp = mi . getConstPool ( ) ; AnnotationsAttribute attr = ( AnnotationsAttribute ) mi . getAttribute ( AnnotationsAttribute . visibleTag ) ; if ( attr == null ) { attr = new AnnotationsAttribute ( cp , AnnotationsAttribute . visibleTag ) ; } Annotation a = new Annotation ( annotation , cp ) ; if ( memberValues != null ) { addMemberValuesToAnnotation ( a , cp , memberValues ) ; } attr . addAnnotation ( a ) ; mi . addAttribute ( attr ) ; } else if ( toAnnotate instanceof CtField ) { CtField fieldToAnnotate = ( CtField ) toAnnotate ; FieldInfo fi = fieldToAnnotate . getFieldInfo ( ) ; ConstPool cp = fi . getConstPool ( ) ; AnnotationsAttribute attr = ( AnnotationsAttribute ) fi . getAttribute ( AnnotationsAttribute . visibleTag ) ; if ( attr == null ) { attr = new AnnotationsAttribute ( cp , AnnotationsAttribute . visibleTag ) ; } Annotation a = new Annotation ( annotation , cp ) ; if ( memberValues != null ) { addMemberValuesToAnnotation ( a , cp , memberValues ) ; } attr . addAnnotation ( a ) ; fi . addAttribute ( attr ) ; } else { throw new UnsupportedOperationException ( "Unknown object type: " + toAnnotate . getClass ( ) ) ; }


signature:
public class ClassGeneratorUtils { /** * Private method to add member values to annotation
 * @ param annotation
 * @ param cp
 * @ param memberValues */
private static void addMemberValuesToAnnotation ( Annotation annotation , ConstPool cp , LinkedHashMap < String , Object > memberValues ) { } }

implementation:
// Get the member value object
for ( String mvName : memberValues . keySet ( ) ) { Object mvValue = memberValues . get ( mvName ) ; MemberValue mv = getMemberValue ( mvValue , cp ) ; annotation . addMemberValue ( mvName , mv ) ; }


signature:
public class AbstractActivityContextInterfaceFactory { /** * This method returns the aci for the specified activity , if exists , it
 * should be invoked by each impl of methods of an ra type aci factory .
 * @ param activity
 * @ return
 * @ throws NullPointerException
 * @ throws UnrecognizedActivityException
 * @ throws FactoryException */
protected ActivityContextInterface getACI ( Object activity ) throws NullPointerException , UnrecognizedActivityException , FactoryException { } }

implementation: if ( activity == null ) { throw new NullPointerException ( "null activity object" ) ; } ActivityHandle handle = null ; for ( ResourceAdaptorEntity raEntity : sleeContainer . getResourceManagement ( ) . getResourceAdaptorEntitiesPerType ( resourceAdaptorTypeID ) ) { handle = raEntity . getResourceAdaptorObject ( ) . getActivityHandle ( activity ) ; if ( handle != null ) { ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl ( raEntity , handle ) ; ActivityContext ac = sleeContainer . getActivityContextFactory ( ) . getActivityContext ( ach ) ; if ( ac != null ) { return ac . getActivityContextInterface ( ) ; } break ; } } throw new UnrecognizedActivityException ( activity . toString ( ) ) ;


signature:
public class AbstractSleeComponent { /** * Retrieves the component javassist class pool
 * @ return */
public ClassPool getClassPool ( ) { } }

implementation:
if ( classPool == null ) { if ( classLoader == null ) { throw new IllegalStateException ( "can't init javassit classpool, there is no class loader set for the component" ) ; } classPool = new ClassPool ( ) ; // add class path for domain and dependencies
classPool . appendClassPath ( new LoaderClassPath ( classLoaderDomain ) ) ; for ( ClassLoader domainDependencies : classLoaderDomain . getAllDependencies ( ) ) { classPool . appendClassPath ( new LoaderClassPath ( domainDependencies ) ) ; } // add class path also for slee
classPool . appendClassPath ( new LoaderClassPath ( classLoaderDomain . getParent ( ) ) ) ; } return classPool ;


signature:
public class AbstractSleeComponent { /** * Specifies the the Deployable Unit this component belongs . This method
 * also sets the reverse relation , adding the component to the deployable
 * unit
 * @ param deployableUnit
 * @ throws AlreadyDeployedException
 * if a component with same id already exists in the du
 * @ throws IllegalStateException
 * if this method is invoked and the deployable unit was already
 * set before */
public void setDeployableUnit ( DeployableUnit deployableUnit ) throws AlreadyDeployedException { } }

implementation: if ( this . deployableUnit != null ) { throw new IllegalStateException ( "deployable unit already set. du = " + this . deployableUnit ) ; } this . deployableUnit = deployableUnit ; if ( ! addToDeployableUnit ( ) ) { throw new AlreadyDeployedException ( "unable to install du having multiple components with id " + getComponentID ( ) ) ; }