mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/osgi/EventAdminMessageService.java
@Activate
    public void activate(final BundleContext context)
    {
        m_Context = context;
        m_Registrations = new AutoExpireHashMap<Integer, RemoteEventRegistration>(
            TimeUnit.HOURS.toMillis(RemoteConstants.REMOTE_EVENT_DEFAULT_REG_TIMEOUT_HOURS),
            TimeUnit.MINUTES.toMillis(1),
            (key, value) -> handleExpiredEntry(key, value));
        m_MessageRouter.bindMessageService(this);
        
        //get any persisted registrations
        final Collection<PersistentData> datas = m_Datastore.query(getClass());
        //iterate through them and re-register
        for (PersistentData data : datas)
        {
            final byte[] bytes = (byte[])data.getEntity();
            //create message
            final PersistentEventRegistrationMessage message;
            try
            {
                message = PersistentEventRegistrationMessage.parseFrom(bytes);
            }
            catch (final IOException e)
            {
                m_Logging.error(e, "Unable to pull a remote event registration with ID %s from the datastore.", 
                        data.getDescription());
                //just continue with the next entity
                continue;
            }
            //re-register for the events
            final int regId = Integer.parseInt(data.getDescription());
            //check if registration id just pulled out is higher than other regIDs
            if (regId > m_LastRegId)
            {
                m_LastRegId = regId;
            }
            final EventRegistrationRequestData dataMsg = message.getRegMessage();
            final int remainingExpHours = message.hasRemainingExpirationTimeHours()
                    ? message.getRemainingExpirationTimeHours() : -1;
            registerListenerLocally(regId, dataMsg, message.getSystemId(), message.getEncryptionType(),
                    remainingExpHours);
        }
    }
/**
     * Activate this component, just save the context for later use and bind this service to the message router.
     * 
     * @param context
     *      context for this bundle
     */
Activate this component, just save the context for later use and bind this service to the message router.

@param context
context for this bundle
Activate this component just save the context for later use and bind this service to the message router . @param context context for this bundle
@Activate
    public void activate(final BundleContext context)
    {
        m_Context = context;
        m_Registrations = new AutoExpireHashMap<Integer, RemoteEventRegistration>(
            TimeUnit.HOURS.toMillis(RemoteConstants.REMOTE_EVENT_DEFAULT_REG_TIMEOUT_HOURS),
            TimeUnit.MINUTES.toMillis(1),
            (key, value) -> handleExpiredEntry(key, value));
        m_MessageRouter.bindMessageService(this);
        final Collection<PersistentData> datas = m_Datastore.query(getClass());
        for (PersistentData data : datas)
        {
            final byte[] bytes = (byte[])data.getEntity();
            final PersistentEventRegistrationMessage message;
            try
            {
                message = PersistentEventRegistrationMessage.parseFrom(bytes);
            }
            catch (final IOException e)
            {
                m_Logging.error(e, "Unable to pull a remote event registration with ID %s from the datastore.", 
                        data.getDescription());
                continue;
            }
            final int regId = Integer.parseInt(data.getDescription());
            if (regId > m_LastRegId)
            {
                m_LastRegId = regId;
            }
            final EventRegistrationRequestData dataMsg = message.getRegMessage();
            final int remainingExpHours = message.hasRemainingExpirationTimeHours()
                    ? message.getRemainingExpirationTimeHours() : -1;
            registerListenerLocally(regId, dataMsg, message.getSystemId(), message.getEncryptionType(),
                    remainingExpHours);
        }
    }
@ Activate public void activate ( final BundleContext context ) { m_Context = context ; m_Registrations = new AutoExpireHashMap < Integer , RemoteEventRegistration > ( TimeUnit . HOURS . toMillis ( RemoteConstants . REMOTE_EVENT_DEFAULT_REG_TIMEOUT_HOURS ) , TimeUnit . MINUTES . toMillis ( 1 ) , ( key , value ) -> handleExpiredEntry ( key , value ) ) ; m_MessageRouter . bindMessageService ( this ) ; final Collection < PersistentData > datas = m_Datastore . query ( getClass ( ) ) ; for ( PersistentData data : datas ) { final byte [ ] bytes = ( byte [ ] ) data . getEntity ( ) ; final PersistentEventRegistrationMessage message ; try { message = PersistentEventRegistrationMessage . parseFrom ( bytes ) ; } catch ( final IOException e ) { m_Logging . error ( e , "Unable to pull a remote event registration with ID %s from the datastore." , data . getDescription ( ) ) ; continue ; } final int regId = Integer . parseInt ( data . getDescription ( ) ) ; if ( regId > m_LastRegId ) { m_LastRegId = regId ; } final EventRegistrationRequestData dataMsg = message . getRegMessage ( ) ; final int remainingExpHours = message . hasRemainingExpirationTimeHours ( ) ? message . getRemainingExpirationTimeHours ( ) : - 1 ; registerListenerLocally ( regId , dataMsg , message . getSystemId ( ) , message . getEncryptionType ( ) , remainingExpHours ) ; } }
Activate this component, just save the context for later use and bind this service to the message router.
Activate this component just save the context for later use and bind this service to the message router .
//get any persisted registrations //iterate through them and re-register //create message //just continue with the next entity //re-register for the events //check if registration id just pulled out is higher than other regIDs