Package org.apache.stratos.messaging.event.topology

Examples of org.apache.stratos.messaging.event.topology.ServiceCreatedEvent


            // Return if topology has not been initialized
            if (!topology.isInitialized())
                return false;

            // Parse complete message and build event
            ServiceCreatedEvent event = (ServiceCreatedEvent) Util.jsonToObject(message, ServiceCreatedEvent.class);

            // Apply service filter
            if (TopologyServiceFilter.getInstance().isActive()) {
                if (TopologyServiceFilter.getInstance().serviceNameExcluded(event.getServiceName())) {
                    // Service is excluded, do not update topology or fire event
                    if (log.isDebugEnabled()) {
                        log.debug(String.format("Service is excluded: [service] %s", event.getServiceName()));
                    }
                    return false;
                }
            }

            // Validate event against the existing topology
            if (topology.serviceExists(event.getServiceName())) {
                if (log.isWarnEnabled()) {
                    log.warn(String.format("Service already created: [service] %s", event.getServiceName()));
                }
            } else {
             
              // Apply changes to the topology
              Service service = new Service(event.getServiceName(), event.getServiceType());
              service.addPorts(event.getPorts());
              topology.addService(service);
             
              if (log.isInfoEnabled()) {
                log.info(String.format("Service created: [service] %s", event.getServiceName()));
              }
            }


            notifyEventListeners(event);
View Full Code Here

TOP

Related Classes of org.apache.stratos.messaging.event.topology.ServiceCreatedEvent

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.