예제 #1
0
        /// <exception cref="Exception"></exception>
        private void populateData()
        {
            AppSensorClient appSensorClient = (AppSensorClient)contextClient.GetObject("AppSensorClient");
            AppSensorServer appSensorServer = (AppSensorServer)contextServer.GetObject("AppSensorServer");
            int             delay           = 500;

            detectionPoint1.setId("IE1");
            detectionSystems1.Add(detectionSystem1);

            ServerConfiguration updatedConfiguration = appSensorServer.getConfiguration();

            updatedConfiguration.setDetectionPoints(loadMockedDetectionPoints());
            appSensorServer.setConfiguration(updatedConfiguration);

            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
        }
        /// <exception cref="XMLStreamException"></exception>
        private DetectionPoint readDetectionPoint(XmlReader xmlReader)
        {
            DetectionPoint detectionPoint = new DetectionPoint();
            bool           finished       = false;

            while (!finished && xmlReader.MoveToNextAttribute())
            {
                //int Event = xmlReader.next();
                string name = XmlUtils.getElementQualifiedName(xmlReader, namespaces);

                switch (xmlReader.NodeType)
                {
                case XmlNodeType.Element:
                    if ("config:id".Equals(name))
                    {
                        detectionPoint.setId(xmlReader.ReadString().Trim());
                    }
                    else if ("config:threshold".Equals(name))
                    {
                        detectionPoint.setThreshold(readThreshold(xmlReader));
                    }
                    else if ("config:response".Equals(name))
                    {
                        detectionPoint.getResponses().Add(readResponse(xmlReader));
                    }
                    else
                    {
                        /** unexpected start element **/
                    }
                    break;

                case XmlNodeType.EndElement:
                    if ("config:detection-point".Equals(name))
                    {
                        finished = true;
                    }
                    else
                    {
                        /** unexpected end element **/
                    }
                    break;

                default:
                    /** unused xml element - nothing to do **/
                    break;
                }
            }

            return(detectionPoint);
        }
        public void doSetup()
        {
            detectionPoint1.setId("IE1");

            detectionSystems1.Add(detectionSystem1);
        }