protected boolean doActivate()

in src/main/java/org/apache/sling/jcr/registration/impl/RmiRegistrationSupport.java [103:130]


    protected boolean doActivate() {

        Object portProp = this.getComponentContext().getProperties().get(
            PROP_REGISTRY_PORT);
        if (portProp instanceof Number) {
            this.registryPort = ((Number) portProp).intValue();
        } else {
            try {
                this.registryPort = Integer.parseInt(String.valueOf(portProp));
            } catch (NumberFormatException nfe) {
                this.registryPort = 0;
            }
        }

        // ensure correct value
        if (this.registryPort < 0) {
            logger.warn("RMI registry disabled (no or negative RMI port configured)");
            return false;
        } else if (this.registryPort == 0) {
            this.registryPort = Registry.REGISTRY_PORT;
        } else if (this.registryPort > 0xffff) {
            logger.warn("Illegal RMI registry port number {} disabling RMI registry", this.registryPort);
            return false;
        }

        logger.info("Using RMI Registry port {}", this.registryPort);
        return true;
    }