// TODO: Implement /* * * private SIF_Request createSIF_Request( ElementDef objectType, String refId, Zone zone ) * { * SIF_Request request = new SIF_Request(); * request.getHeader().setSIF_MsgId( MSG_GUID ); * request.getHeader().setSIF_SourceId( "foo" ); * request.setSIF_MaxBufferSize("32768"); * request.setSIF_Version( ADK.getSIFVersion().toString() ); * Query query = new Query(objectType); * query.addCondition(SifDtd.SIF_REPORTOBJECT_REFID, Condition.EQ, refId); * * SIF_Query q = SIFPrimitives.createSIF_Query(query, zone); * SIF_QueryObject sqo = new SIF_QueryObject(); * sqo.setObjectName( objectType.name() ); * * q.setSIF_QueryObject(sqo); * request.setSIF_Query(q); * * return request; * } * */ private SIF_Response createSIF_Response(IElementDef objType, bool storeInRequestCache, ISerializable stateObject) { SIF_Request req = createSIF_Request(objType); if (storeInRequestCache) { Query q = new Query(objType); q.UserData = stateObject; RequestCache.GetInstance(fAgent).StoreRequestInfo(req, q, fZone); } SIF_Response resp = new SIF_Response(); resp.SIF_RequestMsgId = req.Header.SIF_MsgId; SIF_ObjectData sod = new SIF_ObjectData(); resp.SIF_ObjectData = sod; Object responseObject = null; try { responseObject = ClassFactory.CreateInstance(objType.FQClassName, false); } catch (Exception cfe) { throw new AdkException("Unable to create instance of " + objType.Name, fZone, cfe); } sod.AddChild((SifElement)responseObject); return(resp); }
public static SifMessagePayload MakeSIFMessagePayload(SifElement payload) { if (payload is SIF_Response) { return((SIF_Response)payload); } SIF_Response rsp = new SIF_Response(); rsp.SetSIF_MorePackets(YesNo.NO); rsp.SIF_RequestMsgId = Adk.MakeGuid(); rsp.SIF_PacketNumber = 1; SIF_Header hdr = rsp.Header; hdr.SIF_Timestamp = DateTime.Now; hdr.SIF_MsgId = Adk.MakeGuid(); hdr.SIF_SourceId = "ADK Unit Tests"; hdr.SetSIF_Security(new SIF_SecureChannel(AuthenticationLevel.ZERO, EncryptionLevel.ZERO)); hdr.SIF_DestinationId = "Schema Validator"; if (payload is SifDataObject) { SIF_ObjectData data = new SIF_ObjectData(); data.AddChild(payload); rsp.SIF_ObjectData = data; } else if (payload is SIF_ObjectData) { rsp.SIF_ObjectData = (SIF_ObjectData)payload; } else { throw new ArgumentException("Unable to use payload: " + payload.ElementDef.Name); } return(rsp); }