using System;
using System.Collections;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using Microsoft.MetadirectoryServices;
using Microsoft.DeveloperAndPlatformEvangelism.Demonstrations.TaskVisionII.Utility;
namespace Mms_ManagementAgent_dataJoin_ActiveDirectory
{
public class MAExtensionObject: CLoggingRuleExtension, IMASynchronization
{
private const string c_sFile_Cache = "dataJoin_ActiveDirectory.dat";
private const string c_sFile_Log = @"Join_ActiveDirectory.log";
private const byte c_byThreshold_Log = 10;
private const string c_sCriterion_GroupName = @"YourApplicationUsers";
private const string c_sExceptionMessage_DeSerialization = @"De-serialization failed";
private const string c_sExceptionMessage_Serialization = @"Serialization failed";
private ArrayList m_arMembers = null;
public MAExtensionObject()
{
//
// TODO: Add constructor logic here
//
base.sFile_Log = MAExtensionObject.c_sFile_Log;
base.byThreshold_Log = MAExtensionObject.c_byThreshold_Log;
this.Log(@"Constructed.");
}
void IMASynchronization.Initialize ()
{
//
// TODO: write initialization code
//
}
void IMASynchronization.Terminate ()
{
//
// TODO: write termination code
//
}
bool IMASynchronization.ShouldProjectToMV (CSEntry rConnectorSpaceEntry, out string sMetaverseObjectType)
{
this.Log(@"ShouldProjectToMV");
string sConnectorSpaceObjectType = rConnectorSpaceEntry.ObjectType;
this.Log(string.Concat(@"Metaverse object type: ",sConnectorSpaceObjectType));
switch(sConnectorSpaceObjectType)
{
case "group":
sMetaverseObjectType = @"group";
string sGroupName = rConnectorSpaceEntry[@"cn"].Value;
if(sGroupName == MAExtensionObject.c_sCriterion_GroupName)
{
Microsoft.MetadirectoryServices.ValueCollection arMembers = rConnectorSpaceEntry[@"member"].Values;
int cMembers = arMembers.Count;
if(this.m_arMembers == null)
{
this.m_arMembers = new ArrayList(cMembers);
}
for(int cCurrentMember = 0;cCurrentMember < cMembers;cCurrentMember++)
{
this.m_arMembers.Add(arMembers[cCurrentMember].ToString());
}
foreach(string sMember in this.m_arMembers)
{
this.Log(sMember);
}
}
return false;
default:
sMetaverseObjectType = @"person";
string sName = rConnectorSpaceEntry.DN.ToString();
if(this.m_arMembers != null)
{
foreach(string sMember in this.m_arMembers)
{
this.Log(string.Concat("Comparing ",sName," to ",sMember));
if(string.Compare(sName,sMember,true)==0)
{
this.Log(string.Concat(@"Projecting ",sName));
return true;
}
}
}
return false;
}
}
DeprovisionAction IMASynchronization.Deprovision (CSEntry rConnectorSpaceEntry)
{
//
// TODO: Remove this throw statement if you implement this method
//
throw new EntryPointNotImplementedException();
}
bool IMASynchronization.FilterForDisconnection (CSEntry csentry)
{
//
// TODO: write connector filter code
//
throw new EntryPointNotImplementedException();
}
void IMASynchronization.MapAttributesForJoin (string FlowRuleName, CSEntry csentry, ref ValueCollection values)
{
//
// TODO: write join mapping code
//
throw new EntryPointNotImplementedException();
}
bool IMASynchronization.ResolveJoinSearch (string joinCriteriaName, CSEntry csentry, MVEntry[] rgmventry, out int imventry, ref string MVObjectType)
{
//
// TODO: write join resolution code
//
throw new EntryPointNotImplementedException();
}
void IMASynchronization.MapAttributesForImport( string FlowRuleName, CSEntry csentry, MVEntry mventry)
{
//
// TODO: write your import attribute flow code
//
throw new EntryPointNotImplementedException();
}
void IMASynchronization.MapAttributesForExport (string FlowRuleName, MVEntry mventry, CSEntry csentry)
{
//
// TODO: write your export attribute flow code
//
throw new EntryPointNotImplementedException();
}
}
}