/*>> XLinguServiceEventBroadcaster
760487
public boolean addLinguServiceEventListener(XLinguServiceEventListener xLinEvLis) {

		boolean ret = false;
		if (xLinEvLis == null) {
			ret = false;
		} else {
			xEventListeners.add(xLinEvLis);
			ret = true;
		}

		return ret;
    }
24444
@Beta
    public EventGridEvent[] deserializeEventGridEvents(final String requestContent, final SerializerAdapter<ObjectMapper> serializerAdapter) throws IOException {
        EventGridEvent[] eventGridEvents = serializerAdapter.<EventGridEvent[]>deserialize(requestContent, EventGridEvent[].class);
        for (EventGridEvent receivedEvent : eventGridEvents) {
            if (receivedEvent.data() == null) {
                continue;
            } else {
                final String eventType = receivedEvent.eventType();
                final Type eventDataType;
                if (SystemEventTypeMappings.containsMappingFor(eventType)) {
                    eventDataType = SystemEventTypeMappings.getMapping(eventType);
                } else if (containsCustomEventMappingFor(eventType)) {
                    eventDataType = getCustomEventMapping(eventType);
                } else {
                    eventDataType = null;
                }
                if (eventDataType != null) {
                    final String eventDataAsString = serializerAdapter.serializeRaw(receivedEvent.data());
                    final Object eventData = serializerAdapter.<Object>deserialize(eventDataAsString, eventDataType);
                    setEventData(receivedEvent, eventData);
                }
            }
        }
        return eventGridEvents;
    }
1001712
function IncomingStream(access_token, userid, groupids) {
    this.access_token = access_token;
    this.userid = userid;
    this.groupids = groupids;

    this.client = new WebSocketClient();
    this.connection = null;
    this.socketId = 1;

    this.state = STATE_DISCONNECTED;

    var self = this;

    var connectionInitHelper = function(connection) {

      connection.on('close', function(reasonCode, description) {
        self.emit('status', 'Websocket Disconnected.', description);
        this.connection = null;
        self.setState(STATE_DISCONNECTED);        
      });

      connection.on('error', function(error) {
        self.handleError("Websocket experienced error.", error);
        self.setState(STATE_DISCONNECTED);
      })
        
      connection.on('message', function(msg) {
        if (msg.type === 'utf8' && msg.utf8Data) {
          
          self.emit('status', 'Received:', msg);
          each(JSON.parse(msg.utf8Data), function(data) {

            if (data["channel"] == "/meta/handshake") {
              self.handshakeResponse(data);
            } else if (data["channel"] == "/meta/subscribe") {
              self.subscribeResponse(data);
            } else {
              self.emit('message', data);
            }

          });

        } else {
          self.emit('error','Received a non-utf8 message.', msg);
        }
      });

      return connection;

    }

    this.client.on('connect', function(connection) {
      self.setState(STATE_PENDING);  
      self.connection = connectionInitHelper(connection);
      self.emit('status', 'Websocket Connected');
      self.handshake();
    });

    this.client.on('connectFailed', function(err) {
      self.setState(STATE_DISCONNECTED);
      self.connection = null;
      self.emit('error', 'Connection Failed', err);
    });


}
91768
function EventDevAuth (device){
        if (!device.mmsi)  device.mmsi = parseInt (device.devid);
        if (isNaN (device.mmsi)) device.mmsi=String2Hash(device.devid);
        adapter.BroadcastStatic (device);
        if (device.stamp) adapter.BroadcastPos (device);
    }
104280
@Override
    public MessageEvent parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
                    throws XmlPullParserException, IOException {
        MessageEvent messageEvent = new MessageEvent();
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG) {
                if (parser.getName().equals("id"))
                    messageEvent.setStanzaId(parser.nextText());
                if (parser.getName().equals(MessageEvent.COMPOSING))
                    messageEvent.setComposing(true);
                if (parser.getName().equals(MessageEvent.DELIVERED))
                    messageEvent.setDelivered(true);
                if (parser.getName().equals(MessageEvent.DISPLAYED))
                    messageEvent.setDisplayed(true);
                if (parser.getName().equals(MessageEvent.OFFLINE))
                    messageEvent.setOffline(true);
            } else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals("x")) {
                    done = true;
                }
            }
        }

        return messageEvent;
    }
411794
@Override
    public void handleServerEvent(ISFSEvent event) throws SFSException {
        Zone sfsZone = (Zone) event.getParameter(SFSEventParam.ZONE);
        Room sfsRoom = (Room) event.getParameter(SFSEventParam.ROOM);
        User sfsUser = (User) event.getParameter(SFSEventParam.USER);
        User recipient = (User)event.getParameter(SFSEventParam.RECIPIENT);
        String message = (String)event.getParameter(SFSEventParam.MESSAGE);
        ISFSObject params = (ISFSObject)event.getParameter(SFSEventParam.OBJECT);
        ApiPrivateMessageImpl messageObject = new ApiPrivateMessageImpl();
        messageObject.setContent(message);
        messageObject.setZone((ApiZone)sfsZone.getProperty(APIKey.ZONE));
        messageObject.setRoom((sfsRoom != null) 
                ? (ApiRoom)sfsRoom.getProperty(APIKey.ROOM) : null);
        messageObject.setSender((ApiUser)sfsUser.getProperty(APIKey.USER));
        messageObject.setRecipient((ApiUser)recipient.getProperty(APIKey.USER));
        notifyToHandlers(messageObject, params);
    }
799494
private void callEventSubscriptionAndConnect(DeviceProxy device, String eventType)
            throws DevFailed {
        //  Done for IDL>=5 and not for notifd event system (no attribute name)
        String device_name = device.name();
        String[] info = new String[] {
                device_name,
                "",
                "subscribe",
                eventType,
                Integer.toString(device.get_idl_version())
        };
        DeviceData argIn = new DeviceData();
        argIn.insert(info);
        String cmdName = getEventSubscriptionCommandName();
        ApiUtil.printTrace(device.get_adm_dev().name() + ".command_inout(\"" +
                cmdName + "\") for " + device_name + eventType);
        DeviceData argOut =
                device.get_adm_dev().command_inout(cmdName, argIn);
        ApiUtil.printTrace("    command_inout done.");

        //	And then connect to device
        checkDeviceConnection(device, null, argOut, eventType);
    }
1243974
public void broadcast (ClientObject caller, String message, InvocationListener listener)
        throws InvocationException
    {
        BodyObject body = _locator.forClient(caller);

        // make sure the requesting user has broadcast privileges
        InvocationException.requireAccess(body, ChatCodes.BROADCAST_ACCESS);
        broadcast(body.getVisibleName(), null, message, false, true);
    }
667075
public void accept(XVisitor visitor, XLog log) {
		/*
		 * First call.
		 */
		visitor.visitTracePre(this, log);
		/*
		 * Visit the attributes.
		 */
		for (XAttribute attribute: attributes.values()) {
			attribute.accept(visitor, this);
		}
		/*
		 * Visit the events.
		 */
		for (XEvent event: this) {
			event.accept(visitor, this);
		}
		/*
		 * Last call.
		 */
		visitor.visitTracePost(this, log);
	}
627325
@Override
    public XMLEventReader2 createXMLEventReader(URL src)
        throws XMLStreamException
    {
        /* true for auto-close, since caller has no access to the underlying
         * input stream created from the URL
         */
        return new WstxEventReader(createEventAllocator(),
                                   createSR(createPrivateConfig(), src, true, true));
    }
802163
function EventDevPing (device){
        adapter.Debug (7, "EventDevPing devid=%s name=%s", device.devid, device.name);
         
        var msg = 
            {type : 3
            ,devid: device.devid
        };
        adapter.BroadcastJson (msg);
    }
1172362
function newService()
    {
        $callable = $this->callable;
        if ($callable === null)
            ## no callable provided but rather not throw exception
            throw new \Exception('No Factory Callable Provided.');
        
        // ..
        // DO_LEAST_PHPVER_SUPPORT 5.4 Closure Bind
        if ($callable instanceof \Closure && version_compare(phpversion(), '5.4.0') > 0)
            $callable = $callable->bindTo($this);

        return call_user_func( $callable, $this->services() );
    }
224692
@Override
    public XMLEventWriter createXMLEventWriter(Writer w, String enc)
        throws XMLStreamException
    {
        return new Stax2EventWriterImpl(createSW(null, w, enc, false));
    }
1279874
public void onServiceStartedEvent(ServiceStartedEvent event,
			ActivityContextInterface aci) {
		tracer.info("Restcomm SLEE REST Client Enabler Example service activation.");
		try {
			RESTClientEnablerChild child = (RESTClientEnablerChild) getChildRelation()
					.create(ChildRelationExt.DEFAULT_CHILD_NAME);
			String uri = twitterStatusUpdateBaseURI
					+ URLEncoder.encode(
							"Restcomm SLEE REST Client Application Enabler Example ACTIVATED - "
									+ new Date(), "UTF-8");
			RESTClientEnablerRequest request = new RESTClientEnablerRequest(
					RESTClientEnablerRequest.Type.POST, uri)
					.setOAuthConsumer(consumer);
			child.execute(request);
		} catch (Exception e) {
			tracer.severe("failed to post service activation to twitter", e);
		}
	}
32058
function (isPublic, name, data, ttl, published_at, coreid) {
        var rawFn = function (msg) {
            try {
                msg.setMaxAge(parseInt((ttl && (ttl >= 0)) ? ttl : 60));
                if (published_at) {
                    msg.setTimestamp(moment(published_at).toDate());
                }
            }
            catch (ex) {
                logger.error("onCoreHeard - " + ex);
            }
            return msg;
        };

        var msgName = (isPublic) ? "PublicEvent" : "PrivateEvent";
        var userID = (this.userID || "").toLowerCase() + "/";
        name = (name) ? name.toString() : name;
        if (name && name.indexOf && (name.indexOf(userID) == 0)) {
            name = name.substring(userID.length);
        }

        data = (data) ? data.toString() : data;
        this.sendNONTypeMessage(msgName, { event_name: name, _raw: rawFn }, data);
    }
802062
function broadcastEventFromNative(nativeMessage) {
  var params = {};
  if (nativeMessage.error != null) {
    params.error = nativeMessage.error;
  }

  var chcpEvent = new CustomEvent(nativeMessage.action, {
    'detail': params
  });
  document.dispatchEvent(chcpEvent);
}
699414
@Override
    public PipelineEventReader<XMLEventReader, XMLEvent> getEventReader(
            HttpServletRequest request, HttpServletResponse response) {
        final PipelineEventReader<XMLEventReader, XMLEvent> pipelineEventReader =
                this.wrappedComponent.getEventReader(request, response);

        final XMLEventReader eventReader = pipelineEventReader.getEventReader();

        final IStylesheetDescriptor stylesheetDescriptor =
                stylesheetAttributeSource.getStylesheetDescriptor(request);

        final IPortalRequestInfo portalRequestInfo =
                this.urlSyntaxProvider.getPortalRequestInfo(request);

        final XMLEventReader filteredEventReader;
        if (portalRequestInfo.getTargetedPortletWindowId() == null) {
            final IStylesheetParameterDescriptor defaultWindowStateParam =
                    stylesheetDescriptor.getStylesheetParameterDescriptor(
                            "dashboardForcedWindowState");
            if (defaultWindowStateParam != null) {
                // Set all window states to the specified default
                final WindowState windowState =
                        PortletUtils.getWindowState(defaultWindowStateParam.getDefaultValue());
                filteredEventReader =
                        new SinglePortletWindowStateSettingXMLEventReader(
                                request, eventReader, windowState);
            } else {
                // Make sure there aren't any portlets in a "targeted" window state
                filteredEventReader =
                        new NonTargetedPortletWindowStateSettingXMLEventReader(
                                request, eventReader);
            }
        } else {
            // Not mobile, don't bother filtering
            filteredEventReader = eventReader;
        }

        final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
        return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(
                filteredEventReader, outputProperties);
    }