Merge pull request #2815 from lambdageek/dev/monoerror-mono_compile_method
[mono.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap.Events.Edir.EventData / SecurityEquivalenceEventData.cs
1 /******************************************************************************
2 * The MIT License
3 * Copyright (c) 2003 Novell Inc.  www.novell.com
4
5 * Permission is hereby granted, free of charge, to any person obtaining  a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including  without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
9 * copies of the Software, and to  permit persons to whom the Software is 
10 * furnished to do so, subject to the following conditions:
11
12 * The above copyright notice and this permission notice shall be included in 
13 * all copies or substantial portions of the Software.
14
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *******************************************************************************/
23 //
24 // Novell.Directory.Ldap.Events.Edir.EventData.SecurityEquivalenceEventData.cs
25 //
26 // Author:
27 //   Anil Bhatia (banil@novell.com)
28 //
29 // (C) 2003 Novell, Inc (http://www.novell.com)
30 //
31
32 using System.Collections;
33 using System.Text;
34
35 using Novell.Directory.Ldap.Asn1;
36
37 namespace Novell.Directory.Ldap.Events.Edir.EventData
38 {
39   /// <summary> 
40   /// This class represents the data for Security Equivalence Events.
41   /// </summary>
42   public class SecurityEquivalenceEventData : BaseEdirEventData
43   {
44     protected string strEntryDN;
45     public string EntryDN
46     {
47       get
48       {
49         return strEntryDN;
50       }
51     }
52
53     protected int retry_count;
54     public int RetryCount
55     {
56       get
57       {
58         return retry_count;
59       }
60     }
61
62     protected string strValueDN;
63     public string ValueDN
64     {
65       get
66       {
67         return strValueDN;
68       }
69     }
70
71     protected int referral_count;
72     public int ReferralCount
73     {
74       get
75       {
76         return referral_count;
77       }
78     }
79
80     protected ArrayList referral_list;
81     public ArrayList ReferralList
82     {
83       get
84       {
85         return referral_list;
86       }
87     }
88
89     public SecurityEquivalenceEventData(EdirEventDataType eventDataType, Asn1Object message)
90       : base(eventDataType, message)
91     {
92       int[] length = new int[1];
93
94       strEntryDN = ((Asn1OctetString) decoder.decode(decodedData, length)).stringValue();
95       retry_count = ((Asn1Integer) decoder.decode(decodedData, length)).intValue();
96       strValueDN = ((Asn1OctetString) decoder.decode(decodedData, length)).stringValue();
97
98       Asn1Sequence referalseq = ((Asn1Sequence) decoder.decode(decodedData, length));
99
100       referral_count = ((Asn1Integer) referalseq.get_Renamed(0)).intValue();
101       referral_list = new ArrayList();
102       if (referral_count > 0) 
103       {
104         Asn1Sequence referalseqof = ((Asn1Sequence) referalseq.get_Renamed(1));
105
106         for (int i = 0; i < referral_count; i++) 
107         {
108           referral_list.Add( new ReferralAddress( (Asn1Sequence) referalseqof.get_Renamed(i) ) );
109         }
110       }
111
112       DataInitDone();
113     }
114
115     /// <summary> 
116     /// Returns a string representation of the object.
117     /// </summary>
118     public override string ToString() 
119     {
120       StringBuilder buf = new StringBuilder();
121       buf.Append("[SecurityEquivalenceEventData");
122       buf.AppendFormat("(EntryDN={0})", strEntryDN);
123       buf.AppendFormat("(RetryCount={0})", retry_count);
124       buf.AppendFormat("(valueDN={0})", strValueDN);
125       buf.AppendFormat("(referralCount={0})", referral_count);
126       buf.AppendFormat("(Referral Lists={0})", referral_list);
127       buf.Append("]");
128
129       return buf.ToString();
130     }
131
132   }
133 }