Input: / * ( non - Javadoc ) [CODESPLIT] public long getRoutingTime ( EventTypeID eventTypeID ) { long result = 0L ; for ( int i = 0 ; i < getExecutors ( ) . length ; i ++ ) { result += getRoutingTime ( i , eventTypeID ) ; } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] @ Override public int getWorkingQueueSize ( int executor ) { final EventRouterExecutorStatistics executorStats = getExecutors ( ) [ executor ] . getStatistics ( ) ; return executorStats == null ? 0 : executorStats . getWorkingQueueSize ( ) ; }


Input: Indicates if notifications are enabled for the specified parameter name [CODESPLIT] public boolean getNotificationsEnabled ( String paramName ) { Boolean areNotificationsEnabled = paramNames . get ( paramName ) ; if ( ! isSlee11 ) { if ( areNotificationsEnabled == null || areNotificationsEnabled . booleanValue ( ) ) { // considering that notifications are enabled, by default, for each // param return true ; } else { return false ; } } else { if ( areNotificationsEnabled != null && areNotificationsEnabled . booleanValue ( ) ) { // considering that notifications are enabled, by default, for each // param return true ; } else { return false ; } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ServiceState getState ( ServiceID serviceID ) throws NullPointerException , UnrecognizedServiceException , ManagementException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Service.getState " + serviceID ) ; } if ( serviceID == null ) throw new NullPointerException ( "Null service ID!" ) ; final ServiceComponent serviceComponent = componentRepositoryImpl . getComponentByID ( serviceID ) ; if ( serviceComponent == null ) throw new UnrecognizedServiceException ( serviceID . toString ( ) ) ; return serviceComponent . getServiceState ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public ServiceID [ ] getServices ( ServiceState serviceState ) throws NullPointerException , ManagementException { if ( serviceState == null ) throw new NullPointerException ( "Passed a null state" ) ; try { ArrayList < ServiceID > retval = new ArrayList < ServiceID > ( ) ; for ( ServiceID serviceID : componentRepositoryImpl . getServiceIDs ( ) ) { ServiceComponent service = componentRepositoryImpl . getComponentByID ( serviceID ) ; if ( service == null ) { throw new UnrecognizedServiceException ( serviceID . toString ( ) ) ; } if ( service . getServiceState ( ) . equals ( serviceState ) ) { retval . add ( serviceID ) ; } } return retval . toArray ( new ServiceID [ retval . size ( ) ] ) ; } catch ( Exception e ) { throw new ManagementException ( "Error getting services by state!" , e ) ; } }


Input: Retrieves the set of ra entity link names referenced by the service componen which do not exist [CODESPLIT] public Set < String > getReferencedRAEntityLinksWhichNotExists ( ServiceComponent serviceComponent ) { Set < String > result = new HashSet < String > ( ) ; Set < String > raLinkNames = sleeContainer . getResourceManagement ( ) . getLinkNamesSet ( ) ; for ( String raLink : serviceComponent . getResourceAdaptorEntityLinks ( componentRepositoryImpl ) ) { if ( ! raLinkNames . contains ( raLink ) ) { result . add ( raLink ) ; } } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void activate ( ServiceID serviceID ) throws NullPointerException , UnrecognizedServiceException , InvalidStateException , InvalidLinkNameBindingStateException { activate ( serviceID , null ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void activate ( ServiceID [ ] serviceIDs ) throws NullPointerException , InvalidArgumentException , UnrecognizedServiceException , InvalidStateException , ManagementException { if ( serviceIDs . length == 0 ) { throw new InvalidArgumentException ( "InvalidArgumentException" ) ; } for ( int i = 0 ; i < serviceIDs . length ; i ++ ) { if ( serviceIDs [ i ] == null ) { throw new InvalidArgumentException ( "InvalidArgumentException" ) ; } } for ( int i = 0 ; i < serviceIDs . length - 1 ; i ++ ) for ( int j = i + 1 ; j < serviceIDs . length ; j ++ ) if ( serviceIDs [ i ] == ( serviceIDs [ j ] ) ) { throw new InvalidArgumentException ( "InvalidArgumentException" ) ; } for ( int i = 0 ; i < serviceIDs . length ; i ++ ) { activate ( serviceIDs [ i ] ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void deactivate ( final ServiceID serviceID ) throws NullPointerException , UnrecognizedServiceException , InvalidStateException , ManagementException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Deactivating " + serviceID ) ; } if ( serviceID == null ) throw new NullPointerException ( "NullPointerException" ) ; synchronized ( sleeContainer . getManagementMonitor ( ) ) { final ServiceComponent serviceComponent = componentRepositoryImpl . getComponentByID ( serviceID ) ; if ( serviceComponent == null ) throw new UnrecognizedServiceException ( "Service not found for " + serviceID ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( serviceID . toString ( ) + " state = " + serviceComponent . getServiceState ( ) ) ; final SleeState sleeState = sleeContainer . getSleeState ( ) ; if ( serviceComponent . getServiceState ( ) == ServiceState . STOPPING ) throw new InvalidStateException ( "Service is STOPPING" ) ; if ( serviceComponent . getServiceState ( ) == ServiceState . INACTIVE ) { throw new InvalidStateException ( "Service already deactivated" ) ; } serviceComponent . setServiceState ( ServiceState . STOPPING ) ; // warn ra entities about state change final ResourceManagement resourceManagement = sleeContainer . getResourceManagement ( ) ; for ( String raEntityName : resourceManagement . getResourceAdaptorEntities ( ) ) { resourceManagement . getResourceAdaptorEntity ( raEntityName ) . serviceStopping ( serviceID ) ; } // only end activity if slee was running and is single node in // cluster, otherwise not needed (cluster) or // slee already did it if ( sleeContainer . getCluster ( ) . isSingleMember ( ) && ( sleeState == SleeState . RUNNING || sleeState == SleeState . STOPPING ) ) { if ( sleeState == SleeState . RUNNING ) { endServiceActivity ( serviceID ) ; } else { // chance of concurrency with activity end synchronized ( serviceComponent ) { if ( serviceComponent . isActivityEnded ( ) ) { // activity already ended but service was not in stopping state completeServiceStop ( serviceComponent ) ; } } } } else { serviceComponent . setServiceState ( ServiceState . INACTIVE ) ; // warn ra entities about state change for ( String raEntityName : resourceManagement . getResourceAdaptorEntities ( ) ) { resourceManagement . getResourceAdaptorEntity ( raEntityName ) . serviceInactive ( serviceID ) ; } logger . info ( "Deactivated " + serviceID ) ; } // remove runtime cache related with this service for ( EventEntryDescriptor mEventEntry : serviceComponent . getRootSbbComponent ( ) . getDescriptor ( ) . getEventEntries ( ) . values ( ) ) { if ( mEventEntry . isInitialEvent ( ) ) { EventTypeComponent eventTypeComponent = componentRepositoryImpl . getComponentByID ( mEventEntry . getEventReference ( ) ) ; eventTypeComponent . deactivatedServiceWhichDefineEventAsInitial ( serviceComponent ) ; } } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void deactivate ( ServiceID [ ] arg0 ) throws NullPointerException , InvalidArgumentException , UnrecognizedServiceException , InvalidStateException , ManagementException { if ( arg0 . length == 0 ) { throw new InvalidArgumentException ( "InvalidArgumentException" ) ; } for ( int i = 0 ; i < arg0 . length ; i ++ ) { if ( arg0 [ i ] == null ) { throw new InvalidArgumentException ( "InvalidArgumentException" ) ; } } for ( int i = 0 ; i < arg0 . length - 1 ; i ++ ) for ( int j = i + 1 ; j < arg0 . length ; j ++ ) if ( arg0 [ i ] == ( arg0 [ j ] ) ) { throw new InvalidArgumentException ( "InvalidArgumentException" ) ; } try { for ( int i = 0 ; i < arg0 . length ; i ++ ) { deactivate ( arg0 [ i ] ) ; } } catch ( InvalidStateException ise ) { throw ise ; } catch ( Exception ex ) { throw new ManagementException ( "system exception starting service" , ex ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void deactivateAndActivate ( ServiceID arg0 , ServiceID arg1 ) throws NullPointerException , InvalidArgumentException , UnrecognizedServiceException , InvalidStateException , ManagementException { if ( logger . isInfoEnabled ( ) ) logger . debug ( "deactivateAndActivate (" + arg0 + " , " + arg1 ) ; if ( arg0 == arg1 ) throw new InvalidArgumentException ( "Activating and deactivating the same service!" ) ; if ( ( arg0 == null ) || ( arg1 == null ) ) throw new InvalidArgumentException ( "The service(s) are null!" ) ; try { ServiceComponent serviceToDeactivate = componentRepositoryImpl . getComponentByID ( arg0 ) ; if ( serviceToDeactivate == null ) { throw new UnrecognizedServiceException ( ) ; } else { activate ( arg1 , arg0 ) ; deactivate ( arg0 ) ; } } catch ( InvalidStateException ise ) { throw ise ; } catch ( Exception ex ) { throw new ManagementException ( "exception in deactivating/activating service ! " ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void deactivateAndActivate ( ServiceID [ ] arg0 , ServiceID [ ] arg1 ) throws NullPointerException , InvalidArgumentException , UnrecognizedServiceException , InvalidStateException , ManagementException { if ( arg0 . length == 0 || arg1 . length == 0 ) throw new InvalidArgumentException ( "The parameter array(s) must not be empty." ) ; if ( arg0 . length != arg1 . length ) throw new InvalidArgumentException ( "The parameter arrays must have same lenght." ) ; Set < ServiceID > services = new HashSet < ServiceID > ( ) ; for ( int i = 0 ; i < arg0 . length - 1 ; i ++ ) { if ( arg0 [ i ] == null || arg1 [ i ] == null ) { throw new InvalidArgumentException ( "Null entry found in parameter array(s)." ) ; } if ( ! services . add ( arg0 [ i ] ) || ! services . add ( arg1 [ i ] ) ) { throw new InvalidArgumentException ( "Repeated entry found in parameter array(s)." ) ; } } try { for ( int i = 0 ; i < arg0 . length ; i ++ ) { deactivateAndActivate ( arg0 [ i ] , arg1 [ i ] ) ; } } catch ( InvalidStateException ise ) { throw ise ; } catch ( ManagementException me ) { throw me ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ObjectName getServiceUsageMBean ( ServiceID serviceID ) throws NullPointerException , UnrecognizedServiceException , ManagementException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getServiceUsageMBean " + serviceID ) ; } final ServiceComponent serviceComponent = componentRepositoryImpl . getComponentByID ( serviceID ) ; if ( serviceComponent != null ) { return serviceComponent . getServiceUsageMBean ( ) . getObjectName ( ) ; } else { throw new UnrecognizedServiceException ( serviceID . toString ( ) ) ; } }


Input: Install a service into SLEE [CODESPLIT] public void installService ( final ServiceComponent serviceComponent ) throws Exception { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Installing Service " + serviceComponent ) ; } // creates and registers the service usage mbean final ServiceUsageMBean serviceUsageMBean = sleeContainer . getUsageParametersManagement ( ) . newServiceUsageMBean ( serviceComponent ) ; // add rollback action to remove state created TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { try { serviceUsageMBean . remove ( ) ; } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } ; final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; txContext . getAfterRollbackActions ( ) . add ( action ) ; // register notification sources for all sbbs // final TraceManagement traceMBeanImpl = sleeContainer . getTraceManagement ( ) ; for ( final SbbID sbbID : serviceComponent . getSbbIDs ( componentRepositoryImpl ) ) { // Tracer must be available for both 1.1 and 1.0 sbb components // SbbComponent sbbComponent = // componentRepositoryImpl.getComponentByID(sbbID); // if(sbbComponent.isSlee11()) { traceMBeanImpl . registerNotificationSource ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; // add rollback action to remove state created action = new TransactionalAction ( ) { public void execute ( ) { // remove notification sources for all sbbs traceMBeanImpl . deregisterNotificationSource ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; } } ; txContext . getAfterRollbackActions ( ) . add ( action ) ; } // this might be used not only by 1.1 sbbs... NotificationSourceWrapperImpl sbbMNotificationSource = new NotificationSourceWrapperImpl ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; serviceComponent . getAlarmNotificationSources ( ) . putIfAbsent ( sbbID , sbbMNotificationSource ) ; } sleeContainer . getSbbManagement ( ) . serviceInstall ( serviceComponent ) ; }


Input: uninstall a service . [CODESPLIT] public void uninstallService ( final ServiceComponent serviceComponent ) throws SystemException , UnrecognizedServiceException , InstanceNotFoundException , MBeanRegistrationException , NullPointerException , UnrecognizedResourceAdaptorEntityException , ManagementException , InvalidStateException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Uninstalling service with id " + serviceComponent . getServiceID ( ) ) ; } if ( serviceComponent . getServiceState ( ) . isStopping ( ) ) { // let's be friendly and give it a few secs for ( int i = 0 ; i < 15 ; i ++ ) { try { Thread . sleep ( 1000 ) ; logger . info ( "Waiting for " + serviceComponent . getServiceID ( ) + " to stop, current state is " + serviceComponent . getServiceState ( ) ) ; if ( serviceComponent . getServiceState ( ) . isInactive ( ) ) { break ; } } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } if ( ! serviceComponent . getServiceState ( ) . isInactive ( ) ) { throw new InvalidStateException ( serviceComponent . toString ( ) + " is not inactive" ) ; } final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Closing Usage MBean of service " + serviceComponent . getServiceID ( ) ) ; } ServiceUsageMBean serviceUsageMBean = serviceComponent . getServiceUsageMBean ( ) ; if ( serviceUsageMBean != null ) { serviceUsageMBean . remove ( ) ; // add rollback action to re-create the mbean // FIXME this doesn't make sense, this restore looses all old data, // it shoudl only remove on // commit but as it is right now, the needed sbb components are // already removed TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { try { sleeContainer . getUsageParametersManagement ( ) . newServiceUsageMBean ( serviceComponent ) ; } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } ; txContext . getAfterRollbackActions ( ) . add ( action ) ; } // register notification sources for all sbbs final TraceManagement traceMBeanImpl = sleeContainer . getTraceManagement ( ) ; for ( final SbbID sbbID : serviceComponent . getSbbIDs ( componentRepositoryImpl ) ) { // Tracer must be available for both 1.1 and 1.0 sbb components // SbbComponent sbbComponent = // componentRepositoryImpl.getComponentByID(sbbID); // if(sbbComponent.isSlee11()) { traceMBeanImpl . deregisterNotificationSource ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; // add rollback action to re-add state removed TransactionalAction action = new TransactionalAction ( ) { public void execute ( ) { // remove notification sources for all sbbs traceMBeanImpl . registerNotificationSource ( new SbbNotification ( serviceComponent . getServiceID ( ) , sbbID ) ) ; } } ; txContext . getAfterRollbackActions ( ) . add ( action ) ; } } // warn sbb management that the service is being uninstalled, giving it // the option to clear any related resources sleeContainer . getSbbManagement ( ) . serviceUninstall ( serviceComponent ) ; }


Input: Verifies if the specified ra entity link name is referenced by a non inactive service . [CODESPLIT] public boolean isRAEntityLinkNameReferenced ( String raLinkName ) { if ( raLinkName == null ) { throw new NullPointerException ( "null ra link name" ) ; } boolean b = false ; try { b = transactionManager . requireTransaction ( ) ; for ( ServiceID serviceID : componentRepositoryImpl . getServiceIDs ( ) ) { ServiceComponent serviceComponent = componentRepositoryImpl . getComponentByID ( serviceID ) ; if ( serviceComponent . getServiceState ( ) != ServiceState . INACTIVE && serviceComponent . getResourceAdaptorEntityLinks ( componentRepositoryImpl ) . contains ( raLinkName ) ) { return true ; } } return false ; } finally { try { transactionManager . requireTransactionEnd ( b , false ) ; } catch ( Throwable ex ) { throw new SLEEException ( ex . getMessage ( ) , ex ) ; } } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void activityEnded ( final ServiceActivityHandle activityHandle ) { // do this only on tx commit and in a new thread, to escape the tx context final Runnable r = new Runnable ( ) { public void run ( ) { final ServiceID serviceID = activityHandle . getServiceID ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Activity end for " + serviceID ) ; } // remove and cancel the timer task to force activity ending ScheduledFuture < ? > scheduledFuture = activityEndingTasks . remove ( serviceID ) ; if ( scheduledFuture != null ) { scheduledFuture . cancel ( true ) ; } // get stopping service final ServiceComponent serviceComponent = componentRepositoryImpl . getComponentByID ( serviceID ) ; if ( serviceComponent != null ) { synchronized ( serviceComponent ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Service is in " + serviceComponent . getServiceState ( ) + " state." ) ; } if ( serviceComponent . getServiceState ( ) . isStopping ( ) ) { completeServiceStop ( serviceComponent ) ; } serviceComponent . setActivityEnded ( true ) ; } } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( serviceID . toString ( ) + " activity ended, but component not found, removed concurrently?" ) ; } } } } ; final ExecutorService executorService = Executors . newSingleThreadExecutor ( SLEE_THREAD_FACTORY ) ; TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; if ( txContext != null ) { TransactionalAction txAction = new TransactionalAction ( ) { public void execute ( ) { try { executorService . execute ( r ) ; } catch ( Exception e ) { logger . error ( "failed to execute task to complete service deactivation" , e ) ; } executorService . shutdown ( ) ; } } ; txContext . getAfterCommitActions ( ) . add ( txAction ) ; } else { try { executorService . execute ( r ) ; } catch ( Exception e ) { logger . error ( "failed to execute task to complete service deactivation" , e ) ; } executorService . shutdown ( ) ; } }


Input: Adds the time for an event routing with a specific { @link EventTypeID } . [CODESPLIT] public void eventRouted ( EventTypeID eventTypeID , long routingTime ) { EventTypeRoutingStatisticsImpl eventTypeRoutingStatistics = eventTypeRoutingStatisticsMap . get ( eventTypeID ) ; if ( eventTypeRoutingStatistics == null ) { synchronized ( eventTypeRoutingStatisticsMap ) { eventTypeRoutingStatistics = new EventTypeRoutingStatisticsImpl ( eventTypeID ) ; eventTypeRoutingStatisticsMap . put ( eventTypeID , eventTypeRoutingStatistics ) ; } } eventTypeRoutingStatistics . eventRouted ( routingTime ) ; taskExecuted ( routingTime ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getAverageEventRoutingTime ( ) { long time = 0L ; long events = 0L ; for ( EventTypeRoutingStatistics eventTypeRoutingStatistics : eventTypeRoutingStatisticsMap . values ( ) ) { time += eventTypeRoutingStatistics . getRoutingTime ( ) ; events += eventTypeRoutingStatistics . getEventsRouted ( ) ; } return time == 0L ? 0L : time / events ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getAverageEventRoutingTime ( EventTypeID eventTypeID ) { final EventTypeRoutingStatistics eventTypeRoutingStatistics = getEventTypeRoutingStatistics ( eventTypeID ) ; return eventTypeRoutingStatistics == null ? 0L : eventTypeRoutingStatistics . getAverageEventRoutingTime ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getEventsRouted ( EventTypeID eventTypeID ) { final EventTypeRoutingStatistics eventTypeRoutingStatistics = getEventTypeRoutingStatistics ( eventTypeID ) ; return eventTypeRoutingStatistics == null ? 0L : eventTypeRoutingStatistics . getEventsRouted ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public long getRoutingTime ( EventTypeID eventTypeID ) { final EventTypeRoutingStatistics eventTypeRoutingStatistics = getEventTypeRoutingStatistics ( eventTypeID ) ; return eventTypeRoutingStatistics == null ? 0L : eventTypeRoutingStatistics . getRoutingTime ( ) ; }


Input: Get an <code > AlarmLevel< / code > object from an integer value . [CODESPLIT] public static AlarmLevel fromInt ( int level ) throws IllegalArgumentException { switch ( level ) { case LEVEL_CLEAR : return CLEAR ; case LEVEL_CRITICAL : return CRITICAL ; case LEVEL_MAJOR : return MAJOR ; case LEVEL_WARNING : return WARNING ; case LEVEL_INDETERMINATE : return INDETERMINATE ; case LEVEL_MINOR : return MINOR ; default : throw new IllegalArgumentException ( "Invalid level: " + level ) ; } }


Input: Get an <code > AlarmLevel< / code > object from a string value . [CODESPLIT] public static AlarmLevel fromString ( String level ) throws NullPointerException , IllegalArgumentException { if ( level == null ) throw new NullPointerException ( "level is null" ) ; if ( level . equalsIgnoreCase ( CLEAR_STRING ) ) return CLEAR ; if ( level . equalsIgnoreCase ( CRITICAL_STRING ) ) return CRITICAL ; if ( level . equalsIgnoreCase ( MAJOR_STRING ) ) return MAJOR ; if ( level . equalsIgnoreCase ( WARNING_STRING ) ) return WARNING ; if ( level . equalsIgnoreCase ( INDETERMINATE_STRING ) ) return INDETERMINATE ; if ( level . equalsIgnoreCase ( MINOR_STRING ) ) return MINOR ; throw new IllegalArgumentException ( "Invalid level: " + level ) ; }


Input: Determine if this AlarmLevel object represents a level that is higher than some other AlarmLevel object . For the purposes of the comparison the following order from highest to lowest severity is assumed for alarm levels : <ul > <li > CLEAR <li > CRITICAL <li > MAJOR <li > WARNING <li > INDETERMINATE <li > MINOR < / ul > [CODESPLIT] public boolean isHigherLevel ( AlarmLevel other ) throws NullPointerException { if ( other == null ) throw new NullPointerException ( "other is null" ) ; return this . level < other . level ; }


Input:
} [CODESPLIT] public EventTypeID [ ] getEventTypes ( ) throws ManagementConsoleException { try { EventTypeID [ ] IDs = ( EventTypeID [ ] ) mbeanServer . getAttribute ( deploymentMBean , "EventTypes" ) ; // ManagementConsole.getInstance().getComponentIDMap().put(IDs);
 return IDs ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new ManagementConsoleException ( SleeManagementMBeanUtils . doMessage ( e ) ) ; } }


Input:
/ * ( non - Javadoc ) [CODESPLIT] public ActivityContextImpl createActivityContext ( final ActivityContextHandle ach , int activityFlags ) throws ActivityAlreadyExistsException { if ( sleeContainer . getCongestionControl ( ) . refuseStartActivity ( ) ) { throw new SLEEException ( "congestion control refused activity start" ) ; } // create ac
 ActivityContextCacheData activityContextCacheData = new ActivityContextCacheData ( ach , sleeContainer . getCluster ( ) ) ; if ( activityContextCacheData . exists ( ) ) { throw new ActivityAlreadyExistsException ( ach . toString ( ) ) ; } ActivityContextImpl ac = new ActivityContextImpl ( ach , activityContextCacheData , tracksIdleTime ( ach , true ) , Integer . valueOf ( activityFlags ) , this ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Created activity context with handle " + ach ) ; } return ac ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void eventProcessingFailed ( FailureReason failureReason ) { raEntity . getResourceAdaptorObject ( ) . eventProcessingFailed ( activityHandle , fireableEventType , failureReason , address , receivableService , eventFlags , failureReason ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void eventProcessingSucceed ( boolean sbbProcessedEvent ) { int flags = sbbProcessedEvent ? EventFlags . setSbbProcessedEvent ( eventFlags ) : eventFlags ; raEntity . getResourceAdaptorObject ( ) . eventProcessingSuccessful ( activityHandle , fireableEventType , event , address , receivableService , flags ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void eventUnreferenced ( ) { raEntity . getResourceAdaptorObject ( ) . eventUnreferenced ( activityHandle , fireableEventType , event , address , receivableService , eventFlags ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] @ Override protected void processArguments ( String [ ] args ) throws CommandException { //String sopts = ":lyi:u:d:sr:";
 String sopts = ":lyi:u:dr:" ; LongOpt [ ] lopts = { new LongOpt ( "list" , LongOpt . NO_ARGUMENT , null , ' ' ) , //options
 new LongOpt ( "sbbs" , LongOpt . OPTIONAL_ARGUMENT , null , ListOperation . sbbs ) , new LongOpt ( "services" , LongOpt . NO_ARGUMENT , null , ListOperation . services ) , new LongOpt ( "libraries" , LongOpt . NO_ARGUMENT , null , ListOperation . libraries ) , new LongOpt ( "events" , LongOpt . NO_ARGUMENT , null , ListOperation . events ) , new LongOpt ( "ra-types" , LongOpt . NO_ARGUMENT , null , ListOperation . ra_types ) , new LongOpt ( "ras" , LongOpt . NO_ARGUMENT , null , ListOperation . ras ) , new LongOpt ( "dus" , LongOpt . NO_ARGUMENT , null , ListOperation . dus ) , new LongOpt ( "profile-spec" , LongOpt . NO_ARGUMENT , null , ListOperation . profile_specs ) , new LongOpt ( "installed" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "cid" , LongOpt . REQUIRED_ARGUMENT , null , IsInstalledOperation . cid ) , new LongOpt ( "duid" , LongOpt . REQUIRED_ARGUMENT , null , IsInstalledOperation . duid ) , new LongOpt ( "install" , LongOpt . REQUIRED_ARGUMENT , null , ' ' ) , new LongOpt ( "un-install" , LongOpt . REQUIRED_ARGUMENT , null , ' ' ) , //new LongOpt("duid", LongOpt.REQUIRED_ARGUMENT, null, 'd'),
 new LongOpt ( "desc" , LongOpt . NO_ARGUMENT , null , ' ' ) , //new LongOpt("cid", LongOpt.REQUIRED_ARGUMENT, null, GetDescriptorsOperation.cid),
 //new LongOpt("duid", LongOpt.REQUIRED_ARGUMENT, null, GetDescriptorsOperation.duid),
 new LongOpt ( "ref" , LongOpt . REQUIRED_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 ListOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new IsInstalledOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new InstallOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new UninstallOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //super.operation = new DeployableUnitIDOperation(super.context, super.log, this);
 //super.operation.buildOperation(getopt, args);
 //break;
 //case 's':
 super . operation = new GetDescriptorsOperation ( super . context , super . log , this ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : super . operation = new GetReferringComponentsOperation ( 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: / * ( non - Javadoc ) [CODESPLIT] public void createUsageParameterSet ( SbbID sbbId , String name ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , UsageParameterSetNameAlreadyExistsException , ManagementException { if ( name == null ) throw new NullPointerException ( "Sbb usage param set is null" ) ; if ( name . length ( ) == 0 ) throw new InvalidArgumentException ( "The lenght of the Usage Parameter Set Name is zero!" ) ; if ( ! isValidUsageParameterName ( name ) ) throw new InvalidArgumentException ( "The lenght of the Usage Parameter Set Name is zero!" ) ; _createUsageParameterSet ( sbbId , name , true ) ; }


Input: / * creates the default usage parameter set [CODESPLIT] public void createUsageParameterSet ( SbbID sbbId ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , UsageParameterSetNameAlreadyExistsException , ManagementException { _createUsageParameterSet ( sbbId , null , false ) ; }


Input:
/ * ( non - Javadoc ) [CODESPLIT] private synchronized void _createUsageParameterSet ( SbbID sbbId , String name , boolean failIfSbbHasNoUsageParamSet ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , UsageParameterSetNameAlreadyExistsException , ManagementException { if ( sbbId == null ) throw new NullPointerException ( "Sbb ID is null!" ) ; // get the sbb component
 SbbComponent sbbComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( sbbId ) ; if ( sbbComponent == null ) { throw new UnrecognizedSbbException ( sbbId . toString ( ) ) ; } // get service component and check if the sbb belongs to the service
 ServiceComponent serviceComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( getService ( ) ) ; if ( ! serviceComponent . getSbbIDs ( sleeContainer . getComponentRepository ( ) ) . contains ( sbbId ) ) { throw new UnrecognizedSbbException ( sbbId . toString ( ) + " is not part of " + getService ( ) ) ; } // get sbb usage parameter class
 Class < ? > usageParameterClass = sbbComponent . getUsageParametersConcreteClass ( ) ; if ( usageParameterClass == null ) { if ( failIfSbbHasNoUsageParamSet ) { throw new InvalidArgumentException ( sbbId . toString ( ) + " does not define a usage parameters interface" ) ; } else { return ; } } // check if the usage parameter name set already exists
 SbbUsageMBeanMapKey mapKey = new SbbUsageMBeanMapKey ( sbbId , name ) ; if ( this . usageMBeans . containsKey ( mapKey ) ) { throw new UsageParameterSetNameAlreadyExistsException ( "name " + name + " already exists for service " + serviceComponent + " and sbb " + sbbComponent ) ; } UsageMBeanImpl usageMbean = null ; UsageNotificationManagerMBeanImpl usageNotificationManagerMBean = null ; Thread currentThread = Thread . currentThread ( ) ; ClassLoader currentThreadClassLoader = currentThread . getContextClassLoader ( ) ; try { // change class loader
 currentThread . setContextClassLoader ( sbbComponent . getClassLoader ( ) ) ; // create the actual usage parameter instance and map it in the
 // mbean
 SbbNotification sbbNotification = new SbbNotification ( serviceID , sbbId ) ; AbstractUsageParameterSet installedUsageParameterSet = ( AbstractUsageParameterSet ) AbstractUsageParameterSet . newInstance ( usageParameterClass , sbbNotification , name , sleeContainer ) ; // create and register the usage mbean
 Class < ? > usageParameterMBeanClass = sbbComponent . getUsageParametersMBeanImplConcreteClass ( ) ; Constructor < ? > constructor = null ; if ( sbbComponent . isSlee11 ( ) ) { constructor = usageParameterMBeanClass . getConstructor ( new Class [ ] { Class . class , NotificationSource . class } ) ; } else { constructor = usageParameterMBeanClass . getConstructor ( new Class [ ] { Class . class , SbbNotification . class } ) ; } ObjectName usageParameterMBeanObjectName = generateUsageParametersMBeanObjectName ( name , sbbId , sbbComponent . isSlee11 ( ) ) ; usageMbean = ( UsageMBeanImpl ) constructor . newInstance ( new Object [ ] { sbbComponent . getUsageParametersMBeanConcreteInterface ( ) , sbbNotification } ) ; usageMbean . setObjectName ( usageParameterMBeanObjectName ) ; usageMbean . setParent ( this ) ; sleeContainer . getMBeanServer ( ) . registerMBean ( usageMbean , usageParameterMBeanObjectName ) ; // set the usage param data related with the mbean
 installedUsageParameterSet . setUsageMBean ( usageMbean ) ; usageMbean . setUsageParameter ( installedUsageParameterSet ) ; // store the mbean
 this . usageMBeans . put ( mapKey , usageMbean ) ; // if it's the default usage param set and it's an slee 1.1. sbb
 // then we have to create the notification manager too
 if ( sbbComponent . isSlee11 ( ) && name == null ) { Class < ? > usageNotificationManagerMBeanClass = sbbComponent . getUsageNotificationManagerMBeanImplConcreteClass ( ) ; constructor = usageNotificationManagerMBeanClass . getConstructor ( new Class [ ] { Class . class , NotificationSource . class , SleeComponentWithUsageParametersInterface . class } ) ; usageNotificationManagerMBean = ( UsageNotificationManagerMBeanImpl ) constructor . newInstance ( new Object [ ] { sbbComponent . getUsageNotificationManagerMBeanConcreteInterface ( ) , sbbNotification , sbbComponent } ) ; ObjectName usageNotificationManagerMBeanObjectName = generateUsageNotificationManagerMBeanObjectName ( sbbId ) ; usageNotificationManagerMBean . setObjectName ( usageNotificationManagerMBeanObjectName ) ; sleeContainer . getMBeanServer ( ) . registerMBean ( usageNotificationManagerMBean , usageNotificationManagerMBeanObjectName ) ; this . notificationManagers . put ( sbbId , usageNotificationManagerMBean ) ; } } catch ( Throwable e ) { if ( mapKey != null && usageMbean != null ) { this . usageMBeans . remove ( mapKey ) ; try { sleeContainer . getMBeanServer ( ) . unregisterMBean ( usageMbean . getObjectName ( ) ) ; } catch ( Throwable f ) { logger . error ( "failed to unregister usage parameter mbean " + usageMbean . getObjectName ( ) ) ; } } if ( usageNotificationManagerMBean != null ) { this . notificationManagers . remove ( sbbId ) ; try { sleeContainer . getMBeanServer ( ) . unregisterMBean ( usageNotificationManagerMBean . getObjectName ( ) ) ; } catch ( Throwable f ) { logger . error ( "failed to unregister usage notification manager mbean " + usageNotificationManagerMBean . getObjectName ( ) ) ; } } throw new ManagementException ( e . getMessage ( ) , e ) ; } finally { currentThread . setContextClassLoader ( currentThreadClassLoader ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void removeUsageParameterSet ( SbbID sbbId , String name ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , UnrecognizedUsageParameterSetNameException , ManagementException { if ( name == null ) throw new NullPointerException ( "Sbb usage param set is null" ) ; if ( name . length ( ) == 0 ) throw new InvalidArgumentException ( "The lenght of the Usage Parameter Set Name is zero!" ) ; if ( ! isValidUsageParameterName ( name ) ) throw new InvalidArgumentException ( "The lenght of the Usage Parameter Set Name is zero!" ) ; _removeUsageParameterSet ( sbbId , name ) ; }


Input:
This method returns a list containing the names of the named SBB usage parameter sets that belong to the SBB specified by the sbbID argument and the Service represented by the ServiceUsageMBean object . [CODESPLIT] public synchronized String [ ] getUsageParameterSets ( SbbID sbbId ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , ManagementException { if ( sbbId == null ) throw new NullPointerException ( "Sbb ID is null!" ) ; // get the sbb component
 SbbComponent sbbComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( sbbId ) ; if ( sbbComponent == null ) { throw new UnrecognizedSbbException ( sbbId . toString ( ) ) ; } else { if ( sbbComponent . getUsageParametersInterface ( ) == null ) { throw new InvalidArgumentException ( "no usage parameter interface for " + sbbId ) ; } } // get service component and check if the sbb belongs to the service
 ServiceComponent serviceComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( getService ( ) ) ; if ( ! serviceComponent . getSbbIDs ( sleeContainer . getComponentRepository ( ) ) . contains ( sbbId ) ) { throw new UnrecognizedSbbException ( sbbId . toString ( ) + " is not part of " + getService ( ) ) ; } Set < String > resultSet = new HashSet < String > ( ) ; for ( UsageMBeanImpl usageMBeanImpl : usageMBeans . values ( ) ) { if ( ( ( SbbNotification ) usageMBeanImpl . getNotificationSource ( ) ) . getSbb ( ) . equals ( sbbId ) ) { String name = usageMBeanImpl . getUsageParameterSet ( ) ; if ( name != null ) { resultSet . add ( name ) ; } } } return resultSet . toArray ( new String [ resultSet . size ( ) ] ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public ObjectName getSbbUsageMBean ( SbbID sbbId ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , ManagementException { try { return _getSbbUsageMBean ( sbbId , null ) ; } catch ( UnrecognizedUsageParameterSetNameException e ) { throw new ManagementException ( "default usage parameter name not found" , e ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public ObjectName getSbbUsageMBean ( SbbID sbbId , String name ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , UnrecognizedUsageParameterSetNameException , ManagementException { if ( name == null ) throw new NullPointerException ( "Sbb usage param set is null" ) ; if ( name . length ( ) == 0 ) throw new InvalidArgumentException ( "The lenght of the Usage Parameter Set Name is zero!" ) ; if ( ! isValidUsageParameterName ( name ) ) throw new InvalidArgumentException ( "The lenght of the Usage Parameter Set Name is zero!" ) ; return _getSbbUsageMBean ( sbbId , name ) ; }


Input:
Resets the usage parameters of only the SBB specified by the sbbID argument argument ( within the Service represented by the ServiceUsageMBean object ) . [CODESPLIT] public synchronized void resetAllUsageParameters ( SbbID sbbId ) throws NullPointerException , UnrecognizedSbbException , InvalidArgumentException , ManagementException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "resetAllUsageParameters: " + sbbId ) ; } if ( sbbId == null ) throw new NullPointerException ( "Sbb ID is null!" ) ; // get the sbb component
 SbbComponent sbbComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( sbbId ) ; if ( sbbComponent == null ) { throw new UnrecognizedSbbException ( sbbId . toString ( ) ) ; } else { if ( sbbComponent . getUsageParametersInterface ( ) == null ) { throw new InvalidArgumentException ( "no usage parameter interface for " + sbbId ) ; } } // get service component and check if the sbb belongs to the service
 ServiceComponent serviceComponent = sleeContainer . getComponentRepository ( ) . getComponentByID ( getService ( ) ) ; if ( ! serviceComponent . getSbbIDs ( sleeContainer . getComponentRepository ( ) ) . contains ( sbbId ) ) { throw new UnrecognizedSbbException ( sbbId . toString ( ) + " is not part of " + getService ( ) ) ; } for ( UsageMBeanImpl usageMBeanImpl : usageMBeans . values ( ) ) { SbbNotification sbbNotification = ( SbbNotification ) usageMBeanImpl . getNotificationSource ( ) ; if ( sbbNotification . getSbb ( ) . equals ( sbbId ) ) { usageMBeanImpl . resetAllUsageParameters ( ) ; } } }


Input:
Resets the usage parameters of all SBBs within the Service represented by the ServiceUsageMBean object . The SLEE sets counter - type usage parameters to zero and removes all samples from sample - type usage parameters . [CODESPLIT] public synchronized void resetAllUsageParameters ( ) throws ManagementException { try { //FIXME: hmm, how to check here for clustered... ghmp
 for ( UsageMBeanImpl usageMBeanImpl : usageMBeans . values ( ) ) { usageMBeanImpl . resetAllUsageParameters ( ) ; } } catch ( Throwable e ) { throw new ManagementException ( e . getMessage ( ) , e ) ; } }


Input: Convenience method to retrieve the { @link AbstractUsageParameterSet } for the specified sbb and name [CODESPLIT] public AbstractUsageParameterSet getInstalledUsageParameterSet ( SbbID sbbID , String name ) throws UnrecognizedUsageParameterSetNameException { if ( name == null ) { throw new NullPointerException ( "null name" ) ; } AbstractUsageParameterSet installedUsageParameterSet = _getInstalledUsageParameterSet ( sbbID , name ) ; if ( installedUsageParameterSet == null ) { throw new UnrecognizedUsageParameterSetNameException ( name ) ; } return installedUsageParameterSet ; }


Input: lifecycle methods [CODESPLIT] public void setResourceAdaptorContext ( ResourceAdaptorContext raContext ) { this . raContext = raContext ; this . tracer = raContext . getTracer ( StatisticsResourceAdaptor . class . getSimpleName ( ) ) ; this . sleeContainer = SleeContainer . lookupFromJndi ( ) ; if ( this . sleeContainer != null ) { this . resourceManagement = sleeContainer . getResourceManagement ( ) ; } }


Input:
Sbb abstract class ( general rule � methods cannot start neither with �ejb� nor �sbb� ) <ul > <li > ( 1 . 1 ? ) must have package declaration <li > must implement in some way javax . slee . Sbb ( only methods from interface can have �sbb� prefix ) <ul > <li > each method defined must be implemented as public � not abstract final or static < / ul > <li > must be public and abstract <li > must have public no arg constructor <li > must implement sbbExceptionThrown method <ul > <li > public not abstract final or static no return type 3 arguments : java . lang . Exception java . lang . Object javax . slee . ActivityContextInterface < / ul > <li > must implement sbbRolledBack <ul > <li > method must be public not abstract final or static <li > no return type <li > with single argument - javax . slee . RoledBackContext < / ul > <li > there is no finalize method < / ul > [CODESPLIT] boolean validateAbstractClassConstraints ( Map < String , Method > concreteMethods , Map < String , Method > concreteSuperClassesMethods ) { String errorBuffer = new String ( "" ) ; boolean passed = true ; // Presence of those classes must be checked elsewhere
 Class sbbAbstractClass = this . component . getAbstractSbbClass ( ) ; // Must be public and abstract
 int modifiers = sbbAbstractClass . getModifiers ( ) ; // check that the class modifiers contain abstratc and public
 if ( ! Modifier . isAbstract ( modifiers ) || ! Modifier . isPublic ( modifiers ) ) { errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must be public and abstract" , "6.1" , errorBuffer ) ; } // 1.1 - must be in package
 if ( this . component . isSlee11 ( ) ) { Package declaredPackage = sbbAbstractClass . getPackage ( ) ; if ( declaredPackage == null || declaredPackage . getName ( ) . compareTo ( "" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must be defined inside package space" , "6.1" , errorBuffer ) ; } } // Public no arg constructor - can it have more ?
 // sbbAbstractClass.getConstructor
 // FIXME: no arg constructor has signature "()V" when added from
 // javaassist we check for such constructor and if its public
 try { Constructor constructor = sbbAbstractClass . getConstructor ( ) ; int conMod = constructor . getModifiers ( ) ; if ( ! Modifier . isPublic ( conMod ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must have public constructor " , "6.1" , errorBuffer ) ; } } catch ( SecurityException e ) { e . printStackTrace ( ) ; passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must have no arg constructor, error:" + e . getMessage ( ) , "6.1" , errorBuffer ) ; } catch ( NoSuchMethodException e ) { e . printStackTrace ( ) ; passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must have no arg constructor, error:" + e . getMessage ( ) , "6.1" , errorBuffer ) ; } // Must implements javax.slee.Sbb - and each method there defined, only
 // those methods and two above can have "sbb" prefix
 // those methods MUST be in concrete methods map, later we will use them
 // to see if there is ant "sbbXXXX" method
 // Check if we implement javax.slee.Sbb - either directly or from super
 // class
 Class javaxSleeSbbInterface = ClassUtils . checkInterfaces ( sbbAbstractClass , "javax.slee.Sbb" ) ; // sbbAbstractClass.getI
 if ( javaxSleeSbbInterface == null ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class  must implement, directly or indirectly, the javax.slee.Sbb interface." , "6.1" , errorBuffer ) ; } // FIXME: add check for finalize method
 // Now we have to check methods from javax.slee.Sbb
 // This takes care of method throws clauses
 if ( javaxSleeSbbInterface != null ) { // if it is, we dont have those methods for sure, or maybe we do,
 // implemnted by hand
 // either way its a failure
 // We want only java.slee.Sbb methods :)
 Method [ ] sbbLifecycleMethods = javaxSleeSbbInterface . getDeclaredMethods ( ) ; for ( Method lifecycleMehtod : sbbLifecycleMethods ) { // It must be implemented - so only in concrete methods, if we
 // are left with one not checked bang, its an error
 String methodKey = ClassUtils . getMethodKey ( lifecycleMehtod ) ; Method concreteLifeCycleImpl = null ; if ( concreteMethods . containsKey ( methodKey ) ) { concreteLifeCycleImpl = concreteMethods . remove ( methodKey ) ; } else if ( concreteSuperClassesMethods . containsKey ( methodKey ) ) { concreteLifeCycleImpl = concreteSuperClassesMethods . remove ( methodKey ) ; } else { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must implement life cycle methods, it lacks concrete implementation of: " + lifecycleMehtod . getName ( ) , "6.1.1" , errorBuffer ) ; continue ; } // now we now there is such method, its not private and abstract
 // If we are here its not null
 int lifeCycleModifier = concreteLifeCycleImpl . getModifiers ( ) ; if ( ! Modifier . isPublic ( lifeCycleModifier ) || Modifier . isStatic ( lifeCycleModifier ) || Modifier . isFinal ( lifeCycleModifier ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must implement life cycle methods, which can not be static, final or not public, method: " + lifecycleMehtod . getName ( ) , "6.1.1" , errorBuffer ) ; } } } // there can not be any method which start with ejb/sbb - we removed
 // every from concrete, lets iterate over those sets
 for ( Method concreteMethod : concreteMethods . values ( ) ) { if ( concreteMethod . getName ( ) . startsWith ( "ejb" ) || concreteMethod . getName ( ) . startsWith ( "sbb" ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " with method:  " + concreteMethod . getName ( ) , "6.12" , errorBuffer ) ; } if ( concreteMethod . getName ( ) . compareTo ( "finalize" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class  must not implement \"finalize\" method." , "6.1" , errorBuffer ) ; } } for ( Method concreteMethod : concreteSuperClassesMethods . values ( ) ) { if ( concreteMethod . getName ( ) . startsWith ( "ejb" ) || concreteMethod . getName ( ) . startsWith ( "sbb" ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " with method from super classes:  " + concreteMethod . getName ( ) , "6.12" , errorBuffer ) ; } if ( concreteMethod . getName ( ) . compareTo ( "finalize" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class  must not implement \"finalize\" method. Its implemented by super class." , "6.1" , errorBuffer ) ; } } if ( ! passed ) { logger . error ( errorBuffer ) ; } return passed ; }


Input:
This method checks for presence of [CODESPLIT] boolean validateSbbActivityContextInterface ( Map < String , Method > sbbAbstractClassAbstraMethod , Map < String , Method > sbbAbstractClassAbstraMethodFromSuperClasses ) { if ( this . component . getDescriptor ( ) . getSbbActivityContextInterface ( ) == null ) { // FIXME: add check for asSbbActivityContextInteface method ? This
 // will be catched at the end of check anyway
 if ( logger . isTraceEnabled ( ) ) { logger . trace ( this . component . getDescriptor ( ) . getSbbID ( ) + " : No Sbb activity context interface defined" ) ; } return true ; } String errorBuffer = new String ( "" ) ; boolean passed = true ; Method asACIMethod = null ; // lets go through methods of sbbAbstract class,
 Iterator < Method > it = sbbAbstractClassAbstraMethod . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Method someMethod = it . next ( ) ; if ( someMethod . getName ( ) . compareTo ( _SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE ) == 0 ) { // we have a winner, possibly - we have to check parameter
 // list, cause someone can create abstract method(or crap,
 // it can be concrete) with different parametrs, in case its
 // abstract, it will fail later on
 if ( someMethod . getParameterTypes ( ) . length == 1 && someMethod . getParameterTypes ( ) [ 0 ] . getName ( ) . compareTo ( "javax.slee.ActivityContextInterface" ) == 0 ) { asACIMethod = someMethod ; it . remove ( ) ; break ; } } } if ( asACIMethod == null ) it = sbbAbstractClassAbstraMethodFromSuperClasses . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Method someMethod = it . next ( ) ; if ( someMethod . getName ( ) . compareTo ( _SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE ) == 0 ) { // we have a winner, possibly - we have to check
 // parameter
 // list, cause someone can create abstract method(or
 // crap,
 // it can be concrete) with different parametrs, in case
 // its
 // abstract, it will fail later on
 if ( someMethod . getParameterTypes ( ) . length == 1 && someMethod . getParameterTypes ( ) [ 0 ] . getName ( ) . compareTo ( "javax.slee.ActivityContextInterface" ) == 0 ) { asACIMethod = someMethod ; it . remove ( ) ; break ; } } } if ( asACIMethod == null ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " must imlement narrow method asSbbActivityContextInterface" , "7.7.2" , errorBuffer ) ; } else { // must be public, abstract? FIXME: not native?
 int asACIMethodModifiers = asACIMethod . getModifiers ( ) ; if ( ! Modifier . isPublic ( asACIMethodModifiers ) || ! Modifier . isAbstract ( asACIMethodModifiers ) || Modifier . isNative ( asACIMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface must be public,abstract and not native." , "7.7.2" , errorBuffer ) ; } // now this misery comes to play, return type check
 Class returnType = asACIMethod . getReturnType ( ) ; // Must return something from Sbb defined aci class inheritance
 // tree
 Class definedReturnType = this . component . getActivityContextInterface ( ) ; if ( returnType . getName ( ) . compareTo ( "void" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface must have return type." , "7.7.2" , errorBuffer ) ; } else if ( returnType . equals ( definedReturnType ) ) { // its ok
 // } else if (ClassUtils.checkInterfaces(definedReturnType,
 // returnType
 // .getName()) != null) {
 } else { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface has wrong return type: " + returnType , "7.7.2" , errorBuffer ) ; } // no throws clause
 if ( asACIMethod . getExceptionTypes ( ) != null && asACIMethod . getExceptionTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface must not have throws clause." , "7.7.2" , errorBuffer ) ; } } // Even if we fail above we can do some checks on ACI if its present.
 // this has to be present
 Class sbbActivityContextInterface = this . component . getActivityContextInterface ( ) ; // ACI VALIDATION
 // (1.1) = must be declared in package
 if ( this . component . isSlee11 ( ) && sbbActivityContextInterface . getPackage ( ) == null ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface must be declared in package." , "7.5" , errorBuffer ) ; } if ( ! Modifier . isPublic ( sbbActivityContextInterface . getModifiers ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface must be declared as public." , "7.5" , errorBuffer ) ; } // We can have here ACI objects and java primitives, ugh, both methods
 // dont have to be shown
 passed = checkSbbAciFieldsConstraints ( this . component . getActivityContextInterface ( ) ) ; // finally lets remove asSbb method form abstract lists, this is used
 // later to determine methods that didnt match any sbb definition
 if ( asACIMethod != null ) { sbbAbstractClassAbstraMethod . remove ( ClassUtils . getMethodKey ( asACIMethod ) ) ; sbbAbstractClassAbstraMethodFromSuperClasses . remove ( ClassUtils . getMethodKey ( asACIMethod ) ) ; } if ( ! passed ) { logger . error ( errorBuffer ) ; } return passed ; }


Input:
This method validates all methods in ACI interface : <ul > <li > set / get methods and parameter names as in CMP fields decalration <li > methods must <ul > <li > be public abstract <li > setters must have one param <li > getters return type must match setter type <li > allowe types are : primitives and serilizable types < / ul > < / ul > <br > Sbb descriptor provides method to obtain aci field names if this test passes it means that all fields there should be correct and can be used to verify aliases [CODESPLIT] boolean checkSbbAciFieldsConstraints ( Class sbbAciInterface ) { boolean passed = true ; String errorBuffer = new String ( "" ) ; try { if ( ! sbbAciInterface . isInterface ( ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface MUST be an interface." , "7.5" , errorBuffer ) ; return passed ; } // here we need all fields :)
 HashSet < String > ignore = new HashSet < String > ( ) ; ignore . add ( ActivityContextInterfaceExt . class . getName ( ) ) ; ignore . add ( ActivityContextInterface . class . getName ( ) ) ; // FIXME: we could go other way, run this for each super interface
 // we
 // have???
 Map < String , Method > aciInterfacesDefinedMethods = ClassUtils . getAllInterfacesMethods ( sbbAciInterface , ignore ) ; // Here we will store fields name-type - if there is getter and
 // setter,
 // type must match!!!
 Map < String , Class > localNameToType = new HashMap < String , Class > ( ) ; for ( String methodKey : aciInterfacesDefinedMethods . keySet ( ) ) { Method fieldMethod = aciInterfacesDefinedMethods . get ( methodKey ) ; String methodName = fieldMethod . getName ( ) ; if ( ! ( methodName . startsWith ( "get" ) || methodName . startsWith ( "set" ) ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface can have only getter/setter  methods." , "7.5.1" , errorBuffer ) ; continue ; } // let us get field name:
 String fieldName = methodName . replaceFirst ( "set" , "" ) . replaceFirst ( "get" , "" ) ; if ( ! Character . isUpperCase ( fieldName . charAt ( 0 ) ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface can have only getter/setter  methods - 4th char in those methods must be capital." , "7.5.1" , errorBuffer ) ; } // check throws clause.
 // number of parameters
 if ( fieldMethod . getExceptionTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface getter method must have empty throws clause: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } boolean isGetter = methodName . startsWith ( "get" ) ; Class fieldType = null ; if ( isGetter ) { // no params
 if ( fieldMethod . getParameterTypes ( ) != null && fieldMethod . getParameterTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface getter method must not have parameters: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } fieldType = fieldMethod . getReturnType ( ) ; if ( fieldType . getName ( ) . compareTo ( "void" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface getter method must have return type: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } } else { if ( fieldMethod . getParameterTypes ( ) != null && fieldMethod . getParameterTypes ( ) . length != 1 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface setter method must single parameter: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; // Here we quick fail
 continue ; } fieldType = fieldMethod . getParameterTypes ( ) [ 0 ] ; if ( fieldMethod . getReturnType ( ) . getName ( ) . compareTo ( "void" ) != 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface setter method must not have return type: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } } // Field type can be primitive and serialzable
 if ( ! ( _PRIMITIVES . contains ( fieldType . getName ( ) ) || ClassUtils . checkInterfaces ( fieldType , "java.io.Serializable" ) != null ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface field(" + fieldName + ") has wrong type, only primitives and serializable: " + fieldType , "7.5.1" , errorBuffer ) ; // we fail here
 continue ; } if ( localNameToType . containsKey ( fieldName ) ) { Class storedType = localNameToType . get ( fieldName ) ; if ( ! storedType . equals ( fieldType ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface has wrong definition of parameter - setter and getter types do not match: " + fieldName + ", type1: " + fieldType . getName ( ) + " typ2:" + storedType . getName ( ) , "7.5.1" , errorBuffer ) ; // we fail here
 continue ; } } else { // simply store
 localNameToType . put ( fieldName , fieldType ) ; } } // FIXME: add check against components get aci fields ?
 } finally { if ( ! passed ) { logger . error ( errorBuffer ) ; } } return passed ; }


Input:
See section 1 . 3 of jslee 1 . 1 specs [CODESPLIT] boolean validateCompatibilityReferenceConstraints ( ) { boolean passed = true ; String errorBuffer = new String ( "" ) ; try { if ( ! this . component . isSlee11 ( ) ) { // A 1.0 SBB must not reference or use a 1.1 Profile
 // Specification. This must be enforced by a 1.1
 // JAIN SLEE.
 for ( ProfileSpecRefDescriptor profileReference : this . component . getDescriptor ( ) . getProfileSpecRefs ( ) ) { ProfileSpecificationComponent specComponent = this . repository . getComponentByID ( profileReference . getComponentID ( ) ) ; if ( specComponent == null ) { // should not happen
 passed = false ; errorBuffer = appendToBuffer ( "Referenced " + profileReference . getComponentID ( ) + " was not found in component repository, this should not happen since dependencies were already verified" , "1.3" , errorBuffer ) ; } else { if ( specComponent . isSlee11 ( ) ) { passed = false ; errorBuffer = appendToBuffer ( "Sbb is following 1.0 JSLEE contract, it must not reference 1.1 profile specification: " + profileReference . getComponentID ( ) , "1.3" , errorBuffer ) ; } } } } } finally { if ( ! passed ) { if ( logger . isEnabledFor ( Level . ERROR ) ) { logger . error ( errorBuffer ) ; } } } return passed ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public EventContext createActivityEndEventContext ( ActivityContext ac , EventUnreferencedCallback unreferencedCallback ) { final EventReferencesHandlerImpl referencesHandler = new EventReferencesHandlerImpl ( ) ; final EventContextData data = dataSource . newEventContextData ( ActivityEndEventImpl . EVENT_TYPE_ID , ActivityEndEventImpl . SINGLETON , ac , null , null , null , null , unreferencedCallback , referencesHandler ) ; final EventContextImpl eventContext = new ActivityEndEventContextImpl ( data , this ) ; referencesHandler . setEventContext ( eventContext ) ; return eventContext ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public EventContext createEventContext ( EventTypeID eventTypeId , Object eventObject , ActivityContext ac , Address address , ServiceID serviceID , EventProcessingSucceedCallback succeedCallback , EventProcessingFailedCallback failedCallback , EventUnreferencedCallback unreferencedCallback ) { final EventReferencesHandlerImpl referencesHandler = new EventReferencesHandlerImpl ( ) ; final EventContextData data = dataSource . newEventContextData ( eventTypeId , eventObject , ac , address , serviceID , succeedCallback , failedCallback , unreferencedCallback , referencesHandler ) ; final EventContextImpl eventContext = new EventContextImpl ( data , this ) ; referencesHandler . setEventContext ( eventContext ) ; return eventContext ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public Collection getProfileTables ( ) throws ManagementConsoleException { try { return ( Collection ) mbeanServer . invoke ( profileProvisioningMBean , "getProfileTables" , new Object [ ] { } , new String [ ] { } ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new ManagementConsoleException ( SleeManagementMBeanUtils . doMessage ( e ) ) ; } }


Input:
/ * ( non - Javadoc ) [CODESPLIT] public Collection getProfilesByIndexedAttribute ( String arg0 , String arg1 , Object arg2 ) throws ManagementConsoleException { // TODO Auto-generated method stub
 return null ; }


Input: Get a <code > ServiceState< / code > object from an integer value . [CODESPLIT] public static ServiceState fromInt ( int state ) throws IllegalArgumentException { switch ( state ) { case SERVICE_INACTIVE : return INACTIVE ; case SERVICE_ACTIVE : return ACTIVE ; case SERVICE_STOPPING : return STOPPING ; default : throw new IllegalArgumentException ( "Invalid state: " + state ) ; } }


Input: Get a <code > ServiceState< / code > object from an integer value . [CODESPLIT] public static ServiceState fromString ( String state ) throws NullPointerException , IllegalArgumentException { if ( state == null ) throw new NullPointerException ( "state is null" ) ; if ( state . equalsIgnoreCase ( INACTIVE_STRING ) ) return INACTIVE ; if ( state . equalsIgnoreCase ( ACTIVE_STRING ) ) return ACTIVE ; if ( state . equalsIgnoreCase ( STOPPING_STRING ) ) return STOPPING ; throw new IllegalArgumentException ( "Invalid state: " + state ) ; }


Input: Get an instance of a <code > SleeProvider< / code > peer class . This method is equivalent to { [CODESPLIT] public static SleeProvider getSleeProvider ( String peerClassName ) throws NullPointerException , PeerUnavailableException { ClassLoader classloader = SleeProviderFactory . class . getClassLoader ( ) ; if ( classloader == null ) classloader = ClassLoader . getSystemClassLoader ( ) ; return getSleeProvider ( peerClassName , classloader ) ; }


Input: Get an instance of a <code > SleeProvider< / code > peer class using the specified class loader . [CODESPLIT] public static SleeProvider getSleeProvider ( String peerClassName , ClassLoader classloader ) throws NullPointerException , PeerUnavailableException { if ( peerClassName == null ) throw new NullPointerException ( "peerClassName is null" ) ; if ( peerClassName . length ( ) == 0 ) throw new PeerUnavailableException ( "peerClassName is zero-length" ) ; try { return ( SleeProvider ) classloader . loadClass ( peerClassName ) . newInstance ( ) ; } catch ( Throwable t ) { throw new PeerUnavailableException ( "Peer class could not be instantiated" , t ) ; } }


Input: special handling of serialization [CODESPLIT] private void writeObject ( ObjectOutputStream out ) throws IOException { VendorExtensionUtils . writeObject ( out , vendorDataSerializationEnabled ? vendorData : null ) ; if ( cause != null ) { out . writeBoolean ( true ) ; // serialize the cause inside a marshalled object to isolate // the serialized data for it in the stream out . writeObject ( new MarshalledObject ( cause ) ) ; // serialize a text form of the stack trace StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; cause . printStackTrace ( pw ) ; pw . flush ( ) ; out . writeUTF ( sw . getBuffer ( ) . toString ( ) ) ; } else { out . writeBoolean ( false ) ; } }


Input: special handling of deserialization [CODESPLIT] private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { vendorData = VendorExtensionUtils . readObject ( in , vendorDataDeserializationEnabled ) ; if ( in . readBoolean ( ) ) { // attempt to deserialize the cause try { cause = ( Throwable ) ( ( MarshalledObject ) in . readObject ( ) ) . get ( ) ; } catch ( ClassNotFoundException cnfe ) { // must have been a class not in standard classloaders and not remotely loadable // do nothing now, we'll replace it with the string version included next in the stream } String causeString = in . readUTF ( ) ; if ( cause == null ) { // replace the cause with a generic exception // that includes the original stack trace in its message cause = new Exception ( "Undeserializable cause, original cause stack trace follows: " + causeString ) ; } } }


Input: Get a collection of ProfileID objects that identify all the profiles contained in the specified profile table . The collection returned is immutable . Any attempt to modify it either directly or indirectly will result in a java . lang . UnsupportedOperationException being thrown . [CODESPLIT] public Collection < ProfileID > getProfiles ( String profileTableName ) throws NullPointerException , UnrecognizedProfileTableNameException , TransactionRolledbackLocalException , FacilityException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "getProfiles( profileTableName = " + profileTableName + " )" ) ; } profileManagement . getSleeContainer ( ) . getTransactionManager ( ) . mandateTransaction ( ) ; try { return profileManagement . getProfileTable ( profileTableName ) . getProfiles ( ) ; } catch ( NullPointerException e ) { throw e ; } catch ( UnrecognizedProfileTableNameException e ) { throw e ; } catch ( Throwable e ) { throw new FacilityException ( e . getMessage ( ) , e ) ; } }


Input:
Get a ProfileTableActivity object for a profile table . [CODESPLIT] public ProfileTableActivity getProfileTableActivity ( String profileTableName ) throws NullPointerException , UnrecognizedProfileTableNameException , TransactionRolledbackLocalException , FacilityException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "getProfileTableActivity( profileTableName = " + profileTableName + " )" ) ; } final SleeTransactionManager sleeTransactionManager = profileManagement . getSleeContainer ( ) . getTransactionManager ( ) ; boolean terminateTx = sleeTransactionManager . requireTransaction ( ) ; try { return profileManagement . getProfileTable ( profileTableName ) . getActivity ( ) ; } catch ( NullPointerException e ) { throw e ; } catch ( UnrecognizedProfileTableNameException e ) { throw e ; } catch ( Throwable e ) { throw new FacilityException ( "Failed to obtain profile table." , e ) ; } finally { // never rollback
 try { sleeTransactionManager . requireTransactionEnd ( terminateTx , false ) ; } catch ( Throwable e ) { throw new FacilityException ( e . getMessage ( ) , e ) ; } } }


Input: Get a ProfileID object that identifies the profile contained in the specified profile table where the specified profile attribute is set to the specified value . In the case of a profile attribute of an array type the type of the specified value must be the base component type of the array not the array type itself and the SLEE will return the profile identifier of any profile that contains the value within the array . [CODESPLIT] public ProfileID getProfileByIndexedAttribute ( java . lang . String profileTableName , java . lang . String attributeName , java . lang . Object attributeValue ) throws NullPointerException , UnrecognizedProfileTableNameException , UnrecognizedAttributeException , AttributeNotIndexedException , AttributeTypeMismatchException , TransactionRolledbackLocalException , FacilityException { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "getProfileByIndexedAttribute( profileTableName = " + profileTableName + " , attributeName = " + attributeName + " , attributeValue = " + attributeValue + " )" ) ; } profileManagement . getSleeContainer ( ) . getTransactionManager ( ) . mandateTransaction ( ) ; try { ProfileTableImpl profileTable = profileManagement . getProfileTable ( profileTableName ) ; if ( profileTable . getProfileSpecificationComponent ( ) . isSlee11 ( ) ) { throw new FacilityException ( "JAIN SLEE 1.1 Specs forbidden the usage of this method on SLEE 1.1 Profile Tables" ) ; } Collection < ProfileID > profileIDs = profileTable . getProfilesByAttribute ( attributeName , attributeValue , false ) ; if ( profileIDs . isEmpty ( ) ) { return null ; } else { return profileIDs . iterator ( ) . next ( ) ; } } catch ( NullPointerException e ) { throw e ; } catch ( UnrecognizedProfileTableNameException e ) { throw e ; } catch ( UnrecognizedAttributeException e ) { throw e ; } catch ( AttributeNotIndexedException e ) { throw e ; } catch ( AttributeTypeMismatchException e ) { throw e ; } catch ( Throwable e ) { throw new FacilityException ( e . getMessage ( ) , e ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public List < ProfileSpecificationDescriptorImpl > parse ( InputStream inputStream ) throws DeploymentException { Object jaxbPojo = buildJAXBPojo ( inputStream ) ; List < ProfileSpecificationDescriptorImpl > result = new ArrayList < ProfileSpecificationDescriptorImpl > ( ) ; boolean isSlee11 = false ; MProfileSpecJar mProfileSpecJar = null ; if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee . profile . ProfileSpecJar ) { mProfileSpecJar = new MProfileSpecJar ( ( org . mobicents . slee . container . component . deployment . jaxb . slee . profile . ProfileSpecJar ) jaxbPojo ) ; } else if ( jaxbPojo instanceof org . mobicents . slee . container . component . deployment . jaxb . slee11 . profile . ProfileSpecJar ) { mProfileSpecJar = new MProfileSpecJar ( ( org . mobicents . slee . container . component . deployment . jaxb . slee11 . profile . ProfileSpecJar ) jaxbPojo ) ; isSlee11 = true ; } else { throw new SLEEException ( "unexpected class of jaxb pojo built: " + ( jaxbPojo != null ? jaxbPojo . getClass ( ) : null ) ) ; } MSecurityPermissions securityPermissions = mProfileSpecJar . getSecurityPermissions ( ) ; for ( MProfileSpec mProfileSpec : mProfileSpecJar . getProfileSpec ( ) ) { result . add ( new ProfileSpecificationDescriptorImpl ( mProfileSpec , securityPermissions , isSlee11 ) ) ; } return result ; }


Input:
Method to display result of operation . [CODESPLIT] public void displayResult ( ) { //default impl of display;
 if ( ! context . isQuiet ( ) ) { // Translate the result to text
 String resultText = prepareResultText ( ) ; // render results to out
 PrintWriter out = context . getWriter ( ) ; out . println ( resultText ) ; out . flush ( ) ; } }


Input:
Default implementation . [CODESPLIT] protected String unfoldArray ( String prefix , Object [ ] array , PropertyEditor editor ) { //StringBuffer sb = new StringBuffer("\n");
 StringBuffer sb = new StringBuffer ( "[" ) ; for ( int index = 0 ; index < array . length ; index ++ ) { if ( editor != null ) { editor . setValue ( array [ index ] ) ; sb . append ( editor . getAsText ( ) ) ; } else { sb . append ( array [ index ] . toString ( ) ) ; } if ( index < array . length - 1 ) { sb . append ( CID_SEPARATOR ) ; //sb.append("\n");
 } } sb . append ( "]" ) ; return sb . toString ( ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public int compareTo ( Object obj ) { if ( obj == this ) return 0 ; if ( obj == null ) throw new NullPointerException ( ) ; if ( obj . getClass ( ) == this . getClass ( ) ) { return ( ( CongestionControlNotification ) obj ) . localAddress . compareTo ( this . localAddress ) ; } else { return - 1 ; } }


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 ( ) ; if ( knownAlarms . containsKey ( notification ) ) return false ; // we've not seen this alarm before, or the period has expired since // the first notification knownAlarms . put ( notification , new Long ( System . currentTimeMillis ( ) ) ) ; return true ; } }


Input: private [CODESPLIT] private void clearStaleTimeouts ( ) { Iterator iterator = knownAlarms . values ( ) . iterator ( ) ; long currentTime = System . currentTimeMillis ( ) ; while ( iterator . hasNext ( ) ) { Long firstSeenTime = ( Long ) iterator . next ( ) ; // if period has expired remove reference to the notification if ( ( firstSeenTime . longValue ( ) + period ) < currentTime ) { iterator . 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 UsageNotification ) ) return false ; UsageNotification usageNotification = ( UsageNotification ) notification ; if ( service != null ) { // SLEE 1.0 comparison if ( ! service . equals ( usageNotification . getService ( ) ) ) return false ; if ( ! sbb . equals ( usageNotification . getSbb ( ) ) ) return false ; } else { // SLEE 1.1 comparison if ( ! notificationSource . equals ( usageNotification . getNotificationSource ( ) ) ) return false ; } if ( ! usageNotification . getUsageParameterName ( ) . equals ( paramName ) ) return false ; long current = usageNotification . getValue ( ) ; try { return ( previous != threshold ) ? ( ( previous < threshold && current > threshold ) || // crossed +ve dir ( previous > threshold && current < threshold ) ) // crossed -ve dir : ( getDirection ( previous , current ) == lastDir ) ; // crossed in last dir } finally { if ( previous != current ) { lastDir = getDirection ( previous , current ) ; previous = current ; } } }


Input: Executes a non transacted fire event operation . [CODESPLIT] void execute ( final ActivityHandle realHandle , final ActivityHandle refHandle , final FireableEventType eventType , final Object event , final Address address , final ReceivableService receivableService , final int eventFlags ) throws ActivityIsEndingException , FireEventException , SLEEException , UnrecognizedActivityHandleException { final SleeTransaction tx = super . suspendTransaction ( ) ; try { sleeEndpoint . _fireEvent ( realHandle , refHandle , eventType , event , address , receivableService , eventFlags , tx ) ; } finally { if ( tx != null ) { super . resumeTransaction ( tx ) ; } } }


Input: / * Generates the profile entity factory class [CODESPLIT] public Class < ? > generateClass ( ) { CtClass ctClass = null ; try { ClassPool classPool = profileComponent . getClassPool ( ) ; Collection < ProfileAttribute > profileAttributes = profileComponent . getProfileAttributes ( ) . values ( ) ; String className = profileEntityClass . getName ( ) + "F" ; ctClass = classPool . makeClass ( className ) ; CtClass profileEntityFactoryClass = classPool . get ( ProfileEntityFactory . class . getName ( ) ) ; CtClass [ ] interfaces = new CtClass [ ] { profileEntityFactoryClass } ; ctClass . setInterfaces ( interfaces ) ; // copy newInstance method from interface and generate body CtMethod newInstanceMethod = profileEntityFactoryClass . getDeclaredMethod ( "newInstance" ) ; CtMethod newInstanceMethodCopy = CtNewMethod . copy ( newInstanceMethod , ctClass , null ) ; String newInstanceMethodCopyBody = "{ " + profileEntityClass . getName ( ) + " profileEntity = new " + profileEntityClass . getName ( ) + "();" + " profileEntity.setTableName($1); " + " profileEntity.setProfileName($2); " + " return profileEntity; " + "}" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "\nAdding method named " + newInstanceMethodCopy . getName ( ) + " with body " + newInstanceMethodCopy + " , into class " + className ) ; } newInstanceMethodCopy . setBody ( newInstanceMethodCopyBody ) ; ctClass . addMethod ( newInstanceMethodCopy ) ; // copy copyAttributes method from interface and generate body CtMethod copyAttributesMethod = profileEntityFactoryClass . getDeclaredMethod ( "copyAttributes" ) ; CtMethod copyAttributesMethodCopy = CtNewMethod . copy ( copyAttributesMethod , ctClass , null ) ; // body header String copyAttributesMethodCopyBody = "{ " + profileEntityClass . getName ( ) + " newProfileEntity = (" + profileEntityClass . getName ( ) + ") $2; " + profileEntityClass . getName ( ) + " oldProfileEntity = (" + profileEntityClass . getName ( ) + ") $1; " ; // process fields copy String profileEntityAttributeArrayValueClassName = null ; if ( System . getSecurityManager ( ) == null ) { for ( ProfileAttribute profileAttribute : profileAttributes ) { String accessorMethodSufix = ClassGeneratorUtils . getPojoCmpAccessorSufix ( profileAttribute . getName ( ) ) ; if ( profileAttribute . isArray ( ) ) { profileEntityAttributeArrayValueClassName = profileEntityAttributeArrayValueClasses . get ( profileAttribute . getName ( ) ) . getName ( ) ; copyAttributesMethodCopyBody += "if (oldProfileEntity.get" + accessorMethodSufix + "() != null) { " + // if the target list already exists then empty it so elements get deleted, otherwise create new List . class . getName ( ) + " new" + profileAttribute . getName ( ) + " = newProfileEntity.get" + accessorMethodSufix + "(); " + "if (new" + profileAttribute . getName ( ) + " == null) { new" + profileAttribute . getName ( ) + " = new " + LinkedList . class . getName ( ) + "(); } else { new" + profileAttribute . getName ( ) + ".clear(); } " + // extract list to copy List . class . getName ( ) + " old" + profileAttribute . getName ( ) + " = oldProfileEntity.get" + accessorMethodSufix + "(); " + // iterate each list element "for (" + Iterator . class . getName ( ) + " i = old" + profileAttribute . getName ( ) + ".iterator(); i.hasNext();) { " + profileEntityAttributeArrayValueClassName + " oldArrayValue = (" + profileEntityAttributeArrayValueClassName + ") i.next(); " + profileEntityAttributeArrayValueClassName + " newArrayValue = new " + profileEntityAttributeArrayValueClassName + "(); " + // link to profile entity "newArrayValue.setOwner( newProfileEntity ); " + // copy fields "newArrayValue.setString( oldArrayValue.getString() ); " + "newArrayValue.setSerializable( (" + Serializable . class . getName ( ) + ") " + ObjectCloner . class . getName ( ) + ".makeDeepCopy(oldArrayValue.getSerializable()) ); " + "new" + profileAttribute . getName ( ) + ".add(newArrayValue); " + "} " + "newProfileEntity.set" + accessorMethodSufix + "(new" + profileAttribute . getName ( ) + "); };" ; } else { if ( profileAttribute . isPrimitive ( ) ) { // just copy value copyAttributesMethodCopyBody += " newProfileEntity.set" + accessorMethodSufix + "(oldProfileEntity.get" + accessorMethodSufix + "()); " ; } else { // just copy value but do a deep copy copyAttributesMethodCopyBody += " if (oldProfileEntity.get" + accessorMethodSufix + "() != null) { newProfileEntity.set" + accessorMethodSufix + "((" + profileAttribute . getType ( ) . getName ( ) + ")" + ObjectCloner . class . getName ( ) + ".makeDeepCopy(oldProfileEntity.get" + accessorMethodSufix + "())); }; " ; } } } } else { for ( ProfileAttribute profileAttribute : profileAttributes ) { String accessorMethodSufix = ClassGeneratorUtils . getPojoCmpAccessorSufix ( profileAttribute . getName ( ) ) ; if ( profileAttribute . isArray ( ) ) { profileEntityAttributeArrayValueClassName = profileEntityAttributeArrayValueClasses . get ( profileAttribute . getName ( ) ) . getName ( ) ; copyAttributesMethodCopyBody += "if (" + Utility . class . getName ( ) + ".makeSafeProxyCall(oldProfileEntity,\"get" + accessorMethodSufix + "\",null,null) != null) {" + "" + // if the target list already exists then empty it so elements get deleted, otherwise create new List . class . getName ( ) + " new" + profileAttribute . getName ( ) + " = newProfileEntity.get" + accessorMethodSufix + "(); " + "if (new" + profileAttribute . getName ( ) + " == null) { new" + profileAttribute . getName ( ) + " = new " + LinkedList . class . getName ( ) + "(); } else { new" + profileAttribute . getName ( ) + ".clear(); } " + // extract list to copy //List.class.getName() + " old"+ profileAttribute.getName() + " = oldProfileEntity.get" + accessorMethodSufix + "(); " + List . class . getName ( ) + " old" + profileAttribute . getName ( ) + " = (" + List . class . getName ( ) + ")" + Utility . class . getName ( ) + ".makeSafeProxyCall(oldProfileEntity,\"get" + accessorMethodSufix + "\",null,null);" + // iterate each list element  Iterator . class . getName ( ) + " i = " + Utility . class . getName ( ) + ".makeSafeProxyCall(old" + profileAttribute . getName ( ) + ",\"iterator\",null,null);" + "for (; " + Utility . class . getName ( ) + ".evaluateNext(i);) { " + profileEntityAttributeArrayValueClassName + " oldArrayValue = (" + profileEntityAttributeArrayValueClassName + ") i.next();" + profileEntityAttributeArrayValueClassName + " newArrayValue = new " + profileEntityAttributeArrayValueClassName + "(); " + // link to profile entity "newArrayValue.setOwner( newProfileEntity ); " + // copy fields "newArrayValue.setString( oldArrayValue.getString() ); " + "newArrayValue.setSerializable( (" + Serializable . class . getName ( ) + ") " + ObjectCloner . class . getName ( ) + ".makeDeepCopy(oldArrayValue.getSerializable()) ); " + "new" + profileAttribute . getName ( ) + ".add(newArrayValue); " + "} " + //"newProfileEntity.set"+accessorMethodSufix+"(new"+profileAttribute.getName()+"); };"; Utility . class . getName ( ) + ".makeSafeProxyCall(newProfileEntity,\"set" + accessorMethodSufix + "\",new Class[]{" + Utility . class . getName ( ) + ".getReturnType(oldProfileEntity,\"get" + accessorMethodSufix + "\")},new Object[]{new" + profileAttribute . getName ( ) + "});}" ; } else { if ( profileAttribute . isPrimitive ( ) ) { // just copy value //copyAttributesMethodCopyBody +=  //	  " newProfileEntity.set"+accessorMethodSufix+"(oldProfileEntity.get"+accessorMethodSufix+"()); "; copyAttributesMethodCopyBody += "Object value = " + Utility . class . getName ( ) + ".makeSafeProxyCall(oldProfileEntity,\"get" + accessorMethodSufix + "\",null,null);" ; copyAttributesMethodCopyBody += Utility . class . getName ( ) + ".makeSafeProxyCall(newProfileEntity,\"set" + accessorMethodSufix + "\",new Class[]{" + Utility . class . getName ( ) + ".getReturnType(oldProfileEntity,\"get" + accessorMethodSufix + "\")},new Object[]{value});" ; } else { // just copy value but do a deep copy copyAttributesMethodCopyBody += "if (" + Utility . class . getName ( ) + ".makeSafeProxyCall(oldProfileEntity,\"get" + accessorMethodSufix + "\",null,null) != null)  " + "{ Object value = " + Utility . class . getName ( ) + ".makeSafeProxyCall(oldProfileEntity,\"get" + accessorMethodSufix + "\",null,null);" //+"newProfileEntity.set"+accessorMethodSufix+"(("+profileAttribute.getType().getName()+")"+ObjectCloner.class.getName()+".makeDeepCopy(value)); }; " + Utility . class . getName ( ) + ".makeSafeProxyCall(newProfileEntity,\"set" + accessorMethodSufix + "\",new Class[]{" + Utility . class . getName ( ) + ".getReturnType(oldProfileEntity,\"get" + accessorMethodSufix + "\")},new Object[]{" + ObjectCloner . class . getName ( ) + ".makeDeepCopy(value)});" + "}" ; } } } } // body footer copyAttributesMethodCopyBody += " }" ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "\nAdding method named " + copyAttributesMethodCopy . getName ( ) + " with body " + copyAttributesMethodCopyBody + " , into class " + className ) ; } copyAttributesMethodCopy . setBody ( copyAttributesMethodCopyBody ) ; ctClass . addMethod ( copyAttributesMethodCopy ) ; String deployDir = profileComponent . getDeploymentDir ( ) . getAbsolutePath ( ) ; // write class if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Writing ProfileEntityFactory generated class ( " + ctClass . getName ( ) + " ) to: " + deployDir ) ; } ctClass . writeFile ( deployDir ) ; return Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( className ) ; } catch ( Throwable e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } finally { if ( ctClass != null ) { try { ctClass . defrost ( ) ; } catch ( Throwable e ) { logger . error ( e . getMessage ( ) , e ) ; } } } }


Input: Binds the specified aci name with the specified activity context handle [CODESPLIT] public void bindName ( Object ach , String name ) throws NameAlreadyBoundException { final Node node = getNode ( ) ; if ( node . hasChild ( name ) ) { throw new NameAlreadyBoundException ( "name already bound" ) ; } else { node . addChild ( Fqn . fromElements ( name ) ) . put ( CACHE_NODE_MAP_KEY , ach ) ; } }


Input: Unbinds the specified aci name with the specified activity context id [CODESPLIT] public Object unbindName ( String name ) throws NameNotBoundException { final Node node = getNode ( ) ; final Node childNode = node . getChild ( name ) ; if ( childNode == null ) { throw new NameNotBoundException ( "name not bound" ) ; } else { final Object ach = childNode . get ( CACHE_NODE_MAP_KEY ) ; node . removeChild ( name ) ; return ach ; } }


Input: Lookup of the activity context id bound to the specified aci name [CODESPLIT] public Object lookupName ( String name ) { final Node childNode = getNode ( ) . getChild ( name ) ; if ( childNode == null ) { return null ; } else { return childNode . get ( CACHE_NODE_MAP_KEY ) ; } }


Input: Retrieves a map of the bindings . Key is the aci name and Value is the activity context handle [CODESPLIT] public Map getNameBindings ( ) { Map result = new HashMap ( ) ; Node childNode = null ; Object name = null ; for ( Object obj : getNode ( ) . getChildren ( ) ) { childNode = ( Node ) obj ; name = childNode . getFqn ( ) . getLastElement ( ) ; result . put ( name , childNode . get ( CACHE_NODE_MAP_KEY ) ) ; } return result ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public ObjectName preRegister ( MBeanServer mbs , ObjectName oname ) throws Exception { this . objectName = oname ; this . server = mbs ; return oname ; }


Input: Retrieves the next sbb entity to handle the event . [CODESPLIT] public Result next ( ActivityContext ac , EventContext sleeEvent , Set < SbbEntityID > sbbEntitiesThatHandledCurrentEvent , SleeContainer sleeContainer ) { SbbEntityID sbbEntityId = null ; SbbEntity sbbEntity = null ; EventEntryDescriptor mEventEntry = null ; // get the highest priority sbb from sbb entities attached to AC for ( Iterator < SbbEntityID > iter = ac . getSortedSbbAttachmentSet ( sbbEntitiesThatHandledCurrentEvent ) . iterator ( ) ; iter . hasNext ( ) ; ) { sbbEntityId = iter . next ( ) ; sbbEntity = sleeContainer . getSbbEntityFactory ( ) . getSbbEntity ( sbbEntityId , true ) ; if ( sbbEntity == null ) { // ignore, sbb entity has been removed continue ; } if ( eventRouterConfiguration . isConfirmSbbEntityAttachement ( ) && ! sbbEntity . isAttached ( ac . getActivityContextHandle ( ) ) ) { // detached by a concurrent tx, see Issue 2313 				 continue ; } if ( sleeEvent . getService ( ) != null && ! sleeEvent . getService ( ) . equals ( sbbEntityId . getServiceID ( ) ) ) { if ( ! sleeEvent . isActivityEndEvent ( ) ) { continue ; } else { return new Result ( sbbEntity , false ) ; } } // check event is allowed to be handled by the sbb mEventEntry = sbbEntity . getSbbComponent ( ) . getDescriptor ( ) . getEventEntries ( ) . get ( sleeEvent . getEventTypeId ( ) ) ; if ( mEventEntry != null && mEventEntry . isReceived ( ) ) { return new Result ( sbbEntity , true ) ; } else { if ( ! sleeEvent . isActivityEndEvent ( ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Event is not received by sbb descriptor of entity " + sbbEntityId + ", will not deliver event to sbb entity ..." ) ; } continue ; } else { return new Result ( sbbEntity , false ) ; } } } return null ; }


Input: Get a <code > TraceLevel< / code > object from an integer value . [CODESPLIT] public static TraceLevel fromInt ( int level ) throws IllegalArgumentException { switch ( level ) { case LEVEL_OFF : return OFF ; case LEVEL_SEVERE : return SEVERE ; case LEVEL_WARNING : return WARNING ; case LEVEL_INFO : return INFO ; case LEVEL_CONFIG : return CONFIG ; case LEVEL_FINE : return FINE ; case LEVEL_FINER : return FINER ; case LEVEL_FINEST : return FINEST ; default : throw new IllegalArgumentException ( "Invalid level: " + level ) ; } }


Input: Get a <code > TraceLevel< / code > object from a string value . [CODESPLIT] public static TraceLevel fromString ( String level ) throws NullPointerException , IllegalArgumentException { if ( level == null ) throw new NullPointerException ( "level is null" ) ; if ( level . equalsIgnoreCase ( OFF_STRING ) ) return OFF ; if ( level . equalsIgnoreCase ( SEVERE_STRING ) ) return SEVERE ; if ( level . equalsIgnoreCase ( WARNING_STRING ) ) return WARNING ; if ( level . equalsIgnoreCase ( INFO_STRING ) ) return INFO ; if ( level . equalsIgnoreCase ( CONFIG_STRING ) ) return CONFIG ; if ( level . equalsIgnoreCase ( FINE_STRING ) ) return FINE ; if ( level . equalsIgnoreCase ( FINER_STRING ) ) return FINER ; if ( level . equalsIgnoreCase ( FINEST_STRING ) ) return FINEST ; throw new IllegalArgumentException ( "Invalid level: " + level ) ; }


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


Input: / * ( non - Javadoc ) [CODESPLIT] public void installProfileSpecification ( ProfileSpecificationComponent component ) throws DeploymentException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Installing " + component ) ; } try { JndiManagement jndiManagement = sleeContainer . getJndiManagement ( ) ; logger . debug ( "JndiManagement: " + jndiManagement + " for ProfileSpecificationComponent: " + component ) ; jndiManagement . componentInstall ( component ) ; jndiManagement . pushJndiContext ( component ) ; try { this . createJndiSpace ( component ) ; } finally { jndiManagement . popJndiContext ( ) ; } // FIXME: we wont use trace and alarm in 1.0 way wont we? ProfileEntityFramework profileEntityFramework = new JPAProfileEntityFramework ( component , configuration , sleeContainer . getTransactionManager ( ) ) ; profileEntityFramework . install ( ) ; sleeProfileClassCodeGenerator . process ( component ) ; profileTableFramework . loadProfileTables ( component ) ; } catch ( DeploymentException de ) { throw de ; } catch ( Throwable t ) { t . printStackTrace ( ) ; throw new SLEEException ( t . getMessage ( ) , t ) ; } }


Input: / * ( non - Javadoc ) [CODESPLIT] public void uninstallProfileSpecification ( ProfileSpecificationComponent component ) throws UnrecognizedProfileSpecificationException { Collection < String > profileTableNames = getDeclaredProfileTableNames ( component . getProfileSpecificationID ( ) ) ; for ( String profileTableName : profileTableNames ) { try { this . removeProfileTable ( profileTableName , true ) ; } catch ( Throwable e ) { throw new SLEEException ( e . getMessage ( ) , e ) ; } } // FIXME: For JBoss 7.2.0.Final: // we have a problem with org.hibernate.service.UnknownServiceException: // Unknown service requested [org.hibernate.event.service.spi.EventListenerRegistry] // see https://hibernate.atlassian.net/browse/HHH-8586 //component.getProfileEntityFramework().uninstall(); }


Input: / * ( non - Javadoc ) [CODESPLIT] public ProfileTableImpl getProfileTable ( String profileTableName ) throws NullPointerException , UnrecognizedProfileTableNameException { if ( profileTableName == null ) throw new NullPointerException ( "profile table name is null" ) ; ProfileTableImpl profileTable = null ; if ( sleeContainer . getCluster ( ) . getMobicentsCache ( ) . isLocalMode ( ) ) { // no replication, table may only exist in local resources profileTable = profileTablesLocalObjects . get ( profileTableName ) ; if ( profileTable == null ) { throw new UnrecognizedProfileTableNameException ( profileTableName ) ; } } else { if ( ! profileTableFramework . getConfiguration ( ) . isClusteredProfiles ( ) ) { // profiles are not clustered, table may only exist in local resources profileTable = profileTablesLocalObjects . get ( profileTableName ) ; if ( profileTable == null ) { throw new UnrecognizedProfileTableNameException ( ) ; } } else { // profiles are clustered, table may exist "remotely" and not in local resources, due to runtime creation in another cluster node, we need to go to database first final ProfileSpecificationID profileSpecificationID = profileTableFramework . getProfileSpecificationID ( profileTableName ) ; if ( profileSpecificationID != null ) { // exists in database profileTable = profileTablesLocalObjects . get ( profileTableName ) ; if ( profileTable == null ) { // local resource does not exists, create it ProfileSpecificationComponent component = sleeContainer . getComponentRepository ( ) . getComponentByID ( profileSpecificationID ) ; if ( component != null ) { profileTable = addProfileTableLocally ( createProfileTableInstance ( profileTableName , component ) , false , false ) ; } } } else { // does not exists in database, ensure it is not in local objects profileTablesLocalObjects . remove ( profileTableName ) ; } } } if ( profileTable == null ) throw new UnrecognizedProfileTableNameException ( ) ; else return profileTable ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public EventContextHandle getEventContextHandle ( ) { if ( handle == null ) { handle = new EventContextHandleImpl ( factory . getSleeContainer ( ) . getUuidGenerator ( ) . createUUID ( ) ) ; factory . getDataSource ( ) . addEventContext ( handle , this ) ; } return handle ; }


Input:
Check which combination ( see JSLEE 1 . 0 spec section 10 . 5 . 2 ) matches the Sbb Developer s Profile Specification [CODESPLIT] public static int checkCombination ( ProfileSpecificationComponent component ) { Object profileCmpInterface = component . getDescriptor ( ) . getProfileCMPInterface ( ) ; Object profileManagementInterface = component . getDescriptor ( ) . getProfileManagementInterface ( ) ; Object profileManagementAbstractClass = component . getDescriptor ( ) . getProfileAbstractClass ( ) ; //Object profileManagementLocalObjectInterface = compoenent.getDescriptor().getProfileLocalInterface();
 // if the Profile Specification has no Profile CMP interface, it is incorrect
 if ( profileCmpInterface == null ) return - 1 ; //    if (compoenent.isSlee11()) {
 //      if (profileCmpInterface != null && profileManagementLocalObjectInterface != null && profileManagementAbstractClass != null)
 //        return 4;
 //      if (profileCmpInterface != null && profileManagementAbstractClass != null)
 //        return 3;
 //      if (profileCmpInterface != null && profileManagementLocalObjectInterface != null)
 //        return 2;
 //
 //      return 1;
 //    }
 //    else
 //    {
 if ( profileCmpInterface != null && profileManagementInterface != null && profileManagementAbstractClass != null ) return 4 ; if ( profileCmpInterface != null && profileManagementAbstractClass != null ) return 3 ; if ( profileCmpInterface != null && profileManagementInterface != null ) return 2 ; return 1 ; //    }
 }


Input: Validates an invocation of the { @link SbbLocalObject } . [CODESPLIT] private void validateInvocation ( ) throws TransactionRolledbackLocalException , NoSuchObjectLocalException , SLEEException { // validate tx sleeContainer . getTransactionManager ( ) . mandateTransaction ( ) ; // validate object if ( this . rollbackOnly ) { try { sleeContainer . getTransactionManager ( ) . setRollbackOnly ( ) ; } catch ( SystemException ex ) { throw new SLEEException ( "unable to set rollbackOnly in transaction manager" , ex ) ; } throw new TransactionRolledbackLocalException ( "Unable to proceed, transaction is set to rollback" ) ; } if ( this . isRemoved ) throw new NoSuchObjectLocalException ( "sbb local object is removed" ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public boolean isIdentical ( javax . slee . SbbLocalObject obj ) throws TransactionRequiredLocalException , SLEEException { validateInvocation ( ) ; return this . equals ( obj ) ; }


Input: / * ( non - Javadoc ) [CODESPLIT] public void remove ( ) throws TransactionRequiredLocalException , NoSuchObjectLocalException , SLEEException { if ( trace ) logger . trace ( "remove()" ) ; validateInvocation ( ) ; if ( ! sbbEntity . isReentrant ( ) && sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) . getInvokedNonReentrantSbbEntities ( ) . contains ( sbbEntity . getSbbEntityId ( ) ) ) throw new SLEEException ( " re-entrancy not allowed " ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "nonSleeInitiatedCascadingRemoval : " + sbbEntity . getSbbId ( ) + " entityID = " + sbbEntity . getSbbEntityId ( ) ) ; } try { sleeContainer . getSbbEntityFactory ( ) . removeSbbEntity ( sbbEntity , false ) ; } catch ( Throwable e ) { throw new SLEEException ( "Removal of the sbb entity failed" , e ) ; } try { if ( sleeContainer . getTransactionManager ( ) . getRollbackOnly ( ) ) { final TransactionContext txContext = sleeContainer . getTransactionManager ( ) . getTransactionContext ( ) ; EventRoutingTransactionData ertd = txContext . getEventRoutingTransactionData ( ) ; txContext . getAfterRollbackActions ( ) . add ( new RolledBackAction ( sbbEntity . getSbbEntityId ( ) , ertd . getEventBeingDelivered ( ) . getEvent ( ) , ertd . getAciReceivingEvent ( ) , true ) ) ; } } catch ( Exception e ) { throw new SLEEException ( "Failed to check and possibly set rollback context of entity " + sbbEntity . getSbbEntityId ( ) , e ) ; } // I Think this should set isRemoved only to true but then test 323 // will fail. // :-( // Ralf: see above this . rollbackOnly = true ; this . isRemoved = true ; }