Esempio n. 1
0
 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="sifEventObject">Contains the actual object (partial or whole) that is being added, changed or deleted.</param>
 ///
 public SIF_ObjectData( SIF_EventObject sifEventObject )
     : base(InfraDTD.SIF_OBJECTDATA)
 {
     this.SIF_EventObject = sifEventObject;
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor that accepts values for all mandatory fields
 /// </summary>
 ///<param name="sifEventObject">Contains the actual object (partial or whole) that is being added, changed or deleted.</param>
 ///
 public SIF_ObjectData(SIF_EventObject sifEventObject) : base(InfraDTD.SIF_OBJECTDATA)
 {
     this.SIF_EventObject = sifEventObject;
 }
        private SIF_Event createSIF_Event(IElementDef objType)
        {
            SIF_Event evnt = new SIF_Event();
             evnt.Header.SIF_SourceId = "foo";
             SIF_ObjectData sod = new SIF_ObjectData();
             SIF_EventObject obj = new SIF_EventObject();
             obj.ObjectName = objType.Name;
             sod.SIF_EventObject = obj;
             evnt.SIF_ObjectData = sod;

             obj.Action = EventAction.Add.ToString();

             Object eventObject = null;
             try
             {
            eventObject = ClassFactory.CreateInstance(objType.FQClassName);
             }
             catch (Exception cfe)
             {
            throw new AdkException("Unable to create instance of " + objType.Name, fZone, cfe);
             }

             obj.AddChild(objType, (SifElement)eventObject);

             return evnt;
        }
Esempio n. 4
0
        /**
         *  Sends a SIF_Event
         *  @param zone The zone to send the sifEvent to
         */
        public SIF_Ack SifEvent(IZone zone, Event sifEvent, String destinationId, String sifMsgId)
        {
            if (sifEvent.Data == null || sifEvent.Data.Available == false)
            {
                throw new AdkException("The sifEvent has no SIFDataObjects", zone);
            }

            SIF_ObjectData od = new SIF_ObjectData();

            //  Fill out the SIF_ObjectData
            IDataObjectInputStream inStr = sifEvent.Data;
            SifDataObject data = inStr.ReadDataObject();

            SifVersion msgVersion = data.EffectiveSIFVersion;

            SIF_EventObject eo = new SIF_EventObject();
            od.SIF_EventObject = eo;
            eo.Action = sifEvent.ActionString;
            eo.ObjectName = data.ElementDef.Tag(msgVersion);

            // Create the SIF_Event object
            SIF_Event msg = new SIF_Event(msgVersion);
            msg.SIF_ObjectData = od;

            SIF_Header msgHdr = msg.Header;

            //	Assign SIF_DestinationId if applicable
            if (destinationId != null)
            {
                msgHdr.SIF_DestinationId = destinationId;
            }

            while (data != null)
            {
                eo.Attach(data);
                data = inStr.ReadDataObject();
            }

            if (sifMsgId != null)
            {
                msgHdr.SIF_MsgId = sifMsgId;
            }

            SifContext[] contexts = sifEvent.Contexts;
            if (contexts == null)
            {
                contexts = new SifContext[] { SifContext.DEFAULT };
            }

            SIF_Contexts msgContexts = new SIF_Contexts();
            foreach (SifContext context in contexts)
            {
                msgContexts.AddSIF_Context(context.Name);
            }
            msgHdr.SIF_Contexts = msgContexts;
            return ((ZoneImpl)zone).Dispatcher.send(msg);
        }