Package flex.messaging.services

Examples of flex.messaging.services.Service


                String serviceType = (String) params.get(1);
                // In this case, the destName is not used because the dest is in the
                // message.  It is here just to be consistent with the other methods and
                // in case we need to send something to a destination without a message.
                // String destName = (String) params.get(2);
                Service svc = clusterManager.getMessageBroker().getServiceByType(serviceType);
                if (svc != null)
                {
                    String methodName = (String) params.get(0);
                    Object[] paramValues = params.subList(3, params.size()).toArray();
                    Method[] svcMethods = svc.getClass().getMethods();
                    // note: in order to avoid requiring services to have specific formal
                    // types on methods (superclasses aren't honored by reflection) we just
                    // grab the first method we see with the correct name
                    // -- intended for internal use only
                    for (int i=0; i<svcMethods.length; i++)
View Full Code Here


            ServiceSettings svcSettings = (ServiceSettings)iter.next();
            String svcId = svcSettings.getId();
            String svcClassName = svcSettings.getClassName();

            // Create the Service
            Service service = broker.createService(svcId, svcClassName);

            // Service Class Name - not needed in AbstractService

            // Initialize with service properties
            service.initialize(svcId, svcSettings.getProperties());

            // Default Channels
            for (Iterator chanIter = svcSettings.getDefaultChannels().iterator(); chanIter.hasNext();)
            {
                ChannelSettings chanSettings = (ChannelSettings)chanIter.next();
                service.addDefaultChannel(chanSettings.getId());
            }

            // Adapter Definitions
            Map svcAdapterSettings = svcSettings.getAllAdapterSettings();
            for (Iterator asIter = svcAdapterSettings.values().iterator(); asIter.hasNext();)
            {
                AdapterSettings as = (AdapterSettings) asIter.next();
                service.registerAdapter(as.getId(), as.getClassName());
                if (as.isDefault())
                {
                    service.setDefaultAdapter(as.getId());
                }
            }

            // Destinations
            Map destinationSettings = svcSettings.getDestinationSettings();
View Full Code Here

            getAdapter().start();
            return;
        }

        // Check if the Service is started
        Service service = getService();
        if (!service.isStarted())
        {
            if (Log.isWarn())
            {
                Log.getLogger(getLogCategory()).warn("Destination with id '{0}' cannot be started" +
                        " when its Service with id '{1}' is not started.",
                        new Object[]{getId(), service.getId()});
            }
            return;
        }

        // Set up management
        if (isManaged() && service.isManaged())
        {
            setupDestinationControl(service);
            ServiceControl controller = (ServiceControl)service.getControl();
            if (getControl() != null)
                controller.addDestination(getControl().getObjectName());
        }

        super.start();
View Full Code Here

        String oldId = getId();

        super.setId(id);

        // Update the destination id in the service and MessageBroker
        Service service = getService();
        if (service != null)
        {
            service.getMessageBroker().unregisterDestination(oldId);
            service.getDestinations().remove(oldId);
            service.getMessageBroker().registerDestination(id, service.getId());
            service.getDestinations().put(id, this);
        }
    }
View Full Code Here

     *
     * @param service The <code>Service</code> managing this <code>Destination</code>.
     */
    public void setService(Service service)
    {
        Service oldService = getService();

        setParent(service);

        if (oldService != null)
            oldService.removeDestination(getId());

        // Add the destination to the service if needed
        if (service.getDestination(getId()) != this)
            service.addDestination(this);
    }
View Full Code Here

     *
     * @return The Java class name for the <code>Service</code> manageing this <code>Destination</code>.
     */
    public String getServiceType()
    {
        Service service = getService();
        if (service == null)
        {
            return null;
        }
        else
        {
            return service.getClass().getName();
        }
    }
View Full Code Here

    /** @exclude */
    public Service getServiceByType(String type)
    {
        for (Iterator serviceIter=services.values().iterator(); serviceIter.hasNext(); )
        {
            Service svc = (Service) serviceIter.next();
            if (svc.getClass().getName().equals(type))
            {
                return svc;
            }
        }
        return null;
View Full Code Here

                servicesConfig.addProperty("default-channels", defaultChannelsMap);
        }

        for (Iterator iter = services.values().iterator(); iter.hasNext();)
        {
            Service service = (Service) iter.next();
            ConfigMap serviceConfig = service.describeService(endpoint);
            if (serviceConfig != null && serviceConfig.size() > 0)
                servicesConfig.addProperty("service", serviceConfig);
        }

        // Need to send channel properties again in case the client didn't
View Full Code Here

     */
    public Service createService(String id, String className)
    {
        Class svcClass = ClassUtil.createClass(className, getClassLoader());

        Service service = (Service)ClassUtil.createDefaultInstance(svcClass, Service.class);
        service.setId(id);
        service.setManaged(isManaged());
        service.setMessageBroker(this);

        return service;
    }
View Full Code Here

     * @param id The id of the <code>Service</code>.
     * @return Previous <code>Service</code> associated with the id.
     */
    public Service removeService(String id)
    {
        Service service = getService(id);
        if (service != null)
        {
            service.stop();
            services.remove(id);
        }
        return service;
    }
View Full Code Here

TOP

Related Classes of flex.messaging.services.Service

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.