Package flex.messaging

Examples of flex.messaging.MessageBroker


     */
    public void testSetValidatorBookRemoved()
    {
        try
        {
            MessageBroker broker = FlexContext.getMessageBroker();
            ClassDeserializationValidator dsvalidator =(ClassDeserializationValidator) broker.getDeserializationValidator();
            dsvalidator.removeAllowClassPattern("blazeds.qa.remotingService.Book");

            //System.out.println("Book Validator had Book removed from allowed");
        }
        catch(Exception e)
View Full Code Here


            dsvalidator.addAllowClassPattern("blazeds.qa.remotingService.Book");
            dsvalidator.removeAllowClassPattern("blazeds.qa.remotingService.Book");
            dsvalidator.addAllowClassPattern("blazeds.qa.remotingService.Book");
            dsvalidator.addDisallowClassPattern("blazeds.qa.remotingService.Book");
            dsvalidator.removeDisallowClassPattern("blazeds.qa.remotingService.Book");
            MessageBroker broker = FlexContext.getMessageBroker();
            broker.setDeserializationValidator(dsvalidator);
            //System.out.println("Validator with Book, flex and java set!");
        }
        catch(Exception e)
        {
            System.out.println("test set validator error: " + e.toString());
View Full Code Here

            dsvalidator.addAllowClassPattern("java.*");
            dsvalidator.addAllowClassPattern("javax.*");
            dsvalidator.addAllowClassPattern("\\[Ljava.*");
            dsvalidator.addAllowClassPattern("\\[B*");
            dsvalidator.addDisallowClassPattern("blazeds.qa.remotingService.Book");
            MessageBroker broker = FlexContext.getMessageBroker();
            broker.setDeserializationValidator(dsvalidator);
            //System.out.println("Validator with only 'flex.*' and java, set!");
        }
        catch(Exception e)
        {
            System.out.println("test set empty validator error: " + e.toString());
View Full Code Here

     */
    public void testSetNullValidator()
    {
        try
        {
            MessageBroker broker = FlexContext.getMessageBroker();
            broker.setDeserializationValidator(null);
            //System.out.println("Validator set to null");
        }
        catch(Exception e)
        {
            System.out.println("test set null validator error (remove validator): " + e.toString());
View Full Code Here

    public void testSetTestValidator()
    {
        try
        {
            TestDeserializationValidator dsvalidator = new TestDeserializationValidator();
            MessageBroker broker = FlexContext.getMessageBroker();
            broker.setDeserializationValidator(dsvalidator);
            //System.out.println("TestValidator with class logging only set!");
        }
        catch(Exception e)
        {
            System.out.println("test set TestValidator error: " + e.toString());
View Full Code Here

        }     
       
        this.id = id;
       
        // Update the service id in the broker
        MessageBroker broker = getMessageBroker();
        if (broker != null)
        {
            // broker must have the service then
            broker.removeService(oldId);
            broker.addService(this);
        }           
    }
View Full Code Here

     *
     * @param broker <code>MessageBroker</code> of the <code>AbstractBootstrapService</code>.
     */
    public void setMessageBroker(MessageBroker broker)
    {
        MessageBroker oldBroker = getMessageBroker();                                   

        this.broker = broker;

        if (oldBroker != null)
        {
            oldBroker.removeService(getId());
        }      
               
        // Add service to the new broker if needed
        if (broker.getService(getId()) != this)
            broker.addService(this);       
View Full Code Here

                        }
                    }
                    instance.applicationInstance = inst;

                    // increment attribute-id reference count on MB
                    MessageBroker mb = FlexContext.getMessageBroker();
                    if (mb != null)
                    {
                        mb.incrementAttributeIdRefCount(instance.getAttributeId());
                    }
                }
            }
            catch (Throwable t)
            {
                ConfigurationException ex = new ConfigurationException();
                ex.setMessage(SINGLETON_ERROR, new Object[] { instance.getSource(), id });
                ex.setRootCause(t);

                if (Log.isError())
                    Log.getLogger(ConfigurationManager.LOG_CATEGORY).error(ex.getMessage() + StringUtils.NEWLINE + ExceptionUtil.toString(t));

                throw ex;
            }
        }
        else if(instance.getScope().equalsIgnoreCase(SCOPE_SESSION))
        {
            // increment attribute-id reference count on MB for Session scoped instances
            MessageBroker mb = FlexContext.getMessageBroker();
            if (mb != null)
            {
                mb.incrementAttributeIdRefCount(instance.getAttributeId());
            }
        }
        return instance;
    }
View Full Code Here

        // if we are stopping a destination with an Application or Session scoped assembler, we may
        // have to remove the assembler from the ServletContext or Session
        if (factoryInstance != null)
        {
            MessageBroker mb = FlexContext.getMessageBroker();
            String attributeId = factoryInstance.getAttributeId();

            if (FlexFactory.SCOPE_APPLICATION.equals(factoryInstance.getScope()))
            {

                ServletContext ctx = FlexContext.getServletConfig().getServletContext();

                // this should never be the case, but just in case
                if (ctx == null)
                    return;

                synchronized (ctx)
                {
                    // remove from ServletContext if reference count is zero
                    int refCount = (mb != null) ? mb.decrementAttributeIdRefCount(attributeId) : 0;
                    if (refCount <= 0)
                    {
                        // remove assembler from servlet context
                        ctx.removeAttribute(attributeId);
                    }
                }
            }
            else if (FlexFactory.SCOPE_SESSION.equals(factoryInstance.getScope()))
            {
                FlexSession session = FlexContext.getFlexSession();

                // if this is being stopped during runtime config, we should have a session available to us
                // However, if this is being stopped on MessageBroker shutdown, we will not have a session
                // but do not need to worry about clean up in that case as the entire session will be cleaned up
                if (session == null)
                    return;

                // remove from Session if reference count is zero
                int refCount = (mb != null) ? mb.decrementAttributeIdRefCount(attributeId) : 0;
                if (refCount <= 0)
                {
                    // remove assembler from servlet context
                    session.removeAttribute(attributeId);
                }
View Full Code Here

    {
        if (isStarted())
            return;

        // Check if the MessageBroker is started
        MessageBroker broker = getMessageBroker();
        if (!broker.isStarted())
        {
            if (Log.isWarn())
            {
                Log.getLogger(getLogCategory()).warn("Endpoint with id '{0}' cannot be started" +
                        " when the MessageBroker is not started.",
                        new Object[]{getId()});
            }
            return;
        }

        // Set up management
        if (isManaged() && broker.isManaged())
        {
            setupEndpointControl(broker);
            MessageBrokerControl controller = (MessageBrokerControl)broker.getControl();
            if (getControl() != null)
                controller.addEndpoint(this);
        }

        // Setup Deserializer and Serializer for the SerializationContext
View Full Code Here

TOP

Related Classes of flex.messaging.MessageBroker

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.