~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to src/webservices/.svn/text-base/SyncServiceInfo.cs.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
|
3
 
| Copyright (c) 2007 Novell, Inc.
4
 
| All Rights Reserved.
5
 
|
6
 
| This program is free software; you can redistribute it and/or
7
 
| modify it under the terms of version 2 of the GNU General Public License as
8
 
| published by the Free Software Foundation.
9
 
|
10
 
| This program is distributed in the hope that it will be useful,
11
 
| but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
| GNU General Public License for more details.
14
 
|
15
 
| You should have received a copy of the GNU General Public License
16
 
| along with this program; if not, contact Novell, Inc.
17
 
|
18
 
| To contact Novell about this file by physical or electronic mail,
19
 
| you may find current contact information at www.novell.com 
20
 
|
21
 
| Author: Bruce Getter <bgetter@novell.com> 
22
 
|***************************************************************************/
23
 
 
24
 
using System;
25
 
 
26
 
using Simias;
27
 
using Simias.IdentitySync;
28
 
 
29
 
namespace iFolder.WebService
30
 
{
31
 
        /// <summary>
32
 
        /// Class that represents the current state and configuration
33
 
        /// of the synchronization service.
34
 
        /// </summary>
35
 
        [ Serializable ]
36
 
        public class SyncServiceInfo
37
 
        {
38
 
                /// <summary>
39
 
                /// Date and Time when the synchronization engine was
40
 
                /// started.
41
 
                /// RFC 822 format
42
 
                /// </summary>
43
 
                public string UpSince;
44
 
                
45
 
                /// <summary>
46
 
                /// Number of cycles the engine performed
47
 
                /// </summary>
48
 
                public int Cycles;
49
 
                
50
 
                /// <summary>
51
 
                /// Name of the registered synchronization provider
52
 
                /// </summary>
53
 
                public string   Provider;
54
 
 
55
 
                /// <summary>
56
 
                /// Configured time interval, represented in seconds,
57
 
                /// between synchronization cycles.
58
 
                /// </summary>
59
 
                public int      SynchronizationInterval;
60
 
 
61
 
                /// <summary>
62
 
                /// Configured grace period, represented in seconds,
63
 
                /// the sync service will allow a member to remain
64
 
                /// in the domain when the member no longer exists
65
 
                /// in the external identity store.
66
 
                ///
67
 
                /// Members become disabled in the Simias domain when
68
 
                /// they are no longer exist in the external store.
69
 
                /// </summary>
70
 
                public int      DeleteMemberGracePeriod;
71
 
                
72
 
                /// <summary>
73
 
                /// Current status of the synchronization engine
74
 
                /// status will be one of the following:
75
 
                /// "running"
76
 
                /// "sleeping"
77
 
                /// "disabled"
78
 
                /// "shutdown"
79
 
                /// </summary>
80
 
                public string Status;
81
 
 
82
 
                /// <summary>
83
 
                /// Constructor
84
 
                /// </summary>
85
 
                public SyncServiceInfo()
86
 
                {
87
 
                }
88
 
 
89
 
                /// <summary>
90
 
                /// Get Sync Service Info
91
 
                /// </summary>
92
 
                /// <returns></returns>
93
 
                public static SyncServiceInfo GetSyncServiceInfo()
94
 
                {
95
 
                        SyncServiceInfo info = new SyncServiceInfo();
96
 
                        
97
 
                        info.UpSince =
98
 
                                String.Format(
99
 
                                "{0}, {1} {2} {3} {4}:{5}:{6} GMT",
100
 
                                Service.UpSince.DayOfWeek.ToString(),
101
 
                                Service.UpSince.Day,
102
 
                                LastSyncInfo.MonthsOfYear[ Service.UpSince.Month - 1 ],
103
 
                                Service.UpSince.Year.ToString(),
104
 
                                Service.UpSince.Hour,
105
 
                                Service.UpSince.Minute,
106
 
                                Service.UpSince.Second );
107
 
                        
108
 
                        info.Cycles = Service.Cycles;
109
 
                        
110
 
                        // Get the first provider.   At the moment, sync engine only supports
111
 
                        // one provider anyway.
112
 
                        foreach( IIdentitySyncProvider prov in Service.RegisteredProviders.Values )
113
 
                        {
114
 
                                info.Provider = prov.Name;
115
 
                                break;
116
 
                        }
117
 
                        
118
 
                        info.DeleteMemberGracePeriod = Service.DeleteGracePeriod;
119
 
                        info.SynchronizationInterval = Service.SyncInterval;
120
 
                        info.Status = Service.Status;
121
 
                        
122
 
                        return info;
123
 
                }
124
 
        }
125
 
}