public void initialize()

in remoting/src/main/java/flex/messaging/services/remoting/adapters/JavaAdapter.java [239:297]


    public void initialize(String id, ConfigMap properties) {
        ConfigMap methodsToInclude = properties.getPropertyAsMap(PROPERTY_INCLUDE_METHODS, null);
        if (methodsToInclude != null) {
            List methods = methodsToInclude.getPropertyAsList(METHOD_ELEMENT, null);
            if ((methods != null) && !methods.isEmpty()) {
                int n = methods.size();
                for (int i = 0; i < n; i++) {
                    ConfigMap methodSettings = (ConfigMap) methods.get(i);
                    String name = methodSettings.getPropertyAsString(NAME_ELEMENT, null);
                    RemotingMethod method = new RemotingMethod();
                    method.setName(name);
                    // Check for security constraint.
                    String constraintRef = methodSettings.getPropertyAsString(ConfigurationConstants.SECURITY_CONSTRAINT_ELEMENT, null);
                    if (constraintRef != null) {
                        try {
                            method.setSecurityConstraint(getDestination().getService().getMessageBroker().getSecurityConstraint(constraintRef));
                        } catch (SecurityException se) {
                            // Rethrow with a more descriptive message.
                            ConfigurationException ce = new ConfigurationException();
                            ce.setMessage(REMOTING_METHOD_REFS_UNDEFINED_CONSTRAINT_ERRMSG, new Object[]{name, getDestination().getId(), constraintRef});
                            throw ce;
                        }
                    }
                    addIncludeMethod(method);
                }
            }
        }
        ConfigMap methodsToExclude = properties.getPropertyAsMap(PROPERTY_EXCLUDE_METHODS, null);
        if (methodsToExclude != null) {
            // Warn that <exclude-properties> will be ignored.
            if (includeMethods != null) {
                RemotingDestination dest = (RemotingDestination) getDestination();
                if (Log.isWarn())
                    Log.getLogger(LogCategories.CONFIGURATION).warn("The remoting destination '" + dest.getId() + "' contains both <include-methods/> and <exclude-methods/> configuration. The <exclude-methods/> block will be ignored.");
            }
            // Excludes must be processed regardless of whether we add them or not to avoid 'Unused tags in <properties>' exceptions.
            List methods = methodsToExclude.getPropertyAsList(METHOD_ELEMENT, null);
            if ((methods != null) && !methods.isEmpty()) {
                int n = methods.size();
                for (int i = 0; i < n; i++) {
                    ConfigMap methodSettings = (ConfigMap) methods.get(i);
                    String name = methodSettings.getPropertyAsString(NAME_ELEMENT, null);
                    RemotingMethod method = new RemotingMethod();
                    method.setName(name);
                    // Check for security constraint.
                    String constraintRef = methodSettings.getPropertyAsString(ConfigurationConstants.SECURITY_CONSTRAINT_ELEMENT, null);
                    // Conditionally add, only if include methods are not defined.
                    if (includeMethods == null) {
                        if (constraintRef != null) {
                            RemotingDestination dest = (RemotingDestination) getDestination();
                            if (Log.isWarn())
                                Log.getLogger(LogCategories.CONFIGURATION).warn("The method '" + name + "' for remoting destination '" + dest.getId() + "' is configured to use a security constraint, but security constraints are not applicable for excluded methods.");
                        }
                        addExcludeMethod(method);
                    }
                }
            }
        }
    }