Input: Compare this component identifier with the specified component identifier 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 . <p > Component ordering is determined by comparing the component identifier attributes in the following order : <ol > <li > component type ( nb . any subclass of <code > ComponentID< / code > may be safely compared without causing a <code > ClassCastException< / code > ) <li > component name <li > component vendor <li > component version < / ol > [CODESPLIT] protected final int compareTo ( String thisClassName , ComponentID that ) { int typeComparison = thisClassName . compareTo ( that . getClassName ( ) ) ; if ( typeComparison != 0 ) return typeComparison ; int nameComparison = this . name . compareTo ( that . name ) ; if ( nameComparison != 0 ) return nameComparison ; int vendorComparison = this . vendor . compareTo ( that . vendor ) ; if ( vendorComparison != 0 ) return vendorComparison ; return this . version . compareTo ( that . version ) ; }


Input: private [CODESPLIT] private int rotateLeft ( int value , int bits ) { long l = value & 0x00000000ffffffff  L ; l <<= bits ; return ( int ) l | ( int ) ( l >> 32 ) ; }


Input: Retrieves the object pool for the specified sbb and service . [CODESPLIT] public SbbObjectPoolImpl getObjectPool ( ServiceID serviceID , SbbID sbbID ) { return pools . get ( new ObjectPoolMapKey ( serviceID , sbbID ) ) ; }


Input: Creates an object pool for the specified service and sbb . If a transaction manager is used then and if the tx rollbacks the pool will be removed . [CODESPLIT] public void createObjectPool ( final ServiceID serviceID , final SbbComponent sbbComponent , final SleeTransactionManager sleeTransactionManager ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Creating Pool for  " + serviceID + " and " + sbbComponent ) ; } createObjectPool ( serviceID , sbbComponent ) ; if ( sleeTransactionManager != null && sleeTransactionManager . getTransactionContext ( ) != null ) { // add a rollback action to remove sbb object pool TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Due to tx rollback, removing pool for " + serviceID + " and " + sbbComponent ) ; } try { removeObjectPool ( serviceID , sbbComponent . getSbbID ( ) ) ; } catch ( Throwable e ) { logger . error ( "Failed to remove " + serviceID + " and " + sbbComponent + " object pool" , e ) ; } } } ; sleeTransactionManager . getTransactionContext ( ) . getAfterRollbackActions ( ) . add ( action ) ; } }


Input: Removes the pool for the specified ids [CODESPLIT] private void removeObjectPool ( final ServiceID serviceID , final SbbID sbbID ) { ObjectPoolMapKey key = new ObjectPoolMapKey ( serviceID , sbbID ) ; final SbbObjectPoolImpl objectPool = pools . remove ( key ) ; if ( objectPool != null ) { try { objectPool . close ( ) ; } catch ( Exception e ) { logger . error ( "failed to close pool" , e ) ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Removed Pool for " + key ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ActivityContextInterface getActivityContextInterface ( ServiceActivity serviceActivityImpl ) throws NullPointerException , TransactionRequiredLocalException , UnrecognizedActivityException , FactoryException { ActivityContextHandle ach = new ServiceActivityContextHandle ( new ServiceActivityHandleImpl ( ( ( ServiceActivityImpl ) serviceActivityImpl ) . getServiceID ( ) ) ) ; ActivityContext ac = sleeContainer . getActivityContextFactory ( ) . getActivityContext ( ach ) ; if ( ac == null ) { throw new UnrecognizedActivityException ( serviceActivityImpl ) ; } return ac . getActivityContextInterface ( ) ; }


Input: Executes a non transacted End Activity operation . [CODESPLIT] void execute ( final ActivityHandle handle ) throws UnrecognizedActivityHandleException { final SleeTransaction tx = super . suspendTransaction ( ) ; try { sleeEndpoint . _endActivity ( handle , tx ) ; } finally { if ( tx != null ) { super . resumeTransaction ( tx ) ; } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void startActivity ( ActivityHandle handle , Object activity ) throws NullPointerException , IllegalStateException , ActivityAlreadyExistsException , StartActivityException , SLEEException { startActivity ( handle , activity , ActivityFlags . NO_FLAGS ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void startActivity ( final ActivityHandle handle , Object activity , final int activityFlags ) throws NullPointerException , IllegalStateException , ActivityAlreadyExistsException , StartActivityException , SLEEException { if ( doTraceLogs ) { logger . trace ( "startActivity( handle = " + handle + " , activity = " + activity + " , flags = " + activityFlags + " )" ) ; } checkStartActivityParameters ( handle , activity ) ; startActivityNotTransactedExecutor . execute ( handle , activityFlags , false ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void startActivitySuspended ( ActivityHandle handle , Object activity ) throws NullPointerException , IllegalStateException , TransactionRequiredLocalException , ActivityAlreadyExistsException , StartActivityException , SLEEException { startActivitySuspended ( handle , activity , ActivityFlags . NO_FLAGS ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void startActivitySuspended ( ActivityHandle handle , Object activity , int activityFlags ) throws NullPointerException , IllegalStateException , TransactionRequiredLocalException , ActivityAlreadyExistsException , StartActivityException , SLEEException { if ( doTraceLogs ) { logger . trace ( "startActivitySuspended( handle = " + handle + " , activity = " + activity + " , flags = " + activityFlags + " )" ) ; } // need to check tx before doing out of tx scope activity start txManager . mandateTransaction ( ) ; checkStartActivityParameters ( handle , activity ) ; startActivityNotTransactedExecutor . execute ( handle , activityFlags , true ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void startActivityTransacted ( ActivityHandle handle , Object activity , int activityFlags ) throws NullPointerException , IllegalStateException , TransactionRequiredLocalException , ActivityAlreadyExistsException , StartActivityException , SLEEException { if ( doTraceLogs ) { logger . trace ( "startActivityTransacted( handle = " + handle + " , activity = " + activity + " , flags = " + activityFlags + " )" ) ; } checkStartActivityParameters ( handle , activity ) ; // check tx state txManager . mandateTransaction ( ) ; _startActivity ( handle , activityFlags , null ) ; }


Input: Checks the parameters of startActivity * methods [CODESPLIT] private void checkStartActivityParameters ( ActivityHandle handle , Object activity ) throws NullPointerException , IllegalStateException { // check args if ( handle == null ) { throw new NullPointerException ( "null handle" ) ; } if ( activity == null ) { throw new NullPointerException ( "null activity" ) ; } // check ra state if ( raEntity . getResourceAdaptorObject ( ) . getState ( ) != ResourceAdaptorObjectState . ACTIVE ) { throw new IllegalStateException ( "ra is in state " + raEntity . getResourceAdaptorObject ( ) . getState ( ) ) ; } }


Input: Start activity logic independent of transaction management . [CODESPLIT] ActivityContextHandle _startActivity ( ActivityHandle handle , int activityFlags , final SleeTransaction barrierTx ) { ActivityContext ac = null ; if ( raEntity . getHandleReferenceFactory ( ) != null && ! ActivityFlags . hasSleeMayMarshal ( activityFlags ) ) { final ActivityHandleReference reference = raEntity . getHandleReferenceFactory ( ) . createActivityHandleReference ( handle ) ; try { // create activity context with ref instead ac = acFactory . createActivityContext ( new ResourceAdaptorActivityContextHandleImpl ( raEntity , reference ) , activityFlags ) ; } catch ( ActivityAlreadyExistsException e ) { throw e ; } catch ( RuntimeException e ) { raEntity . getHandleReferenceFactory ( ) . removeActivityHandleReference ( reference ) ; throw e ; } } else { // create activity context ac = acFactory . createActivityContext ( new ResourceAdaptorActivityContextHandleImpl ( raEntity , handle ) , activityFlags ) ; } // suspend activity if needed if ( barrierTx != null && ac != null ) { final ActivityEventQueueManager aeqm = ac . getLocalActivityContext ( ) . getEventQueueManager ( ) ; aeqm . createBarrier ( barrierTx ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { aeqm . removeBarrier ( barrierTx ) ; } } ; final TransactionContext tc = barrierTx . getTransactionContext ( ) ; tc . getAfterCommitActions ( ) . add ( action ) ; tc . getAfterRollbackActions ( ) . add ( action ) ; } return ac . getActivityContextHandle ( ) ; }


Input: End activity logic independent of transaction management . [CODESPLIT] void _endActivity ( ActivityHandle handle , final SleeTransaction barrierTx ) throws UnrecognizedActivityHandleException { final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl ( raEntity , handle ) ; // get ac final ActivityContext ac = acFactory . getActivityContext ( ach ) ; if ( ac != null ) { // suspend activity if needed if ( barrierTx != null ) { final ActivityEventQueueManager aeqm = ac . getLocalActivityContext ( ) . getEventQueueManager ( ) ; aeqm . createBarrier ( barrierTx ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { aeqm . removeBarrier ( barrierTx ) ; } } ; final TransactionContext tc = barrierTx . getTransactionContext ( ) ; tc . getAfterCommitActions ( ) . add ( action ) ; tc . getAfterRollbackActions ( ) . add ( action ) ; } // end the activity ac . endActivity ( ) ; } else { throw new UnrecognizedActivityHandleException ( handle . toString ( ) ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void fireEvent ( ActivityHandle handle , FireableEventType eventType , Object event , Address address , ReceivableService receivableService ) throws NullPointerException , UnrecognizedActivityHandleException , IllegalEventException , ActivityIsEndingException , FireEventException , SLEEException { fireEvent ( handle , eventType , event , address , receivableService , EventFlags . NO_FLAGS , true ) ; }


Input: Checks that fire event methods can be invoked [CODESPLIT] private void checkFireEventPreconditions ( ActivityHandle handle , FireableEventType eventType , Object event ) throws NullPointerException , IllegalEventException , IllegalStateException { if ( event == null ) throw new NullPointerException ( "event is null" ) ; if ( handle == null ) throw new NullPointerException ( "handle is null" ) ; if ( eventType == null ) { throw new NullPointerException ( "eventType is null" ) ; } final EventTypeComponent eventTypeComponent = componentRepository . getComponentByID ( eventType . getEventType ( ) ) ; if ( eventTypeComponent == null ) { throw new IllegalEventException ( "event type not installed (more on SLEE 1.1 specs 15.14.8)" ) ; } if ( ! eventTypeComponent . getEventTypeClass ( ) . isAssignableFrom ( event . getClass ( ) ) ) { throw new IllegalEventException ( "the class of the event object fired is not assignable to the event class of the event type (more on SLEE 1.1 specs 15.14.8) " ) ; } if ( eventType . getClass ( ) != FireableEventTypeImpl . class ) { throw new IllegalEventException ( "unknown implementation of FireableEventType" ) ; } if ( raEntity . getAllowedEventTypes ( ) != null && ! raEntity . getAllowedEventTypes ( ) . contains ( eventType . getEventType ( ) ) ) { throw new IllegalEventException ( "Resource Adaptor configured to not ignore ra type event checking and the event " + eventType . getEventType ( ) + " does not belongs to any of the ra types implemented by the resource adaptor" ) ; } }


Input: Event firing logic independent of transaction management . [CODESPLIT] void _fireEvent ( ActivityHandle realHandle , ActivityHandle refHandle , FireableEventType eventType , Object event , Address address , ReceivableService receivableService , int eventFlags , final SleeTransaction barrierTx ) throws ActivityIsEndingException , SLEEException { final ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl ( raEntity , refHandle ) ; // get ac final ActivityContext ac = acFactory . getActivityContext ( ach ) ; if ( ac == null ) { throw new UnrecognizedActivityHandleException ( "Unable to fire " + eventType . getEventType ( ) + " on activity handle " + realHandle + " , the handle is not mapped to an activity context" ) ; } else { // suspend activity if needed if ( barrierTx != null ) { final ActivityEventQueueManager aeqm = ac . getLocalActivityContext ( ) . getEventQueueManager ( ) ; aeqm . createBarrier ( barrierTx ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { aeqm . removeBarrier ( barrierTx ) ; } } ; final TransactionContext tc = barrierTx . getTransactionContext ( ) ; tc . getAfterCommitActions ( ) . add ( action ) ; tc . getAfterRollbackActions ( ) . add ( action ) ; } final EventProcessingCallbacks callbacks = new EventProcessingCallbacks ( realHandle , eventType , event , address , receivableService , eventFlags , raEntity ) ; final EventProcessingSucceedCallback succeedCallback = EventFlags . hasRequestProcessingSuccessfulCallback ( eventFlags ) ? callbacks : null ; final EventProcessingFailedCallback failedCallback = EventFlags . hasRequestProcessingFailedCallback ( eventFlags ) ? callbacks : null ; final EventUnreferencedCallback unreferencedCallback = EventFlags . hasRequestEventReferenceReleasedCallback ( eventFlags ) ? callbacks : null ; ac . fireEvent ( eventType . getEventType ( ) , event , address , receivableService == null ? null : receivableService . getService ( ) , succeedCallback , failedCallback , unreferencedCallback ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void suspendActivity ( ActivityHandle handle ) throws NullPointerException , TransactionRequiredLocalException , UnrecognizedActivityHandleException , SLEEException { suspendActivity ( handle , true ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void suspendReplicatedActivity ( ActivityHandle handle ) throws NullPointerException , TransactionRequiredLocalException , UnrecognizedActivityHandleException , SLEEException { suspendActivity ( handle , false ) ; }


Input: Generate the Sbb Local Object Class [CODESPLIT] public Class generateSbbLocalObjectConcreteClass ( ) { //Generates the implements link if ( logger . isTraceEnabled ( ) ) { logger . trace ( "generateSbbLocalObjectConcreteClass: sbbLocalObjectInterface = " + sbbLocalObjectName + " deployPath = " + deployPath ) ; } try { concreteSbbLocalObject = pool . makeClass ( ConcreteClassGeneratorUtils . SBB_LOCAL_OBJECT_CLASS_NAME_PREFIX + sbbLocalObjectName + ConcreteClassGeneratorUtils . SBB_LOCAL_OBJECT_CLASS_NAME_SUFFIX ) ; try { sleeSbbLocalObject = pool . get ( SbbLocalObjectImpl . class . getName ( ) ) ; sbbLocalObjectInterface = pool . get ( sbbLocalObjectName ) ; } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; String s = "Problem with pool " ; logger . error ( s , nfe ) ; throw new RuntimeException ( s , nfe ) ; } // This is our implementation interface. CtClass concreteClassInterface ; try { concreteClassInterface = pool . get ( SbbLocalObjectConcrete . class . getName ( ) ) ; } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; String s = "Problem with the pool! " ; logger . error ( s , nfe ) ; throw new RuntimeException ( s , nfe ) ; } ConcreteClassGeneratorUtils . createInterfaceLinks ( concreteSbbLocalObject , new CtClass [ ] { sbbLocalObjectInterface , concreteClassInterface } ) ; //Generates an inheritance link to the slee implementation of the // SbbLocalObject interface ConcreteClassGeneratorUtils . createInheritanceLink ( concreteSbbLocalObject , sleeSbbLocalObject ) ; //Generates the methods to implement from the interface Map interfaceMethods = ClassUtils . getInterfaceMethodsFromInterface ( sbbLocalObjectInterface ) ; generateConcreteMethods ( interfaceMethods , sbbAbstractClassName ) ; try { concreteSbbLocalObject . writeFile ( deployPath ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Concrete Class " + concreteSbbLocalObject . getName ( ) + " generated in the following path " + deployPath ) ; } } catch ( CannotCompileException e ) { String s = " Unexpected exception ! " ; logger . fatal ( s , e ) ; throw new RuntimeException ( s , e ) ; } catch ( IOException e ) { String s = "IO Exception!" ; logger . error ( s , e ) ; return null ; } //load the class try { return Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( concreteSbbLocalObject . getName ( ) ) ; } catch ( ClassNotFoundException e ) { logger . error ( "unable to load sbb local object impl class" , e ) ; return null ; } } finally { if ( this . concreteSbbLocalObject != null ) this . concreteSbbLocalObject . defrost ( ) ; } }


Input: Generates the concrete methods of the class [CODESPLIT] private void generateConcreteMethods ( Map interfaceMethods , String sbbAbstractClassName ) { if ( interfaceMethods == null ) return ; Iterator it = interfaceMethods . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { CtMethod interfaceMethod = ( CtMethod ) it . next ( ) ; if ( interfaceMethod == null ) return ; // The following methods are implemented in the superclass if ( interfaceMethod . getName ( ) . equals ( "isIdentical" ) || interfaceMethod . getName ( ) . equals ( "equals" ) || interfaceMethod . getName ( ) . equals ( "hashCode" ) || interfaceMethod . getName ( ) . equals ( "getSbbPriority" ) || interfaceMethod . getName ( ) . equals ( "remove" ) || interfaceMethod . getName ( ) . equals ( "setSbbPriority" ) || interfaceMethod . getName ( ) . equals ( "getName" ) || interfaceMethod . getName ( ) . equals ( "getChildRelation" ) || interfaceMethod . getName ( ) . equals ( "getParent" ) ) continue ; String methodToAdd = "public " ; //Add the return type boolean hasReturn = false ; CtClass returnType = null ; try { // There's probably a more elegant way to do this. returnType = interfaceMethod . getReturnType ( ) ; if ( returnType . equals ( CtClass . voidType ) ) { methodToAdd += "void " ; } else { methodToAdd = methodToAdd . concat ( returnType . getName ( ) + " " ) ; hasReturn = true ; } } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; methodToAdd = methodToAdd + "void " ; } //Add the method name methodToAdd += interfaceMethod . getName ( ) + "(" ; //Add the parameters CtClass [ ] parameterTypes = null ; ; try { parameterTypes = interfaceMethod . getParameterTypes ( ) ; for ( int argNumber = 0 ; argNumber < parameterTypes . length ; argNumber ++ ) { methodToAdd = methodToAdd . concat ( parameterTypes [ argNumber ] . getName ( ) + " arg_" + argNumber ) ; if ( argNumber + 1 < parameterTypes . length ) methodToAdd = methodToAdd + "," ; } } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; throw new RuntimeException ( "unexpected Exception ! " , nfe ) ; } methodToAdd = methodToAdd + ") { " ; // We need to do this in a type neutral way ! methodToAdd += SbbConcrete . class . getName ( ) + " concrete = " + " getSbbEntity().getSbbObject().getSbbConcrete();" ; //These methods are delegated to superclass. // Note the convoluted code here because finally is not supported // yet by javaassist. methodToAdd += "Object[] args = new Object [" + parameterTypes . length + "];" ; methodToAdd += "Class[] types = new Class [" + parameterTypes . length + "];" ; if ( parameterTypes != null && parameterTypes . length > 0 ) { for ( int argNumber = 0 ; argNumber < parameterTypes . length ; argNumber ++ ) { methodToAdd += "args[" + argNumber + "]  = " ; // Check if parameter type is primitive and add the wrapper // types. if ( parameterTypes [ argNumber ] . isPrimitive ( ) ) { CtClass ptype = parameterTypes [ argNumber ] ; if ( ptype . equals ( CtClass . intType ) ) { methodToAdd += "Integer.valueOf(" + "arg_" + argNumber + ");" ; } else if ( ptype . equals ( CtClass . booleanType ) ) { methodToAdd += "Boolean.valueOf(" + "arg_" + argNumber + ");" ; } else if ( ptype . equals ( CtClass . longType ) ) { methodToAdd += "Long.valueOf(" + "arg_" + argNumber + ");" ; } else if ( ptype . equals ( CtClass . shortType ) ) { methodToAdd += "Short.valueOf(" + "arg_" + argNumber + ");" ; } else if ( ptype . equals ( CtClass . floatType ) ) { methodToAdd += "Float.valueOf(" + "arg_" + argNumber + ");" ; } else if ( ptype . equals ( CtClass . doubleType ) ) { methodToAdd += "Double.valueOf(" + "arg_" + argNumber + ");" ; } else if ( ptype . equals ( CtClass . charType ) ) { methodToAdd += "Character.valueOf(" + "arg_" + argNumber + ");" ; } } else { methodToAdd += "arg_" + argNumber + ";" ; } } for ( int i = 0 ; i < parameterTypes . length ; i ++ ) { methodToAdd += "types[" + i + "] = " ; if ( parameterTypes [ i ] . isPrimitive ( ) ) { CtClass ptype = parameterTypes [ i ] ; if ( ptype . equals ( CtClass . intType ) ) { methodToAdd += "Integer.TYPE;" ; } else if ( ptype . equals ( CtClass . booleanType ) ) { methodToAdd += "Boolean.TYPE;" ; } else if ( ptype . equals ( CtClass . longType ) ) { methodToAdd += "Long.TYPE;" ; } else if ( ptype . equals ( CtClass . shortType ) ) { methodToAdd += "Short.TYPE;" ; } else if ( ptype . equals ( CtClass . floatType ) ) { methodToAdd += "Float.TYPE;" ; } else if ( ptype . equals ( CtClass . doubleType ) ) { methodToAdd += "Double.TYPE;" ; } else if ( ptype . equals ( CtClass . charType ) ) { methodToAdd += "Character.TYPE;" ; } } else { methodToAdd += parameterTypes [ i ] . getName ( ) + ".class; " ; } } } if ( hasReturn ) { methodToAdd += " return  " + "(" + returnType . getName ( ) + ")" ; } if ( returnType . isPrimitive ( ) ) { methodToAdd += "sbbLocalObjectInterceptor.invokeAndReturn" + returnType . getSimpleName ( ) + "(concrete," + "\"" + interfaceMethod . getName ( ) + "\"" + ", args, types); " ; } else { methodToAdd += "sbbLocalObjectInterceptor.invokeAndReturnObject(concrete," + "\"" + interfaceMethod . getName ( ) + "\"" + ", args, types );" ; } methodToAdd += "}" ; //Add the implementation code if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Method " + methodToAdd + " added" ) ; } CtMethod methodTest ; try { methodTest = CtNewMethod . make ( methodToAdd , concreteSbbLocalObject ) ; concreteSbbLocalObject . addMethod ( methodTest ) ; } catch ( CannotCompileException cce ) { cce . printStackTrace ( ) ; throw new RuntimeException ( "error generating method " , cce ) ; } } }


Input: User should overide it to provide different name for instance for boolean \ is \ prefix [CODESPLIT] protected void makeGetter ( ) { if ( fieldClass . equals ( boolean . class ) || fieldClass . equals ( Boolean . class ) ) { super . operationName = "is" + this . beanFieldName ; } else { super . operationName = "get" + this . beanFieldName ; } }


Input:
This method is called to convert optArg from string form if no conversion is needed it should return passed object . [CODESPLIT] protected Object convert ( String optArg ) throws SecurityException , NoSuchMethodException , IllegalArgumentException , InstantiationException , IllegalAccessException , InvocationTargetException , CommandException { if ( fieldClass . isPrimitive ( ) ) { // TODO: to optimize, to rework new to valueOf
 if ( fieldClass . equals ( int . class ) ) { return new Integer ( optArg ) ; } else if ( fieldClass . equals ( long . class ) ) { return new Long ( optArg ) ; } else if ( fieldClass . equals ( int . class ) ) { return new Integer ( optArg ) ; } else if ( fieldClass . equals ( byte . class ) ) { return new Byte ( optArg ) ; } else if ( fieldClass . equals ( short . class ) ) { return new Short ( optArg ) ; } else if ( fieldClass . equals ( float . class ) ) { return new Float ( optArg ) ; } else if ( fieldClass . equals ( double . class ) ) { return new Double ( optArg ) ; } else if ( fieldClass . equals ( boolean . class ) ) { return new Boolean ( optArg ) ; } else if ( fieldClass . equals ( char . class ) ) { return new Character ( optArg . charAt ( 0 ) ) ; } //?
 throw new CommandException ( "Unpredicted place. Please report." ) ; } else if ( isClassNumber ( ) ) { //Handle Long, Integer, .., Boolean
 Constructor < ? > con = fieldClass . getConstructor ( String . class ) ; return con . newInstance ( optArg ) ; } return optArg ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public Set < K > getLocalKeyset ( ) { Set < K > set = new HashSet < K > ( ) ; ReplicatedDataKeyClusteredCacheData < K , V > handleCacheData = null ; Address handleCacheDataClusterNode = null ; for ( K handle : cacheData . getAllKeys ( ) ) { handleCacheData = new ReplicatedDataKeyClusteredCacheData < K , V > ( cacheData , handle , cluster ) ; handleCacheDataClusterNode = handleCacheData . getClusterNodeAddress ( ) ; if ( handleCacheDataClusterNode == null || handleCacheDataClusterNode . equals ( cluster . getLocalAddress ( ) ) ) { set . add ( handle ) ; } } return Collections . unmodifiableSet ( set ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean put ( K key , V value ) { final ReplicatedDataKeyClusteredCacheData < K , V > keyCacheData = new ReplicatedDataKeyClusteredCacheData < K , V > ( cacheData , key , cluster ) ; boolean created = keyCacheData . create ( ) ; if ( value != null ) { keyCacheData . setValue ( value ) ; } return created ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public V get ( K key ) { final ReplicatedDataKeyClusteredCacheData < K , V > handleCacheData = new ReplicatedDataKeyClusteredCacheData < K , V > ( cacheData , key , cluster ) ; return handleCacheData . exists ( ) ? handleCacheData . getValue ( ) : null ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean contains ( K key ) { return new ReplicatedDataKeyClusteredCacheData < K , V > ( cacheData , key , cluster ) . exists ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean remove ( K key ) { return new ReplicatedDataKeyClusteredCacheData < K , V > ( cacheData , key , cluster ) . remove ( ) ; }


Input: Determine whether the specified notification should be delivered to notification listeners using this notification filter . [CODESPLIT] public boolean isNotificationEnabled ( Notification notification ) { if ( ! ( notification instanceof TraceNotification ) ) return false ; if ( minLevel_10 != null ) { // SLEE 1.0 comparison Level traceLevel = ( ( TraceNotification ) notification ) . getLevel ( ) ; return traceLevel != null && ! minLevel_10 . isHigherLevel ( traceLevel ) ; } else { // SLEE 1.1 comparison TraceLevel traceLevel = ( ( TraceNotification ) notification ) . getTraceLevel ( ) ; return traceLevel != null && ! minLevel_11 . isHigherLevel ( traceLevel ) ; } }


Input: Set the profile table and profile referenced by this profile identifier to new values . [CODESPLIT] public final void setProfileID ( String profileTableName , String profileName ) throws NullPointerException , IllegalArgumentException { if ( profileTableName == null ) throw new NullPointerException ( "profileTableName is null" ) ; if ( profileName == null ) throw new NullPointerException ( "profileName is null" ) ; if ( profileTableName . indexOf ( ' ' ) >= 0 ) throw new IllegalArgumentException ( "profileTableName cannot contain the '/' character" ) ; this . profileTableName = profileTableName ; this . profileName = profileName ; this . address = null ; }


Input: Get an <code > Address< / code > object containing the address form of the profile identified by this profile identifier . [CODESPLIT] public Address toAddress ( ) { if ( address == null ) { address = new Address ( AddressPlan . SLEE_PROFILE , profileTableName + ' ' + profileName ) ; } return address ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void barrierEvent ( EventContext eventContext ) { if ( barriedEvents == null ) { barriedEvents = new LinkedList < EventContext > ( ) ; } barriedEvents . add ( eventContext ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public EventContext [ ] removeEventsBarried ( ) { // this is safe because adding events and calling this is ever done by // same executor/thread final EventContext [ ] result = barriedEvents . toArray ( new EventContext [ barriedEvents . size ( ) ] ) ; barriedEvents = null ; return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public EventRouterExecutor getExecutor ( ActivityContextHandle activityContextHandle ) { return executors [ ( activityContextHandle . hashCode ( ) & Integer . MAX_VALUE ) % executors . length ] ; }


Input: Get a <code > SleeState< / code > object from an integer value . [CODESPLIT] public static SleeState fromInt ( int state ) throws IllegalArgumentException { switch ( state ) { case SLEE_STOPPED : return STOPPED ; case SLEE_STARTING : return STARTING ; case SLEE_RUNNING : return RUNNING ; case SLEE_STOPPING : return STOPPING ; default : throw new IllegalArgumentException ( "Invalid state: " + state ) ; } }


Input: Get a <code > SleeState< / code > object from a string value . [CODESPLIT] public static SleeState fromString ( String state ) throws NullPointerException , IllegalArgumentException { if ( state == null ) throw new NullPointerException ( "state is null" ) ; if ( state . equalsIgnoreCase ( STOPPED_STRING ) ) return STOPPED ; if ( state . equalsIgnoreCase ( STARTING_STRING ) ) return STARTING ; if ( state . equalsIgnoreCase ( RUNNING_STRING ) ) return RUNNING ; if ( state . equalsIgnoreCase ( STOPPING_STRING ) ) return STOPPING ; throw new IllegalArgumentException ( "Invalid state: " + state ) ; }


Input:
protected DeployableUnitsCard deployableUnitsCard ; [CODESPLIT] private String extractMessage ( String result ) { // Fix:
 // Firefox 2 encapsulates the text inside <pre> tag
 String startPreTag = "<pre>" ; String endPreTag = "</pre>" ; result = result . trim ( ) ; if ( result . startsWith ( startPreTag ) && result . endsWith ( endPreTag ) ) { result = result . substring ( startPreTag . length ( ) , result . length ( ) - endPreTag . length ( ) ) ; } return result ; }


Input: Determine whether the specified notification should be delivered to notification listeners using this notification filter . [CODESPLIT] public boolean isNotificationEnabled ( Notification notification ) { if ( ! ( notification instanceof AlarmNotification ) ) return false ; synchronized ( knownAlarms ) { clearStaleTimeouts ( ) ; NotificationInfo info = ( NotificationInfo ) knownAlarms . get ( notification ) ; if ( info == null ) { // we've not seen this alarm before, or the period has expired since // the first notification knownAlarms . put ( notification , new NotificationInfo ( System . currentTimeMillis ( ) ) ) ; return false ; } if ( ++ info . count == threshold ) { // passed threshold knownAlarms . remove ( notification ) ; return true ; } return false ; } }


Input: private [CODESPLIT] private void clearStaleTimeouts ( ) { Iterator iterator = knownAlarms . values ( ) . iterator ( ) ; long currentTime = System . currentTimeMillis ( ) ; while ( iterator . hasNext ( ) ) { NotificationInfo info = ( NotificationInfo ) iterator . next ( ) ; // if period has expired remove reference to the notification if ( ( info . firstSeenTime + period ) < currentTime ) { iterator . remove ( ) ; } } }


Input: Installs the specified { [CODESPLIT] public void installResourceAdaptorType ( ResourceAdaptorTypeComponent component ) throws DeploymentException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Installing " + component ) ; } // generate code for aci factory new ResourceAdaptorTypeClassCodeGenerator ( ) . process ( component ) ; // create instance of aci factory and store it in the // component if ( component . getActivityContextInterfaceFactoryConcreteClass ( ) != null ) { try { Constructor < ? > constructor = component . getActivityContextInterfaceFactoryConcreteClass ( ) . getConstructor ( new Class [ ] { SleeContainer . class , ResourceAdaptorTypeID . class } ) ; Object aciFactory = constructor . newInstance ( new Object [ ] { sleeContainer , component . getResourceAdaptorTypeID ( ) } ) ; component . setActivityContextInterfaceFactory ( aciFactory ) ; } catch ( Throwable e ) { throw new SLEEException ( "unable to create ra type aci factory instance" , e ) ; } } final ResourceAdaptorTypeID resourceAdaptorTypeID = component . getResourceAdaptorTypeID ( ) ; entitiesPerType . put ( resourceAdaptorTypeID , new HashSet < ResourceAdaptorEntity > ( ) ) ; TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { entitiesPerType . remove ( resourceAdaptorTypeID ) ; } } ; sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) . getAfterRollbackActions ( ) . add ( action ) ; }


Input: Installs the specified { [CODESPLIT] public void installResourceAdaptor ( final ResourceAdaptorComponent component ) throws DeploymentException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Installing " + component ) ; } new ResourceAdaptorClassCodeGenerator ( ) . process ( component ) ; // if we are in cluster mode we need to add the RA class loader domain to the replication class loader if ( ! sleeContainer . getCluster ( ) . getMobicentsCache ( ) . isLocalMode ( ) ) { final ReplicationClassLoader replicationClassLoader = sleeContainer . getReplicationClassLoader ( ) ; replicationClassLoader . addDomain ( component . getClassLoaderDomain ( ) ) ; final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; if ( txContext != null ) { TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { replicationClassLoader . removeDomain ( component . getClassLoaderDomain ( ) ) ; } } ; txContext . getAfterRollbackActions ( ) . add ( action ) ; } } }


Input: Uninstalls the specified { [CODESPLIT] public void uninstallResourceAdaptorType ( final ResourceAdaptorTypeComponent component ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Uninstalling " + component ) ; } final ResourceAdaptorTypeID resourceAdaptorTypeID = component . getResourceAdaptorTypeID ( ) ; final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; TransactionalAction action1 = new TransactionalAction ( ) { public void execute ( ) { entitiesPerType . remove ( resourceAdaptorTypeID ) ; } } ; if ( txContext != null ) { txContext . getAfterCommitActions ( ) . add ( action1 ) ; } else { action1 . execute ( ) ; } // if we are in cluster mode we need to remove the RA class loader domain from the replication class loader if ( ! sleeContainer . getCluster ( ) . getMobicentsCache ( ) . isLocalMode ( ) ) { final ReplicationClassLoader replicationClassLoader = sleeContainer . getReplicationClassLoader ( ) ; TransactionalAction action2 = new TransactionalAction ( ) { public void execute ( ) { replicationClassLoader . removeDomain ( component . getClassLoaderDomain ( ) ) ; } } ; if ( txContext != null ) { txContext . getAfterCommitActions ( ) . add ( action2 ) ; } else { action2 . execute ( ) ; } } }


Input: Uninstalls the specified { [CODESPLIT] public void uninstallResourceAdaptor ( ResourceAdaptorComponent component ) throws DependencyException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Uninstalling " + component ) ; } for ( ResourceAdaptorEntity raEntity : resourceAdaptorEntities . values ( ) ) { if ( raEntity . getResourceAdaptorID ( ) . equals ( component . getResourceAdaptorID ( ) ) ) { throw new DependencyException ( "can't uninstall " + component . getResourceAdaptorID ( ) + " since ra entity " + raEntity . getName ( ) + " refers it" ) ; } } }


Input: The contains method . This method returns true if the SBB entity represented by the SBB local object specified by the input argument is a member of this child relation . If the method argument is not an SBB local object is an invalid SBB local object or is an SBB local object whose underlying SBB entity is not a member of this child relation then this method returns false . [CODESPLIT] public boolean contains ( Object object ) { if ( ! ( object instanceof SbbLocalObject ) ) return false ; final SbbLocalObjectImpl sbblocal = ( SbbLocalObjectImpl ) object ; final SbbEntityID sbbEntityId = sbblocal . getSbbEntityId ( ) ; if ( ! idBelongsToChildRelation ( sbbEntityId ) ) { return false ; } return new SbbEntityCacheData ( sbbEntityId , sleeContainer . getCluster ( ) . getMobicentsCache ( ) ) . exists ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public void clear ( ) { sleeContainer . getTransactionManager ( ) . mandateTransaction ( ) ; for ( Iterator it = iterator ( ) ; it . hasNext ( ) ; ) { it . next ( ) ; it . remove ( ) ; } }


Input: Spec page 62 The remove methods : clear remove removeAll and retainAll . o These methods may remove SBB entities from the child relation . The input argument specifies which SBB entities will be removed from the child relation or retained in the child relation by specifying the SBB local object or collection of SBB local objects that represent the SBB entities to be removed or retained . o Removing an SBB entity from a child relation initiates a cascading removal of the SBB entity tree rooted by the SBB entity similar to invoking the remove method on an SBB local object that represents the SBB entity . [CODESPLIT] public boolean remove ( Object object ) { sleeContainer . getTransactionManager ( ) . mandateTransaction ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "removing sbb local object " + object ) ; } if ( object == null ) throw new NullPointerException ( "Null arg for remove " ) ; if ( ! ( object instanceof SbbLocalObject ) ) return false ; final SbbLocalObjectImpl sbbLocalObjectImpl = ( SbbLocalObjectImpl ) object ; if ( ! idBelongsToChildRelation ( sbbLocalObjectImpl . getSbbEntityId ( ) ) && ! sbbLocalObjectImpl . getSbbEntity ( ) . isRemoved ( ) ) { return false ; } else { sbbLocalObjectImpl . remove ( ) ; return true ; } }


Input: This method returns true if all SBB entities represented by the SBB local objects in the collection specified by the input argument are members of this child relation . If the collection contains an object that is not an SBB local object an SBB local object that is invalid or an SBB local object whose underlying SBB entity is not a member of this child relation then this method returns false . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public boolean containsAll ( Collection c ) { if ( c == null ) throw new NullPointerException ( "null collection!" ) ; for ( Iterator it = c . iterator ( ) ; it . hasNext ( ) ; ) { if ( ! contains ( it . next ( ) ) ) { return false ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "containsAll : collection = " + c + " > all in child relation" ) ; } return true ; }


Input: Removing an SBB entity from a child relation initiates a cascading removal of the SBB entity tree rooted by the SBB entity similar to invoking the remove method on an SBB local object that represents the SBB entity . [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public boolean removeAll ( Collection c ) { boolean flag = true ; if ( c == null ) throw new NullPointerException ( " null collection ! " ) ; for ( Iterator it = c . iterator ( ) ; it . hasNext ( ) ; ) { flag &= this . remove ( it . next ( ) ) ; } return flag ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ SuppressWarnings ( "rawtypes" ) public boolean retainAll ( Collection c ) { boolean flag = false ; if ( c == null ) throw new NullPointerException ( " null arg! " ) ; for ( Iterator it = this . iterator ( ) ; it . hasNext ( ) ; ) { if ( ! c . contains ( it . next ( ) ) ) { flag = true ; it . remove ( ) ; } } return flag ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public Object [ ] toArray ( Object [ ] a ) { if ( a == null ) throw new NullPointerException ( "null arg!" ) ; HashSet localObjects = this . getLocalObjects ( ) ; return localObjects . toArray ( a ) ; }


Input: extension methods [CODESPLIT] private void validateChildName ( String childName ) throws IllegalArgumentException , NullPointerException { if ( childName == null ) { throw new NullPointerException ( "null child name" ) ; } if ( childName . isEmpty ( ) ) { throw new IllegalArgumentException ( "empty child name" ) ; } }


Input:
/ * ( non - Javadoc ) [CODESPLIT] @ Override protected void processArguments ( String [ ] args ) throws CommandException { String sopts = ":rsdi" ; LongOpt [ ] lopts = { new LongOpt ( "start" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "stopt" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "shutdown" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "info" , LongOpt . NO_ARGUMENT , null , ' ' ) , } ; Getopt getopt = new Getopt ( null , args , sopts , lopts ) ; // getopt.setOpterr(false);
 int code ; while ( ( code = getopt . getopt ( ) ) != - 1 ) { switch ( code ) { case ' ' : throw new CommandException ( "Option requires an argument: " + args [ getopt . getOptind ( ) - 1 ] ) ; case ' ' : throw new CommandException ( "Invalid (or ambiguous) option: " + args [ getopt . getOptind ( ) - 1 ] ) ; case ' ' : super . operation = new StartOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new StopOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new ShutdownOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new InfoOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; default : throw new CommandException ( "Command: \"" + getName ( ) + "\", found unexpected opt: " + args [ getopt . getOptind ( ) - 1 ] ) ; } } }


Input: Get a <code > FailureReason< / code > object from an integer value . <p > This method returns the singleton objects for the failure reasons defined in this class . For all vendor - defined reason codes ( those greater than 0 in value ) a non - unique <code > FailureReason< / code > object is return encapsulating that value . [CODESPLIT] public static FailureReason fromInt ( int reason ) throws IllegalArgumentException { switch ( reason ) { case REASON_OTHER_REASON : return OTHER_REASON ; case REASON_EVENT_QUEUE_FULL : return EVENT_QUEUE_FULL ; case REASON_EVENT_QUEUE_TIMEOUT : return EVENT_QUEUE_TIMEOUT ; case REASON_SYSTEM_OVERLOAD : return SYSTEM_OVERLOAD ; case REASON_EVENT_MARSHALING_ERROR : return EVENT_MARSHALING_ERROR ; case REASON_FIRING_TRANSACTION_ROLLED_BACK : return FIRING_TRANSACTION_ROLLED_BACK ; default : if ( reason > 0 ) return new FailureReason ( reason ) ; else throw new IllegalArgumentException ( "Invalid failure reason: " + reason ) ; } }


Input: Get a JMX Object Name property string that uniquely identifies the specified SLEE internal component or subsystem suitable for inclusion in the Object Name of a Usage MBean . This method makes use of the { [CODESPLIT] public static String getUsageMBeanProperties ( String subsystemName ) { if ( subsystemName == null ) throw new NullPointerException ( "subsystemName is null" ) ; return SUBSYSTEM_NAME_KEY + ' ' + ObjectName . quote ( subsystemName ) ; }


Input: 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 . <p > If <code > obj< / code > is a <code > SubsystemNotification< / code > order is determined by comparing the encapsulated subsystem 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 > . <p > [CODESPLIT] public int compareTo ( Object obj ) { // can't compare with null if ( obj == null ) throw new NullPointerException ( "obj is null" ) ; if ( obj == this ) return 0 ; if ( obj instanceof SubsystemNotification ) { // compare the profile table name SubsystemNotification that = ( SubsystemNotification ) obj ; return this . subsystemName . compareTo ( that . subsystemName ) ; } else { return super . compareTo ( TYPE , obj ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setBoolean ( Boolean attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setByte ( Byte attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setCharacter ( Character attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setDouble ( Double attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setFloat ( Float attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setInteger ( Integer attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setLong ( Long attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setShort ( Short attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } }


Input: Stores the attr value converting and storing in the string field of the entity [CODESPLIT] public void setAddress ( Address attrValue ) { if ( attrValue != null ) { setString ( attrValue . toString ( ) ) ; } else { setString ( null ) ; } setSerializable ( attrValue ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void setTimerThreads ( int value ) { if ( this . timerThreads == null ) { logger . info ( "SLEE Timer facility initiated with " + value + " threads." ) ; } else { logger . warn ( "Setting timer facility threads to " + value + ". If called with server running a stop and start is need to apply changes." ) ; } this . timerThreads = value ; }


Input: Determine if this Level object represents a level that is higher or more severe that some other Level object . For the purposes of the comparison OFF is considered a higher level than SEVERE . [CODESPLIT] public boolean isHigherLevel ( Level other ) throws NullPointerException { if ( other == null ) throw new NullPointerException ( "other is null" ) ; return this . level < other . level ; }


Input: Resolve deserialisation references so that the singleton property of each enumerated object is preserved . [CODESPLIT] private Object readResolve ( ) throws StreamCorruptedException { if ( level == LEVEL_OFF ) return OFF ; if ( level == LEVEL_SEVERE ) return SEVERE ; if ( level == LEVEL_WARNING ) return WARNING ; if ( level == LEVEL_INFO ) return INFO ; if ( level == LEVEL_CONFIG ) return CONFIG ; if ( level == LEVEL_FINE ) return FINE ; if ( level == LEVEL_FINER ) return FINER ; if ( level == LEVEL_FINEST ) return FINEST ; throw new StreamCorruptedException ( "Invalid internal state found" ) ; }


Input: Parser for the deployment config xml . [CODESPLIT] private void parseDeployConfig ( InputStream deployConfigInputStream , ResourceManagement resourceManagement ) throws SAXException , ParserConfigurationException , IOException { if ( deployConfigInputStream == null ) { throw new NullPointerException ( "null deploy config input stream" ) ; } Document doc = null ; try { // Read the file into a Document SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; Schema schema = schemaFactory . newSchema ( DeployConfigParser . class . getClassLoader ( ) . getResource ( "deploy-config.xsd" ) ) ; DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; // factory.setValidating(false); factory . setSchema ( schema ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; builder . setErrorHandler ( new ErrorHandler ( ) { public void error ( SAXParseException e ) throws SAXException { logger . error ( "Error parsing deploy-config.xml" , e ) ; return ; } public void fatalError ( SAXParseException e ) throws SAXException { logger . error ( "Fatal error parsing deploy-config.xml" , e ) ; return ; } public void warning ( SAXParseException e ) throws SAXException { logger . warn ( "Warning parsing deploy-config.xml" , e ) ; return ; } } ) ; doc = builder . parse ( deployConfigInputStream ) ; } finally { try { deployConfigInputStream . close ( ) ; } catch ( IOException e ) { logger . error ( "failed to close deploy config input stream" , e ) ; } } Map < String , Collection < ManagementAction > > postInstallActions = new HashMap < String , Collection < ManagementAction > > ( ) ; Map < String , Collection < ManagementAction > > preUninstallActions = new HashMap < String , Collection < ManagementAction > > ( ) ; // By now we only care about <ra-entity> nodes NodeList raEntities = doc . getElementsByTagName ( "ra-entity" ) ; // The RA identifier String raId = null ; // The collection of Post-Install Actions Collection < ManagementAction > cPostInstallActions = new ArrayList < ManagementAction > ( ) ; // The collection of Pre-Uninstall Actions Collection < ManagementAction > cPreUninstallActions = new ArrayList < ManagementAction > ( ) ; // Iterate through each ra-entity node for ( int i = 0 ; i < raEntities . getLength ( ) ; i ++ ) { Element raEntity = ( Element ) raEntities . item ( i ) ; // Get the component ID ComponentIDPropertyEditor cidpe = new ComponentIDPropertyEditor ( ) ; cidpe . setAsText ( raEntity . getAttribute ( "resource-adaptor-id" ) ) ; raId = cidpe . getValue ( ) . toString ( ) ; // The RA Entity Name String entityName = raEntity . getAttribute ( "entity-name" ) ; // Select the properties node NodeList propsNodeList = raEntity . getElementsByTagName ( "properties" ) ; if ( propsNodeList . getLength ( ) > 1 ) { logger . warn ( "Invalid ra-entity element, has more than one properties child. Reading only first." ) ; } // The properties for this RA ConfigProperties props = new ConfigProperties ( ) ; Element propsNode = ( Element ) propsNodeList . item ( 0 ) ; // Do we have any properties at all? if ( propsNode != null ) { // Select the property elements NodeList propsList = propsNode . getElementsByTagName ( "property" ) ; // For each element, add it to the Properties object for ( int j = 0 ; j < propsList . getLength ( ) ; j ++ ) { Element property = ( Element ) propsList . item ( j ) ; String propertyName = property . getAttribute ( "name" ) ; String propertyType = property . getAttribute ( "type" ) ; String propertyValue = property . getAttribute ( "value" ) ; props . addProperty ( new ConfigProperties . Property ( propertyName , propertyType , ConfigProperties . Property . toObject ( propertyType , propertyValue ) ) ) ; } } // Create the Resource Adaptor ID cidpe . setAsText ( raEntity . getAttribute ( "resource-adaptor-id" ) ) ; ResourceAdaptorID componentID = ( ResourceAdaptorID ) cidpe . getValue ( ) ; // Add the Create and Activate RA Entity actions to the Post-Install // Actions cPostInstallActions . add ( new CreateResourceAdaptorEntityAction ( componentID , entityName , props , resourceManagement ) ) ; cPostInstallActions . add ( new ActivateResourceAdaptorEntityAction ( entityName , resourceManagement ) ) ; // Each RA might have zero or more links.. get them NodeList links = raEntity . getElementsByTagName ( "ra-link" ) ; for ( int j = 0 ; j < links . getLength ( ) ; j ++ ) { String linkName = ( ( Element ) links . item ( j ) ) . getAttribute ( "name" ) ; cPostInstallActions . add ( new BindLinkNameAction ( linkName , entityName , resourceManagement ) ) ; cPreUninstallActions . add ( new UnbindLinkNameAction ( linkName , resourceManagement ) ) ; } // Add the Deactivate and Remove RA Entity actions to the // Pre-Uninstall Actions cPreUninstallActions . add ( new DeactivateResourceAdaptorEntityAction ( entityName , resourceManagement ) ) ; cPreUninstallActions . add ( new RemoveResourceAdaptorEntityAction ( entityName , resourceManagement ) ) ; // Finally add the actions to the respective hashmap. if ( raId != null ) { // We need to check if we are updating or adding new ones. if ( postInstallActions . containsKey ( raId ) ) { postInstallActions . get ( raId ) . addAll ( cPostInstallActions ) ; } else { postInstallActions . put ( raId , cPostInstallActions ) ; } // Same here... if ( preUninstallActions . containsKey ( raId ) ) { preUninstallActions . get ( raId ) . addAll ( cPreUninstallActions ) ; } else { preUninstallActions . put ( raId , cPreUninstallActions ) ; } } // recreate the lists for the next round (might come a new RA ID)... cPostInstallActions = new ArrayList < ManagementAction > ( ) ; cPreUninstallActions = new ArrayList < ManagementAction > ( ) ; raId = null ; } this . postInstallActions = Collections . unmodifiableMap ( postInstallActions ) ; this . preUninstallActions = Collections . unmodifiableMap ( preUninstallActions ) ; }


Input: Builds a list of { [CODESPLIT] public List < ServiceDescriptorImpl > parse ( InputStream inputStream ) throws DeploymentException { Object jaxbPojo = buildJAXBPojo ( inputStream ) ; List < ServiceDescriptorImpl > result = new ArrayList < ServiceDescriptorImpl > ( ) ; MServiceXML serviceXML = null ; if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee . service . ServiceXml ) { serviceXML = new MServiceXML ( ( org . mobicents . slee . container . component . deployment . jaxb . slee . service . ServiceXml ) jaxbPojo ) ; } else if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee11 . service . ServiceXml ) { serviceXML = new MServiceXML ( ( org . mobicents . slee . container . component . deployment . jaxb . slee11 . service . ServiceXml ) jaxbPojo ) ; } else { throw new SLEEException ( "unexpected class of jaxb pojo built: " + ( jaxbPojo != null ? jaxbPojo . getClass ( ) : null ) ) ; } for ( MService mService : serviceXML . getMServices ( ) ) { result . add ( new ServiceDescriptorImpl ( mService ) ) ; } return result ; }


Input: cleans up the class pool cache [CODESPLIT] public void clean ( ) { for ( ClassPath classPath : classPaths ) { classPool . removeClassPath ( classPath ) ; } for ( String classMade : classesMade ) { try { classPool . get ( classMade ) . detach ( ) ; } catch ( NotFoundException e ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Failed to detach class " + classMade + " from class pool" , e ) ; } } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ExternalActivityHandle createActivityHandle ( ) throws ResourceException { if ( sleeContainer == null ) { throw new ResourceException ( "Connection is in closed state" ) ; } if ( sleeContainer . getSleeState ( ) != SleeState . RUNNING ) { throw new ResourceException ( "Container is not in running state." ) ; } return sleeContainer . getNullActivityFactory ( ) . createNullActivityHandle ( ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] public void fireEvent ( Object event , EventTypeID eventType , ExternalActivityHandle activityHandle , Address address ) throws NullPointerException , UnrecognizedActivityException , UnrecognizedEventException , ResourceException { if ( sleeContainer == null ) { throw new ResourceException ( "Connection is in closed state" ) ; } if ( sleeContainer . getSleeState ( ) != SleeState . RUNNING ) { throw new ResourceException ( "Container is not in running state." ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "fireEvent(event=" + event + ",eventType=" + eventType + ",activityHandle=" + activityHandle + ",address=" + address + ")" ) ; } if ( event == null ) { throw new NullPointerException ( "event is null" ) ; } if ( eventType == null ) { throw new NullPointerException ( "event type is null" ) ; } if ( activityHandle == null ) { throw new NullPointerException ( "activity handle is null" ) ; } EventTypeComponent eventTypeComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( eventType ) ; if ( eventTypeComponent == null ) { throw new UnrecognizedEventException ( "event type not installed" ) ; } if ( ! eventTypeComponent . getEventTypeClass ( ) . isAssignableFrom ( event . getClass ( ) ) ) { logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . toString ( ) ) ; logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . getCanonicalName ( ) ) ; logger . info ( "" + Arrays . toString ( eventTypeComponent . getEventTypeClass ( ) . getDeclaredMethods ( ) ) ) ; logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . getClass ( ) . toString ( ) ) ; logger . info ( "" + eventTypeComponent . getEventTypeClass ( ) . getClass ( ) . getCanonicalName ( ) ) ; logger . info ( "" + event . getClass ( ) . toString ( ) ) ; logger . info ( "" + event . getClass ( ) . getCanonicalName ( ) ) ; logger . info ( "" + Arrays . toString ( event . getClass ( ) . getDeclaredMethods ( ) ) ) ; logger . info ( "*" + eventTypeComponent ) ; logger . info ( "*" + eventTypeComponent . getEventTypeID ( ) ) ; logger . info ( "*" + event ) ; logger . info ( "&" + eventTypeComponent . getClassLoader ( ) ) ; logger . info ( "&" + eventTypeComponent . getEventTypeClass ( ) . getClassLoader ( ) ) ; logger . info ( "&" + event . getClass ( ) . getClassLoader ( ) ) ; //throw new UnrecognizedEventException(
 //	"the class of the event object fired is not assignable to the event class of the event type.\n" +
 //	" EventClass: "+event.getClass()+", component class: "+eventTypeComponent.getEventTypeClass());
 } if ( ! ( activityHandle instanceof NullActivityHandle ) ) { throw new UnrecognizedActivityException ( activityHandle ) ; } // check container state is running
 SleeContainer sleeContainer = SleeContainer . lookupFromJndi ( ) ; if ( sleeContainer . getSleeState ( ) != SleeState . RUNNING ) { throw new IllegalStateException ( "Container is not running" ) ; } SleeTransactionManager txMgr = sleeContainer . getTransactionManager ( ) ; boolean newTx = txMgr . requireTransaction ( ) ; boolean rollback = true ; try { final NullActivityHandle nullActivityHandle = ( NullActivityHandle ) activityHandle ; final ActivityContextHandle ach = nullActivityHandle . getActivityContextHandle ( ) ; ActivityContext ac = sleeContainer . getActivityContextFactory ( ) . getActivityContext ( ach ) ; if ( ac == null ) { sleeContainer . getNullActivityFactory ( ) . createNullActivity ( nullActivityHandle , false ) ; ac = sleeContainer . getActivityContextFactory ( ) . getActivityContext ( ach ) ; if ( ac == null ) { throw new SLEEException ( "unable to create null ac for external activity handle " + activityHandle ) ; } } ac . fireEvent ( eventType , event , address , null , null , null , null ) ; rollback = false ; } catch ( Throwable ex ) { logger . error ( "Exception in fireEvent!" , ex ) ; } finally { if ( newTx ) { if ( rollback ) { try { txMgr . rollback ( ) ; } catch ( Throwable e ) { logger . error ( "failed to rollback implicit tx" , e ) ; } } else { try { txMgr . commit ( ) ; } catch ( Throwable e ) { logger . error ( "failed to commit implicit tx" , e ) ; } } } // else ignore, specs say there is no need to rollback a tx if event
 // queuing failed
 } }


Input: / * ( non - Javadoc ) [CODESPLIT] public EventTypeID getEventTypeID ( String name , String vendor , String version ) throws UnrecognizedEventException , ResourceException { if ( sleeContainer == null ) { throw new ResourceException ( "Connection is in closed state" ) ; } if ( sleeContainer . getSleeState ( ) != SleeState . RUNNING ) { throw new ResourceException ( "Container is not in running state." ) ; } EventTypeID eventTypeID = new EventTypeID ( name , vendor , version ) ; EventTypeComponent eventTypeComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( eventTypeID ) ; if ( eventTypeComponent == null ) { throw new UnrecognizedEventException ( "event type not installed" ) ; } else { return eventTypeID ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { parentSbbEntityID = ( SbbEntityID ) in . readObject ( ) ; parentChildRelation = in . readUTF ( ) ; childID = in . readUTF ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public void writeExternal ( ObjectOutput out ) throws IOException { out . writeObject ( parentSbbEntityID ) ; out . writeUTF ( parentChildRelation ) ; out . writeUTF ( childID ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] @ Override protected void processArguments ( String [ ] args ) throws CommandException { //first, we must get atleast -t, possibly -p, depending on those we call different method on ProfileProvisioningMBean
 //String sopts = ":t:p:ldwecrog:s";
 String sopts = "-:l:xdwecrog:s" ; LongOpt [ ] lopts = { //conf part
 //new LongOpt("table", LongOpt.REQUIRED_ARGUMENT, null, 't'),
 //new LongOpt("profile", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
 new LongOpt ( "noprefix" , LongOpt . NO_ARGUMENT , null , 0x1000 ) , //operration part
 new LongOpt ( "list" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "extlist" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "dirty" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "write" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "edit" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "commit" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "restore" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "close" , LongOpt . NO_ARGUMENT , null , ' ' ) , //get,set,bussines
 new LongOpt ( "get" , LongOpt . REQUIRED_ARGUMENT , null , ' ' ) , new LongOpt ( "set" , LongOpt . NO_ARGUMENT , null , ' ' ) , //options for set
 new LongOpt ( "name" , LongOpt . REQUIRED_ARGUMENT , null , SetAttributeOperation . name ) , new LongOpt ( "separator" , LongOpt . OPTIONAL_ARGUMENT , null , SetAttributeOperation . separator ) , new LongOpt ( "value" , LongOpt . OPTIONAL_ARGUMENT , null , SetAttributeOperation . value ) , //new LongOpt("bussines", LongOpt.NO_ARGUMENT, null, 'b'),
 } ; Getopt getopt = new Getopt ( null , args , sopts , lopts ) ; getopt . setOpterr ( false ) ; int nonOptArgIndex = 0 ; int code ; while ( ( code = getopt . getopt ( ) ) != - 1 ) { switch ( code ) { case ' ' : throw new CommandException ( "Option requires an argument: " + args [ getopt . getOptind ( ) - 1 ] ) ; case ' ' : throw new CommandException ( "Invalid (or ambiguous) option: " + args [ getopt . getOptind ( ) - 1 ] ) ; //CONF PART
 //			case 't':
 //				this.profileTableName = getopt.getOptarg();
 //				break;
 //			case 'p':
 //				this.profileName = getopt.getOptarg();
 //				break;
 // OPERATION PART
 case 0x1000 : break ; case 1 : //non opt args, table and profile name(maybe)
 switch ( nonOptArgIndex ) { case 0 : profileTableName = getopt . getOptarg ( ) ; nonOptArgIndex ++ ; break ; case 1 : profileName = getopt . getOptarg ( ) ; nonOptArgIndex ++ ; break ; default : throw new CommandException ( "Command: \"" + getName ( ) + "\" expects at most two non opt arguments!" ) ; } break ; case ' ' : //list
 super . operation = new ListOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //extlist
 super . operation = new ExtListOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //dirt
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "isProfileDirty" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //write
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "isProfileWriteable" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //edit
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "editProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //commit
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "commitProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //restore
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "restoreProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //close
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "closeProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //get
 super . operation = new GetAttributeOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //set
 super . operation = new SetAttributeOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; //			case 'b':
 //				//bussines
 //				super.operation = new BussinesMethodOperation(super.context, super.log, this);
 //				super.operation.buildOperation(getopt, args);
 //				break;
 default : throw new CommandException ( "Command: \"" + getName ( ) + "\", found unexpected opt: " + args [ getopt . getOptind ( ) - 1 ] ) ; } } }


Input:
Adds call to this profile . [CODESPLIT] @ SuppressWarnings ( "unchecked" ) public static void addProfileCall ( ProfileObjectImpl po ) throws SLEEException { SleeTransactionManager sleeTransactionManager = sleeContainer . getTransactionManager ( ) ; try { if ( sleeTransactionManager . getTransaction ( ) == null ) { return ; } } catch ( SystemException se ) { throw new SLEEException ( "Unable to verify SLEE Transaction." , se ) ; } String key = makeKey ( po ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Recording call to profile. Key[" + key + "]" ) ; } final TransactionContext txContext = sleeTransactionManager . getTransactionContext ( ) ; ProfileCallRecorderTransactionData data = ( ProfileCallRecorderTransactionData ) txContext . getData ( ) . get ( TRANSACTION_CONTEXT_KEY ) ; // If data does not exist, create it
 if ( data == null ) { data = new ProfileCallRecorderTransactionData ( ) ; txContext . getData ( ) . put ( TRANSACTION_CONTEXT_KEY , data ) ; } if ( ! po . isProfileReentrant ( ) ) { // we need to check
 if ( data . invokedProfiles . contains ( key ) && data . invokedProfiles . getLast ( ) . compareTo ( key ) != 0 ) { throw new SLEEException ( "Detected loopback call. Call sequence: " + data . invokedProfiles ) ; } data . invokedProfiles . add ( key ) ; data . invokedProfileTablesNames . add ( po . getProfileTable ( ) . getProfileTableName ( ) ) ; } }


Input: Retrieves a profile object for the table and specified profile name there is only one profile object per profile entity per transaction [CODESPLIT] public ProfileObjectImpl getProfile ( String profileName ) throws TransactionRequiredLocalException , SLEEException { Map txData = getTxData ( ) ; ProfileTransactionID key = new ProfileTransactionID ( profileName , profileTable . getProfileTableName ( ) ) ; ProfileObjectImpl value = ( ProfileObjectImpl ) txData . get ( key ) ; if ( value == null ) { ProfileObjectPool pool = profileTable . getProfileManagement ( ) . getObjectPoolManagement ( ) . getObjectPool ( profileTable . getProfileTableName ( ) ) ; value = pool . borrowObject ( ) ; passivateProfileObjectOnTxEnd ( profileTable . getSleeContainer ( ) . getTransactionManager ( ) , value , pool ) ; try { value . profileActivate ( profileName ) ; } catch ( UnrecognizedProfileNameException e ) { value . invalidateObject ( ) ; pool . invalidateObject ( value ) ; return null ; } txData . put ( key , value ) ; } return value ; }


Input: Adds transactional actions to the active transaction to passivate a profile object . [CODESPLIT] public static void passivateProfileObjectOnTxEnd ( SleeTransactionManager txManager , final ProfileObjectImpl profileObject , final ProfileObjectPool pool ) { TransactionalAction afterRollbackAction = new TransactionalAction ( ) { public void execute ( ) { profileObject . invalidateObject ( ) ; pool . returnObject ( profileObject ) ; } } ; TransactionalAction beforeCommitAction = new TransactionalAction ( ) { public void execute ( ) { if ( profileObject . getState ( ) == ProfileObjectState . READY ) { if ( ! profileObject . getProfileEntity ( ) . isRemove ( ) ) { profileObject . fireAddOrUpdatedEventIfNeeded ( ) ; profileObject . profilePassivate ( ) ; } else { profileObject . profileRemove ( true , false ) ; } pool . returnObject ( profileObject ) ; } } } ; final TransactionContext txContext = txManager . getTransactionContext ( ) ; txContext . getAfterRollbackActions ( ) . add ( afterRollbackAction ) ; txContext . getBeforeCommitActions ( ) . add ( beforeCommitAction ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] public boolean validate ( ) { boolean passed = true ; try { if ( ! validateDescriptor ( ) ) { // this is quick fail
 passed = false ; return passed ; } // we cant validate some parts on fail here
 if ( ! validateCMPInterface ( ) ) { passed = false ; } else { if ( ! validateProfileTableInterface ( ) ) { passed = false ; } } if ( ! validateProfileLocalInterface ( ) ) { passed = false ; } if ( ! validateProfileManagementInterface ( ) ) { passed = false ; } if ( ! validateAbstractClass ( ) ) { passed = false ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } return passed ; }


Input:
Should not be called when CMP interface validation fails cause it depends on result of it [CODESPLIT] boolean validateProfileManagementInterface ( ) { // this is optional
 boolean passed = true ; String errorBuffer = new String ( "" ) ; if ( this . component . getProfileManagementInterfaceClass ( ) == null ) { // it can hapen when its not present
 return passed ; } try { Class profileManagementInterfaceClass = this . component . getProfileManagementInterfaceClass ( ) ; if ( ! profileManagementInterfaceClass . isInterface ( ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface is not an interface class!!!" , "10.10" , errorBuffer ) ; return passed ; } if ( this . component . isSlee11 ( ) && profileManagementInterfaceClass . getPackage ( ) == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface must be declared within named package." , "10.10" , errorBuffer ) ; } if ( ! Modifier . isPublic ( profileManagementInterfaceClass . getModifiers ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface must be declaredas public." , "10.10" , errorBuffer ) ; } // now here comes the fun. methods are subject to restrictions form
 // 10.17 and 10.18, BUT interface may implement or just define CMPs
 // that MUST reasemlbe CMPs definition from CMP interface - that is
 // all getter/setter methods defined
 Set < String > ignore = new HashSet < String > ( ) ; ignore . add ( "java.lang.Object" ) ; Map < String , Method > cmpInterfaceMethods = ClassUtils . getAllInterfacesMethods ( this . component . getProfileCmpInterfaceClass ( ) , ignore ) ; Map < String , Method > managementInterfaceMethods = ClassUtils . getAllInterfacesMethods ( profileManagementInterfaceClass , ignore ) ; // we cant simply remove all methods from
 // managementInterfaceMethods.removeAll(cmpInterfaceMethods) since
 // with abstract classes it becomes comp;licated
 // we can have doubling definition with for instance return type or
 // throws clause (as diff) which until concrete class wont be
 // noticed - and is an error....
 // FIXME: does mgmt interface have to define both CMP accessors?
 Iterator < Entry < String , Method > > entryIterator = managementInterfaceMethods . entrySet ( ) . iterator ( ) ; while ( entryIterator . hasNext ( ) ) { Entry < String , Method > entry = entryIterator . next ( ) ; String key = entry . getKey ( ) ; if ( cmpInterfaceMethods . containsKey ( key ) ) { // FIXME: possibly we shoudl iterate over names?
 if ( ! compareMethod ( entry . getValue ( ) , cmpInterfaceMethods . get ( key ) ) ) { // return type or throws clause, or modifiers differ
 passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface declares method which has signature simlar to CMP method, but it has different throws clause, return type or modifiers, which is wrong." , "10.10" , errorBuffer ) ; } } else { // we can have setter/getter like as stand alone ?
 if ( _FORBIDEN_METHODS . contains ( key ) ) { // this is forrbiden, section 10.18
 passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface declares method from forbiden list, method: " + entry . getKey ( ) , "10.18" , errorBuffer ) ; continue ; } // is this the right place? This tells validator
 // wheather it should require profile abstract class in
 // case of 1.1
 requiredProfileAbstractClass = true ; // we know that name is ok.
 // FIXME: SPECS Are weird - Management methods may not
 // have the same name and arguments as a Profile CMP
 // field get or set accessor method. <---- ITS CMP
 // METHOD< SIGNATURE IS NAME AND
 // PARAMETERS and its implemented if its doubled from
 // CMP or this interface extends CMP
 // interface.....!!!!!!!!!!!!!!!!!!
 if ( key . startsWith ( "ejb" ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface declares method with wrong prefix, method: " + entry . getKey ( ) , "10.18" , errorBuffer ) ; continue ; } // there are no reqs other than parameters?
 Class [ ] params = entry . getValue ( ) . getParameterTypes ( ) ; for ( int index = 0 ; index < params . length ; index ++ ) { if ( _ALLOWED_MANAGEMENT_TYPES . contains ( params [ index ] . toString ( ) ) || ClassUtils . checkInterfaces ( params [ index ] , "java.io.Serializable" ) != null ) { } else { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management interface declares management method with wrong parameter at index[" + index + "], method: " + entry . getKey ( ) , "10.18" , errorBuffer ) ; } } } } } finally { if ( ! passed ) { if ( logger . isEnabledFor ( Level . ERROR ) ) logger . error ( errorBuffer ) ; //System.err.println(errorBuffer);
 } } return passed ; }


Input:
shoudl not be run if other interfaces vaildation fails . [CODESPLIT] boolean validateAbstractClass ( ) { boolean passed = true ; String errorBuffer = new String ( "" ) ; try { if ( this . component . getDescriptor ( ) . getProfileAbstractClass ( ) == null ) { if ( this . requiredProfileAbstractClass ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management abstract class must be present" , "3.X" , errorBuffer ) ; return passed ; } } else { if ( this . component . getProfileAbstractClass ( ) == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile management abstract class has not been loaded" , "3.X" , errorBuffer ) ; return passed ; } } Class profileAbstractClass = this . component . getProfileAbstractClass ( ) ; // FIXME: Alexandre: Added this, was making some tests fail. Review!
 if ( profileAbstractClass == null ) { return passed ; } // if (profileAbstractClass.isInterface()
 // || profileAbstractClass.isEnum()) {
 // passed = false;
 // errorBuffer = appendToBuffer(
 // "Profile specification profile abstract class in not a clas.",
 // "10.11", errorBuffer);
 // return passed;
 // }
 if ( this . component . isSlee11 ( ) ) { if ( profileAbstractClass . getPackage ( ) == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must be defined in package." , "10.11" , errorBuffer ) ; } // FIXME: what about 1.0 ?
 // public, no arg constructor without throws clause
 Constructor c = null ; try { c = profileAbstractClass . getConstructor ( null ) ; } catch ( Exception e ) { // TODO Auto-generated catch block
 // e.printStackTrace();
 } if ( c == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must define public no arg constructor." , "10.11" , errorBuffer ) ; } else { if ( ! Modifier . isPublic ( c . getModifiers ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must define public no arg constructor." , "10.11" , errorBuffer ) ; } if ( c . getExceptionTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must define public no arg constructor without throws clause." , "10.11" , errorBuffer ) ; } } } int modifiers = profileAbstractClass . getModifiers ( ) ; if ( ! Modifier . isAbstract ( modifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must be defined abstract." , "10.11" , errorBuffer ) ; } if ( ! Modifier . isPublic ( modifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must be defined public." , "10.11" , errorBuffer ) ; } // in case of 1.0 it has to implement as concrete methods from
 // javax.slee.profile.ProfileManagement - section 10.8 of 1.0 specs
 Map < String , Method > requiredLifeCycleMethods = null ; Set < String > ignore = new HashSet < String > ( ) ; ignore . add ( "java.lang.Object" ) ; if ( this . component . isSlee11 ( ) ) { Class javaxSleeProfileProfileClass = ClassUtils . checkInterfaces ( profileAbstractClass , "javax.slee.profile.Profile" ) ; if ( javaxSleeProfileProfileClass == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement javax.slee.profile.Profile." , "10.11" , errorBuffer ) ; requiredLifeCycleMethods = ClassUtils . getAllInterfacesMethods ( javax . slee . profile . ProfileLocalObject . class , ignore ) ; } else { requiredLifeCycleMethods = ClassUtils . getAllInterfacesMethods ( javaxSleeProfileProfileClass , ignore ) ; } } else { Class javaxSleeProfileProfileManagement = ClassUtils . checkInterfaces ( profileAbstractClass , "javax.slee.profile.ProfileManagement" ) ; if ( javaxSleeProfileProfileManagement == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement javax.slee.profile.ProfileManagement." , "10.8" , errorBuffer ) ; requiredLifeCycleMethods = ClassUtils . getAllInterfacesMethods ( javax . slee . profile . ProfileManagement . class , ignore ) ; } else { requiredLifeCycleMethods = ClassUtils . getAllInterfacesMethods ( javaxSleeProfileProfileManagement , ignore ) ; } } Map < String , Method > abstractMethods = ClassUtils . getAbstractMethodsFromClass ( profileAbstractClass ) ; Map < String , Method > abstractMethodsFromSuperClasses = ClassUtils . getAbstractMethodsFromSuperClasses ( profileAbstractClass ) ; Map < String , Method > concreteMethods = ClassUtils . getConcreteMethodsFromClass ( profileAbstractClass ) ; Map < String , Method > concreteMethodsFromSuperClasses = ClassUtils . getConcreteMethodsFromSuperClasses ( profileAbstractClass ) ; // FIXME: Alexandre: Verify if this is correct
 // The isProfileDirty, markProfileDirty and  isProfileValid methods must not be
 // implemented as they are implemented by the SLEE. These three methods are implemented by the
 // SLEE at deployment time.
 Set < String > toBeImplementedBySlee = new HashSet < String > ( ) ; toBeImplementedBySlee . add ( "isProfileDirty" ) ; toBeImplementedBySlee . add ( "markProfileDirty" ) ; toBeImplementedBySlee . add ( "isProfileValid" ) ; for ( Entry < String , Method > entry : requiredLifeCycleMethods . entrySet ( ) ) { Method m = entry . getValue ( ) ; //
 Method methodFromClass = ClassUtils . getMethodFromMap ( m . getName ( ) , m . getParameterTypes ( ) , concreteMethods , concreteMethodsFromSuperClasses ) ; if ( methodFromClass == null ) { if ( this . component . isSlee11 ( ) || ( ! this . component . isSlee11 ( ) && ! toBeImplementedBySlee . contains ( m . getName ( ) ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement certain lifecycle methods. Method not found in concrete(non private) methods: " + m . getName ( ) , "10.11" , errorBuffer ) ; } continue ; } if ( methodFromClass != null && toBeImplementedBySlee . contains ( m . getName ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "[JAIN SLEE 1.0] The " + m . getName ( ) + " method must not be implemented as they are implemented by the SLEE." , "10.11" , errorBuffer ) ; continue ; } // it concrete - must check return type
 if ( ! m . getReturnType ( ) . getName ( ) . equals ( methodFromClass . getReturnType ( ) . getName ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement certain lifecycle methods. Method with name: " + m . getName ( ) + " found in concrete(non private) methods has different return type: " + methodFromClass . getReturnType ( ) + ", than one declared in interface: " + m . getReturnType ( ) , "10.11" , errorBuffer ) ; } if ( ! Arrays . equals ( m . getExceptionTypes ( ) , methodFromClass . getExceptionTypes ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement certain lifecycle methods. Method with name: " + m . getName ( ) + " found in concrete(non private) methods has different throws clause than one found in class." , "10.11" , errorBuffer ) ; } // must be public, not abstract, not final, not static
 modifiers = methodFromClass . getModifiers ( ) ; if ( ! Modifier . isPublic ( modifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement certain lifecycle methods. Method with name: " + m . getName ( ) + " found in concrete(non private) methods must be public." , "10.11" , errorBuffer ) ; } if ( Modifier . isStatic ( modifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement certain lifecycle methods. Method with name: " + m . getName ( ) + " found in concrete(non private) methods must not be static." , "10.11" , errorBuffer ) ; } if ( Modifier . isFinal ( modifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement certain lifecycle methods. Method with name: " + m . getName ( ) + " found in concrete(non private) methods must not be final." , "10.11" , errorBuffer ) ; } // FIXME: native?
 } // in 1.1 and 1.0 it must implement CMP interfaces, but methods
 // defined there MUST stay abstract
 Class profileCMPInterface = ClassUtils . checkInterfaces ( profileAbstractClass , this . component . getProfileCmpInterfaceClass ( ) . getName ( ) ) ; if ( profileCMPInterface == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement profile CMP interface." , "10.11" , errorBuffer ) ; return passed ; } // abstract class implements CMP Interface, but leaves all methods
 // as abstract
 Map < String , Method > cmpInterfaceMethods = ClassUtils . getAllInterfacesMethods ( profileCMPInterface , ignore ) ; if ( profileCMPInterface == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement defined profile CMP interface." , "10.11" , errorBuffer ) ; } else { for ( Entry < String , Method > entry : cmpInterfaceMethods . entrySet ( ) ) { Method m = entry . getValue ( ) ; //
 Method methodFromClass = ClassUtils . getMethodFromMap ( m . getName ( ) , m . getParameterTypes ( ) , concreteMethods , concreteMethodsFromSuperClasses ) ; if ( methodFromClass != null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must leave CMP interface methods as abstract, it can not be concrete: " + m . getName ( ) , "10.11" , errorBuffer ) ; continue ; } methodFromClass = ClassUtils . getMethodFromMap ( m . getName ( ) , m . getParameterTypes ( ) , abstractMethods , abstractMethodsFromSuperClasses ) ; // it concrete - must check return type
 if ( m . getReturnType ( ) . getName ( ) . compareTo ( methodFromClass . getReturnType ( ) . getName ( ) ) != 0 ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must not decalre methods from CMP interface with different return type. Method with name: " + m . getName ( ) + " found in (non private) class methods has different return type: " + methodFromClass . getReturnType ( ) + ", than one declared in interface: " + m . getReturnType ( ) , "10.11" , errorBuffer ) ; } if ( ! Arrays . equals ( m . getExceptionTypes ( ) , methodFromClass . getExceptionTypes ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must not change throws clause. Method with name: " + m . getName ( ) + " found in (non private) class methods has different throws clause than one found in class." , "10.11" , errorBuffer ) ; } // FIXME: should we do that?
 abstractMethods . remove ( entry . getKey ( ) ) ; abstractMethodsFromSuperClasses . remove ( entry . getKey ( ) ) ; } } // those checks are......
 // 1.0 and 1.1 if we define management interface we have to
 // implement it, and all methods that are not CMPs
 if ( this . component . getDescriptor ( ) . getProfileManagementInterface ( ) != null ) { Class profileManagementInterfaceClass = this . component . getProfileManagementInterfaceClass ( ) ; // if abstract class and management interface are both defined than abstract class must implement the management interface
 if ( this . component . getProfileAbstractClass ( ) != null && ! profileManagementInterfaceClass . isAssignableFrom ( this . component . getProfileAbstractClass ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile abstract class must implement profile management interface if both are specified" , "10.11" , errorBuffer ) ; } Map < String , Method > profileManagementInterfaceMethods = ClassUtils . getAllInterfacesMethods ( profileManagementInterfaceClass , ignore ) ; // methods except those defined in CMP interface must be
 // concrete
 for ( Entry < String , Method > entry : profileManagementInterfaceMethods . entrySet ( ) ) { Method m = entry . getValue ( ) ; // CMP methods must stay abstract
 // check if this method is the same as in CMP interface is
 // done elsewhere
 // that check shoudl be ok to run this one!!! XXX
 if ( cmpInterfaceMethods . containsKey ( entry . getKey ( ) ) ) { // we do nothing, cmp interface is validate above
 } else { // 10.8/10.11
 Method concreteMethodFromAbstractClass = ClassUtils . getMethodFromMap ( m . getName ( ) , m . getParameterTypes ( ) , concreteMethods , concreteMethodsFromSuperClasses ) ; if ( concreteMethodFromAbstractClass == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement as non private methods from profile management interface other than CMP methods" , "10.11" , errorBuffer ) ; continue ; } int concreteMethodModifiers = concreteMethodFromAbstractClass . getModifiers ( ) ; // public, and cannot be static,abstract, or final.
 if ( ! Modifier . isPublic ( concreteMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement methods from profile management interface as public, offending method: " + concreteMethodFromAbstractClass . getName ( ) , "10.11" , errorBuffer ) ; } if ( Modifier . isStatic ( concreteMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement methods from profile management interface as not static, offending method: " + concreteMethodFromAbstractClass . getName ( ) , "10.11" , errorBuffer ) ; } if ( Modifier . isFinal ( concreteMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement methods from profile management interface as not final, offending method: " + concreteMethodFromAbstractClass . getName ( ) , "10.11" , errorBuffer ) ; } } } } if ( this . component . isSlee11 ( ) ) { // ProfileLocalObject and UsageInterface are domains of 1.1
 // uff, ProfileLocal again that stupid check cross two
 // interfaces and one abstract class.....
 if ( this . component . getDescriptor ( ) . getProfileLocalInterface ( ) != null ) { // abstract class MUST NOT implement it
 if ( ClassUtils . checkInterfaces ( profileAbstractClass , this . component . getDescriptor ( ) . getProfileLocalInterface ( ) . getProfileLocalInterfaceName ( ) ) != null || ClassUtils . checkInterfaces ( profileAbstractClass , "javax.slee.profile.ProfileLocalObject" ) != null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must not implement profile local interface in any way(only methods must be implemented)" , "10.11" , errorBuffer ) ; } Class profileLocalObjectClass = this . component . getProfileLocalInterfaceClass ( ) ; ignore . add ( "javax.slee.profile.ProfileLocalObject" ) ; Map < String , Method > profileLocalObjectInterfaceMethods = ClassUtils . getAllInterfacesMethods ( profileLocalObjectClass , ignore ) ; ignore . remove ( "javax.slee.profile.ProfileLocalObject" ) ; // methods except those defined in CMP interface must be
 // concrete
 for ( Entry < String , Method > entry : profileLocalObjectInterfaceMethods . entrySet ( ) ) { Method m = entry . getValue ( ) ; // CMP methods must stay abstract
 // check if this method is the same as in CMP interface
 // is done elsewhere
 // that check shoudl be ok to run this one!!! XXX
 if ( cmpInterfaceMethods . containsKey ( entry . getKey ( ) ) ) { // we do nothing, cmp interface is validate above
 } else { // 10.8/10.11
 Method concreteMethodFromAbstractClass = ClassUtils . getMethodFromMap ( m . getName ( ) , m . getParameterTypes ( ) , concreteMethods , concreteMethodsFromSuperClasses ) ; if ( concreteMethodFromAbstractClass == null ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement as non private methods from profile local interface other than CMP methods" , "10.11" , errorBuffer ) ; continue ; } int concreteMethodModifiers = concreteMethodFromAbstractClass . getModifiers ( ) ; // public, and cannot be static,abstract, or final.
 if ( ! Modifier . isPublic ( concreteMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement methods from profile local interface as public, offending method: " + concreteMethodFromAbstractClass . getName ( ) , "10.11" , errorBuffer ) ; } if ( Modifier . isStatic ( concreteMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement methods from profile local interface as not static, offending method: " + concreteMethodFromAbstractClass . getName ( ) , "10.11" , errorBuffer ) ; } if ( Modifier . isFinal ( concreteMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification profile abstract class must implement methods from profile management interface as not final, offending method: " + concreteMethodFromAbstractClass . getName ( ) , "10.11" , errorBuffer ) ; } } } } // usage parameters
 if ( this . component . getDescriptor ( ) . getProfileUsageParameterInterface ( ) != null ) { if ( ! validateProfileUsageInterface ( abstractMethods , abstractMethodsFromSuperClasses ) ) { passed = false ; } } } // FIXME: add check on abstract methods same as in SBB ?
 } finally { if ( ! passed ) { if ( logger . isEnabledFor ( Level . ERROR ) ) logger . error ( errorBuffer ) ; //System.err.println(errorBuffer);
 } } return passed ; }


Input:
Validated descriptor against some basic constraints : all references are correct some fields are declaredproperly no double definitions if proper elements are present - for instance some elements exclude others . [CODESPLIT] boolean validateDescriptor ( ) { boolean passed = true ; String errorBuffer = new String ( "" ) ; if ( ! this . component . isSlee11 ( ) ) { return passed ; // there is not much we can do for those oldies.
 } try { HashSet < String > collatorAlliases = new HashSet < String > ( ) ; ProfileSpecificationDescriptorImpl desc = this . component . getDescriptor ( ) ; for ( CollatorDescriptor mc : desc . getCollators ( ) ) { if ( collatorAlliases . contains ( mc . getCollatorAlias ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares collator alias twice: " + mc . getCollatorAlias ( ) , "3.3.7" , errorBuffer ) ; } else { collatorAlliases . add ( mc . getCollatorAlias ( ) ) ; } } // double deifnition of refs is allowed.
 Map < String , ProfileCMPFieldDescriptor > cmpName2Field = new HashMap < String , ProfileCMPFieldDescriptor > ( ) ; for ( ProfileCMPFieldDescriptor c : desc . getProfileCMPInterface ( ) . getCmpFields ( ) ) { if ( ! Character . isLowerCase ( c . getCmpFieldName ( ) . charAt ( 0 ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares wrong cmp field name, first char is not lower case, field: " + c . getCmpFieldName ( ) , "3.3.7" , errorBuffer ) ; } if ( cmpName2Field . containsKey ( c . getCmpFieldName ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares cmp field twice: " + c . getCmpFieldName ( ) , "3.3.7" , errorBuffer ) ; } else { cmpName2Field . put ( c . getCmpFieldName ( ) , c ) ; } if ( c . getUniqueCollatorRef ( ) != null && ! collatorAlliases . contains ( c . getUniqueCollatorRef ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares cmp field: " + c . getCmpFieldName ( ) + ", with wrong collator reference: " + c . getUniqueCollatorRef ( ) , "3.3.7" , errorBuffer ) ; } for ( IndexHintDescriptor indexHint : c . getIndexHints ( ) ) { if ( indexHint . getCollatorRef ( ) != null && ! collatorAlliases . contains ( indexHint . getCollatorRef ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares cmp field: " + c . getCmpFieldName ( ) + ", with index hint declaring wrong collator reference: " + c . getUniqueCollatorRef ( ) , "3.3.7" , errorBuffer ) ; } } } Set < String > queriesNames = new HashSet < String > ( ) ; for ( QueryDescriptor mq : desc . getQueryElements ( ) ) { if ( queriesNames . contains ( mq . getName ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares queries with the same name: " + mq . getName ( ) , "3.3.7" , errorBuffer ) ; } else { // FIXME: all declaredparameters have to be used in
 // expressions?
 HashSet < String > decalredParameters = new HashSet < String > ( ) ; HashSet < String > usedParameters = new HashSet < String > ( ) ; for ( QueryParameterDescriptor mqp : mq . getQueryParameters ( ) ) { if ( decalredParameters . contains ( mqp . getName ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( "Profile specification declares query parameter twice, parameter name: " + mqp . getName ( ) + ", in query: " + mq . getName ( ) , "3.3.7" , errorBuffer ) ; } else { decalredParameters . add ( mqp . getName ( ) ) ; } } if ( ! validateExpression ( mq . getName ( ) , mq . getQueryExpression ( ) , usedParameters , cmpName2Field . keySet ( ) , collatorAlliases ) ) { passed = false ; } if ( ! usedParameters . containsAll ( decalredParameters ) && ! decalredParameters . containsAll ( usedParameters ) ) { passed = false ; decalredParameters . retainAll ( usedParameters ) ; errorBuffer = appendToBuffer ( "Profile specification declares query parameter that are not used, in query: " + mq . getName ( ) + ", not used parameters: " + Arrays . toString ( decalredParameters . toArray ( ) ) , "3.3.7" , errorBuffer ) ; } } } // FIXME: this should be here or not?
 if ( ! validateEnvEntries ( ) ) { passed = false ; } } finally { if ( ! passed ) { if ( logger . isEnabledFor ( Level . ERROR ) ) logger . error ( errorBuffer ) ; //System.err.println(errorBuffer);
 } } return passed ; }