1) Integrated with PolicyManager in InfoAgent.Recommend method, when an Info Agent receives a recommendation

rg2023 [2003-05-11 00:49:59]
1) Integrated with PolicyManager in InfoAgent.Recommend method, when an Info Agent receives a recommendation
response, the IA will check with the PolicyManager before sharing the resource(s) recommended
2) Rebuilt installers with latest IA
Filename
discus2/bin/InfoAgent.asmx.cs
discus2/bin/TotalRecallSetup.msi
discus2/bin/TotalRecallSetupDebug.msi
diff --git a/discus2/bin/InfoAgent.asmx.cs b/discus2/bin/InfoAgent.asmx.cs
index efd317f..ce22add 100644
--- a/discus2/bin/InfoAgent.asmx.cs
+++ b/discus2/bin/InfoAgent.asmx.cs
@@ -25,9 +25,50 @@ using PSL.TotalRecall;
 using PSL.TotalRecall.Util;
 using PSL.Web.Services.DynamicInvoke;
 using PSL.Web.Services.DynamicProxy;
-
+using PSL.TotalRecall.PolicyManager;
 namespace TotalRecall
 {
+	public class Context:IContext
+	{
+		private Hashtable m_participants = new Hashtable();
+		private string m_strTopic = "";
+
+		public Context()
+		{}
+
+		public Hashtable Participants
+		{
+			get
+			{ return this.m_participants; }
+		}
+
+		public string Topic
+		{
+			get
+			{ return this.m_strTopic; }
+			set
+			{
+				if( value == null || value.Length == 0 )
+					return;
+
+				this.m_strTopic = value;
+			}
+		}
+
+		public void AddParticipant( string strContactID )
+		{
+			if( strContactID == null || strContactID.Length == 0 )
+				return;
+
+			this.m_participants.Add( strContactID, strContactID );
+		}
+
+		public void ClearParticipants()
+		{
+			this.m_participants.Clear();
+		}
+	}
+
 	/// <summary>
 	/// Summary description for InfoAgent.
 	/// </summary>
@@ -141,7 +182,7 @@ namespace TotalRecall
 			// Set the proxy cache location
 			this.ProxyCache = ConfigurationSettings.AppSettings["ProxyCache"];
 			// Set the database connection string
-			this.DBConnect = ConfigurationSettings.AppSettings["ConnectionString"];
+			this.DBConnect = ConfigurationSettings.AppSettings["DatabaseConnectionString"];
 			// Set the info agent url
 			this.IAUrl = ConfigurationSettings.AppSettings["InfoAgentUrl"];

@@ -1581,16 +1622,49 @@ namespace TotalRecall

 			ParticipantDAO participDAO = new ParticipantDAO( this.DBConnect );
 			ResourceDAO resDAO = new ResourceDAO( this.DBConnect );
+			Context ctx = new Context();
+			ctx.Topic = mtgDAO.GetMeetingTopic( recRespMsg.MeetingID );
+			ArrayList lstParticipants = participDAO.GetParticipants( recRespMsg.MeetingID );
+			IEnumerator participIt = lstParticipants.GetEnumerator();
+			while( participIt.MoveNext() )
+			{
+				MeetingParticipant p = (MeetingParticipant) participIt.Current;
+				ctx.AddParticipant( p.Name );
+			}
+
 			MeetingParticipant organizer = participDAO.GetOrganizer( recRespMsg.MeetingID );

 			IEnumerator it = recRespMsg.ResourceMessage.m_lstResources.GetEnumerator();
 			while( it.MoveNext() )
 			{
 				Resource res = (Resource) it.Current;
-				MeetingResource mtgRes = new MeetingResource( res, recRespMsg.MeetingID, me.Name );
-				// Here is where we would ask the policy manager if it's ok to
-				// share this resource
-				resDAO.AddMeetingResource( mtgRes.MeetingID, mtgRes );
+				// For each resource recommended, clear it with the policy manager
+				// Get the policies governing a resource
+				ArrayList lstPolicy = resDAO.GetResourcePolicies( res.ID );
+				if( lstPolicy.Count == 0 )
+				{
+					MeetingResource mtgRes = new MeetingResource( res, recRespMsg.MeetingID, me.Name );
+					// Here is where we would ask the policy manager if it's ok to
+					// share this resource
+					resDAO.AddMeetingResource( mtgRes.MeetingID, mtgRes );
+					continue; // Move on to next resource
+				}
+
+				// Get the policies governing each resource
+				IEnumerator polIt = lstPolicy.GetEnumerator();
+				while( polIt.MoveNext() )
+				{
+					// Determine what can be shared
+					EvaluationResult evalRes = PolicyManager.evaluatePolicy( (string) polIt.Current, ctx );
+					if( evalRes.Result == true )
+					{
+						MeetingResource mtgRes = new MeetingResource( res, recRespMsg.MeetingID, me.Name );
+						// Here is where we would ask the policy manager if it's ok to
+						// share this resource
+						resDAO.AddMeetingResource( mtgRes.MeetingID, mtgRes );
+						break; // Accept the first policy that is satisfied
+					}
+				}
 			}

 			// If I'm not the organizer then I have to send a context message
diff --git a/discus2/bin/TotalRecallSetup.msi b/discus2/bin/TotalRecallSetup.msi
index 315e7c6..fe64856 100644
Binary files a/discus2/bin/TotalRecallSetup.msi and b/discus2/bin/TotalRecallSetup.msi differ
diff --git a/discus2/bin/TotalRecallSetupDebug.msi b/discus2/bin/TotalRecallSetupDebug.msi
index 6981048..9bc6dbc 100644
Binary files a/discus2/bin/TotalRecallSetupDebug.msi and b/discus2/bin/TotalRecallSetupDebug.msi differ