Package flex.messaging.services.remoting

Examples of flex.messaging.services.remoting.RemotingDestination


     *
     * @param destination The <code>Destination</code> instance to be added.
     */
    public void addDestination(Destination destination)
    {
        RemotingDestination remotingDest = (RemotingDestination)destination;
        super.addDestination(remotingDest);
    }
View Full Code Here


        */

        if (msg instanceof RemotingMessage)
        {
            RemotingMessage message = (RemotingMessage)msg;
            RemotingDestination destination = (RemotingDestination)getDestination(msg);
            RemotingDestinationControl destinationControl = (destination.isManaged()) ? (RemotingDestinationControl)destination.getControl() : null;

            if (destination != null)
            {
                ServiceAdapter adapter = destination.getAdapter();
                long startTime = 0;
                if (destinationControl != null)
                    startTime = System.currentTimeMillis();
                try
                {
View Full Code Here

        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);
                    }
                }
            }
View Full Code Here

            return;
        }
        super.start();
        validateInstanceSettings();

        RemotingDestination remotingDestination = (RemotingDestination) getDestination();
        if (FlexFactory.SCOPE_APPLICATION.equals(remotingDestination.getScope()))
        {
            FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();
            createInstance(factoryInstance.getInstanceClass());
        }
    }
View Full Code Here

    //--------------------------------------------------------------------------

    /** {@inheritDoc} */
    public Object invoke(Message message)
    {
        RemotingDestination remotingDestination = (RemotingDestination)getDestination();
        RemotingMessage remotingMessage = (RemotingMessage)message;
        FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();

        // We don't allow the client to specify the source for
        // Java based services.
        String className = factoryInstance.getSource();
        remotingMessage.setSource(className);

        String methodName = remotingMessage.getOperation();
        List parameters = remotingMessage.getParameters();
        Object result = null;

        try
        {
            // Test that the target method may be invoked based upon include/exclude method settings.
            if (includeMethods != null)
            {
                RemotingMethod method = (RemotingMethod)includeMethods.get(methodName);
                if (method == null)
                    MethodMatcher.methodNotFound(methodName, null, new Match(null));

                // Check method-level security constraint, if defined.
                SecurityConstraint constraint = method.getSecurityConstraint();
                if (constraint != null)
                    getDestination().getService().getMessageBroker().getLoginManager().checkConstraint(constraint);
            }
            else if ((excludeMethods != null) && excludeMethods.containsKey(methodName))
                MethodMatcher.methodNotFound(methodName, null, new Match(null));

            // Lookup and invoke.
            Object instance = createInstance(factoryInstance.getInstanceClass());
            if (instance == null)
            {
                MessageException me = new MessageException("Null instance returned from: " + factoryInstance);
                me.setCode("Server.Processing");
                throw me;
            }
            Class c = instance.getClass();

            MethodMatcher methodMatcher = remotingDestination.getMethodMatcher();
            Method method = methodMatcher.getMethod(c, methodName, parameters);
            result = method.invoke(instance, parameters.toArray());

            saveInstance(instance);
        }
View Full Code Here

     *
     * @see flex.messaging.FlexFactory
     */
    protected Object createInstance(Class cl)
    {
        RemotingDestination remotingDestination = (RemotingDestination) getDestination();
        // Note: this breaks the admin console right now as we use this to call
        // mbean methods.  Might have performance impact as well?
        //assertAccess(cl.getName());
        FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();
        Object instance = factoryInstance.lookup();
        if (isStarted() && instance instanceof FlexComponent
                && !((FlexComponent)instance).isStarted())
        {
            ((FlexComponent)instance).start();
View Full Code Here

     * this sets the attribute in the FlexSession to trigger sesison replication
     * for this attribute.
     */
    protected void saveInstance(Object instance)
    {
        RemotingDestination remotingDestination = (RemotingDestination) getDestination();
        FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();
        factoryInstance.operationComplete(instance);
    }
View Full Code Here

        }
    }

    protected void validateInstanceSettings()
    {
        RemotingDestination remotingDestination = (RemotingDestination) getDestination();
        // This will validate that we have a valid factory instance and accesses
        // any constructor properties needed for our factory so they do not give
        // startup warnings.
        remotingDestination.getFactoryInstance();
    }
View Full Code Here

     * @param methodName The method name.
     * @return <code>true</code> if the method is defined; otherwise <code>false</code>.
     */
    private boolean isMethodDefinedBySource(String methodName)
    {
        RemotingDestination remotingDestination = (RemotingDestination)getDestination();
        FactoryInstance factoryInstance = remotingDestination.getFactoryInstance();
        Class c = factoryInstance.getInstanceClass();
        if (c == null)
            return true; // No source class; ignore validation and generate an error at runtime.
        Method[] methods = c.getMethods();
        int n = methods.length;
View Full Code Here

TOP

Related Classes of flex.messaging.services.remoting.RemotingDestination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.