protected boolean doActivate()

in src/main/java/org/apache/sling/jcr/registration/impl/JndiRegistrationSupport.java [92:115]


    protected boolean doActivate() {
        @SuppressWarnings("unchecked")
        Dictionary<String, Object> props = this.getComponentContext().getProperties();
        Properties env = new Properties();
        for (Enumeration<String> pe = props.keys(); pe.hasMoreElements();) {
            String key = pe.nextElement();
            if (key.startsWith("java.naming.")) {
                env.setProperty(key, (String) props.get(key));
            }
        }

        try {
            // create the JNDI context for registration
            this.jndiContext = this.createInitialContext(env);
            logger.info("Using JNDI context {} to register repositories", this.jndiContext.getEnvironment());

            return true;
        } catch (NamingException ne) {
            logger.error("Problem setting up JNDI initial context, repositories will not be registered. Reason: {}", ne.getMessage());
        }

        // fallback to false
        return false;
    }