protected synchronized void activate(BundleContext context, Map<String, Object> props) {

        String jndiName = (String) props.get("jndiName");
        String originalValue = (String) props.get("value");
        //Since we declare a default value of false in the metatype, if decode isn't specified, props should return false
        boolean decode = (Boolean) props.get("decode");

        if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set");
            }
            return;
        }
        String value = originalValue;
        if (decode) {
            try {
                value = PasswordUtil.decode(originalValue);
            } catch (Exception e) {
                Tr.error(tc, "jndi.decode.failed", originalValue, e);
            }
        }
        Object parsedValue = LiteralParser.parse(value);
        String valueClassName = parsedValue.getClass().getName();
        final Object serviceObject = decode ? new Decode(originalValue) : parsedValue;
        Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
        propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName);
        }
        this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService);
    }
protected synchronized void activate ( BundleContext context , Map < String , Object > props ) { String jndiName = ( String ) props . get ( "jndiName" ) ; String originalValue = ( String ) props . get ( "value" ) ; boolean decode = ( Boolean ) props . get ( "decode" ) ; if ( jndiName == null || jndiName . isEmpty ( ) || originalValue == null || originalValue . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set" ) ; } return ; } String value = originalValue ; if ( decode ) { try { value = PasswordUtil . decode ( originalValue ) ; } catch ( Exception e ) { Tr . error ( tc , "jndi.decode.failed" , originalValue , e ) ; } } Object parsedValue = LiteralParser . parse ( value ) ; String valueClassName = parsedValue . getClass ( ) . getName ( ) ; final Object serviceObject = decode ? new Decode ( originalValue ) : parsedValue ; Dictionary < String , Object > propertiesForJndiService = new Hashtable < String , Object > ( ) ; propertiesForJndiService . put ( "osgi.jndi.service.name" , jndiName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName ) ; } this . serviceRegistration = context . registerService ( valueClassName , serviceObject , propertiesForJndiService ) ; }
Registers the JNDI service for the supplied properties as long as the jndiName and value are set

@param context
@param props The properties containing values for <code>"jndiName"</code> and <code>"value"</code>