mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/osgi/EventAdminMessageService.java
private void registerListenerLocally(final int regId, final EventRegistrationRequestData message, 
            final int systemId, final EncryptType encryptionType, final int remainingExpHours)
    {
        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
        // set topic property
        final String[] topics = new String[message.getTopicCount()];
        properties.put(EventConstants.EVENT_TOPIC, message.getTopicList().toArray(topics));
        
        // set filter property
        final String ignoreRemoteEventFilter = String.format("(!(%s=*))", RemoteConstants.REMOTE_EVENT_PROP);
        // if requesting a certain filter combine with base filter of ignoring remote events
        if (message.hasFilter())
        {
            properties.put(EventConstants.EVENT_FILTER, String.format("(&%s%s)",
                    ignoreRemoteEventFilter,
                    message.getFilter()));
        }
        else
        {
            properties.put(EventConstants.EVENT_FILTER, ignoreRemoteEventFilter);
        }
        
        // register event handler for the given channel
        final ServiceRegistration<EventHandler> reg = m_Context.registerService(EventHandler.class, 
                new EventHandlerImpl(systemId, encryptionType, message), properties);

        // Determine the expiration time for the registration
        final long expireTimeMillis;
        if (remainingExpHours > 0)
        {
            expireTimeMillis = TimeUnit.HOURS.toMillis(remainingExpHours);
        }
        else
        {
            expireTimeMillis = TimeUnit.HOURS.toMillis(message.getExpirationTimeHours());
        }

        m_Registrations.put(regId, new RemoteEventRegistration(systemId, reg, message), expireTimeMillis);
    }
/**
     * Register an event handler based of the information in a remote event registration request.
     * @param regId
     *     the registration ID to use
     * @param message
     *     the remote event registration message that contains the information of what to listen for
     * @param systemId
     *     the id of the system which is requesting to receive remote notification of events
     * @param encryptionType
     *     the type of encryption to apply to event messages that are generated in response to the registration
     * @param remainingExpHours
     *     number of hours remaining before the registration expires, -1 if registration is new
     */
Register an event handler based of the information in a remote event registration request.
Register an event handler based of the information in a remote event registration request .
private void registerListenerLocally(final int regId, final EventRegistrationRequestData message, 
            final int systemId, final EncryptType encryptionType, final int remainingExpHours)
    {
        final Dictionary<String, Object> properties = new Hashtable<String, Object>();
        final String[] topics = new String[message.getTopicCount()];
        properties.put(EventConstants.EVENT_TOPIC, message.getTopicList().toArray(topics));
        final String ignoreRemoteEventFilter = String.format("(!(%s=*))", RemoteConstants.REMOTE_EVENT_PROP);
        if (message.hasFilter())
        {
            properties.put(EventConstants.EVENT_FILTER, String.format("(&%s%s)",
                    ignoreRemoteEventFilter,
                    message.getFilter()));
        }
        else
        {
            properties.put(EventConstants.EVENT_FILTER, ignoreRemoteEventFilter);
        }
        final ServiceRegistration<EventHandler> reg = m_Context.registerService(EventHandler.class, 
                new EventHandlerImpl(systemId, encryptionType, message), properties);
        final long expireTimeMillis;
        if (remainingExpHours > 0)
        {
            expireTimeMillis = TimeUnit.HOURS.toMillis(remainingExpHours);
        }
        else
        {
            expireTimeMillis = TimeUnit.HOURS.toMillis(message.getExpirationTimeHours());
        }
        m_Registrations.put(regId, new RemoteEventRegistration(systemId, reg, message), expireTimeMillis);
    }
private void registerListenerLocally ( final int regId , final EventRegistrationRequestData message , final int systemId , final EncryptType encryptionType , final int remainingExpHours ) { final Dictionary < String , Object > properties = new Hashtable < String , Object > ( ) ; final String [ ] topics = new String [ message . getTopicCount ( ) ] ; properties . put ( EventConstants . EVENT_TOPIC , message . getTopicList ( ) . toArray ( topics ) ) ; final String ignoreRemoteEventFilter = String . format ( "(!(%s=*))" , RemoteConstants . REMOTE_EVENT_PROP ) ; if ( message . hasFilter ( ) ) { properties . put ( EventConstants . EVENT_FILTER , String . format ( "(&%s%s)" , ignoreRemoteEventFilter , message . getFilter ( ) ) ) ; } else { properties . put ( EventConstants . EVENT_FILTER , ignoreRemoteEventFilter ) ; } final ServiceRegistration < EventHandler > reg = m_Context . registerService ( EventHandler . class , new EventHandlerImpl ( systemId , encryptionType , message ) , properties ) ; final long expireTimeMillis ; if ( remainingExpHours > 0 ) { expireTimeMillis = TimeUnit . HOURS . toMillis ( remainingExpHours ) ; } else { expireTimeMillis = TimeUnit . HOURS . toMillis ( message . getExpirationTimeHours ( ) ) ; } m_Registrations . put ( regId , new RemoteEventRegistration ( systemId , reg , message ) , expireTimeMillis ) ; }
Register an event handler based of the information in a remote event registration request.
Register an event handler based of the information in a remote event registration request .
// set topic property // set filter property // if requesting a certain filter combine with base filter of ignoring remote events // register event handler for the given channel // Determine the expiration time for the registration