Exemplo n.º 1
0
 public DiscoveredService(String _ServiceGlobalUniqueName, Uri _ServiceURI, DiscoverableServiceType _ServiceType, DateTime _LastAnnouncementTime)
 {
     ServiceGlobalUniqueName = _ServiceGlobalUniqueName;
     ServiceUri = _ServiceURI;
     ServiceType = _ServiceType;
     LastAnnouncementTime = _LastAnnouncementTime;
 }
Exemplo n.º 2
0
 public DiscoveredService(String _ServiceGlobalUniqueName, Uri _ServiceURI, DiscoverableServiceType _ServiceType)
 {
     ServiceGlobalUniqueName = _ServiceGlobalUniqueName;
     ServiceUri = _ServiceURI;
     ServiceType = _ServiceType;
     LastAnnouncementTime = TimestampNonce.Now;
 }
Exemplo n.º 3
0
            public void Deserialize(byte[] mySerializedBytes)
            {
                SerializationReader reader = new SerializationReader(mySerializedBytes);

                ServiceGlobalUniqueName         = reader.ReadString();
                String _ServiceUri              = reader.ReadString();
                ServiceType                     = (DiscoverableServiceType)reader.ReadOptimizedByte();

                if (!Uri.TryCreate(_ServiceUri,UriKind.Absolute,out ServiceUri))
                    throw new NotificationException_InvalidNotificationPayload("IP not parseable. Notification Packet invalid!");
            }
Exemplo n.º 4
0
        /// <summary>
        /// the constructor, you can have as much Announcers as you need to announce all the services you have
        /// </summary>
        public Announcer(String _ServiceGlobalUniqueName, Uri _ServiceUri, DiscoverableServiceType _ServiceType)
        {
            Debug.WriteLine("[Announcer] Service Announcer is starting up for Service "+_ServiceGlobalUniqueName+" !");

            _internalServiceGlobalUniqueName = _ServiceGlobalUniqueName;
            ServiceUri = _ServiceUri;
            ServiceType = _ServiceType;

            NotificationSettings NotificationSettings = new NotificationSettings();
            NotificationSettings.StartBrigde = true;
            _NotificationDispatcher = new NotificationDispatcher(new UUID("ServiceDiscovery_Announcement"), NotificationSettings);

            //// Start the Housekeeper Thread which gets rid of timeouted known services
            Thread Announcer_Thread = new Thread(new ThreadStart(AnnouncerThread));
            Announcer_Thread.Name = "Announcer.AnnouncerThread()";
            Announcer_Thread.Start();
            Debug.WriteLine("[Announcer] Service Announcer is up and running for Service " + _ServiceGlobalUniqueName + " !");
        }
Exemplo n.º 5
0
 public Arguments(String _ServiceName, Uri _ServiceUri, DiscoverableServiceType _ServiceType)
 {
     ServiceGlobalUniqueName = _ServiceName;
     ServiceUri = _ServiceUri;
     ServiceType = _ServiceType;
 }
Exemplo n.º 6
0
 /// <summary>
 /// this method adds a DiscoverableService to the List of Services to look for, e.g. that can be discovered
 /// </summary>
 /// <param name="Type">the type of the Service</param>
 public void AddDiscoverableService(DiscoverableServiceType Type)
 {
     switch (Type)
     {
         case DiscoverableServiceType.Database:
             Debug.WriteLine("[Discovery] Added Database Discovery");
             _NotificationDispatcher.RegisterRecipient(new NSD_Database(), this);
             break;
         case DiscoverableServiceType.Filesystem:
             Debug.WriteLine("[Discovery] Added Filesystem Discovery");
             _NotificationDispatcher.RegisterRecipient(new NSD_Filesystem(), this);
             break;
         case DiscoverableServiceType.StorageEngine:
             Debug.WriteLine("[Discovery] Added StorageEngine Discovery");
             _NotificationDispatcher.RegisterRecipient(new NSD_StorageEngine(), this);
             break;
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// this method removes a DiscoverableService from the List of Services to look for, e.g. that can be discovered
 /// </summary>
 /// <param name="Type">the type of the Service</param>
 public void RemoveDiscoverableService(DiscoverableServiceType Type)
 {
     switch (Type)
     {
         case DiscoverableServiceType.Database:
             _NotificationDispatcher.UnRegisterRecipient(new NSD_Database(), this);
             break;
         case DiscoverableServiceType.Filesystem:
             _NotificationDispatcher.UnRegisterRecipient(new NSD_Filesystem(), this);
             break;
         case DiscoverableServiceType.StorageEngine:
             _NotificationDispatcher.UnRegisterRecipient(new NSD_StorageEngine(), this);
             break;
     }
 }