diff options
author | Jeff Ames | 2008-04-17 12:16:19 +0000 |
---|---|---|
committer | Jeff Ames | 2008-04-17 12:16:19 +0000 |
commit | fe3265f4913d4d40be6e4bd2473cbcb3c6f01feb (patch) | |
tree | 6f2b593b4f3c887bd981dfd3f68a539b8e3fc804 /OpenSim/Region/Modules/SvnSerialiser | |
parent | * Missed a file while committing. (diff) | |
download | opensim-SC_OLD-fe3265f4913d4d40be6e4bd2473cbcb3c6f01feb.zip opensim-SC_OLD-fe3265f4913d4d40be6e4bd2473cbcb3c6f01feb.tar.gz opensim-SC_OLD-fe3265f4913d4d40be6e4bd2473cbcb3c6f01feb.tar.bz2 opensim-SC_OLD-fe3265f4913d4d40be6e4bd2473cbcb3c6f01feb.tar.xz |
Update svn properties. Add copyright info to some source files.
Diffstat (limited to 'OpenSim/Region/Modules/SvnSerialiser')
-rw-r--r-- | OpenSim/Region/Modules/SvnSerialiser/Properties/AssemblyInfo.cs | 99 | ||||
-rw-r--r-- | OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs | 301 |
2 files changed, 227 insertions, 173 deletions
diff --git a/OpenSim/Region/Modules/SvnSerialiser/Properties/AssemblyInfo.cs b/OpenSim/Region/Modules/SvnSerialiser/Properties/AssemblyInfo.cs index 3d0aa3e..e50a89e 100644 --- a/OpenSim/Region/Modules/SvnSerialiser/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/Modules/SvnSerialiser/Properties/AssemblyInfo.cs | |||
@@ -1,36 +1,63 @@ | |||
1 | using System.Reflection; | 1 | /* |
2 | using System.Runtime.CompilerServices; | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | using System.Runtime.InteropServices; | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | 4 | * | |
5 | // General Information about an assembly is controlled through the following | 5 | * Redistribution and use in source and binary forms, with or without |
6 | // set of attributes. Change these attribute values to modify the information | 6 | * modification, are permitted provided that the following conditions are met: |
7 | // associated with an assembly. | 7 | * * Redistributions of source code must retain the above copyright |
8 | [assembly: AssemblyTitle("SvnSerialiser")] | 8 | * notice, this list of conditions and the following disclaimer. |
9 | [assembly: AssemblyDescription("")] | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | [assembly: AssemblyConfiguration("")] | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | [assembly: AssemblyCompany("")] | 11 | * documentation and/or other materials provided with the distribution. |
12 | [assembly: AssemblyProduct("SvnSerialiser")] | 12 | * * Neither the name of the OpenSim Project nor the |
13 | [assembly: AssemblyCopyright("Copyright © 2008")] | 13 | * names of its contributors may be used to endorse or promote products |
14 | [assembly: AssemblyTrademark("")] | 14 | * derived from this software without specific prior written permission. |
15 | [assembly: AssemblyCulture("")] | 15 | * |
16 | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | |
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | // to COM components. If you need to access a type in this assembly from | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | [assembly: ComVisible(false)] | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | [assembly: Guid("c0893655-0c18-4dd7-8b5b-5f58ab1ec6c7")] | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
25 | // Version information for an assembly consists of the following four values: | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | // | 26 | */ |
27 | // Major Version | 27 | |
28 | // Minor Version | 28 | using System.Reflection; |
29 | // Build Number | 29 | using System.Runtime.CompilerServices; |
30 | // Revision | 30 | using System.Runtime.InteropServices; |
31 | // | 31 | |
32 | // You can specify all the values or you can default the Build and Revision Numbers | 32 | // General Information about an assembly is controlled through the following |
33 | // by using the '*' as shown below: | 33 | // set of attributes. Change these attribute values to modify the information |
34 | // [assembly: AssemblyVersion("1.0.*")] | 34 | // associated with an assembly. |
35 | [assembly: AssemblyVersion("1.0.0.0")] | 35 | [assembly: AssemblyTitle("SvnSerialiser")] |
36 | [assembly: AssemblyFileVersion("1.0.0.0")] | 36 | [assembly: AssemblyDescription("")] |
37 | [assembly: AssemblyConfiguration("")] | ||
38 | [assembly: AssemblyCompany("")] | ||
39 | [assembly: AssemblyProduct("SvnSerialiser")] | ||
40 | [assembly: AssemblyCopyright("Copyright (c) 2008")] | ||
41 | [assembly: AssemblyTrademark("")] | ||
42 | [assembly: AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | [assembly: ComVisible(false)] | ||
48 | |||
49 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
50 | [assembly: Guid("c0893655-0c18-4dd7-8b5b-5f58ab1ec6c7")] | ||
51 | |||
52 | // Version information for an assembly consists of the following four values: | ||
53 | // | ||
54 | // Major Version | ||
55 | // Minor Version | ||
56 | // Build Number | ||
57 | // Revision | ||
58 | // | ||
59 | // You can specify all the values or you can default the Build and Revision Numbers | ||
60 | // by using the '*' as shown below: | ||
61 | // [assembly: AssemblyVersion("1.0.*")] | ||
62 | [assembly: AssemblyVersion("1.0.0.0")] | ||
63 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs index 71882fd..a27ccec 100644 --- a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs | |||
@@ -1,137 +1,164 @@ | |||
1 | using System; | 1 | /* |
2 | using System.Collections.Generic; | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | using Nini.Config; | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | using OpenSim.Region.Environment.Interfaces; | 4 | * |
5 | using OpenSim.Region.Environment.Scenes; | 5 | * Redistribution and use in source and binary forms, with or without |
6 | using OpenSim.Region.Environment.Modules.ExportSerialiser; | 6 | * modification, are permitted provided that the following conditions are met: |
7 | 7 | * * Redistributions of source code must retain the above copyright | |
8 | using PumaCode.SvnDotNet.SubversionSharp; | 8 | * notice, this list of conditions and the following disclaimer. |
9 | using PumaCode.SvnDotNet.AprSharp; | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | 10 | * notice, this list of conditions and the following disclaimer in the | |
11 | namespace OpenSim.Region.Modules.SvnSerialiser | 11 | * documentation and/or other materials provided with the distribution. |
12 | { | 12 | * * Neither the name of the OpenSim Project nor the |
13 | public class SvnBackupModule : IRegionModule | 13 | * names of its contributors may be used to endorse or promote products |
14 | { | 14 | * derived from this software without specific prior written permission. |
15 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 15 | * |
16 | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | |
17 | private SvnClient m_svnClient; | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | private bool m_installBackupOnLoad = false; | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | private string m_svnurl = "svn://url.tld/repository/"; | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | private string m_svnuser = "user"; | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | private string m_svnpass = "password"; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | private string m_svndir = "modsvn/"; | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | private IRegionSerialiser m_serialiser; | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | private List<Scene> m_scenes = new List<Scene>(); | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | #region SvnModule Core | 26 | */ |
27 | 27 | ||
28 | public void SaveRegion(Scene scene) | 28 | using System; |
29 | { | 29 | using System.Collections.Generic; |
30 | List<string> filenames = m_serialiser.SerialiseRegion(scene, m_svndir); | 30 | using Nini.Config; |
31 | foreach (string filename in filenames) | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | { | 32 | using OpenSim.Region.Environment.Scenes; |
33 | m_svnClient.Add3(filename, false, true, false); | 33 | using OpenSim.Region.Environment.Modules.ExportSerialiser; |
34 | } | 34 | |
35 | 35 | using PumaCode.SvnDotNet.SubversionSharp; | |
36 | m_svnClient.Commit3(filenames, true, false); | 36 | using PumaCode.SvnDotNet.AprSharp; |
37 | } | 37 | |
38 | 38 | namespace OpenSim.Region.Modules.SvnSerialiser | |
39 | #endregion | 39 | { |
40 | 40 | public class SvnBackupModule : IRegionModule | |
41 | #region SvnDotNet Callbacks | 41 | { |
42 | 42 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
43 | private SvnError SimpleAuth(out SvnAuthCredSimple svnCredentials, IntPtr baton, | 43 | |
44 | AprString realm, AprString username, bool maySave, AprPool pool) | 44 | private SvnClient m_svnClient; |
45 | { | 45 | private bool m_installBackupOnLoad = false; |
46 | svnCredentials = SvnAuthCredSimple.Alloc(pool); | 46 | private string m_svnurl = "svn://url.tld/repository/"; |
47 | svnCredentials.Username = new AprString(m_svnuser, pool); | 47 | private string m_svnuser = "user"; |
48 | svnCredentials.Password = new AprString(m_svnpass, pool); | 48 | private string m_svnpass = "password"; |
49 | svnCredentials.MaySave = false; | 49 | private string m_svndir = "modsvn/"; |
50 | return SvnError.NoError; | 50 | private IRegionSerialiser m_serialiser; |
51 | } | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | ||
53 | private SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile, AprArray commitItems, IntPtr baton, AprPool pool) | 53 | #region SvnModule Core |
54 | { | 54 | |
55 | if (!commitItems.IsNull) | 55 | public void SaveRegion(Scene scene) |
56 | { | 56 | { |
57 | foreach (SvnClientCommitItem item in commitItems) | 57 | List<string> filenames = m_serialiser.SerialiseRegion(scene, m_svndir); |
58 | { | 58 | foreach (string filename in filenames) |
59 | m_log.Debug("[SVNBACKUP]: Updated " + item.Path.ToString() + " (" + item.Kind.ToString() + ") " + item.Revision.ToString()); | 59 | { |
60 | m_log.Debug("[SVNBACKUP]: " + item.Url.ToString() + " -> " + item.CopyFromUrl.ToString()); | 60 | m_svnClient.Add3(filename, false, true, false); |
61 | } | 61 | } |
62 | } | 62 | |
63 | 63 | m_svnClient.Commit3(filenames, true, false); | |
64 | m_log.Debug("[SVNBACKUP]: Appending log message."); | 64 | } |
65 | 65 | ||
66 | logMessage = new AprString("Automated Region Backup", pool); | 66 | #endregion |
67 | tmpFile = new SvnPath(pool); | 67 | |
68 | 68 | #region SvnDotNet Callbacks | |
69 | return (SvnError.NoError); | 69 | |
70 | } | 70 | private SvnError SimpleAuth(out SvnAuthCredSimple svnCredentials, IntPtr baton, |
71 | 71 | AprString realm, AprString username, bool maySave, AprPool pool) | |
72 | #endregion | 72 | { |
73 | 73 | svnCredentials = SvnAuthCredSimple.Alloc(pool); | |
74 | #region IRegionModule Members | 74 | svnCredentials.Username = new AprString(m_svnuser, pool); |
75 | 75 | svnCredentials.Password = new AprString(m_svnpass, pool); | |
76 | public void Initialise(Scene scene, IConfigSource source) | 76 | svnCredentials.MaySave = false; |
77 | { | 77 | return SvnError.NoError; |
78 | lock (m_scenes) | 78 | } |
79 | { | 79 | |
80 | m_scenes.Add(scene); | 80 | private SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile, AprArray commitItems, IntPtr baton, AprPool pool) |
81 | } | 81 | { |
82 | 82 | if (!commitItems.IsNull) | |
83 | scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 83 | { |
84 | } | 84 | foreach (SvnClientCommitItem item in commitItems) |
85 | 85 | { | |
86 | void EventManager_OnPluginConsole(string[] args) | 86 | m_log.Debug("[SVNBACKUP]: Updated " + item.Path.ToString() + " (" + item.Kind.ToString() + ") " + item.Revision.ToString()); |
87 | { | 87 | m_log.Debug("[SVNBACKUP]: " + item.Url.ToString() + " -> " + item.CopyFromUrl.ToString()); |
88 | if (args[0] == "testsvn") | 88 | } |
89 | SaveRegion(m_scenes[0]); | 89 | } |
90 | } | 90 | |
91 | 91 | m_log.Debug("[SVNBACKUP]: Appending log message."); | |
92 | public void PostInitialise() | 92 | |
93 | { | 93 | logMessage = new AprString("Automated Region Backup", pool); |
94 | m_log.Info("[SVNBACKUP]: Disabled."); | 94 | tmpFile = new SvnPath(pool); |
95 | return; | 95 | |
96 | 96 | return (SvnError.NoError); | |
97 | m_log.Info("[SVNBACKUP]: Connecting..."); | 97 | } |
98 | 98 | ||
99 | m_svnClient = new SvnClient(); | 99 | #endregion |
100 | m_svnClient.AddUsernameProvider(); | 100 | |
101 | m_svnClient.AddPromptProvider(new SvnAuthProviderObject.SimplePrompt(SimpleAuth), IntPtr.Zero, 2); | 101 | #region IRegionModule Members |
102 | m_svnClient.OpenAuth(); | 102 | |
103 | 103 | public void Initialise(Scene scene, IConfigSource source) | |
104 | m_log.Info("[SVNBACKUP]: Checking out base directory..."); | 104 | { |
105 | 105 | lock (m_scenes) | |
106 | if (!System.IO.Directory.Exists(m_svndir)) | 106 | { |
107 | System.IO.Directory.CreateDirectory(m_svndir); | 107 | m_scenes.Add(scene); |
108 | 108 | } | |
109 | m_svnClient.Checkout2(m_svnurl, m_svndir, Svn.Revision.Head, Svn.Revision.Head, true, false); | 109 | |
110 | 110 | scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | |
111 | if (m_scenes.Count > 0) | 111 | } |
112 | m_serialiser = m_scenes[0].RequestModuleInterface<IRegionSerialiser>(); | 112 | |
113 | 113 | void EventManager_OnPluginConsole(string[] args) | |
114 | if (m_installBackupOnLoad) | 114 | { |
115 | { | 115 | if (args[0] == "testsvn") |
116 | 116 | SaveRegion(m_scenes[0]); | |
117 | } | 117 | } |
118 | } | 118 | |
119 | 119 | public void PostInitialise() | |
120 | public void Close() | 120 | { |
121 | { | 121 | m_log.Info("[SVNBACKUP]: Disabled."); |
122 | 122 | return; | |
123 | } | 123 | |
124 | 124 | m_log.Info("[SVNBACKUP]: Connecting..."); | |
125 | public string Name | 125 | |
126 | { | 126 | m_svnClient = new SvnClient(); |
127 | get { return "SvnBackupModule"; } | 127 | m_svnClient.AddUsernameProvider(); |
128 | } | 128 | m_svnClient.AddPromptProvider(new SvnAuthProviderObject.SimplePrompt(SimpleAuth), IntPtr.Zero, 2); |
129 | 129 | m_svnClient.OpenAuth(); | |
130 | public bool IsSharedModule | 130 | |
131 | { | 131 | m_log.Info("[SVNBACKUP]: Checking out base directory..."); |
132 | get { return true; } | 132 | |
133 | } | 133 | if (!System.IO.Directory.Exists(m_svndir)) |
134 | 134 | System.IO.Directory.CreateDirectory(m_svndir); | |
135 | #endregion | 135 | |
136 | } | 136 | m_svnClient.Checkout2(m_svnurl, m_svndir, Svn.Revision.Head, Svn.Revision.Head, true, false); |
137 | } | 137 | |
138 | if (m_scenes.Count > 0) | ||
139 | m_serialiser = m_scenes[0].RequestModuleInterface<IRegionSerialiser>(); | ||
140 | |||
141 | if (m_installBackupOnLoad) | ||
142 | { | ||
143 | |||
144 | } | ||
145 | } | ||
146 | |||
147 | public void Close() | ||
148 | { | ||
149 | |||
150 | } | ||
151 | |||
152 | public string Name | ||
153 | { | ||
154 | get { return "SvnBackupModule"; } | ||
155 | } | ||
156 | |||
157 | public bool IsSharedModule | ||
158 | { | ||
159 | get { return true; } | ||
160 | } | ||
161 | |||
162 | #endregion | ||
163 | } | ||
164 | } | ||