Package flex.messaging.services.remoting

Examples of flex.messaging.services.remoting.RemotingDestination


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

    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

     * @param id The id of the <code>RemotingDestination</code>.
     * @return The <code>Destination</code> instanced created.
     */
    public Destination createDestination(String id)
    {
        RemotingDestination destination = new RemotingDestination();
        destination.setId(id);
        destination.setManaged(isManaged());
        destination.setService(this);    

        return destination;
    }
View Full Code Here

     *
     * @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

    System.out.println("[Auto Export JavaBean to BlazeDS RemotingDestination],beans="+ addedBeanNames);
  }
 
  protected void createJavaBeanDestination(Service service, Class clazz) {
    String destinationId = StringUtils.uncapitalize(ClassUtils.getShortName(clazz));
    RemotingDestination destination = (RemotingDestination) service.createDestination(destinationId);

    destination.setSource(clazz.getName());
   
    if(destFactory != null)
      destination.setFactory(destFactory);
        if(destAdapter != null)
          destination.createAdapter(destAdapter);
        if(destScope != null)
          destination.setScope(destScope);
        if(destSecurityConstraint != null)
          destination.setSecurityConstraint(destSecurityConstraint);
        if(destChannel != null)
          destination.addChannel(destChannel);
   
        service.addDestination(destination);
  }
View Full Code Here

     * @param id The id of the <code>RemotingDestination</code>.
     * @return The <code>Destination</code> instanced created.
     */
    public Destination createDestination(String id)
    {
        RemotingDestination destination = new RemotingDestination();
        destination.setId(id);
        destination.setManaged(isManaged());
        destination.setService(this);

        return destination;
    }
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.