Compare commits
449 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3057974f31 | ||
|
|
bfd883f533 | ||
|
|
da5b7e199a | ||
|
|
64cc76bd79 | ||
|
|
bf374705c6 | ||
|
|
9ce2f95f37 | ||
|
|
316854dc13 | ||
|
|
9136e02ed3 | ||
|
|
1d6735f0ec | ||
|
|
373ac90156 | ||
|
|
6f591376dd | ||
|
|
95d9c773d9 | ||
|
|
4ae04dd0a8 | ||
|
|
61f9b3c2cf | ||
|
|
b2ef5658b1 | ||
|
|
a7f0af41ab | ||
|
|
c7a2e1b2d4 | ||
|
|
0116b80795 | ||
|
|
d743a221e8 | ||
|
|
92edbd3e47 | ||
|
|
cabb70d90a | ||
|
|
ae24548216 | ||
|
|
85c20e1493 | ||
|
|
821b8a5517 | ||
|
|
491d898db8 | ||
|
|
5f60eb136e | ||
|
|
8b3b89ecf4 | ||
|
|
0524458069 | ||
|
|
a160b44e07 | ||
|
|
255e05beb5 | ||
|
|
912f0c7fde | ||
|
|
693b5d0838 | ||
|
|
50ddb20204 | ||
|
|
cc2622660b | ||
|
|
bdeda18b52 | ||
|
|
8eb70f9719 | ||
|
|
2f6d401db1 | ||
|
|
82d0d1c092 | ||
|
|
f831a1778b | ||
|
|
20e6b7a320 | ||
|
|
c38f7c96e7 | ||
|
|
698066d7e3 | ||
|
|
c5cfae7bac | ||
|
|
241ed5734e | ||
|
|
0209033dd9 | ||
|
|
f5ca701273 | ||
|
|
0526a91206 | ||
|
|
4be13b1a42 | ||
|
|
992efdc283 | ||
|
|
c7d812802f | ||
|
|
5074d290e4 | ||
|
|
d6e1333810 | ||
|
|
66a833796c | ||
|
|
32c43bf59a | ||
|
|
a6c7995b71 | ||
|
|
8048a8a39d | ||
|
|
2603f9a134 | ||
|
|
3bd2ec7b2e | ||
|
|
e589a31bc4 | ||
|
|
e4114799c3 | ||
|
|
59546a348a | ||
|
|
ddd072b3fb | ||
|
|
147c2d6f80 | ||
|
|
427ae1087f | ||
|
|
1c63f6cd85 | ||
|
|
3b38cc10de | ||
|
|
d446b19e72 | ||
|
|
e9bac02fec | ||
|
|
8b5d012200 | ||
|
|
fa8def5e70 | ||
|
|
5fc990d9e7 | ||
|
|
8d832e3231 | ||
|
|
1ed7b591b2 | ||
|
|
76238715e3 | ||
|
|
f77f9ecd8f | ||
|
|
fc76b5f589 | ||
|
|
6bc7e3429f | ||
|
|
009b15c436 | ||
|
|
dd1b99cd0d | ||
|
|
25bb80da77 | ||
|
|
3a8128d309 | ||
|
|
2c8d25a110 | ||
|
|
12ee3a3c93 | ||
|
|
e79eac238e | ||
|
|
2f6bb01370 | ||
|
|
9209657f93 | ||
|
|
547e027899 | ||
|
|
bc7d84b75c | ||
|
|
add7abc1de | ||
|
|
91cfce3758 | ||
|
|
8a69070b51 | ||
|
|
6fdd5bfe2d | ||
|
|
608bb0dfef | ||
|
|
087f475893 | ||
|
|
a69cb5e390 | ||
|
|
5f6e9e6ab9 | ||
|
|
7ad36d3d75 | ||
|
|
8938fac4fd | ||
|
|
139f425f4c | ||
|
|
8966ed9c82 | ||
|
|
7ae55f6248 | ||
|
|
0a9c98e7c4 | ||
|
|
0b8b302aa0 | ||
|
|
d8b604b550 | ||
|
|
56fe4c24b8 | ||
|
|
955db6e4be | ||
|
|
705b675d28 | ||
|
|
b46380e373 | ||
|
|
a90054aa16 | ||
|
|
362007e5d3 | ||
|
|
7ce0ec874a | ||
|
|
959cd60225 | ||
|
|
10750421a3 | ||
|
|
9500ba2ff5 | ||
|
|
8b70477556 | ||
|
|
04845c1898 | ||
|
|
f3c21524be | ||
|
|
5c23b4aa56 | ||
|
|
85646b157c | ||
|
|
7eda9364fd | ||
|
|
f8d49e0a30 | ||
|
|
68a4f897b4 | ||
|
|
43acd99bb3 | ||
|
|
b7457a0a5d | ||
|
|
c77444a821 | ||
|
|
1636f535ba | ||
|
|
fac55bc78b | ||
|
|
4433f53f72 | ||
|
|
a1c4585a39 | ||
|
|
9b6e89457c | ||
|
|
7ecd9b3f1a | ||
|
|
c6ba50b7e2 | ||
|
|
0b2b2daf23 | ||
|
|
58dac970af | ||
|
|
c4eaf195b5 | ||
|
|
d975bd8e5c | ||
|
|
7701ea2798 | ||
|
|
54cedfe432 | ||
|
|
94a46867ed | ||
|
|
c4c4c3696e | ||
|
|
0f3314c04c | ||
|
|
d834a2c3da | ||
|
|
e80e04c5fd | ||
|
|
309f440fc0 | ||
|
|
db5ea850f6 | ||
|
|
20e3de1f0a | ||
|
|
335c1b4420 | ||
|
|
a97a887ea4 | ||
|
|
e40acda6c8 | ||
|
|
e7be131b89 | ||
|
|
fd4a059e9b | ||
|
|
2f454843d8 | ||
|
|
a573b5767b | ||
|
|
5c04d768a6 | ||
|
|
4bf1598930 | ||
|
|
07b4889eab | ||
|
|
7a3bb266eb | ||
|
|
f34cc6b469 | ||
|
|
9b9e2a8c71 | ||
|
|
2fbbc13c71 | ||
|
|
35bf75a77a | ||
|
|
f505c1d0a4 | ||
|
|
04a68db195 | ||
|
|
e2a521742a | ||
|
|
956225f0e1 | ||
|
|
18ed68cd31 | ||
|
|
4d712ddaae | ||
|
|
dd544f811a | ||
|
|
e0b287961f | ||
|
|
add47befac | ||
|
|
0e36994fe7 | ||
|
|
3ea72eeabb | ||
|
|
1a2cbbc8c1 | ||
|
|
f35eb8819c | ||
|
|
e442c2a3f9 | ||
|
|
37815f3402 | ||
|
|
8cbd0d3b5f | ||
|
|
8198062610 | ||
|
|
80e4068b3e | ||
|
|
1379ae4310 | ||
|
|
7bd48d383d | ||
|
|
f6f6ef1532 | ||
|
|
4423630f1e | ||
|
|
5caae0293a | ||
|
|
c8c608acc8 | ||
|
|
3d053b194a | ||
|
|
2fdd535302 | ||
|
|
1f7a0cf892 | ||
|
|
83929c69e3 | ||
|
|
87590491b5 | ||
|
|
62dd83f473 | ||
|
|
84b0a23e19 | ||
|
|
393a782858 | ||
|
|
7f61de8f57 | ||
|
|
e99341d7df | ||
|
|
efd4810851 | ||
|
|
92a8d7ce6c | ||
|
|
d6eff8ebcf | ||
|
|
af2d20c5fa | ||
|
|
47a9e48f46 | ||
|
|
94c417c90c | ||
|
|
ce3e265575 | ||
|
|
b2fefe3e3f | ||
|
|
2084e08ad7 | ||
|
|
9568718add | ||
|
|
6a70349512 | ||
|
|
0ad8046582 | ||
|
|
ad38450f9c | ||
|
|
c8f3bb56ff | ||
|
|
59851ceee6 | ||
|
|
044979066c | ||
|
|
776d62b9c6 | ||
|
|
ae9362636e | ||
|
|
48134af616 | ||
|
|
fc1ac25935 | ||
|
|
0f1a3f8ed2 | ||
|
|
8c20610293 | ||
|
|
d5ed92cf38 | ||
|
|
6478617c93 | ||
|
|
0c5850237e | ||
|
|
9e37d24624 | ||
|
|
44c86cedcf | ||
|
|
cfca9e1e81 | ||
|
|
5b9ca6e35f | ||
|
|
862caa72a8 | ||
|
|
2d9b69c186 | ||
|
|
e9c9a74e0a | ||
|
|
b80ea00265 | ||
|
|
d2e17f4ffb | ||
|
|
1abb70cc73 | ||
|
|
946e06eb58 | ||
|
|
66692f90e3 | ||
|
|
a964431c21 | ||
|
|
496a8a4f7c | ||
|
|
24056dc98b | ||
|
|
6772c9d2b6 | ||
|
|
e3dbd79543 | ||
|
|
d9c48e70a9 | ||
|
|
51bb311565 | ||
|
|
f4e30664e6 | ||
|
|
44d523518a | ||
|
|
8c39392eaa | ||
|
|
884410501e | ||
|
|
a87d7a1296 | ||
|
|
f0152790cf | ||
|
|
8452c0869d | ||
|
|
20e748205e | ||
|
|
649d45a2d4 | ||
|
|
0ae861d7d7 | ||
|
|
511481e8d9 | ||
|
|
1676e70dfe | ||
|
|
46b5fe5acd | ||
|
|
089f5403a7 | ||
|
|
1597e33549 | ||
|
|
121c6b4835 | ||
|
|
a764eb5dc7 | ||
|
|
d22bdb5095 | ||
|
|
a2aadb78a9 | ||
|
|
71adb37fa8 | ||
|
|
6591f8a592 | ||
|
|
3724a38ab4 | ||
|
|
54e6c26def | ||
|
|
0907d5d69e | ||
|
|
53d3f46add | ||
|
|
d657b76dba | ||
|
|
253e2ed699 | ||
|
|
1121919b57 | ||
|
|
61ce884336 | ||
|
|
71fdc24f5c | ||
|
|
aa51b83fdc | ||
|
|
b321c0a932 | ||
|
|
3f901d313b | ||
|
|
67cfe34e67 | ||
|
|
643cc7a0ee | ||
|
|
b3cb99036c | ||
|
|
9602227eb6 | ||
|
|
5e103f2b2e | ||
|
|
d49d44923d | ||
|
|
cbe0841bc9 | ||
|
|
596af3f600 | ||
|
|
8f0d6d6b5c | ||
|
|
a08360e3cd | ||
|
|
06f639b8f3 | ||
|
|
ba3dfe4121 | ||
|
|
67cfac0cf1 | ||
|
|
8ad8bd6282 | ||
|
|
045a44b1af | ||
|
|
d321d23afe | ||
|
|
e3f60ce06f | ||
|
|
4b96a78039 | ||
|
|
19a5e606b3 | ||
|
|
a18f4964cf | ||
|
|
f5c310d9d4 | ||
|
|
a6c93ce875 | ||
|
|
1b8f91a0db | ||
|
|
7371c7662a | ||
|
|
f3a4860635 | ||
|
|
43c303e27a | ||
|
|
e51be5f4a7 | ||
|
|
59f683066a | ||
|
|
b19e564317 | ||
|
|
e881f35fbb | ||
|
|
59a841d69c | ||
|
|
e7439efc74 | ||
|
|
0054afd39b | ||
|
|
7f699fca9a | ||
|
|
e5e951d92c | ||
|
|
5a653ef96f | ||
|
|
165f193f78 | ||
|
|
6eecbc95e4 | ||
|
|
a9f4d7a29c | ||
|
|
c54e0953d0 | ||
|
|
b575bf2524 | ||
|
|
30f59370d3 | ||
|
|
73491cceed | ||
|
|
28c7bb99bf | ||
|
|
551727cd19 | ||
|
|
bde26a8282 | ||
|
|
11c4a2cfd0 | ||
|
|
93b930b937 | ||
|
|
b53b871669 | ||
|
|
0a29842caf | ||
|
|
49fbe0ddb4 | ||
|
|
46fea74726 | ||
|
|
69b551c516 | ||
|
|
fa0621b486 | ||
|
|
84a1a0a729 | ||
|
|
b891291135 | ||
|
|
d8d6e8a304 | ||
|
|
e3c1466047 | ||
|
|
df30b1c832 | ||
|
|
3d3e0ea4f3 | ||
|
|
c7a457f9ee | ||
|
|
31bf25d05e | ||
|
|
eecaa3d9dd | ||
|
|
e38e8ae987 | ||
|
|
6dbe25360e | ||
|
|
6483470ec5 | ||
|
|
83fad75e22 | ||
|
|
7cd44c1a81 | ||
|
|
f8b6bc8d11 | ||
|
|
0020afaf67 | ||
|
|
b8b4517211 | ||
|
|
824d7190c2 | ||
|
|
30d64444a0 | ||
|
|
9904700dfd | ||
|
|
49dbae65c9 | ||
|
|
b056c243e4 | ||
|
|
c00158b238 | ||
|
|
794419852b | ||
|
|
fbafd22124 | ||
|
|
b9cd66d510 | ||
|
|
b310efc50f | ||
|
|
0fdf883cbd | ||
|
|
1382dc976c | ||
|
|
54e4dcf454 | ||
|
|
f6b1344722 | ||
|
|
5ffd59e7b8 | ||
|
|
0889b5aef1 | ||
|
|
59ca92b10b | ||
|
|
956f337046 | ||
|
|
a6a6bf007a | ||
|
|
2e9890bbe6 | ||
|
|
f2427a7320 | ||
|
|
2a6dbd068e | ||
|
|
d092977f4a | ||
|
|
e3f229225c | ||
|
|
ee9d46c825 | ||
|
|
dbd8c400ce | ||
|
|
29a740ec8c | ||
|
|
c2d3afdeee | ||
|
|
9155c9ee37 | ||
|
|
0d1d437bd3 | ||
|
|
b15f20520f | ||
|
|
172e2f4e76 | ||
|
|
23cd1b1954 | ||
|
|
cade14c58c | ||
|
|
1e222d52e6 | ||
|
|
f9ae9afaac | ||
|
|
09bbfc1d56 | ||
|
|
79511ecce2 | ||
|
|
2fe75a62be | ||
|
|
da414fd509 | ||
|
|
f2891e7738 | ||
|
|
fbefa8273b | ||
|
|
ceccfe02d0 | ||
|
|
129de26032 | ||
|
|
43a6fa1d01 | ||
|
|
cc8246206d | ||
|
|
551696bb45 | ||
|
|
ded16d3529 | ||
|
|
2e6dce434f | ||
|
|
9888f95068 | ||
|
|
8bbb88ea4e | ||
|
|
69d83e1548 | ||
|
|
d3e7a52933 | ||
|
|
aa695e92f7 | ||
|
|
0ddd1ce0b7 | ||
|
|
cc18ab12f8 | ||
|
|
2c3f6aaa87 | ||
|
|
5dedacca3c | ||
|
|
ad2f0a1290 | ||
|
|
bd3b9f79c2 | ||
|
|
ed148eba32 | ||
|
|
06f41bb017 | ||
|
|
a27d33cb63 | ||
|
|
22c325aa5a | ||
|
|
ac2fcbe224 | ||
|
|
63b6b9cdce | ||
|
|
de55110247 | ||
|
|
b9d22aa821 | ||
|
|
de927adf27 | ||
|
|
79395bc7db | ||
|
|
c81f37cf82 | ||
|
|
25b4160434 | ||
|
|
32c464ad1f | ||
|
|
d5aceb6d95 | ||
|
|
81f7e9b462 | ||
|
|
8383bde768 | ||
|
|
d114713694 | ||
|
|
cad2bf5b08 | ||
|
|
247c66b3fe | ||
|
|
73c2162ff6 | ||
|
|
889ce36afa | ||
|
|
c3d4b66953 | ||
|
|
234b29cf66 | ||
|
|
31827b0286 | ||
|
|
df121a7cd0 | ||
|
|
03df03b269 | ||
|
|
f1522e6204 | ||
|
|
87bce90086 | ||
|
|
4a29a7f92c | ||
|
|
0149265ee8 | ||
|
|
0844e5951c | ||
|
|
251d1b8fbb | ||
|
|
7f0f5060ec | ||
|
|
d179f2cce9 | ||
|
|
5d0778014d | ||
|
|
4c10826caa | ||
|
|
873c9098d8 | ||
|
|
6ce5080049 | ||
|
|
b9546d12f2 | ||
|
|
a49c524c9e | ||
|
|
b7f1fc116e | ||
|
|
28aa8010b2 | ||
|
|
c09eb00031 | ||
|
|
1113b3b6eb | ||
|
|
a81a16f22f | ||
|
|
8428b25939 |
@@ -1,8 +1,60 @@
|
||||
<!-- -*- xml -*- -->
|
||||
<!-- please leave the top comment for us emacs folks -->
|
||||
<property name="projectdir" value="opensim-0.5.5" />
|
||||
<property name="nunitcmd" value="nunit-console" />
|
||||
|
||||
<!-- For safety/laziness sake, we're going to take the approach of deleting known extraneous files here rather than
|
||||
trying to copy across only the essential ones -->
|
||||
<property name="distbindir" value="distbin" />
|
||||
<target name="distbin">
|
||||
<copy file="bin/OpenSim.ini.example" tofile="bin/OpenSim.ini"/>
|
||||
<copy file="bin/config-include/StandaloneCommon.ini.example" tofile="bin/config-include/StandaloneCommon.ini"/>
|
||||
<delete dir="${distbindir}"/>
|
||||
<copy todir="${distbindir}">
|
||||
<fileset>
|
||||
<include name="**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<delete dir="${distbindir}/OpenSim"/>
|
||||
<delete dir="${distbindir}/Prebuild"/>
|
||||
<delete dir="${distbindir}/%temp%"/>
|
||||
<delete dir="${distbindir}/.nant"/>
|
||||
<delete>
|
||||
<fileset basedir="${distbindir}">
|
||||
<include name="BUILDING.txt"/>
|
||||
<include name="Makefile"/>
|
||||
<include name="nant-color"/>
|
||||
<include name="OpenSim.*"/>
|
||||
<include name="prebuild.xml"/>
|
||||
<include name="runprebuild*"/>
|
||||
<include name="TESTING.txt"/>
|
||||
<include name="TestResult.xml"/>
|
||||
<include name="bin/OpenSim.Server.ini"/>
|
||||
<include name="bin/Regions/*"/>
|
||||
<include name="bin/*.db"/>
|
||||
<include name="**/.git/**"/>
|
||||
<include name=".gitignore"/>
|
||||
<include name=".hgignore"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
</target>
|
||||
|
||||
<!-- I don't think these targets are being actively used. But just in case, we'll just comment them out for now - justincc -->
|
||||
<!--
|
||||
<property name="projectdir" value="opensim-0.6.9" />
|
||||
<target name="dist" depends="distdir">
|
||||
<zip zipfile="${projectdir}.zip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar destfile="${projectdir}.tar.gz" compression="GZip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
<target name="distdir">
|
||||
<delete dir="${projectdir}" />
|
||||
<copy todir="${projectdir}">
|
||||
@@ -21,14 +73,14 @@
|
||||
<include name="bin/assets/**" />
|
||||
<include name="bin/data/**" />
|
||||
<include name="bin/OpenSim*xml" />
|
||||
<!-- the next is to exclude built libs -->
|
||||
<exclude name="bin/OpenSim.*dll" />
|
||||
<include name="bin/OpenSim.ini" />
|
||||
<include name="bin/defaultstripe.png" />
|
||||
<exclude name="bin/OpenSim.*dll" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<touch file="${projectdir}/bin/startup_commands.txt" />
|
||||
</target>
|
||||
-->
|
||||
|
||||
<target name="test" depends="build, find-nunit">
|
||||
<setenv name="MONO_THREADS_PER_CPU" value="100" />
|
||||
@@ -43,11 +95,6 @@
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.communications.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.communications.tests)==0}" />
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.framework.servers.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Servers.Tests.dll" />
|
||||
</exec>
|
||||
@@ -90,6 +137,8 @@
|
||||
</exec>
|
||||
<fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.mysql.tests)==0}" />
|
||||
|
||||
<delete dir="%temp%"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="test-cov" depends="build">
|
||||
@@ -106,17 +155,6 @@
|
||||
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Servers.cov" />
|
||||
</exec>
|
||||
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
<arg value="--profile=monocov:outfile=./cov/OpenSim.Framework.Communications.cov,+[OpenSim.Framework.Communications]" />
|
||||
<arg value="/usr/lib/nunit/nunit-console.exe" />
|
||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||
</exec>
|
||||
<delete dir="./cov/OpenSim.Framework.Communications" />
|
||||
<exec program="monocov">
|
||||
<arg value="--export-html=./cov/OpenSim.Framework.Servers ./cov/OpenSim.Framework.Communications.cov" />
|
||||
</exec>
|
||||
|
||||
<!--
|
||||
<exec program="mono">
|
||||
<arg value="--debug" />
|
||||
@@ -227,11 +265,6 @@
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.communications.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Communications.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Communications.Tests.dll-Results.xml" />
|
||||
</exec>
|
||||
|
||||
<exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.framework.serialization.tests">
|
||||
<arg value="./bin/OpenSim.Framework.Serialization.Tests.dll" />
|
||||
<arg value="-xml=test-results/OpenSim.Framework.Serialization.Tests.dll-Results.xml" />
|
||||
@@ -301,7 +334,6 @@
|
||||
<!-- <test> -->
|
||||
<!-- <assemblies> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Communications.Tests.dll"/> -->
|
||||
<!-- <include name="./bin/OpenSim.Framework.Servers.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.ClientStack.LindenUDP.Tests.dll" /> -->
|
||||
<!-- <include name="./bin/OpenSim.Region.ScriptEngine.Tests.dll" /> -->
|
||||
@@ -317,17 +349,3 @@
|
||||
<target name="doxygen">
|
||||
<exec program="doxygen" workingdir="doc" commandline="doxygen.conf" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="dist" depends="distdir">
|
||||
<zip zipfile="${projectdir}.zip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</zip>
|
||||
<tar destfile="${projectdir}.tar.gz" compression="GZip">
|
||||
<fileset basedir=".">
|
||||
<include name="${projectdir}/**" />
|
||||
</fileset>
|
||||
</tar>
|
||||
</target>
|
||||
|
||||
@@ -164,6 +164,7 @@ This software uses components from the following developers:
|
||||
* log4net (http://logging.apache.org/log4net/)
|
||||
* GlynnTucker.Cache (http://gtcache.sourceforge.net/)
|
||||
* NDesk.Options 0.2.1 (http://www.ndesk.org/Options)
|
||||
* Json.NET 3.5 Release 6. The binary used is actually Newtonsoft.Json.Net20.dll for Mono 2.4 compatability (http://james.newtonking.com/projects/json-net.aspx)
|
||||
|
||||
Some plugins are based on Cable Beach
|
||||
Cable Beach is Copyright (c) 2008 Intel Corporation
|
||||
|
||||
@@ -123,6 +123,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod;
|
||||
availableMethods["admin_shutdown"] = XmlRpcShutdownMethod;
|
||||
availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
|
||||
availableMethods["admin_dialog"] = XmlRpcDialogMethod;
|
||||
availableMethods["admin_restart"] = XmlRpcRestartMethod;
|
||||
availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
|
||||
// User management
|
||||
@@ -212,9 +213,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
|
||||
throw new Exception("region not found");
|
||||
|
||||
int timeout = 30000;
|
||||
string message;
|
||||
|
||||
if (requestData.ContainsKey("restart")
|
||||
&& ((string)requestData["restart"] == "delayed")
|
||||
&& requestData.ContainsKey("milliseconds"))
|
||||
{
|
||||
timeout = Int32.Parse(requestData["milliseconds"].ToString());
|
||||
|
||||
if (timeout < 15000)
|
||||
{
|
||||
//It must be at least 15 seconds or we'll cancel the reboot request
|
||||
timeout = 15000;
|
||||
}
|
||||
|
||||
message
|
||||
= "Region is restarting in " + ((int)(timeout / 1000)).ToString()
|
||||
+ " second(s). Please save what you are doing and log out.";
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "Region is restarting in 30 second(s). Please save what you are doing and log out.";
|
||||
}
|
||||
|
||||
if (requestData.ContainsKey("noticetype")
|
||||
&& ((string)requestData["noticetype"] == "dialog"))
|
||||
{
|
||||
m_app.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!requestData.ContainsKey("noticetype")
|
||||
|| ((string)requestData["noticetype"] != "none"))
|
||||
{
|
||||
m_app.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendGeneralAlert(message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
responseData["rebooting"] = true;
|
||||
response.Value = responseData;
|
||||
rebootedScene.Restart(30);
|
||||
rebootedScene.Restart(timeout / 1000,false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -277,6 +328,53 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
m_log.Info("[RADMIN]: Alert request complete");
|
||||
return response;
|
||||
}
|
||||
public XmlRpcResponse XmlRpcDialogMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
m_log.Info("[RADMIN]: Dialog request started");
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable requestData = (Hashtable)request.Params[0];
|
||||
|
||||
checkStringParameters(request, new string[] { "password", "from", "message" });
|
||||
|
||||
if (m_requiredPassword != String.Empty &&
|
||||
(!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
|
||||
throw new Exception("wrong password");
|
||||
|
||||
string message = (string)requestData["message"];
|
||||
string fromuuid = (string)requestData["from"];
|
||||
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
|
||||
|
||||
responseData["accepted"] = true;
|
||||
responseData["success"] = true;
|
||||
response.Value = responseData;
|
||||
|
||||
m_app.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
|
||||
|
||||
responseData["accepted"] = false;
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
||||
m_log.Info("[RADMIN]: Alert request complete");
|
||||
return response;
|
||||
}
|
||||
|
||||
public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
@@ -384,13 +482,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||
message = "Region is going down now.";
|
||||
}
|
||||
|
||||
m_app.SceneManager.ForEachScene(
|
||||
if (requestData.ContainsKey("noticetype")
|
||||
&& ((string) requestData["noticetype"] == "dialog"))
|
||||
{
|
||||
m_app.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!requestData.ContainsKey("noticetype")
|
||||
|| ((string)requestData["noticetype"] != "none"))
|
||||
{
|
||||
m_app.SceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
|
||||
if (dialogModule != null)
|
||||
dialogModule.SendGeneralAlert(message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Perform shutdown
|
||||
System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
|
||||
protected string RegionStats(OSHttpResponse httpResponse, Scene scene)
|
||||
{
|
||||
int users = scene.GetAvatars().Count;
|
||||
int users = scene.GetRootAgentCount();
|
||||
int objects = scene.Entities.Count - users;
|
||||
|
||||
RestXmlWriter rxw = new RestXmlWriter(new StringWriter());
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||
rxw.WriteString(s.RegionInfo.InternalEndPoint.ToString());
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
int users = s.GetAvatars().Count;
|
||||
int users = s.GetRootAgentCount();
|
||||
rxw.WriteStartAttribute(String.Empty, "avatars", String.Empty);
|
||||
rxw.WriteValue(users);
|
||||
rxw.WriteEndAttribute();
|
||||
|
||||
@@ -826,11 +826,19 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
public void Close(bool sendStop)
|
||||
{
|
||||
m_log.Info("[MXP ClientStack] Close Called");
|
||||
|
||||
// Tell the client to go
|
||||
SendLogoutPacket();
|
||||
if (sendStop == true)
|
||||
{
|
||||
SendLogoutPacket();
|
||||
}
|
||||
|
||||
// Let MXPPacketServer clean it up
|
||||
if (Session.SessionState != SessionState.Disconnected)
|
||||
@@ -923,7 +931,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
public void SendGenericMessage(string method, List<string> message)
|
||||
public void SendGenericMessage(string method, List<byte[]> message)
|
||||
{
|
||||
// Need to translate to MXP somehow
|
||||
}
|
||||
|
||||
@@ -438,6 +438,11 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
public void Close(bool sendStop)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
@@ -497,7 +502,7 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendGenericMessage(string method, List<string> message)
|
||||
public void SendGenericMessage(string method, List<Byte[]> message)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -445,6 +445,11 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
public void Close(bool sendStop)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
@@ -504,7 +509,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void SendGenericMessage(string method, List<string> message)
|
||||
public void SendGenericMessage(string method, List<byte[]> message)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -635,9 +635,9 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="connection">connection to the database</param>
|
||||
private void DeleteItemsInFolder(UUID folderID, SqlConnection connection)
|
||||
{
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryitems WHERE folderID=@folderID", connection))
|
||||
using (SqlCommand command = new SqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", connection))
|
||||
{
|
||||
command.Parameters.Add(database.CreateParameter("folderID", folderID));
|
||||
command.Parameters.Add(database.CreateParameter("parentFolderID", folderID));
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -671,7 +671,16 @@ VALUES
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
//Return default LL windlight settings
|
||||
return new RegionMeta7WindlightData();
|
||||
}
|
||||
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
}
|
||||
/// <summary>
|
||||
/// Loads the settings of a region.
|
||||
/// </summary>
|
||||
@@ -696,7 +705,7 @@ VALUES
|
||||
}
|
||||
}
|
||||
|
||||
//If comes here then there is now region setting for that region
|
||||
//If we reach this point then there are new region settings for that region
|
||||
regionSettings = new RegionSettings();
|
||||
regionSettings.RegionUUID = regionUUID;
|
||||
regionSettings.OnSave += StoreRegionSettings;
|
||||
|
||||
@@ -582,8 +582,21 @@ namespace OpenSim.Data.MSSQL
|
||||
/// <param name="appearance">the appearence</param>
|
||||
override public void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
|
||||
{
|
||||
string sql = @"DELETE FROM avatarappearance WHERE owner=@owner;
|
||||
INSERT INTO avatarappearance
|
||||
string sql = @"DELETE FROM avatarappearance WHERE owner=@owner";
|
||||
using (AutoClosingSqlCommand cmd = database.Query(sql))
|
||||
{
|
||||
cmd.Parameters.Add(database.CreateParameter("@owner", appearance.Owner));
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[USER DB] Error deleting old user appearance, error: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
sql=@"INSERT INTO avatarappearance
|
||||
(owner, serial, visual_params, texture, avatar_height,
|
||||
body_item, body_asset, skin_item, skin_asset, hair_item,
|
||||
hair_asset, eyes_item, eyes_asset, shirt_item, shirt_asset,
|
||||
|
||||
@@ -149,8 +149,9 @@ namespace OpenSim.Data
|
||||
UpdateVersion(_type, newversion);
|
||||
}
|
||||
version = newversion;
|
||||
cmd.Dispose();
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
}
|
||||
|
||||
// private int MaxVersion()
|
||||
|
||||
@@ -711,6 +711,102 @@ namespace OpenSim.Data.MySQL
|
||||
}
|
||||
}
|
||||
|
||||
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
RegionMeta7WindlightData nWP = new RegionMeta7WindlightData();
|
||||
nWP.OnSave += StoreRegionWindlightSettings;
|
||||
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
string command = "select * from `regionwindlight` where region_id = ?regionID";
|
||||
|
||||
using(MySqlCommand cmd = new MySqlCommand(command))
|
||||
{
|
||||
cmd.Connection = dbcon;
|
||||
|
||||
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
|
||||
|
||||
IDataReader result = ExecuteReader(cmd);
|
||||
if (!result.Read())
|
||||
{
|
||||
//No result, so store our default windlight profile and return it
|
||||
nWP.regionID = regionUUID;
|
||||
StoreRegionWindlightSettings(nWP);
|
||||
return nWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID.TryParse(result["region_id"].ToString(), out nWP.regionID);
|
||||
nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
|
||||
nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
|
||||
nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
|
||||
nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
|
||||
nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
|
||||
nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
|
||||
nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
|
||||
nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
|
||||
nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
|
||||
nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
|
||||
nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
|
||||
nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
|
||||
nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
|
||||
nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
|
||||
nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
|
||||
nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
|
||||
nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
|
||||
UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
|
||||
nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
|
||||
nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
|
||||
nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
|
||||
nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
|
||||
nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
|
||||
nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
|
||||
nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
|
||||
nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
|
||||
nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
|
||||
nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
|
||||
nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
|
||||
nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
|
||||
nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
|
||||
nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
|
||||
nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
|
||||
nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
|
||||
nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
|
||||
nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
|
||||
nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
|
||||
nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
|
||||
nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
|
||||
nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
|
||||
nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
|
||||
nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
|
||||
nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
|
||||
nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
|
||||
nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
|
||||
nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
|
||||
nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
|
||||
nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
|
||||
nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
|
||||
nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
|
||||
nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
|
||||
nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
|
||||
nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
|
||||
nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
|
||||
nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
|
||||
nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
|
||||
nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
|
||||
nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
|
||||
nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
|
||||
nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
|
||||
nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
|
||||
nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nWP;
|
||||
}
|
||||
|
||||
public RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
RegionSettings rs = null;
|
||||
@@ -749,6 +845,109 @@ namespace OpenSim.Data.MySQL
|
||||
return rs;
|
||||
}
|
||||
|
||||
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
|
||||
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
|
||||
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
|
||||
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
|
||||
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
|
||||
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
|
||||
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
|
||||
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
|
||||
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
|
||||
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
|
||||
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
|
||||
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
|
||||
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
|
||||
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
|
||||
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
|
||||
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
|
||||
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
|
||||
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
|
||||
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
|
||||
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
|
||||
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
|
||||
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
|
||||
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
|
||||
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
|
||||
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
|
||||
|
||||
cmd.Parameters.AddWithValue("region_id", wl.regionID);
|
||||
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
|
||||
cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
|
||||
cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
|
||||
cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
|
||||
cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
|
||||
cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
|
||||
cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
|
||||
cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
|
||||
cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
|
||||
cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
|
||||
cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
|
||||
cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
|
||||
cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
|
||||
cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
|
||||
cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
|
||||
cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
|
||||
cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
|
||||
cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
|
||||
cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
|
||||
cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
|
||||
cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
|
||||
cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
|
||||
cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
|
||||
cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
|
||||
cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
|
||||
cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
|
||||
cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
|
||||
cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
|
||||
cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
|
||||
cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
|
||||
cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
|
||||
cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
|
||||
cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
|
||||
cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
|
||||
cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
|
||||
cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
|
||||
cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
|
||||
cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
|
||||
cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
|
||||
cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
|
||||
cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
|
||||
cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
|
||||
cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
|
||||
cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StoreRegionSettings(RegionSettings rs)
|
||||
{
|
||||
lock (m_dbLock)
|
||||
|
||||
70
OpenSim/Data/MySQL/Resources/032_RegionStore.sql
Normal file
70
OpenSim/Data/MySQL/Resources/032_RegionStore.sql
Normal file
@@ -0,0 +1,70 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `regionwindlight` (
|
||||
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
|
||||
`water_color_r` float(9,6) unsigned NOT NULL DEFAULT '4.000000',
|
||||
`water_color_g` float(9,6) unsigned NOT NULL DEFAULT '38.000000',
|
||||
`water_color_b` float(9,6) unsigned NOT NULL DEFAULT '64.000000',
|
||||
`water_fog_density_exponent` float(3,1) unsigned NOT NULL DEFAULT '4.0',
|
||||
`underwater_fog_modifier` float(3,2) unsigned NOT NULL DEFAULT '0.25',
|
||||
`reflection_wavelet_scale_1` float(3,1) unsigned NOT NULL DEFAULT '2.0',
|
||||
`reflection_wavelet_scale_2` float(3,1) unsigned NOT NULL DEFAULT '2.0',
|
||||
`reflection_wavelet_scale_3` float(3,1) unsigned NOT NULL DEFAULT '2.0',
|
||||
`fresnel_scale` float(3,2) unsigned NOT NULL DEFAULT '0.40',
|
||||
`fresnel_offset` float(3,2) unsigned NOT NULL DEFAULT '0.50',
|
||||
`refract_scale_above` float(3,2) unsigned NOT NULL DEFAULT '0.03',
|
||||
`refract_scale_below` float(3,2) unsigned NOT NULL DEFAULT '0.20',
|
||||
`blur_multiplier` float(4,3) unsigned NOT NULL DEFAULT '0.040',
|
||||
`big_wave_direction_x` float(3,2) NOT NULL DEFAULT '1.05',
|
||||
`big_wave_direction_y` float(3,2) NOT NULL DEFAULT '-0.42',
|
||||
`little_wave_direction_x` float(3,2) NOT NULL DEFAULT '1.11',
|
||||
`little_wave_direction_y` float(3,2) NOT NULL DEFAULT '-1.16',
|
||||
`normal_map_texture` varchar(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
|
||||
`horizon_r` float(3,2) unsigned NOT NULL DEFAULT '0.25',
|
||||
`horizon_g` float(3,2) unsigned NOT NULL DEFAULT '0.25',
|
||||
`horizon_b` float(3,2) unsigned NOT NULL DEFAULT '0.32',
|
||||
`horizon_i` float(3,2) unsigned NOT NULL DEFAULT '0.32',
|
||||
`haze_horizon` float(3,2) unsigned NOT NULL DEFAULT '0.19',
|
||||
`blue_density_r` float(3,2) unsigned NOT NULL DEFAULT '0.12',
|
||||
`blue_density_g` float(3,2) unsigned NOT NULL DEFAULT '0.22',
|
||||
`blue_density_b` float(3,2) unsigned NOT NULL DEFAULT '0.38',
|
||||
`blue_density_i` float(3,2) unsigned NOT NULL DEFAULT '0.38',
|
||||
`haze_density` float(3,2) unsigned NOT NULL DEFAULT '0.70',
|
||||
`density_multiplier` float(3,2) unsigned NOT NULL DEFAULT '0.18',
|
||||
`distance_multiplier` float(4,1) unsigned NOT NULL DEFAULT '0.8',
|
||||
`max_altitude` int(4) unsigned NOT NULL DEFAULT '1605',
|
||||
`sun_moon_color_r` float(3,2) unsigned NOT NULL DEFAULT '0.24',
|
||||
`sun_moon_color_g` float(3,2) unsigned NOT NULL DEFAULT '0.26',
|
||||
`sun_moon_color_b` float(3,2) unsigned NOT NULL DEFAULT '0.30',
|
||||
`sun_moon_color_i` float(3,2) unsigned NOT NULL DEFAULT '0.30',
|
||||
`sun_moon_position` float(4,3) unsigned NOT NULL DEFAULT '0.317',
|
||||
`ambient_r` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`ambient_g` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`ambient_b` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`ambient_i` float(3,2) unsigned NOT NULL DEFAULT '0.35',
|
||||
`east_angle` float(3,2) unsigned NOT NULL DEFAULT '0.00',
|
||||
`sun_glow_focus` float(3,2) unsigned NOT NULL DEFAULT '0.10',
|
||||
`sun_glow_size` float(3,2) unsigned NOT NULL DEFAULT '1.75',
|
||||
`scene_gamma` float(4,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`star_brightness` float(3,2) unsigned NOT NULL DEFAULT '0.00',
|
||||
`cloud_color_r` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_color_g` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_color_b` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_color_i` float(3,2) unsigned NOT NULL DEFAULT '0.41',
|
||||
`cloud_x` float(3,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`cloud_y` float(3,2) unsigned NOT NULL DEFAULT '0.53',
|
||||
`cloud_density` float(3,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`cloud_coverage` float(3,2) unsigned NOT NULL DEFAULT '0.27',
|
||||
`cloud_scale` float(3,2) unsigned NOT NULL DEFAULT '0.42',
|
||||
`cloud_detail_x` float(3,2) unsigned NOT NULL DEFAULT '1.00',
|
||||
`cloud_detail_y` float(3,2) unsigned NOT NULL DEFAULT '0.53',
|
||||
`cloud_detail_density` float(3,2) unsigned NOT NULL DEFAULT '0.12',
|
||||
`cloud_scroll_x` float(3,2) unsigned NOT NULL DEFAULT '0.20',
|
||||
`cloud_scroll_x_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`cloud_scroll_y` float(3,2) unsigned NOT NULL DEFAULT '0.01',
|
||||
`cloud_scroll_y_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`draw_classic_clouds` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`region_id`)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
@@ -50,7 +50,16 @@ namespace OpenSim.Data.Null
|
||||
public void StoreRegionSettings(RegionSettings rs)
|
||||
{
|
||||
}
|
||||
|
||||
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
//Return default LL windlight settings
|
||||
return new RegionMeta7WindlightData();
|
||||
}
|
||||
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
}
|
||||
public RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
@@ -339,4 +339,4 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
@@ -62,8 +62,8 @@ namespace OpenSim.Data.SQLite
|
||||
Migration m = new Migration(m_connection, assem, "EstateStore");
|
||||
m.Update();
|
||||
|
||||
m_connection.Close();
|
||||
m_connection.Open();
|
||||
//m_connection.Close();
|
||||
// m_connection.Open();
|
||||
|
||||
Type t = typeof(EstateSettings);
|
||||
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
||||
@@ -90,7 +90,7 @@ namespace OpenSim.Data.SQLite
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
@@ -140,13 +140,13 @@ namespace OpenSim.Data.SQLite
|
||||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
if ((bool)m_FieldMap[name].GetValue(es))
|
||||
cmd.Parameters.Add(":"+name, "1");
|
||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||
else
|
||||
cmd.Parameters.Add(":"+name, "0");
|
||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,8 +164,8 @@ namespace OpenSim.Data.SQLite
|
||||
r.Close();
|
||||
|
||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||
|
||||
// This will throw on dupe key
|
||||
try
|
||||
@@ -180,7 +180,7 @@ namespace OpenSim.Data.SQLite
|
||||
//
|
||||
cmd.Parameters.Clear();
|
||||
cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID";
|
||||
cmd.Parameters.Add(":UUID", regionID.ToString());
|
||||
cmd.Parameters.AddWithValue(":UUID", regionID.ToString());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -222,13 +222,13 @@ namespace OpenSim.Data.SQLite
|
||||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
if ((bool)m_FieldMap[name].GetValue(es))
|
||||
cmd.Parameters.Add(":"+name, "1");
|
||||
cmd.Parameters.AddWithValue(":"+name, "1");
|
||||
else
|
||||
cmd.Parameters.Add(":"+name, "0");
|
||||
cmd.Parameters.AddWithValue(":"+name, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
cmd.Parameters.AddWithValue(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace OpenSim.Data.SQLite
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID);
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace OpenSim.Data.SQLite
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
@@ -281,8 +281,8 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
foreach (EstateBan b in es.EstateBans)
|
||||
{
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":bannedUUID", b.BannedUserID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
@@ -294,7 +294,7 @@ namespace OpenSim.Data.SQLite
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
@@ -304,8 +304,8 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
foreach (UUID uuid in data)
|
||||
{
|
||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.Add(":uuid", uuid.ToString());
|
||||
cmd.Parameters.AddWithValue(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.AddWithValue(":uuid", uuid.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
@@ -319,7 +319,7 @@ namespace OpenSim.Data.SQLite
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", EstateID);
|
||||
cmd.Parameters.AddWithValue(":EstateID", EstateID);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
@@ -337,4 +337,4 @@ namespace OpenSim.Data.SQLite
|
||||
return uuids.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
@@ -65,12 +65,18 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
protected IDataReader ExecuteReader(SqliteCommand cmd)
|
||||
{
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||
newConnection.Open();
|
||||
lock (m_Connection)
|
||||
{
|
||||
//SqliteConnection newConnection =
|
||||
// (SqliteConnection)((ICloneable)connection).Clone();
|
||||
//newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
return cmd.ExecuteReader();
|
||||
//cmd.Connection = newConnection;
|
||||
cmd.Connection = m_Connection;
|
||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||
|
||||
return cmd.ExecuteReader();
|
||||
}
|
||||
}
|
||||
|
||||
protected void CloseReaderCommand(SqliteCommand cmd)
|
||||
@@ -80,4 +86,4 @@ namespace OpenSim.Data.SQLite
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
@@ -54,10 +54,23 @@ namespace OpenSim.Data.SQLite
|
||||
m_Realm = realm;
|
||||
if (storeName != String.Empty)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
m_Connection = new SqliteConnection(connectionString);
|
||||
//Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString));
|
||||
m_Connection.Open();
|
||||
|
||||
Migration m = new Migration(m_Connection, assem, storeName);
|
||||
m.Update();
|
||||
if (storeName != String.Empty)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
//SqliteConnection newConnection =
|
||||
// (SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||
//newConnection.Open();
|
||||
|
||||
//Migration m = new Migration(newConnection, assem, storeName);
|
||||
Migration m = new Migration(m_Connection, assem, storeName);
|
||||
m.Update();
|
||||
//newConnection.Close();
|
||||
//newConnection.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Type t = typeof(T);
|
||||
@@ -180,7 +193,7 @@ namespace OpenSim.Data.SQLite
|
||||
result.Add(row);
|
||||
}
|
||||
|
||||
CloseReaderCommand(cmd);
|
||||
//CloseCommand(cmd);
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
@@ -88,15 +88,17 @@ namespace OpenSim.Data.SQLite
|
||||
invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
|
||||
|
||||
ds = new DataSet();
|
||||
|
||||
|
||||
ds.Tables.Add(createInventoryFoldersTable());
|
||||
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
||||
setupFoldersCommands(invFoldersDa, conn);
|
||||
CreateDataSetMapping(invFoldersDa, "inventoryfolders");
|
||||
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
||||
|
||||
ds.Tables.Add(createInventoryItemsTable());
|
||||
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
||||
setupItemsCommands(invItemsDa, conn);
|
||||
CreateDataSetMapping(invItemsDa, "inventoryitems");
|
||||
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
||||
|
||||
ds.AcceptChanges();
|
||||
@@ -721,6 +723,15 @@ namespace OpenSim.Data.SQLite
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
|
||||
{
|
||||
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
|
||||
foreach (DataColumn col in ds.Tables[tableName].Columns)
|
||||
{
|
||||
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the "inventoryitems" table
|
||||
/// </summary>
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SQLite;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
@@ -66,7 +66,7 @@ namespace OpenSim.Data.SQLite
|
||||
connectionString = "URI=file:GridServerSqlite.db;";
|
||||
}
|
||||
|
||||
dbcon = new SQLiteConnection(connectionString);
|
||||
dbcon = new SqliteConnection(connectionString);
|
||||
|
||||
dbcon.Open();
|
||||
}
|
||||
@@ -93,11 +93,11 @@ namespace OpenSim.Data.SQLite
|
||||
/// <returns>A SQLite DB Command</returns>
|
||||
public IDbCommand Query(string sql, Dictionary<string, string> parameters)
|
||||
{
|
||||
SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand();
|
||||
SqliteCommand dbcommand = (SqliteCommand) dbcon.CreateCommand();
|
||||
dbcommand.CommandText = sql;
|
||||
foreach (KeyValuePair<string, string> param in parameters)
|
||||
{
|
||||
SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value);
|
||||
SqliteParameter paramx = new SqliteParameter(param.Key, param.Value);
|
||||
dbcommand.Parameters.Add(paramx);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
@@ -87,119 +87,151 @@ namespace OpenSim.Data.SQLite
|
||||
/// <param name="connectionString">the connection string</param>
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
ds = new DataSet();
|
||||
|
||||
m_log.Info("[REGION DB]: Sqlite - connecting: " + connectionString);
|
||||
m_conn = new SqliteConnection(m_connectionString);
|
||||
m_conn.Open();
|
||||
|
||||
|
||||
|
||||
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
||||
primDa = new SqliteDataAdapter(primSelectCmd);
|
||||
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
||||
|
||||
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
||||
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
|
||||
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
|
||||
|
||||
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
|
||||
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
||||
|
||||
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
|
||||
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
|
||||
|
||||
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
|
||||
landDa = new SqliteDataAdapter(landSelectCmd);
|
||||
|
||||
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
|
||||
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
||||
|
||||
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
||||
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
||||
// This actually does the roll forward assembly stuff
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_conn, assem, "RegionStore");
|
||||
m.Update();
|
||||
|
||||
lock (ds)
|
||||
try
|
||||
{
|
||||
ds.Tables.Add(createPrimTable());
|
||||
setupPrimCommands(primDa, m_conn);
|
||||
primDa.Fill(ds.Tables["prims"]);
|
||||
m_connectionString = connectionString;
|
||||
|
||||
ds.Tables.Add(createShapeTable());
|
||||
setupShapeCommands(shapeDa, m_conn);
|
||||
ds = new DataSet("Region");
|
||||
|
||||
ds.Tables.Add(createItemsTable());
|
||||
setupItemsCommands(itemsDa, m_conn);
|
||||
itemsDa.Fill(ds.Tables["primitems"]);
|
||||
m_log.Info("[SQLITE REGION DB]: Sqlite - connecting: " + connectionString);
|
||||
m_conn = new SqliteConnection(m_connectionString);
|
||||
m_conn.Open();
|
||||
|
||||
ds.Tables.Add(createTerrainTable());
|
||||
setupTerrainCommands(terrainDa, m_conn);
|
||||
SqliteCommand primSelectCmd = new SqliteCommand(primSelect, m_conn);
|
||||
primDa = new SqliteDataAdapter(primSelectCmd);
|
||||
|
||||
ds.Tables.Add(createLandTable());
|
||||
setupLandCommands(landDa, m_conn);
|
||||
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
|
||||
shapeDa = new SqliteDataAdapter(shapeSelectCmd);
|
||||
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
|
||||
|
||||
ds.Tables.Add(createLandAccessListTable());
|
||||
setupLandAccessCommands(landAccessListDa, m_conn);
|
||||
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
|
||||
itemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
||||
|
||||
ds.Tables.Add(createRegionSettingsTable());
|
||||
|
||||
setupRegionSettingsCommands(regionSettingsDa, m_conn);
|
||||
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
|
||||
terrainDa = new SqliteDataAdapter(terrainSelectCmd);
|
||||
|
||||
// WORKAROUND: This is a work around for sqlite on
|
||||
// windows, which gets really unhappy with blob columns
|
||||
// that have no sample data in them. At some point we
|
||||
// need to actually find a proper way to handle this.
|
||||
try
|
||||
SqliteCommand landSelectCmd = new SqliteCommand(landSelect, m_conn);
|
||||
landDa = new SqliteDataAdapter(landSelectCmd);
|
||||
|
||||
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
|
||||
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
|
||||
|
||||
SqliteCommand regionSettingsSelectCmd = new SqliteCommand(regionSettingsSelect, m_conn);
|
||||
regionSettingsDa = new SqliteDataAdapter(regionSettingsSelectCmd);
|
||||
// This actually does the roll forward assembly stuff
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_conn, assem, "RegionStore");
|
||||
m.Update();
|
||||
|
||||
lock (ds)
|
||||
{
|
||||
shapeDa.Fill(ds.Tables["primshapes"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on primshapes table");
|
||||
}
|
||||
ds.Tables.Add(createPrimTable());
|
||||
setupPrimCommands(primDa, m_conn);
|
||||
|
||||
try
|
||||
{
|
||||
terrainDa.Fill(ds.Tables["terrain"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on terrain table");
|
||||
}
|
||||
ds.Tables.Add(createShapeTable());
|
||||
setupShapeCommands(shapeDa, m_conn);
|
||||
|
||||
try
|
||||
{
|
||||
landDa.Fill(ds.Tables["land"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on land table");
|
||||
}
|
||||
ds.Tables.Add(createItemsTable());
|
||||
setupItemsCommands(itemsDa, m_conn);
|
||||
|
||||
try
|
||||
{
|
||||
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
|
||||
}
|
||||
ds.Tables.Add(createTerrainTable());
|
||||
setupTerrainCommands(terrainDa, m_conn);
|
||||
|
||||
try
|
||||
{
|
||||
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
|
||||
ds.Tables.Add(createLandTable());
|
||||
setupLandCommands(landDa, m_conn);
|
||||
|
||||
ds.Tables.Add(createLandAccessListTable());
|
||||
setupLandAccessCommands(landAccessListDa, m_conn);
|
||||
|
||||
ds.Tables.Add(createRegionSettingsTable());
|
||||
setupRegionSettingsCommands(regionSettingsDa, m_conn);
|
||||
|
||||
// WORKAROUND: This is a work around for sqlite on
|
||||
// windows, which gets really unhappy with blob columns
|
||||
// that have no sample data in them. At some point we
|
||||
// need to actually find a proper way to handle this.
|
||||
try
|
||||
{
|
||||
primDa.Fill(ds.Tables["prims"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on prims table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
shapeDa.Fill(ds.Tables["primshapes"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on primshapes table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
itemsDa.Fill(ds.Tables["primitems"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
terrainDa.Fill(ds.Tables["terrain"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on terrain table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
landDa.Fill(ds.Tables["land"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on land table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
landAccessListDa.Fill(ds.Tables["landaccesslist"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on landaccesslist table");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
regionSettingsDa.Fill(ds.Tables["regionsettings"]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[SQLITE REGION DB]: Caught fill error on regionsettings table");
|
||||
}
|
||||
|
||||
// We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values!
|
||||
// Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409
|
||||
// Possibly because we manually set up our own DataTables before connecting to the database
|
||||
CreateDataSetMapping(primDa, "prims");
|
||||
CreateDataSetMapping(shapeDa, "primshapes");
|
||||
CreateDataSetMapping(itemsDa, "primitems");
|
||||
CreateDataSetMapping(terrainDa, "terrain");
|
||||
CreateDataSetMapping(landDa, "land");
|
||||
CreateDataSetMapping(landAccessListDa, "landaccesslist");
|
||||
CreateDataSetMapping(regionSettingsDa, "regionsettings");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Caught fill error on regionsettings table");
|
||||
}
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error(e);
|
||||
Environment.Exit(23);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -272,7 +304,16 @@ namespace OpenSim.Data.SQLite
|
||||
Commit();
|
||||
}
|
||||
}
|
||||
|
||||
public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
//Return default LL windlight settings
|
||||
return new RegionMeta7WindlightData();
|
||||
}
|
||||
public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
|
||||
{
|
||||
//This connector doesn't support the windlight module yet
|
||||
}
|
||||
public RegionSettings LoadRegionSettings(UUID regionUUID)
|
||||
{
|
||||
lock (ds)
|
||||
@@ -320,7 +361,7 @@ namespace OpenSim.Data.SQLite
|
||||
{
|
||||
foreach (SceneObjectPart prim in obj.Children.Values)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
||||
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
||||
addPrim(prim, obj.UUID, regionUUID);
|
||||
}
|
||||
}
|
||||
@@ -402,7 +443,7 @@ namespace OpenSim.Data.SQLite
|
||||
lock (ds)
|
||||
{
|
||||
DataRow[] primsForRegion = prims.Select(byRegion);
|
||||
m_log.Info("[REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
|
||||
// m_log.Info("[SQLITE REGION DB]: Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
|
||||
|
||||
// First, create all groups
|
||||
foreach (DataRow primRow in primsForRegion)
|
||||
@@ -424,8 +465,8 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info(
|
||||
"[REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
m_log.Warn(
|
||||
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
prim.Shape = PrimitiveBaseShape.Default;
|
||||
}
|
||||
|
||||
@@ -437,11 +478,11 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows");
|
||||
m_log.Info("[REGION DB]: " + e.ToString());
|
||||
m_log.Error("[SQLITE REGION DB]: Failed create prim object in new group, exception and data follows");
|
||||
m_log.Error("[SQLITE REGION DB]: ", e);
|
||||
foreach (DataColumn col in prims.Columns)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,7 +507,7 @@ namespace OpenSim.Data.SQLite
|
||||
else
|
||||
{
|
||||
m_log.Warn(
|
||||
"[REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
"[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
|
||||
prim.Shape = PrimitiveBaseShape.Default;
|
||||
}
|
||||
|
||||
@@ -476,11 +517,11 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows");
|
||||
m_log.Info("[REGION DB]: " + e.ToString());
|
||||
m_log.Error("[SQLITE REGION DB]: Failed create prim object in group, exception and data follows");
|
||||
m_log.Error("[SQLITE REGION DB]: ", e);
|
||||
foreach (DataColumn col in prims.Columns)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
m_log.Error("[SQLITE REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -493,20 +534,23 @@ namespace OpenSim.Data.SQLite
|
||||
/// </summary>
|
||||
/// <param name="prim">the prim</param>
|
||||
private void LoadItems(SceneObjectPart prim)
|
||||
{
|
||||
//m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
|
||||
|
||||
{
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
|
||||
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
DataRow[] dbItemRows = dbItems.Select(sql);
|
||||
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
|
||||
|
||||
foreach (DataRow row in dbItemRows)
|
||||
{
|
||||
TaskInventoryItem item = buildItem(row);
|
||||
inventory.Add(item);
|
||||
|
||||
//m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Restored item {0} {1}", item.Name, item.ItemID);
|
||||
}
|
||||
|
||||
prim.Inventory.RestoreInventoryItems(inventory);
|
||||
@@ -542,7 +586,7 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
// the following is an work around for .NET. The perf
|
||||
// issues associated with it aren't as bad as you think.
|
||||
m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString());
|
||||
m_log.Debug("[SQLITE REGION DB]: Storing terrain revision r" + revision.ToString());
|
||||
String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
|
||||
" values(:RegionUUID, :Revision, :Heightfield)";
|
||||
|
||||
@@ -594,15 +638,15 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
}
|
||||
}
|
||||
rev = (int) row["Revision"];
|
||||
rev = Convert.ToInt32(row["Revision"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[REGION DB]: No terrain found for region");
|
||||
m_log.Warn("[SQLITE REGION DB]: No terrain found for region");
|
||||
return null;
|
||||
}
|
||||
|
||||
m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
|
||||
m_log.Debug("[SQLITE REGION DB]: Loaded terrain revision r" + rev.ToString());
|
||||
}
|
||||
}
|
||||
return terret;
|
||||
@@ -746,6 +790,7 @@ namespace OpenSim.Data.SQLite
|
||||
/// </summary>
|
||||
public void Commit()
|
||||
{
|
||||
//m_log.Debug("[SQLITE]: Starting commit");
|
||||
lock (ds)
|
||||
{
|
||||
primDa.Update(ds, "prims");
|
||||
@@ -760,18 +805,11 @@ namespace OpenSim.Data.SQLite
|
||||
{
|
||||
regionSettingsDa.Update(ds, "regionsettings");
|
||||
}
|
||||
catch (SqliteExecutionException SqlEx)
|
||||
catch (SqliteException SqlEx)
|
||||
{
|
||||
if (SqlEx.Message.Contains("logic error"))
|
||||
{
|
||||
throw new Exception(
|
||||
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
|
||||
SqlEx);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw SqlEx;
|
||||
}
|
||||
throw new Exception(
|
||||
"There was a SQL error or connection string configuration error when saving the region settings. This could be a bug, it could also happen if ConnectionString is defined in the [DatabaseService] section of StandaloneCommon.ini in the config_include folder. This could also happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. If this is your first time running OpenSimulator, please restart the simulator and bug a developer to fix this!",
|
||||
SqlEx);
|
||||
}
|
||||
ds.AcceptChanges();
|
||||
}
|
||||
@@ -793,6 +831,15 @@ namespace OpenSim.Data.SQLite
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
|
||||
{
|
||||
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
|
||||
foreach (DataColumn col in ds.Tables[tableName].Columns)
|
||||
{
|
||||
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -1381,7 +1428,7 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
catch (InvalidCastException)
|
||||
{
|
||||
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
|
||||
m_log.ErrorFormat("[SQLITE REGION DB]: unable to get parcel telehub settings for {1}", newData.Name);
|
||||
newData.UserLocation = Vector3.Zero;
|
||||
newData.UserLookAt = Vector3.Zero;
|
||||
}
|
||||
@@ -1888,7 +1935,7 @@ namespace OpenSim.Data.SQLite
|
||||
/// <param name="items"></param>
|
||||
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
|
||||
{
|
||||
m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
|
||||
// m_log.DebugFormat("[SQLITE REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
|
||||
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
|
||||
@@ -1955,6 +2002,7 @@ namespace OpenSim.Data.SQLite
|
||||
sql += ") values (:";
|
||||
sql += String.Join(", :", cols);
|
||||
sql += ")";
|
||||
//m_log.DebugFormat("[SQLITE]: Created insert command {0}", sql);
|
||||
SqliteCommand cmd = new SqliteCommand(sql);
|
||||
|
||||
// this provides the binding for all our parameters, so
|
||||
@@ -2250,6 +2298,36 @@ namespace OpenSim.Data.SQLite
|
||||
return DbType.String;
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintDataSet(DataSet ds)
|
||||
{
|
||||
// Print out any name and extended properties.
|
||||
Console.WriteLine("DataSet is named: {0}", ds.DataSetName);
|
||||
foreach (System.Collections.DictionaryEntry de in ds.ExtendedProperties)
|
||||
{
|
||||
Console.WriteLine("Key = {0}, Value = {1}", de.Key, de.Value);
|
||||
}
|
||||
Console.WriteLine();
|
||||
foreach (DataTable dt in ds.Tables)
|
||||
{
|
||||
Console.WriteLine("=> {0} Table:", dt.TableName);
|
||||
// Print out the column names.
|
||||
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
|
||||
{
|
||||
Console.Write(dt.Columns[curCol].ColumnName + "\t");
|
||||
}
|
||||
Console.WriteLine("\n----------------------------------");
|
||||
// Print the DataTable.
|
||||
for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
|
||||
{
|
||||
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
|
||||
{
|
||||
Console.Write(dt.Rows[curRow][curCol].ToString() + "\t");
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
@@ -115,15 +115,19 @@ namespace OpenSim.Data.SQLite
|
||||
|
||||
setupUserCommands(da, conn);
|
||||
da.Fill(ds.Tables["users"]);
|
||||
CreateDataSetMapping(da, "users");
|
||||
|
||||
setupAgentCommands(dua, conn);
|
||||
dua.Fill(ds.Tables["useragents"]);
|
||||
CreateDataSetMapping(dua, "useragents");
|
||||
|
||||
setupUserFriendsCommands(daf, conn);
|
||||
daf.Fill(ds.Tables["userfriends"]);
|
||||
CreateDataSetMapping(daf, "userfriends");
|
||||
|
||||
setupAvatarAppearanceCommands(daa, conn);
|
||||
daa.Fill(ds.Tables["avatarappearance"]);
|
||||
CreateDataSetMapping(daa, "avatarappearance");
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -706,15 +710,10 @@ namespace OpenSim.Data.SQLite
|
||||
aa.SkirtItem = new UUID((String)row["SkirtItem"]);
|
||||
aa.SkirtAsset = new UUID((String)row["SkirtAsset"]);
|
||||
|
||||
// Ewe Loon
|
||||
// Used Base64String because for some reason it wont accept using Byte[] (which works in Region date)
|
||||
|
||||
String str = (String)row["Texture"];
|
||||
byte[] texture = Convert.FromBase64String(str);
|
||||
byte[] texture = (byte[])row["Texture"];
|
||||
aa.Texture = new Primitive.TextureEntry(texture, 0, texture.Length);
|
||||
|
||||
str = (String)row["VisualParams"];
|
||||
byte[] VisualParams = Convert.FromBase64String(str);
|
||||
byte[] VisualParams = (byte[])row["VisualParams"];
|
||||
aa.VisualParams = VisualParams;
|
||||
|
||||
aa.Serial = Convert.ToInt32(row["Serial"]);
|
||||
@@ -793,6 +792,15 @@ namespace OpenSim.Data.SQLite
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
protected void CreateDataSetMapping(IDataAdapter da, string tableName)
|
||||
{
|
||||
ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
|
||||
foreach (DataColumn col in ds.Tables[tableName].Columns)
|
||||
{
|
||||
dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create the "users" table
|
||||
/// </summary>
|
||||
@@ -924,9 +932,8 @@ namespace OpenSim.Data.SQLite
|
||||
SQLiteUtil.createCol(aa, "SkirtItem", typeof(String));
|
||||
SQLiteUtil.createCol(aa, "SkirtAsset", typeof(String));
|
||||
|
||||
// Used Base64String because for some reason it wont accept using Byte[] (which works in Region date)
|
||||
SQLiteUtil.createCol(aa, "Texture", typeof (String));
|
||||
SQLiteUtil.createCol(aa, "VisualParams", typeof (String));
|
||||
SQLiteUtil.createCol(aa, "Texture", typeof (Byte[]));
|
||||
SQLiteUtil.createCol(aa, "VisualParams", typeof (Byte[]));
|
||||
|
||||
SQLiteUtil.createCol(aa, "Serial", typeof(Int32));
|
||||
SQLiteUtil.createCol(aa, "AvatarHeight", typeof(Double));
|
||||
@@ -1090,8 +1097,8 @@ namespace OpenSim.Data.SQLite
|
||||
row["SkirtAsset"] = appearance.SkirtAsset.ToString();
|
||||
|
||||
// Used Base64String because for some reason it wont accept using Byte[] (which works in Region date)
|
||||
row["Texture"] = Convert.ToBase64String(appearance.Texture.GetBytes());
|
||||
row["VisualParams"] = Convert.ToBase64String(appearance.VisualParams);
|
||||
row["Texture"] = appearance.Texture.GetBytes();
|
||||
row["VisualParams"] = appearance.VisualParams;
|
||||
|
||||
row["Serial"] = appearance.Serial;
|
||||
row["AvatarHeight"] = appearance.AvatarHeight;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
|
||||
namespace OpenSim.Data.SQLite
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ using System;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using Mono.Data.SqliteClient;
|
||||
using Mono.Data.Sqlite;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
@@ -147,8 +147,8 @@ namespace OpenSim.Data.SQLite
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
CloseReaderCommand(cmd);
|
||||
|
||||
|
||||
//CloseCommand(cmd);
|
||||
return perms;
|
||||
}
|
||||
}
|
||||
|
||||
65
OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs
Normal file
65
OpenSim/Data/SQLiteLegacy/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
[assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")]
|
||||
[assembly : AssemblyDescription("")]
|
||||
[assembly : AssemblyConfiguration("")]
|
||||
[assembly : AssemblyCompany("http://opensimulator.org")]
|
||||
[assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")]
|
||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
||||
[assembly : AssemblyTrademark("")]
|
||||
[assembly : AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
[assembly : ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("0.6.5.*")]
|
||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
||||
12
OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql
Normal file
12
OpenSim/Data/SQLiteLegacy/Resources/001_AssetStore.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE assets(
|
||||
UUID varchar(255) primary key,
|
||||
Name varchar(255),
|
||||
Description varchar(255),
|
||||
Type integer,
|
||||
InvType integer,
|
||||
Local integer,
|
||||
Temporary integer,
|
||||
Data blob);
|
||||
|
||||
COMMIT;
|
||||
32
OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql
Normal file
32
OpenSim/Data/SQLiteLegacy/Resources/001_InventoryStore.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE inventoryfolders(
|
||||
UUID varchar(255) primary key,
|
||||
name varchar(255),
|
||||
agentID varchar(255),
|
||||
parentID varchar(255),
|
||||
type integer,
|
||||
version integer);
|
||||
|
||||
CREATE TABLE inventoryitems(
|
||||
UUID varchar(255) primary key,
|
||||
assetID varchar(255),
|
||||
assetType integer,
|
||||
invType integer,
|
||||
parentFolderID varchar(255),
|
||||
avatarID varchar(255),
|
||||
creatorsID varchar(255),
|
||||
inventoryName varchar(255),
|
||||
inventoryDescription varchar(255),
|
||||
inventoryNextPermissions integer,
|
||||
inventoryCurrentPermissions integer,
|
||||
inventoryBasePermissions integer,
|
||||
inventoryEveryOnePermissions integer,
|
||||
salePrice integer default 99,
|
||||
saleType integer default 0,
|
||||
creationDate integer default 2000,
|
||||
groupID varchar(255) default '00000000-0000-0000-0000-000000000000',
|
||||
groupOwned integer default 0,
|
||||
flags integer default 0);
|
||||
|
||||
COMMIT;
|
||||
144
OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql
Normal file
144
OpenSim/Data/SQLiteLegacy/Resources/001_RegionStore.sql
Normal file
@@ -0,0 +1,144 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE prims(
|
||||
UUID varchar(255) primary key,
|
||||
RegionUUID varchar(255),
|
||||
ParentID integer,
|
||||
CreationDate integer,
|
||||
Name varchar(255),
|
||||
SceneGroupID varchar(255),
|
||||
Text varchar(255),
|
||||
Description varchar(255),
|
||||
SitName varchar(255),
|
||||
TouchName varchar(255),
|
||||
CreatorID varchar(255),
|
||||
OwnerID varchar(255),
|
||||
GroupID varchar(255),
|
||||
LastOwnerID varchar(255),
|
||||
OwnerMask integer,
|
||||
NextOwnerMask integer,
|
||||
GroupMask integer,
|
||||
EveryoneMask integer,
|
||||
BaseMask integer,
|
||||
PositionX float,
|
||||
PositionY float,
|
||||
PositionZ float,
|
||||
GroupPositionX float,
|
||||
GroupPositionY float,
|
||||
GroupPositionZ float,
|
||||
VelocityX float,
|
||||
VelocityY float,
|
||||
VelocityZ float,
|
||||
AngularVelocityX float,
|
||||
AngularVelocityY float,
|
||||
AngularVelocityZ float,
|
||||
AccelerationX float,
|
||||
AccelerationY float,
|
||||
AccelerationZ float,
|
||||
RotationX float,
|
||||
RotationY float,
|
||||
RotationZ float,
|
||||
RotationW float,
|
||||
ObjectFlags integer,
|
||||
SitTargetOffsetX float NOT NULL default 0,
|
||||
SitTargetOffsetY float NOT NULL default 0,
|
||||
SitTargetOffsetZ float NOT NULL default 0,
|
||||
SitTargetOrientW float NOT NULL default 0,
|
||||
SitTargetOrientX float NOT NULL default 0,
|
||||
SitTargetOrientY float NOT NULL default 0,
|
||||
SitTargetOrientZ float NOT NULL default 0);
|
||||
|
||||
CREATE TABLE primshapes(
|
||||
UUID varchar(255) primary key,
|
||||
Shape integer,
|
||||
ScaleX float,
|
||||
ScaleY float,
|
||||
ScaleZ float,
|
||||
PCode integer,
|
||||
PathBegin integer,
|
||||
PathEnd integer,
|
||||
PathScaleX integer,
|
||||
PathScaleY integer,
|
||||
PathShearX integer,
|
||||
PathShearY integer,
|
||||
PathSkew integer,
|
||||
PathCurve integer,
|
||||
PathRadiusOffset integer,
|
||||
PathRevolutions integer,
|
||||
PathTaperX integer,
|
||||
PathTaperY integer,
|
||||
PathTwist integer,
|
||||
PathTwistBegin integer,
|
||||
ProfileBegin integer,
|
||||
ProfileEnd integer,
|
||||
ProfileCurve integer,
|
||||
ProfileHollow integer,
|
||||
Texture blob,
|
||||
ExtraParams blob,
|
||||
State Integer NOT NULL default 0);
|
||||
|
||||
CREATE TABLE primitems(
|
||||
itemID varchar(255) primary key,
|
||||
primID varchar(255),
|
||||
assetID varchar(255),
|
||||
parentFolderID varchar(255),
|
||||
invType integer,
|
||||
assetType integer,
|
||||
name varchar(255),
|
||||
description varchar(255),
|
||||
creationDate integer,
|
||||
creatorID varchar(255),
|
||||
ownerID varchar(255),
|
||||
lastOwnerID varchar(255),
|
||||
groupID varchar(255),
|
||||
nextPermissions string,
|
||||
currentPermissions string,
|
||||
basePermissions string,
|
||||
everyonePermissions string,
|
||||
groupPermissions string);
|
||||
|
||||
CREATE TABLE terrain(
|
||||
RegionUUID varchar(255),
|
||||
Revision integer,
|
||||
Heightfield blob);
|
||||
|
||||
CREATE TABLE land(
|
||||
UUID varchar(255) primary key,
|
||||
RegionUUID varchar(255),
|
||||
LocalLandID string,
|
||||
Bitmap blob,
|
||||
Name varchar(255),
|
||||
Desc varchar(255),
|
||||
OwnerUUID varchar(255),
|
||||
IsGroupOwned string,
|
||||
Area integer,
|
||||
AuctionID integer,
|
||||
Category integer,
|
||||
ClaimDate integer,
|
||||
ClaimPrice integer,
|
||||
GroupUUID varchar(255),
|
||||
SalePrice integer,
|
||||
LandStatus integer,
|
||||
LandFlags string,
|
||||
LandingType string,
|
||||
MediaAutoScale string,
|
||||
MediaTextureUUID varchar(255),
|
||||
MediaURL varchar(255),
|
||||
MusicURL varchar(255),
|
||||
PassHours float,
|
||||
PassPrice string,
|
||||
SnapshotUUID varchar(255),
|
||||
UserLocationX float,
|
||||
UserLocationY float,
|
||||
UserLocationZ float,
|
||||
UserLookAtX float,
|
||||
UserLookAtY float,
|
||||
UserLookAtZ float,
|
||||
AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000');
|
||||
|
||||
CREATE TABLE landaccesslist(
|
||||
LandUUID varchar(255),
|
||||
AccessUUID varchar(255),
|
||||
Flags string);
|
||||
|
||||
COMMIT;
|
||||
39
OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql
Normal file
39
OpenSim/Data/SQLiteLegacy/Resources/001_UserStore.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
-- users table
|
||||
CREATE TABLE users(
|
||||
UUID varchar(255) primary key,
|
||||
username varchar(255),
|
||||
surname varchar(255),
|
||||
passwordHash varchar(255),
|
||||
passwordSalt varchar(255),
|
||||
homeRegionX integer,
|
||||
homeRegionY integer,
|
||||
homeLocationX float,
|
||||
homeLocationY float,
|
||||
homeLocationZ float,
|
||||
homeLookAtX float,
|
||||
homeLookAtY float,
|
||||
homeLookAtZ float,
|
||||
created integer,
|
||||
lastLogin integer,
|
||||
rootInventoryFolderID varchar(255),
|
||||
userInventoryURI varchar(255),
|
||||
userAssetURI varchar(255),
|
||||
profileCanDoMask integer,
|
||||
profileWantDoMask integer,
|
||||
profileAboutText varchar(255),
|
||||
profileFirstText varchar(255),
|
||||
profileImage varchar(255),
|
||||
profileFirstImage varchar(255),
|
||||
webLoginKey text default '00000000-0000-0000-0000-000000000000');
|
||||
-- friends table
|
||||
CREATE TABLE userfriends(
|
||||
ownerID varchar(255),
|
||||
friendID varchar(255),
|
||||
friendPerms integer,
|
||||
ownerPerms integer,
|
||||
datetimestamp integer);
|
||||
|
||||
COMMIT;
|
||||
|
||||
10
OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql
Normal file
10
OpenSim/Data/SQLiteLegacy/Resources/002_AssetStore.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data);
|
||||
INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets;
|
||||
DROP TABLE assets;
|
||||
CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data);
|
||||
INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup;
|
||||
DROP TABLE assets_backup;
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,8 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
create index inventoryfolders_agentid on inventoryfolders(agentid);
|
||||
create index inventoryfolders_parentid on inventoryfolders(parentid);
|
||||
create index inventoryitems_parentfolderid on inventoryitems(parentfolderid);
|
||||
create index inventoryitems_avatarid on inventoryitems(avatarid);
|
||||
|
||||
COMMIT;
|
||||
10
OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql
Normal file
10
OpenSim/Data/SQLiteLegacy/Resources/002_RegionStore.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE regionban(
|
||||
regionUUID varchar (255),
|
||||
bannedUUID varchar (255),
|
||||
bannedIp varchar (255),
|
||||
bannedIpHostMask varchar (255)
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/002_UserStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE users add homeRegionID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
1
OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql
Normal file
1
OpenSim/Data/SQLiteLegacy/Resources/003_AssetStore.sql
Normal file
@@ -0,0 +1 @@
|
||||
DELETE FROM assets WHERE UUID = 'dc4b9f0bd00845c696a401dd947ac621'
|
||||
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0;
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/003_RegionStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE primitems add flags integer not null default 0;
|
||||
|
||||
COMMIT;
|
||||
6
OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql
Normal file
6
OpenSim/Data/SQLiteLegacy/Resources/003_UserStore.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE users add userFlags integer NOT NULL default 0;
|
||||
ALTER TABLE users add godLevel integer NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
||||
7
OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql
Normal file
7
OpenSim/Data/SQLiteLegacy/Resources/004_AssetStore.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
BEGIN;
|
||||
|
||||
update assets
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
COMMIT;
|
||||
36
OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql
Normal file
36
OpenSim/Data/SQLiteLegacy/Resources/004_InventoryStore.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
BEGIN;
|
||||
|
||||
update inventoryitems
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
update inventoryitems
|
||||
set assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21, 12)
|
||||
where assetID not like '%-%';
|
||||
|
||||
update inventoryitems
|
||||
set parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21, 12)
|
||||
where parentFolderID not like '%-%';
|
||||
|
||||
update inventoryitems
|
||||
set avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21, 12)
|
||||
where avatarID not like '%-%';
|
||||
|
||||
update inventoryitems
|
||||
set creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21, 12)
|
||||
where creatorsID not like '%-%';
|
||||
|
||||
|
||||
update inventoryfolders
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
update inventoryfolders
|
||||
set agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21, 12)
|
||||
where agentID not like '%-%';
|
||||
|
||||
update inventoryfolders
|
||||
set parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21, 12)
|
||||
where parentID not like '%-%';
|
||||
|
||||
COMMIT;
|
||||
38
OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql
Normal file
38
OpenSim/Data/SQLiteLegacy/Resources/004_RegionStore.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
BEGIN;
|
||||
|
||||
create table regionsettings (
|
||||
regionUUID char(36) not null,
|
||||
block_terraform integer not null,
|
||||
block_fly integer not null,
|
||||
allow_damage integer not null,
|
||||
restrict_pushing integer not null,
|
||||
allow_land_resell integer not null,
|
||||
allow_land_join_divide integer not null,
|
||||
block_show_in_search integer not null,
|
||||
agent_limit integer not null,
|
||||
object_bonus float not null,
|
||||
maturity integer not null,
|
||||
disable_scripts integer not null,
|
||||
disable_collisions integer not null,
|
||||
disable_physics integer not null,
|
||||
terrain_texture_1 char(36) not null,
|
||||
terrain_texture_2 char(36) not null,
|
||||
terrain_texture_3 char(36) not null,
|
||||
terrain_texture_4 char(36) not null,
|
||||
elevation_1_nw float not null,
|
||||
elevation_2_nw float not null,
|
||||
elevation_1_ne float not null,
|
||||
elevation_2_ne float not null,
|
||||
elevation_1_se float not null,
|
||||
elevation_2_se float not null,
|
||||
elevation_1_sw float not null,
|
||||
elevation_2_sw float not null,
|
||||
water_height float not null,
|
||||
terrain_raise_limit float not null,
|
||||
terrain_lower_limit float not null,
|
||||
use_estate_sun integer not null,
|
||||
fixed_sun integer not null,
|
||||
sun_position float not null,
|
||||
covenant char(36));
|
||||
|
||||
COMMIT;
|
||||
6
OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql
Normal file
6
OpenSim/Data/SQLiteLegacy/Resources/004_UserStore.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE users add customType varchar(32) not null default '';
|
||||
ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/005_RegionStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
delete from regionsettings;
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/005_UserStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `attachpoint` int(11) NOT NULL DEFAULT 0, `item` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `asset` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000');
|
||||
|
||||
COMMIT;
|
||||
102
OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql
Normal file
102
OpenSim/Data/SQLiteLegacy/Resources/006_RegionStore.sql
Normal file
@@ -0,0 +1,102 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE estate_groups (
|
||||
EstateID int(10) NOT NULL,
|
||||
uuid char(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estate_managers (
|
||||
EstateID int(10) NOT NULL,
|
||||
uuid char(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estate_map (
|
||||
RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
|
||||
EstateID int(11) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estate_settings (
|
||||
EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
EstateName varchar(64) default NULL,
|
||||
AbuseEmailToEstateOwner tinyint(4) NOT NULL,
|
||||
DenyAnonymous tinyint(4) NOT NULL,
|
||||
ResetHomeOnTeleport tinyint(4) NOT NULL,
|
||||
FixedSun tinyint(4) NOT NULL,
|
||||
DenyTransacted tinyint(4) NOT NULL,
|
||||
BlockDwell tinyint(4) NOT NULL,
|
||||
DenyIdentified tinyint(4) NOT NULL,
|
||||
AllowVoice tinyint(4) NOT NULL,
|
||||
UseGlobalTime tinyint(4) NOT NULL,
|
||||
PricePerMeter int(11) NOT NULL,
|
||||
TaxFree tinyint(4) NOT NULL,
|
||||
AllowDirectTeleport tinyint(4) NOT NULL,
|
||||
RedirectGridX int(11) NOT NULL,
|
||||
RedirectGridY int(11) NOT NULL,
|
||||
ParentEstateID int(10) NOT NULL,
|
||||
SunPosition double NOT NULL,
|
||||
EstateSkipScripts tinyint(4) NOT NULL,
|
||||
BillableFactor float NOT NULL,
|
||||
PublicAccess tinyint(4) NOT NULL
|
||||
);
|
||||
insert into estate_settings (EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
|
||||
delete from estate_settings;
|
||||
CREATE TABLE estate_users (
|
||||
EstateID int(10) NOT NULL,
|
||||
uuid char(36) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE estateban (
|
||||
EstateID int(10) NOT NULL,
|
||||
bannedUUID varchar(36) NOT NULL,
|
||||
bannedIp varchar(16) NOT NULL,
|
||||
bannedIpHostMask varchar(16) NOT NULL,
|
||||
bannedNameMask varchar(64) default NULL
|
||||
);
|
||||
|
||||
drop table regionsettings;
|
||||
CREATE TABLE regionsettings (
|
||||
regionUUID char(36) NOT NULL,
|
||||
block_terraform int(11) NOT NULL,
|
||||
block_fly int(11) NOT NULL,
|
||||
allow_damage int(11) NOT NULL,
|
||||
restrict_pushing int(11) NOT NULL,
|
||||
allow_land_resell int(11) NOT NULL,
|
||||
allow_land_join_divide int(11) NOT NULL,
|
||||
block_show_in_search int(11) NOT NULL,
|
||||
agent_limit int(11) NOT NULL,
|
||||
object_bonus float NOT NULL,
|
||||
maturity int(11) NOT NULL,
|
||||
disable_scripts int(11) NOT NULL,
|
||||
disable_collisions int(11) NOT NULL,
|
||||
disable_physics int(11) NOT NULL,
|
||||
terrain_texture_1 char(36) NOT NULL,
|
||||
terrain_texture_2 char(36) NOT NULL,
|
||||
terrain_texture_3 char(36) NOT NULL,
|
||||
terrain_texture_4 char(36) NOT NULL,
|
||||
elevation_1_nw float NOT NULL,
|
||||
elevation_2_nw float NOT NULL,
|
||||
elevation_1_ne float NOT NULL,
|
||||
elevation_2_ne float NOT NULL,
|
||||
elevation_1_se float NOT NULL,
|
||||
elevation_2_se float NOT NULL,
|
||||
elevation_1_sw float NOT NULL,
|
||||
elevation_2_sw float NOT NULL,
|
||||
water_height float NOT NULL,
|
||||
terrain_raise_limit float NOT NULL,
|
||||
terrain_lower_limit float NOT NULL,
|
||||
use_estate_sun int(11) NOT NULL,
|
||||
fixed_sun int(11) NOT NULL,
|
||||
sun_position float NOT NULL,
|
||||
covenant char(36) default NULL,
|
||||
Sandbox tinyint(4) NOT NULL,
|
||||
PRIMARY KEY (regionUUID)
|
||||
);
|
||||
|
||||
CREATE INDEX estate_ban_estate_id on estateban(EstateID);
|
||||
CREATE INDEX estate_groups_estate_id on estate_groups(EstateID);
|
||||
CREATE INDEX estate_managers_estate_id on estate_managers(EstateID);
|
||||
CREATE INDEX estate_map_estate_id on estate_map(EstateID);
|
||||
CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID);
|
||||
CREATE INDEX estate_users_estate_id on estate_users(EstateID);
|
||||
|
||||
COMMIT;
|
||||
20
OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql
Normal file
20
OpenSim/Data/SQLiteLegacy/Resources/006_UserStore.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
-- usersagents table
|
||||
CREATE TABLE IF NOT EXISTS useragents(
|
||||
UUID varchar(255) primary key,
|
||||
agentIP varchar(255),
|
||||
agentPort integer,
|
||||
agentOnline boolean,
|
||||
sessionID varchar(255),
|
||||
secureSessionID varchar(255),
|
||||
regionID varchar(255),
|
||||
loginTime integer,
|
||||
logoutTime integer,
|
||||
currentRegion varchar(255),
|
||||
currentHandle varchar(255),
|
||||
currentPosX float,
|
||||
currentPosY float,
|
||||
currentPosZ float);
|
||||
|
||||
COMMIT;
|
||||
8
OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql
Normal file
8
OpenSim/Data/SQLiteLegacy/Resources/007_RegionStore.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
begin;
|
||||
|
||||
alter table estate_settings add column AbuseEmail varchar(255) not null default '';
|
||||
|
||||
alter table estate_settings add column EstateOwner varchar(36) not null default '';
|
||||
|
||||
commit;
|
||||
|
||||
7
OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql
Normal file
7
OpenSim/Data/SQLiteLegacy/Resources/007_UserStore.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
ALTER TABLE useragents add currentLookAtX float not null default 128;
|
||||
ALTER TABLE useragents add currentLookAtY float not null default 128;
|
||||
ALTER TABLE useragents add currentLookAtZ float not null default 70;
|
||||
|
||||
COMMIT;
|
||||
6
OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql
Normal file
6
OpenSim/Data/SQLiteLegacy/Resources/008_RegionStore.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
begin;
|
||||
|
||||
alter table estate_settings add column DenyMinors tinyint not null default 0;
|
||||
|
||||
commit;
|
||||
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/008_UserStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
ALTER TABLE users add email varchar(250);
|
||||
|
||||
COMMIT;
|
||||
8
OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql
Normal file
8
OpenSim/Data/SQLiteLegacy/Resources/009_RegionStore.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
|
||||
ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
|
||||
ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
|
||||
ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
|
||||
|
||||
COMMIT;
|
||||
11
OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql
Normal file
11
OpenSim/Data/SQLiteLegacy/Resources/009_UserStore.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
BEGIN;
|
||||
|
||||
update users
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
update useragents
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/010_RegionStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN ClickAction INTEGER NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
||||
37
OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql
Normal file
37
OpenSim/Data/SQLiteLegacy/Resources/010_UserStore.sql
Normal file
@@ -0,0 +1,37 @@
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS avatarappearance(
|
||||
Owner varchar(36) NOT NULL primary key,
|
||||
BodyItem varchar(36) DEFAULT NULL,
|
||||
BodyAsset varchar(36) DEFAULT NULL,
|
||||
SkinItem varchar(36) DEFAULT NULL,
|
||||
SkinAsset varchar(36) DEFAULT NULL,
|
||||
HairItem varchar(36) DEFAULT NULL,
|
||||
HairAsset varchar(36) DEFAULT NULL,
|
||||
EyesItem varchar(36) DEFAULT NULL,
|
||||
EyesAsset varchar(36) DEFAULT NULL,
|
||||
ShirtItem varchar(36) DEFAULT NULL,
|
||||
ShirtAsset varchar(36) DEFAULT NULL,
|
||||
PantsItem varchar(36) DEFAULT NULL,
|
||||
PantsAsset varchar(36) DEFAULT NULL,
|
||||
ShoesItem varchar(36) DEFAULT NULL,
|
||||
ShoesAsset varchar(36) DEFAULT NULL,
|
||||
SocksItem varchar(36) DEFAULT NULL,
|
||||
SocksAsset varchar(36) DEFAULT NULL,
|
||||
JacketItem varchar(36) DEFAULT NULL,
|
||||
JacketAsset varchar(36) DEFAULT NULL,
|
||||
GlovesItem varchar(36) DEFAULT NULL,
|
||||
GlovesAsset varchar(36) DEFAULT NULL,
|
||||
UnderShirtItem varchar(36) DEFAULT NULL,
|
||||
UnderShirtAsset varchar(36) DEFAULT NULL,
|
||||
UnderPantsItem varchar(36) DEFAULT NULL,
|
||||
UnderPantsAsset varchar(36) DEFAULT NULL,
|
||||
SkirtItem varchar(36) DEFAULT NULL,
|
||||
SkirtAsset varchar(36) DEFAULT NULL,
|
||||
Texture blob,
|
||||
VisualParams blob,
|
||||
Serial int DEFAULT NULL,
|
||||
AvatarHeight float DEFAULT NULL
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
28
OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql
Normal file
28
OpenSim/Data/SQLiteLegacy/Resources/011_RegionStore.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
||||
ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN TextureAnimation string;
|
||||
ALTER TABLE prims ADD COLUMN ParticleSystem string;
|
||||
ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0;
|
||||
ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/012_RegionStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN Material INTEGER NOT NULL default 3;
|
||||
|
||||
COMMIT;
|
||||
6
OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql
Normal file
6
OpenSim/Data/SQLiteLegacy/Resources/013_RegionStore.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0;
|
||||
ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
||||
8
OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql
Normal file
8
OpenSim/Data/SQLiteLegacy/Resources/014_RegionStore.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
begin;
|
||||
|
||||
ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0;
|
||||
ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0;
|
||||
ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0;
|
||||
|
||||
commit;
|
||||
|
||||
6
OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql
Normal file
6
OpenSim/Data/SQLiteLegacy/Resources/015_RegionStore.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
||||
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
||||
5
OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql
Normal file
5
OpenSim/Data/SQLiteLegacy/Resources/016_RegionStore.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
COMMIT;
|
||||
8
OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql
Normal file
8
OpenSim/Data/SQLiteLegacy/Resources/017_RegionStore.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
BEGIN;
|
||||
CREATE TEMPORARY TABLE prims_backup(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
|
||||
INSERT INTO prims_backup SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims;
|
||||
DROP TABLE prims;
|
||||
CREATE TABLE prims(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
|
||||
INSERT INTO prims SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims_backup;
|
||||
DROP TABLE prims_backup;
|
||||
COMMIT;
|
||||
79
OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql
Normal file
79
OpenSim/Data/SQLiteLegacy/Resources/018_RegionStore.sql
Normal file
@@ -0,0 +1,79 @@
|
||||
BEGIN;
|
||||
|
||||
update terrain
|
||||
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
|
||||
where RegionUUID not like '%-%';
|
||||
|
||||
|
||||
update landaccesslist
|
||||
set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12)
|
||||
where LandUUID not like '%-%';
|
||||
|
||||
update landaccesslist
|
||||
set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12)
|
||||
where AccessUUID not like '%-%';
|
||||
|
||||
|
||||
update prims
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
update prims
|
||||
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
|
||||
where RegionUUID not like '%-%';
|
||||
|
||||
update prims
|
||||
set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12)
|
||||
where SceneGroupID not like '%-%';
|
||||
|
||||
update prims
|
||||
set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12)
|
||||
where CreatorID not like '%-%';
|
||||
|
||||
update prims
|
||||
set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12)
|
||||
where OwnerID not like '%-%';
|
||||
|
||||
update prims
|
||||
set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12)
|
||||
where GroupID not like '%-%';
|
||||
|
||||
update prims
|
||||
set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12)
|
||||
where LastOwnerID not like '%-%';
|
||||
|
||||
|
||||
update primshapes
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
|
||||
update land
|
||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
||||
where UUID not like '%-%';
|
||||
|
||||
update land
|
||||
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
|
||||
where RegionUUID not like '%-%';
|
||||
|
||||
update land
|
||||
set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12)
|
||||
where OwnerUUID not like '%-%';
|
||||
|
||||
update land
|
||||
set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12)
|
||||
where GroupUUID not like '%-%';
|
||||
|
||||
update land
|
||||
set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12)
|
||||
where MediaTextureUUID not like '%-%';
|
||||
|
||||
update land
|
||||
set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12)
|
||||
where SnapshotUUID not like '%-%';
|
||||
|
||||
update land
|
||||
set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12)
|
||||
where AuthbuyerID not like '%-%';
|
||||
|
||||
COMMIT;
|
||||
@@ -0,0 +1,20 @@
|
||||
<Addin id="OpenSim.Data.SQLite" version="0.1">
|
||||
<Runtime>
|
||||
<Import assembly="OpenSim.Data.SQLite.dll"/>
|
||||
</Runtime>
|
||||
<Dependencies>
|
||||
<Addin id="OpenSim.Data" version="0.5" />
|
||||
</Dependencies>
|
||||
<Extension path = "/OpenSim/GridData">
|
||||
<Plugin id="SQLiteGridData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteGridData" />
|
||||
</Extension>
|
||||
<Extension path = "/OpenSim/AssetData">
|
||||
<Plugin id="SQLiteAssetData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteAssetData" />
|
||||
</Extension>
|
||||
<Extension path = "/OpenSim/InventoryData">
|
||||
<Plugin id="SQLiteInventoryData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteInventoryStore" />
|
||||
</Extension>
|
||||
<Extension path = "/OpenSim/UserData">
|
||||
<Plugin id="SQLiteUserData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteUserData" />
|
||||
</Extension>
|
||||
</Addin>
|
||||
342
OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
Normal file
342
OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
Normal file
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
/// <summary>
|
||||
/// An asset storage interface for the SQLite database system
|
||||
/// </summary>
|
||||
public class SQLiteAssetData : AssetDataBase
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
|
||||
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
|
||||
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
|
||||
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
|
||||
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
|
||||
private const string assetSelect = "select * from assets";
|
||||
|
||||
private SqliteConnection m_conn;
|
||||
|
||||
override public void Dispose()
|
||||
{
|
||||
if (m_conn != null)
|
||||
{
|
||||
m_conn.Close();
|
||||
m_conn = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <list type="bullet">
|
||||
/// <item>Initialises AssetData interface</item>
|
||||
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
|
||||
/// <item>use default URI if connect string is empty.</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="dbconnect">connect string</param>
|
||||
override public void Initialise(string dbconnect)
|
||||
{
|
||||
if (dbconnect == string.Empty)
|
||||
{
|
||||
dbconnect = "URI=file:Asset.db,version=3";
|
||||
}
|
||||
m_conn = new SqliteConnection(dbconnect);
|
||||
m_conn.Open();
|
||||
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_conn, assem, "AssetStore");
|
||||
m.Update();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetch Asset
|
||||
/// </summary>
|
||||
/// <param name="uuid">UUID of ... ?</param>
|
||||
/// <returns>Asset base</returns>
|
||||
override public AssetBase GetAsset(UUID uuid)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
AssetBase asset = buildAsset(reader);
|
||||
reader.Close();
|
||||
return asset;
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an asset
|
||||
/// </summary>
|
||||
/// <param name="asset">Asset Base</param>
|
||||
override public void StoreAsset(AssetBase asset)
|
||||
{
|
||||
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
|
||||
if (ExistsAsset(asset.FullID))
|
||||
{
|
||||
//LogAssetLoad(asset);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Some... logging functionnality
|
||||
// /// </summary>
|
||||
// /// <param name="asset"></param>
|
||||
// private static void LogAssetLoad(AssetBase asset)
|
||||
// {
|
||||
// string temporary = asset.Temporary ? "Temporary" : "Stored";
|
||||
// string local = asset.Local ? "Local" : "Remote";
|
||||
//
|
||||
// int assetLength = (asset.Data != null) ? asset.Data.Length : 0;
|
||||
//
|
||||
// m_log.Debug("[ASSET DB]: " +
|
||||
// string.Format("Loaded {5} {4} Asset: [{0}][{3}] \"{1}\":{2} ({6} bytes)",
|
||||
// asset.FullID, asset.Name, asset.Description, asset.Type,
|
||||
// temporary, local, assetLength));
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Check if an asset exist in database
|
||||
/// </summary>
|
||||
/// <param name="uuid">The asset UUID</param>
|
||||
/// <returns>True if exist, or false.</returns>
|
||||
override public bool ExistsAsset(UUID uuid)
|
||||
{
|
||||
lock (this) {
|
||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.Close();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete an asset from database
|
||||
/// </summary>
|
||||
/// <param name="uuid"></param>
|
||||
public void DeleteAsset(UUID uuid)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static AssetBase buildAsset(IDataReader row)
|
||||
{
|
||||
// TODO: this doesn't work yet because something more
|
||||
// interesting has to be done to actually get these values
|
||||
// back out. Not enough time to figure it out yet.
|
||||
AssetBase asset = new AssetBase(
|
||||
new UUID((String)row["UUID"]),
|
||||
(String)row["Name"],
|
||||
Convert.ToSByte(row["Type"])
|
||||
);
|
||||
|
||||
asset.Description = (String) row["Description"];
|
||||
asset.Local = Convert.ToBoolean(row["Local"]);
|
||||
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
||||
asset.Data = (byte[]) row["Data"];
|
||||
return asset;
|
||||
}
|
||||
|
||||
private static AssetMetadata buildAssetMetadata(IDataReader row)
|
||||
{
|
||||
AssetMetadata metadata = new AssetMetadata();
|
||||
|
||||
metadata.FullID = new UUID((string) row["UUID"]);
|
||||
metadata.Name = (string) row["Name"];
|
||||
metadata.Description = (string) row["Description"];
|
||||
metadata.Type = Convert.ToSByte(row["Type"]);
|
||||
metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
|
||||
|
||||
// Current SHA1s are not stored/computed.
|
||||
metadata.SHA1 = new byte[] {};
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of AssetMetadata objects. The list is a subset of
|
||||
/// the entire data set offset by <paramref name="start" /> containing
|
||||
/// <paramref name="count" /> elements.
|
||||
/// </summary>
|
||||
/// <param name="start">The number of results to discard from the total data set.</param>
|
||||
/// <param name="count">The number of rows the returned list should contain.</param>
|
||||
/// <returns>A list of AssetMetadata objects.</returns>
|
||||
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
|
||||
{
|
||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetMetadataSQL, m_conn))
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":start", start));
|
||||
cmd.Parameters.Add(new SqliteParameter(":count", count));
|
||||
|
||||
using (IDataReader reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
AssetMetadata metadata = buildAssetMetadata(reader);
|
||||
retList.Add(metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retList;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Database Binding functions
|
||||
*
|
||||
* These will be db specific due to typing, and minor differences
|
||||
* in databases.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
#region IPlugin interface
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
override public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
Module module = GetType().Module;
|
||||
// string dllName = module.Assembly.ManifestModule.Name;
|
||||
Version dllVersion = module.Assembly.GetName().Version;
|
||||
|
||||
return
|
||||
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
||||
dllVersion.Revision);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialise the AssetData interface using default URI
|
||||
/// </summary>
|
||||
override public void Initialise()
|
||||
{
|
||||
Initialise("URI=file:Asset.db,version=3");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of this DB provider
|
||||
/// </summary>
|
||||
override public string Name
|
||||
{
|
||||
get { return "SQLite Asset storage engine"; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
262
OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs
Normal file
262
OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs
Normal file
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
|
||||
{
|
||||
private string m_Realm;
|
||||
private List<string> m_ColumnNames;
|
||||
private int m_LastExpire;
|
||||
private string m_connectionString;
|
||||
|
||||
protected static SqliteConnection m_Connection;
|
||||
private static bool m_initialized = false;
|
||||
|
||||
public SQLiteAuthenticationData(string connectionString, string realm)
|
||||
: base(connectionString)
|
||||
{
|
||||
m_Realm = realm;
|
||||
m_connectionString = connectionString;
|
||||
|
||||
if (!m_initialized)
|
||||
{
|
||||
m_Connection = new SqliteConnection(connectionString);
|
||||
m_Connection.Open();
|
||||
|
||||
using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
|
||||
{
|
||||
dbcon.Open();
|
||||
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
|
||||
m.Update();
|
||||
dbcon.Close();
|
||||
}
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
public AuthenticationData Get(UUID principalID)
|
||||
{
|
||||
AuthenticationData ret = new AuthenticationData();
|
||||
ret.Data = new Dictionary<string, object>();
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID");
|
||||
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
||||
|
||||
IDataReader result = ExecuteReader(cmd, m_Connection);
|
||||
|
||||
try
|
||||
{
|
||||
if (result.Read())
|
||||
{
|
||||
ret.PrincipalID = principalID;
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = result.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
|
||||
foreach (string s in m_ColumnNames)
|
||||
{
|
||||
if (s == "UUID")
|
||||
continue;
|
||||
|
||||
ret.Data[s] = result[s].ToString();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Store(AuthenticationData data)
|
||||
{
|
||||
if (data.Data.ContainsKey("UUID"))
|
||||
data.Data.Remove("UUID");
|
||||
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
string[] values = new string[data.Data.Count];
|
||||
int i = 0;
|
||||
foreach (object o in data.Data.Values)
|
||||
values[i++] = o.ToString();
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
if (Get(data.PrincipalID) != null)
|
||||
{
|
||||
|
||||
|
||||
string update = "update `" + m_Realm + "` set ";
|
||||
bool first = true;
|
||||
foreach (string field in fields)
|
||||
{
|
||||
if (!first)
|
||||
update += ", ";
|
||||
update += "`" + field + "` = :" + field;
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
update += " where UUID = :UUID";
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
||||
|
||||
cmd.CommandText = update;
|
||||
try
|
||||
{
|
||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values (:UUID, :" + String.Join(", :", fields) + ")";
|
||||
|
||||
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
||||
foreach (string field in fields)
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
try
|
||||
{
|
||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
||||
{
|
||||
CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
CloseCommand(cmd);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
CloseCommand(cmd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool SetDataItem(UUID principalID, string item, string value)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand("update `" + m_Realm +
|
||||
"` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'");
|
||||
|
||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool SetToken(UUID principalID, string token, int lifetime)
|
||||
{
|
||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
|
||||
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");
|
||||
|
||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||
{
|
||||
cmd.Dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckToken(UUID principalID, string token, int lifetime)
|
||||
{
|
||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
||||
DoExpire();
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
|
||||
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
|
||||
|
||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||
{
|
||||
cmd.Dispose();
|
||||
return true;
|
||||
}
|
||||
|
||||
cmd.Dispose();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DoExpire()
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
|
||||
ExecuteNonQuery(cmd, m_Connection);
|
||||
|
||||
cmd.Dispose();
|
||||
|
||||
m_LastExpire = System.Environment.TickCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
389
OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
Normal file
389
OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
Normal file
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
public class SQLiteEstateStore : IEstateDataStore
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private SqliteConnection m_connection;
|
||||
private string m_connectionString;
|
||||
|
||||
private FieldInfo[] m_Fields;
|
||||
private Dictionary<string, FieldInfo> m_FieldMap =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
public void Initialise(string connectionString)
|
||||
{
|
||||
m_connectionString = connectionString;
|
||||
|
||||
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
|
||||
|
||||
m_connection = new SqliteConnection(m_connectionString);
|
||||
m_connection.Open();
|
||||
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(m_connection, assem, "EstateStore");
|
||||
m.Update();
|
||||
|
||||
m_connection.Close();
|
||||
m_connection.Open();
|
||||
|
||||
Type t = typeof(EstateSettings);
|
||||
m_Fields = t.GetFields(BindingFlags.NonPublic |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.DeclaredOnly);
|
||||
|
||||
foreach (FieldInfo f in m_Fields)
|
||||
if (f.Name.Substring(0, 2) == "m_")
|
||||
m_FieldMap[f.Name.Substring(2)] = f;
|
||||
}
|
||||
|
||||
private string[] FieldList
|
||||
{
|
||||
get { return new List<string>(m_FieldMap.Keys).ToArray(); }
|
||||
}
|
||||
|
||||
public EstateSettings LoadEstateSettings(UUID regionID)
|
||||
{
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = :RegionID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
|
||||
return DoLoad(cmd, regionID);
|
||||
}
|
||||
|
||||
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID)
|
||||
{
|
||||
EstateSettings es = new EstateSettings();
|
||||
es.OnSave += StoreEstateSettings;
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
if (r.Read())
|
||||
{
|
||||
foreach (string name in FieldList)
|
||||
{
|
||||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
int v = Convert.ToInt32(r[name]);
|
||||
if (v != 0)
|
||||
m_FieldMap[name].SetValue(es, true);
|
||||
else
|
||||
m_FieldMap[name].SetValue(es, false);
|
||||
}
|
||||
else if (m_FieldMap[name].GetValue(es) is UUID)
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
|
||||
UUID.TryParse(r[name].ToString(), out uuid);
|
||||
m_FieldMap[name].SetValue(es, uuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FieldMap[name].SetValue(es, Convert.ChangeType(r[name], m_FieldMap[name].FieldType));
|
||||
}
|
||||
}
|
||||
r.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Migration case
|
||||
//
|
||||
r.Close();
|
||||
|
||||
List<string> names = new List<string>(FieldList);
|
||||
|
||||
names.Remove("EstateID");
|
||||
|
||||
string sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
foreach (string name in FieldList)
|
||||
{
|
||||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
if ((bool)m_FieldMap[name].GetValue(es))
|
||||
cmd.Parameters.Add(":"+name, "1");
|
||||
else
|
||||
cmd.Parameters.Add(":"+name, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
r = cmd.ExecuteReader();
|
||||
|
||||
r.Read();
|
||||
|
||||
es.EstateID = Convert.ToUInt32(r["id"]);
|
||||
|
||||
r.Close();
|
||||
|
||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
|
||||
// This will throw on dupe key
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
es.Save();
|
||||
}
|
||||
|
||||
LoadBanList(es);
|
||||
|
||||
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
|
||||
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
|
||||
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
|
||||
return es;
|
||||
}
|
||||
|
||||
public void StoreEstateSettings(EstateSettings es)
|
||||
{
|
||||
List<string> fields = new List<string>(FieldList);
|
||||
fields.Remove("EstateID");
|
||||
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
foreach (string f in fields)
|
||||
terms.Add(f+" = :"+f);
|
||||
|
||||
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = :EstateID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
|
||||
foreach (string name in FieldList)
|
||||
{
|
||||
if (m_FieldMap[name].GetValue(es) is bool)
|
||||
{
|
||||
if ((bool)m_FieldMap[name].GetValue(es))
|
||||
cmd.Parameters.Add(":"+name, "1");
|
||||
else
|
||||
cmd.Parameters.Add(":"+name, "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.Parameters.Add(":"+name, m_FieldMap[name].GetValue(es).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
SaveBanList(es);
|
||||
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
|
||||
SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
|
||||
SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
|
||||
}
|
||||
|
||||
private void LoadBanList(EstateSettings es)
|
||||
{
|
||||
es.ClearBans();
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "select bannedUUID from estateban where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
while (r.Read())
|
||||
{
|
||||
EstateBan eb = new EstateBan();
|
||||
|
||||
UUID uuid = new UUID();
|
||||
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
|
||||
|
||||
eb.BannedUserID = uuid;
|
||||
eb.BannedHostAddress = "0.0.0.0";
|
||||
eb.BannedHostIPMask = "0.0.0.0";
|
||||
es.AddBan(eb);
|
||||
}
|
||||
r.Close();
|
||||
}
|
||||
|
||||
private void SaveBanList(EstateSettings es)
|
||||
{
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from estateban where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )";
|
||||
|
||||
foreach (EstateBan b in es.EstateBans)
|
||||
{
|
||||
cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
|
||||
cmd.Parameters.Add(":bannedUUID", b.BannedUserID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
void SaveUUIDList(uint EstateID, string table, UUID[] data)
|
||||
{
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.Parameters.Clear();
|
||||
|
||||
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )";
|
||||
|
||||
foreach (UUID uuid in data)
|
||||
{
|
||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
||||
cmd.Parameters.Add(":uuid", uuid.ToString());
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
UUID[] LoadUUIDList(uint EstateID, string table)
|
||||
{
|
||||
List<UUID> uuids = new List<UUID>();
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "select uuid from "+table+" where EstateID = :EstateID";
|
||||
cmd.Parameters.Add(":EstateID", EstateID);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
while (r.Read())
|
||||
{
|
||||
// EstateBan eb = new EstateBan();
|
||||
|
||||
UUID uuid = new UUID();
|
||||
UUID.TryParse(r["uuid"].ToString(), out uuid);
|
||||
|
||||
uuids.Add(uuid);
|
||||
}
|
||||
r.Close();
|
||||
|
||||
return uuids.ToArray();
|
||||
}
|
||||
|
||||
public EstateSettings LoadEstateSettings(int estateID)
|
||||
{
|
||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID :EstateID";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
||||
|
||||
return DoLoad(cmd, UUID.Zero);
|
||||
}
|
||||
|
||||
public List<int> GetEstates(string search)
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
|
||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName :EstateName";
|
||||
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = sql;
|
||||
cmd.Parameters.Add(":EstateName", search);
|
||||
|
||||
IDataReader r = cmd.ExecuteReader();
|
||||
|
||||
while (r.Read())
|
||||
{
|
||||
result.Add(Convert.ToInt32(r["EstateID"]));
|
||||
}
|
||||
r.Close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool LinkRegion(UUID regionID, int estateID)
|
||||
{
|
||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||
|
||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
||||
|
||||
if (cmd.ExecuteNonQuery() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<UUID> GetRegions(int estateID)
|
||||
{
|
||||
return new List<UUID>();
|
||||
}
|
||||
|
||||
public bool DeleteEstate(int estateID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
91
OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs
Normal file
91
OpenSim/Data/SQLiteLegacy/SQLiteFramework.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using Mono.Data.SqliteClient;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
/// <summary>
|
||||
/// A database interface class to a user profile storage system
|
||||
/// </summary>
|
||||
public class SQLiteFramework
|
||||
{
|
||||
protected Object m_lockObject = new Object();
|
||||
|
||||
protected SQLiteFramework(string connectionString)
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//
|
||||
// All non queries are funneled through one connection
|
||||
// to increase performance a little
|
||||
//
|
||||
protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
|
||||
{
|
||||
lock (connection)
|
||||
{
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)connection).Clone();
|
||||
newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||
|
||||
return cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
|
||||
{
|
||||
lock (connection)
|
||||
{
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)connection).Clone();
|
||||
newConnection.Open();
|
||||
|
||||
cmd.Connection = newConnection;
|
||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
||||
|
||||
return cmd.ExecuteReader();
|
||||
}
|
||||
}
|
||||
|
||||
protected void CloseCommand(SqliteCommand cmd)
|
||||
{
|
||||
cmd.Connection.Close();
|
||||
cmd.Connection.Dispose();
|
||||
cmd.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
268
OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs
Normal file
268
OpenSim/Data/SQLiteLegacy/SQLiteGenericTableHandler.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected Dictionary<string, FieldInfo> m_Fields =
|
||||
new Dictionary<string, FieldInfo>();
|
||||
|
||||
protected List<string> m_ColumnNames = null;
|
||||
protected string m_Realm;
|
||||
protected FieldInfo m_DataField = null;
|
||||
|
||||
protected static SqliteConnection m_Connection;
|
||||
private static bool m_initialized;
|
||||
|
||||
public SQLiteGenericTableHandler(string connectionString,
|
||||
string realm, string storeName) : base(connectionString)
|
||||
{
|
||||
m_Realm = realm;
|
||||
|
||||
if (!m_initialized)
|
||||
{
|
||||
m_Connection = new SqliteConnection(connectionString);
|
||||
m_Connection.Open();
|
||||
|
||||
if (storeName != String.Empty)
|
||||
{
|
||||
Assembly assem = GetType().Assembly;
|
||||
SqliteConnection newConnection =
|
||||
(SqliteConnection)((ICloneable)m_Connection).Clone();
|
||||
newConnection.Open();
|
||||
|
||||
Migration m = new Migration(newConnection, assem, storeName);
|
||||
m.Update();
|
||||
newConnection.Close();
|
||||
newConnection.Dispose();
|
||||
}
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
Type t = typeof(T);
|
||||
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
|
||||
BindingFlags.Instance |
|
||||
BindingFlags.DeclaredOnly);
|
||||
|
||||
if (fields.Length == 0)
|
||||
return;
|
||||
|
||||
foreach (FieldInfo f in fields)
|
||||
{
|
||||
if (f.Name != "Data")
|
||||
m_Fields[f.Name] = f;
|
||||
else
|
||||
m_DataField = f;
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckColumnNames(IDataReader reader)
|
||||
{
|
||||
if (m_ColumnNames != null)
|
||||
return;
|
||||
|
||||
m_ColumnNames = new List<string>();
|
||||
|
||||
DataTable schemaTable = reader.GetSchemaTable();
|
||||
foreach (DataRow row in schemaTable.Rows)
|
||||
{
|
||||
if (row["ColumnName"] != null &&
|
||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public T[] Get(string field, string key)
|
||||
{
|
||||
return Get(new string[] { field }, new string[] { key });
|
||||
}
|
||||
|
||||
public T[] Get(string[] fields, string[] keys)
|
||||
{
|
||||
if (fields.Length != keys.Length)
|
||||
return new T[0];
|
||||
|
||||
List<string> terms = new List<string>();
|
||||
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
for (int i = 0 ; i < fields.Length ; i++)
|
||||
{
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
||||
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
||||
}
|
||||
|
||||
string where = String.Join(" and ", terms.ToArray());
|
||||
|
||||
string query = String.Format("select * from {0} where {1}",
|
||||
m_Realm, where);
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
|
||||
protected T[] DoQuery(SqliteCommand cmd)
|
||||
{
|
||||
IDataReader reader = ExecuteReader(cmd, m_Connection);
|
||||
if (reader == null)
|
||||
return new T[0];
|
||||
|
||||
CheckColumnNames(reader);
|
||||
|
||||
List<T> result = new List<T>();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
T row = new T();
|
||||
|
||||
foreach (string name in m_Fields.Keys)
|
||||
{
|
||||
if (m_Fields[name].GetValue(row) is bool)
|
||||
{
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
||||
}
|
||||
else if (m_Fields[name].GetValue(row) is UUID)
|
||||
{
|
||||
UUID uuid = UUID.Zero;
|
||||
|
||||
UUID.TryParse(reader[name].ToString(), out uuid);
|
||||
m_Fields[name].SetValue(row, uuid);
|
||||
}
|
||||
else if (m_Fields[name].GetValue(row) is int)
|
||||
{
|
||||
int v = Convert.ToInt32(reader[name]);
|
||||
m_Fields[name].SetValue(row, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Fields[name].SetValue(row, reader[name]);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_DataField != null)
|
||||
{
|
||||
Dictionary<string, string> data =
|
||||
new Dictionary<string, string>();
|
||||
|
||||
foreach (string col in m_ColumnNames)
|
||||
{
|
||||
data[col] = reader[col].ToString();
|
||||
if (data[col] == null)
|
||||
data[col] = String.Empty;
|
||||
}
|
||||
|
||||
m_DataField.SetValue(row, data);
|
||||
}
|
||||
|
||||
result.Add(row);
|
||||
}
|
||||
|
||||
CloseCommand(cmd);
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public T[] Get(string where)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
string query = String.Format("select * from {0} where {1}",
|
||||
m_Realm, where);
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
|
||||
public bool Store(T row)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
string query = "";
|
||||
List<String> names = new List<String>();
|
||||
List<String> values = new List<String>();
|
||||
|
||||
foreach (FieldInfo fi in m_Fields.Values)
|
||||
{
|
||||
names.Add(fi.Name);
|
||||
values.Add(":" + fi.Name);
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
|
||||
}
|
||||
|
||||
if (m_DataField != null)
|
||||
{
|
||||
Dictionary<string, string> data =
|
||||
(Dictionary<string, string>)m_DataField.GetValue(row);
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in data)
|
||||
{
|
||||
names.Add(kvp.Key);
|
||||
values.Add(":" + kvp.Key);
|
||||
cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
|
||||
}
|
||||
}
|
||||
|
||||
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Delete(string field, string val)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
|
||||
cmd.Parameters.Add(new SqliteParameter(field, val));
|
||||
|
||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
898
OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs
Normal file
898
OpenSim/Data/SQLiteLegacy/SQLiteInventoryStore.cs
Normal file
@@ -0,0 +1,898 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Mono.Data.SqliteClient;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
/// <summary>
|
||||
/// An Inventory Interface to the SQLite database
|
||||
/// </summary>
|
||||
public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private const string invItemsSelect = "select * from inventoryitems";
|
||||
private const string invFoldersSelect = "select * from inventoryfolders";
|
||||
|
||||
private static SqliteConnection conn;
|
||||
private static DataSet ds;
|
||||
private static SqliteDataAdapter invItemsDa;
|
||||
private static SqliteDataAdapter invFoldersDa;
|
||||
|
||||
private static bool m_Initialized = false;
|
||||
|
||||
public void Initialise()
|
||||
{
|
||||
m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
|
||||
throw new PluginNotInitialisedException(Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <list type="bullet">
|
||||
/// <item>Initialises Inventory interface</item>
|
||||
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
|
||||
/// <item>use default URI if connect string string is empty.</item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <param name="dbconnect">connect string</param>
|
||||
public void Initialise(string dbconnect)
|
||||
{
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_Initialized = true;
|
||||
|
||||
if (dbconnect == string.Empty)
|
||||
{
|
||||
dbconnect = "URI=file:inventoryStore.db,version=3";
|
||||
}
|
||||
m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect);
|
||||
conn = new SqliteConnection(dbconnect);
|
||||
|
||||
conn.Open();
|
||||
|
||||
Assembly assem = GetType().Assembly;
|
||||
Migration m = new Migration(conn, assem, "InventoryStore");
|
||||
m.Update();
|
||||
|
||||
SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
|
||||
invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
||||
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
||||
|
||||
SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
|
||||
invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
|
||||
|
||||
ds = new DataSet();
|
||||
|
||||
ds.Tables.Add(createInventoryFoldersTable());
|
||||
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
||||
setupFoldersCommands(invFoldersDa, conn);
|
||||
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
||||
|
||||
ds.Tables.Add(createInventoryItemsTable());
|
||||
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
||||
setupItemsCommands(invItemsDa, conn);
|
||||
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
||||
|
||||
ds.AcceptChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the inventory interface
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (conn != null)
|
||||
{
|
||||
conn.Close();
|
||||
conn = null;
|
||||
}
|
||||
if (invItemsDa != null)
|
||||
{
|
||||
invItemsDa.Dispose();
|
||||
invItemsDa = null;
|
||||
}
|
||||
if (invFoldersDa != null)
|
||||
{
|
||||
invFoldersDa.Dispose();
|
||||
invFoldersDa = null;
|
||||
}
|
||||
if (ds != null)
|
||||
{
|
||||
ds.Dispose();
|
||||
ds = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
public InventoryItemBase buildItem(DataRow row)
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.ID = new UUID((string) row["UUID"]);
|
||||
item.AssetID = new UUID((string) row["assetID"]);
|
||||
item.AssetType = Convert.ToInt32(row["assetType"]);
|
||||
item.InvType = Convert.ToInt32(row["invType"]);
|
||||
item.Folder = new UUID((string) row["parentFolderID"]);
|
||||
item.Owner = new UUID((string) row["avatarID"]);
|
||||
item.CreatorId = (string)row["creatorsID"];
|
||||
item.Name = (string) row["inventoryName"];
|
||||
item.Description = (string) row["inventoryDescription"];
|
||||
|
||||
item.NextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
|
||||
item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
|
||||
item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
|
||||
item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
|
||||
item.GroupPermissions = Convert.ToUInt32(row["inventoryGroupPermissions"]);
|
||||
|
||||
// new fields
|
||||
if (!Convert.IsDBNull(row["salePrice"]))
|
||||
item.SalePrice = Convert.ToInt32(row["salePrice"]);
|
||||
|
||||
if (!Convert.IsDBNull(row["saleType"]))
|
||||
item.SaleType = Convert.ToByte(row["saleType"]);
|
||||
|
||||
if (!Convert.IsDBNull(row["creationDate"]))
|
||||
item.CreationDate = Convert.ToInt32(row["creationDate"]);
|
||||
|
||||
if (!Convert.IsDBNull(row["groupID"]))
|
||||
item.GroupID = new UUID((string)row["groupID"]);
|
||||
|
||||
if (!Convert.IsDBNull(row["groupOwned"]))
|
||||
item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
|
||||
|
||||
if (!Convert.IsDBNull(row["Flags"]))
|
||||
item.Flags = Convert.ToUInt32(row["Flags"]);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill a database row with item data
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="item"></param>
|
||||
private static void fillItemRow(DataRow row, InventoryItemBase item)
|
||||
{
|
||||
row["UUID"] = item.ID.ToString();
|
||||
row["assetID"] = item.AssetID.ToString();
|
||||
row["assetType"] = item.AssetType;
|
||||
row["invType"] = item.InvType;
|
||||
row["parentFolderID"] = item.Folder.ToString();
|
||||
row["avatarID"] = item.Owner.ToString();
|
||||
row["creatorsID"] = item.CreatorId.ToString();
|
||||
row["inventoryName"] = item.Name;
|
||||
row["inventoryDescription"] = item.Description;
|
||||
|
||||
row["inventoryNextPermissions"] = item.NextPermissions;
|
||||
row["inventoryCurrentPermissions"] = item.CurrentPermissions;
|
||||
row["inventoryBasePermissions"] = item.BasePermissions;
|
||||
row["inventoryEveryOnePermissions"] = item.EveryOnePermissions;
|
||||
row["inventoryGroupPermissions"] = item.GroupPermissions;
|
||||
|
||||
// new fields
|
||||
row["salePrice"] = item.SalePrice;
|
||||
row["saleType"] = item.SaleType;
|
||||
row["creationDate"] = item.CreationDate;
|
||||
row["groupID"] = item.GroupID.ToString();
|
||||
row["groupOwned"] = item.GroupOwned;
|
||||
row["flags"] = item.Flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add inventory folder
|
||||
/// </summary>
|
||||
/// <param name="folder">Folder base</param>
|
||||
/// <param name="add">true=create folder. false=update existing folder</param>
|
||||
/// <remarks>nasty</remarks>
|
||||
private void addFolder(InventoryFolderBase folder, bool add)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
|
||||
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
|
||||
if (inventoryRow == null)
|
||||
{
|
||||
if (! add)
|
||||
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID);
|
||||
|
||||
inventoryRow = inventoryFolderTable.NewRow();
|
||||
fillFolderRow(inventoryRow, folder);
|
||||
inventoryFolderTable.Rows.Add(inventoryRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (add)
|
||||
m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID);
|
||||
|
||||
fillFolderRow(inventoryRow, folder);
|
||||
}
|
||||
|
||||
invFoldersDa.Update(ds, "inventoryfolders");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move an inventory folder
|
||||
/// </summary>
|
||||
/// <param name="folder">folder base</param>
|
||||
private void moveFolder(InventoryFolderBase folder)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
|
||||
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
|
||||
if (inventoryRow == null)
|
||||
{
|
||||
inventoryRow = inventoryFolderTable.NewRow();
|
||||
fillFolderRow(inventoryRow, folder);
|
||||
inventoryFolderTable.Rows.Add(inventoryRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveFolderRow(inventoryRow, folder);
|
||||
}
|
||||
|
||||
invFoldersDa.Update(ds, "inventoryfolders");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add an item in inventory
|
||||
/// </summary>
|
||||
/// <param name="item">the item</param>
|
||||
/// <param name="add">true=add item ; false=update existing item</param>
|
||||
private void addItem(InventoryItemBase item, bool add)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||
|
||||
DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString());
|
||||
if (inventoryRow == null)
|
||||
{
|
||||
if (!add)
|
||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID);
|
||||
|
||||
inventoryRow = inventoryItemTable.NewRow();
|
||||
fillItemRow(inventoryRow, item);
|
||||
inventoryItemTable.Rows.Add(inventoryRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (add)
|
||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID);
|
||||
|
||||
fillItemRow(inventoryRow, item);
|
||||
}
|
||||
|
||||
invItemsDa.Update(ds, "inventoryitems");
|
||||
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
|
||||
inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
|
||||
if (inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either.
|
||||
inventoryRow["version"] = (int)inventoryRow["version"] + 1;
|
||||
|
||||
invFoldersDa.Update(ds, "inventoryfolders");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// TODO : DataSet commit
|
||||
/// </summary>
|
||||
public void Shutdown()
|
||||
{
|
||||
// TODO: DataSet commit
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of this DB provider
|
||||
/// </summary>
|
||||
/// <returns>Name of DB provider</returns>
|
||||
public string Name
|
||||
{
|
||||
get { return "SQLite Inventory Data Interface"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the version of this DB provider
|
||||
/// </summary>
|
||||
/// <returns>A string containing the DB provider version</returns>
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
Module module = GetType().Module;
|
||||
// string dllName = module.Assembly.ManifestModule.Name;
|
||||
Version dllVersion = module.Assembly.GetName().Version;
|
||||
|
||||
|
||||
return
|
||||
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
||||
dllVersion.Revision);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of inventory items contained within the specified folder
|
||||
/// </summary>
|
||||
/// <param name="folderID">The UUID of the target folder</param>
|
||||
/// <returns>A List of InventoryItemBase items</returns>
|
||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
List<InventoryItemBase> retval = new List<InventoryItemBase>();
|
||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||
string selectExp = "parentFolderID = '" + folderID + "'";
|
||||
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
retval.Add(buildItem(row));
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of the root folders within a users inventory
|
||||
/// </summary>
|
||||
/// <param name="user">The user whos inventory is to be searched</param>
|
||||
/// <returns>A list of folder objects</returns>
|
||||
public List<InventoryFolderBase> getUserRootFolders(UUID user)
|
||||
{
|
||||
return new List<InventoryFolderBase>();
|
||||
}
|
||||
|
||||
// see InventoryItemBase.getUserRootFolder
|
||||
public InventoryFolderBase getUserRootFolder(UUID user)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'";
|
||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
folders.Add(buildFolder(row));
|
||||
}
|
||||
|
||||
// There should only ever be one root folder for a user. However, if there's more
|
||||
// than one we'll simply use the first one rather than failing. It would be even
|
||||
// nicer to print some message to this effect, but this feels like it's too low a
|
||||
// to put such a message out, and it's too minor right now to spare the time to
|
||||
// suitably refactor.
|
||||
if (folders.Count > 0)
|
||||
{
|
||||
return folders[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a list of all the child folders of a parent folder
|
||||
/// </summary>
|
||||
/// <param name="folders">list where folders will be appended</param>
|
||||
/// <param name="parentID">ID of parent</param>
|
||||
protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
string selectExp = "parentID = '" + parentID + "'";
|
||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
folders.Add(buildFolder(row));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of inventory folders contained in the folder 'parentID'
|
||||
/// </summary>
|
||||
/// <param name="parentID">The folder to get subfolders for</param>
|
||||
/// <returns>A list of inventory folders</returns>
|
||||
public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
|
||||
{
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
getInventoryFolders(ref folders, parentID);
|
||||
return folders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// See IInventoryDataPlugin
|
||||
/// </summary>
|
||||
/// <param name="parentID"></param>
|
||||
/// <returns></returns>
|
||||
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
|
||||
{
|
||||
/* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one
|
||||
* - We will only need to hit the database twice instead of n times.
|
||||
* - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
|
||||
* by the same person, each user only has 1 inventory heirarchy
|
||||
* - The returned list is not ordered, instead of breadth-first ordered
|
||||
There are basically 2 usage cases for getFolderHeirarchy:
|
||||
1) Getting the user's entire inventory heirarchy when they log in
|
||||
2) Finding a subfolder heirarchy to delete when emptying the trash.
|
||||
This implementation will pull all inventory folders from the database, and then prune away any folder that
|
||||
is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
|
||||
database than to make n requests. This pays off only if requested heirarchy is large.
|
||||
By making this choice, we are making the worst case better at the cost of making the best case worse
|
||||
- Francis
|
||||
*/
|
||||
|
||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
||||
DataRow[] folderRows = null, parentRow;
|
||||
InventoryFolderBase parentFolder = null;
|
||||
lock (ds)
|
||||
{
|
||||
/* Fetch the parent folder from the database to determine the agent ID.
|
||||
* Then fetch all inventory folders for that agent from the agent ID.
|
||||
*/
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
string selectExp = "UUID = '" + parentID + "'";
|
||||
parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
|
||||
if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
|
||||
{
|
||||
parentFolder = buildFolder(parentRow[0]);
|
||||
UUID agentID = parentFolder.Owner;
|
||||
selectExp = "agentID = '" + agentID + "'";
|
||||
folderRows = inventoryFolderTable.Select(selectExp);
|
||||
}
|
||||
|
||||
if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist
|
||||
{ // or has no children
|
||||
/* if we're querying the root folder, just return an unordered list of all folders in the user's
|
||||
* inventory
|
||||
*/
|
||||
if (parentFolder.ParentID == UUID.Zero)
|
||||
{
|
||||
foreach (DataRow row in folderRows)
|
||||
{
|
||||
InventoryFolderBase curFolder = buildFolder(row);
|
||||
if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy
|
||||
folders.Add(buildFolder(row));
|
||||
}
|
||||
} // If requesting root folder
|
||||
/* else we are querying a non-root folder. We currently have a list of all of the user's folders,
|
||||
* we must construct a list of all folders in the heirarchy below parentID.
|
||||
* Our first step will be to construct a hash table of all folders, indexed by parent ID.
|
||||
* Once we have constructed the hash table, we will do a breadth-first traversal on the tree using the
|
||||
* hash table to find child folders.
|
||||
*/
|
||||
else
|
||||
{ // Querying a non-root folder
|
||||
|
||||
// Build a hash table of all user's inventory folders, indexed by each folder's parent ID
|
||||
Dictionary<UUID, List<InventoryFolderBase>> hashtable =
|
||||
new Dictionary<UUID, List<InventoryFolderBase>>(folderRows.GetLength(0));
|
||||
|
||||
foreach (DataRow row in folderRows)
|
||||
{
|
||||
InventoryFolderBase curFolder = buildFolder(row);
|
||||
if (curFolder.ParentID != UUID.Zero) // Discard root of tree - not needed
|
||||
{
|
||||
if (hashtable.ContainsKey(curFolder.ParentID))
|
||||
{
|
||||
// Current folder already has a sibling - append to sibling list
|
||||
hashtable[curFolder.ParentID].Add(curFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>();
|
||||
siblingList.Add(curFolder);
|
||||
// Current folder has no known (yet) siblings
|
||||
hashtable.Add(curFolder.ParentID, siblingList);
|
||||
}
|
||||
}
|
||||
} // For all inventory folders
|
||||
|
||||
// Note: Could release the ds lock here - we don't access folderRows or the database anymore.
|
||||
// This is somewhat of a moot point as the callers of this function usually lock db anyways.
|
||||
|
||||
if (hashtable.ContainsKey(parentID)) // if requested folder does have children
|
||||
folders.AddRange(hashtable[parentID]);
|
||||
|
||||
// BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static
|
||||
for (int i = 0; i < folders.Count; i++)
|
||||
if (hashtable.ContainsKey(folders[i].ID))
|
||||
folders.AddRange(hashtable[folders[i].ID]);
|
||||
|
||||
} // if requesting a subfolder heirarchy
|
||||
} // if folder parentID exists and has children
|
||||
} // lock ds
|
||||
return folders;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an inventory item by its UUID
|
||||
/// </summary>
|
||||
/// <param name="item">The UUID of the item to be returned</param>
|
||||
/// <returns>A class containing item information</returns>
|
||||
public InventoryItemBase getInventoryItem(UUID item)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString());
|
||||
if (row != null)
|
||||
{
|
||||
return buildItem(row);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specified inventory folder by its UUID
|
||||
/// </summary>
|
||||
/// <param name="folder">The UUID of the folder to be returned</param>
|
||||
/// <returns>A class containing folder information</returns>
|
||||
public InventoryFolderBase getInventoryFolder(UUID folder)
|
||||
{
|
||||
// TODO: Deep voodoo here. If you enable this code then
|
||||
// multi region breaks. No idea why, but I figured it was
|
||||
// better to leave multi region at this point. It does mean
|
||||
// that you don't get to see system textures why creating
|
||||
// clothes and the like. :(
|
||||
lock (ds)
|
||||
{
|
||||
DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString());
|
||||
if (row != null)
|
||||
{
|
||||
return buildFolder(row);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new inventory item based on item
|
||||
/// </summary>
|
||||
/// <param name="item">The item to be created</param>
|
||||
public void addInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
addItem(item, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates an inventory item with item (updates based on ID)
|
||||
/// </summary>
|
||||
/// <param name="item">The updated item</param>
|
||||
public void updateInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
addItem(item, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete an inventory item
|
||||
/// </summary>
|
||||
/// <param name="item">The item UUID</param>
|
||||
public void deleteInventoryItem(UUID itemID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||
|
||||
DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString());
|
||||
if (inventoryRow != null)
|
||||
{
|
||||
inventoryRow.Delete();
|
||||
}
|
||||
|
||||
invItemsDa.Update(ds, "inventoryitems");
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryItemBase queryInventoryItem(UUID itemID)
|
||||
{
|
||||
return getInventoryItem(itemID);
|
||||
}
|
||||
|
||||
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||
{
|
||||
return getInventoryFolder(folderID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete all items in the specified folder
|
||||
/// </summary>
|
||||
/// <param name="folderId">id of the folder, whose item content should be deleted</param>
|
||||
/// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
|
||||
private void deleteItemsInFolder(UUID folderId)
|
||||
{
|
||||
List<InventoryItemBase> items = getInventoryInFolder(folderId);
|
||||
|
||||
foreach (InventoryItemBase i in items)
|
||||
deleteInventoryItem(i.ID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new folder specified by folder
|
||||
/// </summary>
|
||||
/// <param name="folder">The inventory folder</param>
|
||||
public void addInventoryFolder(InventoryFolderBase folder)
|
||||
{
|
||||
addFolder(folder, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates a folder based on its ID with folder
|
||||
/// </summary>
|
||||
/// <param name="folder">The inventory folder</param>
|
||||
public void updateInventoryFolder(InventoryFolderBase folder)
|
||||
{
|
||||
addFolder(folder, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves a folder based on its ID with folder
|
||||
/// </summary>
|
||||
/// <param name="folder">The inventory folder</param>
|
||||
public void moveInventoryFolder(InventoryFolderBase folder)
|
||||
{
|
||||
moveFolder(folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a folder
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This will clean-up any child folders and child items as well
|
||||
/// </remarks>
|
||||
/// <param name="folderID">the folder UUID</param>
|
||||
public void deleteInventoryFolder(UUID folderID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
|
||||
|
||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
||||
DataRow inventoryRow;
|
||||
|
||||
//Delete all sub-folders
|
||||
foreach (InventoryFolderBase f in subFolders)
|
||||
{
|
||||
inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString());
|
||||
if (inventoryRow != null)
|
||||
{
|
||||
deleteItemsInFolder(f.ID);
|
||||
inventoryRow.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
//Delete the actual row
|
||||
inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString());
|
||||
if (inventoryRow != null)
|
||||
{
|
||||
deleteItemsInFolder(folderID);
|
||||
inventoryRow.Delete();
|
||||
}
|
||||
|
||||
invFoldersDa.Update(ds, "inventoryfolders");
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Data Table definitions
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Create the "inventoryitems" table
|
||||
/// </summary>
|
||||
private static DataTable createInventoryItemsTable()
|
||||
{
|
||||
DataTable inv = new DataTable("inventoryitems");
|
||||
|
||||
createCol(inv, "UUID", typeof (String)); //inventoryID
|
||||
createCol(inv, "assetID", typeof (String));
|
||||
createCol(inv, "assetType", typeof (Int32));
|
||||
createCol(inv, "invType", typeof (Int32));
|
||||
createCol(inv, "parentFolderID", typeof (String));
|
||||
createCol(inv, "avatarID", typeof (String));
|
||||
createCol(inv, "creatorsID", typeof (String));
|
||||
|
||||
createCol(inv, "inventoryName", typeof (String));
|
||||
createCol(inv, "inventoryDescription", typeof (String));
|
||||
// permissions
|
||||
createCol(inv, "inventoryNextPermissions", typeof (Int32));
|
||||
createCol(inv, "inventoryCurrentPermissions", typeof (Int32));
|
||||
createCol(inv, "inventoryBasePermissions", typeof (Int32));
|
||||
createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
|
||||
createCol(inv, "inventoryGroupPermissions", typeof (Int32));
|
||||
|
||||
// sale info
|
||||
createCol(inv, "salePrice", typeof(Int32));
|
||||
createCol(inv, "saleType", typeof(Byte));
|
||||
|
||||
// creation date
|
||||
createCol(inv, "creationDate", typeof(Int32));
|
||||
|
||||
// group info
|
||||
createCol(inv, "groupID", typeof(String));
|
||||
createCol(inv, "groupOwned", typeof(Boolean));
|
||||
|
||||
// Flags
|
||||
createCol(inv, "flags", typeof(UInt32));
|
||||
|
||||
inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] };
|
||||
return inv;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the "inventoryfolders" table
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static DataTable createInventoryFoldersTable()
|
||||
{
|
||||
DataTable fol = new DataTable("inventoryfolders");
|
||||
|
||||
createCol(fol, "UUID", typeof (String)); //folderID
|
||||
createCol(fol, "name", typeof (String));
|
||||
createCol(fol, "agentID", typeof (String));
|
||||
createCol(fol, "parentID", typeof (String));
|
||||
createCol(fol, "type", typeof (Int32));
|
||||
createCol(fol, "version", typeof (Int32));
|
||||
|
||||
fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]};
|
||||
return fol;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]);
|
||||
da.InsertCommand.Connection = conn;
|
||||
|
||||
da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", ds.Tables["inventoryitems"]);
|
||||
da.UpdateCommand.Connection = conn;
|
||||
|
||||
SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
|
||||
delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
|
||||
delete.Connection = conn;
|
||||
da.DeleteCommand = delete;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="da"></param>
|
||||
/// <param name="conn"></param>
|
||||
private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]);
|
||||
da.InsertCommand.Connection = conn;
|
||||
|
||||
da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", ds.Tables["inventoryfolders"]);
|
||||
da.UpdateCommand.Connection = conn;
|
||||
|
||||
SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
|
||||
delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
|
||||
delete.Connection = conn;
|
||||
da.DeleteCommand = delete;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <returns></returns>
|
||||
private static InventoryFolderBase buildFolder(DataRow row)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
folder.ID = new UUID((string) row["UUID"]);
|
||||
folder.Name = (string) row["name"];
|
||||
folder.Owner = new UUID((string) row["agentID"]);
|
||||
folder.ParentID = new UUID((string) row["parentID"]);
|
||||
folder.Type = Convert.ToInt16(row["type"]);
|
||||
folder.Version = Convert.ToUInt16(row["version"]);
|
||||
return folder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="folder"></param>
|
||||
private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
|
||||
{
|
||||
row["UUID"] = folder.ID.ToString();
|
||||
row["name"] = folder.Name;
|
||||
row["agentID"] = folder.Owner.ToString();
|
||||
row["parentID"] = folder.ParentID.ToString();
|
||||
row["type"] = folder.Type;
|
||||
row["version"] = folder.Version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="folder"></param>
|
||||
private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
|
||||
{
|
||||
row["UUID"] = folder.ID.ToString();
|
||||
row["parentID"] = folder.ParentID.ToString();
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
||||
{
|
||||
lock (ds)
|
||||
{
|
||||
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
||||
|
||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
||||
string selectExp
|
||||
= "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1";
|
||||
//m_log.DebugFormat("[SQL]: sql = " + selectExp);
|
||||
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
||||
foreach (DataRow row in rows)
|
||||
{
|
||||
items.Add(buildItem(row));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2265
OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
Normal file
2265
OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
Normal file
File diff suppressed because it is too large
Load Diff
307
OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs
Normal file
307
OpenSim/Data/SQLiteLegacy/SQLiteUtils.cs
Normal file
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using Mono.Data.SqliteClient;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for methods needed by all SQLite database classes
|
||||
/// </summary>
|
||||
public class SQLiteUtil
|
||||
{
|
||||
/***********************************************************************
|
||||
*
|
||||
* Database Definition Helper Functions
|
||||
*
|
||||
* This should be db agnostic as we define them in ADO.NET terms
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dt"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
public static void createCol(DataTable dt, string name, Type type)
|
||||
{
|
||||
DataColumn col = new DataColumn(name, type);
|
||||
dt.Columns.Add(col);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* SQL Statement Creation Functions
|
||||
*
|
||||
* These functions create SQL statements for update, insert, and create.
|
||||
* They can probably be factored later to have a db independant
|
||||
* portion and a db specific portion
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Create an insert command
|
||||
/// </summary>
|
||||
/// <param name="table">table name</param>
|
||||
/// <param name="dt">data table</param>
|
||||
/// <returns>the created command</returns>
|
||||
/// <remarks>
|
||||
/// This is subtle enough to deserve some commentary.
|
||||
/// Instead of doing *lots* and *lots of hardcoded strings
|
||||
/// for database definitions we'll use the fact that
|
||||
/// realistically all insert statements look like "insert
|
||||
/// into A(b, c) values(:b, :c) on the parameterized query
|
||||
/// front. If we just have a list of b, c, etc... we can
|
||||
/// generate these strings instead of typing them out.
|
||||
/// </remarks>
|
||||
public static SqliteCommand createInsertCommand(string table, DataTable dt)
|
||||
{
|
||||
|
||||
string[] cols = new string[dt.Columns.Count];
|
||||
for (int i = 0; i < dt.Columns.Count; i++)
|
||||
{
|
||||
DataColumn col = dt.Columns[i];
|
||||
cols[i] = col.ColumnName;
|
||||
}
|
||||
|
||||
string sql = "insert into " + table + "(";
|
||||
sql += String.Join(", ", cols);
|
||||
// important, the first ':' needs to be here, the rest get added in the join
|
||||
sql += ") values (:";
|
||||
sql += String.Join(", :", cols);
|
||||
sql += ")";
|
||||
SqliteCommand cmd = new SqliteCommand(sql);
|
||||
|
||||
// this provides the binding for all our parameters, so
|
||||
// much less code than it used to be
|
||||
foreach (DataColumn col in dt.Columns)
|
||||
{
|
||||
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create an update command
|
||||
/// </summary>
|
||||
/// <param name="table">table name</param>
|
||||
/// <param name="pk"></param>
|
||||
/// <param name="dt"></param>
|
||||
/// <returns>the created command</returns>
|
||||
public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
|
||||
{
|
||||
string sql = "update " + table + " set ";
|
||||
string subsql = String.Empty;
|
||||
foreach (DataColumn col in dt.Columns)
|
||||
{
|
||||
if (subsql.Length > 0)
|
||||
{
|
||||
// a map function would rock so much here
|
||||
subsql += ", ";
|
||||
}
|
||||
subsql += col.ColumnName + "= :" + col.ColumnName;
|
||||
}
|
||||
sql += subsql;
|
||||
sql += " where " + pk;
|
||||
SqliteCommand cmd = new SqliteCommand(sql);
|
||||
|
||||
// this provides the binding for all our parameters, so
|
||||
// much less code than it used to be
|
||||
|
||||
foreach (DataColumn col in dt.Columns)
|
||||
{
|
||||
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dt">Data Table</param>
|
||||
/// <returns></returns>
|
||||
public static string defineTable(DataTable dt)
|
||||
{
|
||||
string sql = "create table " + dt.TableName + "(";
|
||||
string subsql = String.Empty;
|
||||
foreach (DataColumn col in dt.Columns)
|
||||
{
|
||||
if (subsql.Length > 0)
|
||||
{
|
||||
// a map function would rock so much here
|
||||
subsql += ",\n";
|
||||
}
|
||||
subsql += col.ColumnName + " " + sqliteType(col.DataType);
|
||||
if (dt.PrimaryKey.Length > 0)
|
||||
{
|
||||
if (col == dt.PrimaryKey[0])
|
||||
{
|
||||
subsql += " primary key";
|
||||
}
|
||||
}
|
||||
}
|
||||
sql += subsql;
|
||||
sql += ")";
|
||||
return sql;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Database Binding functions
|
||||
*
|
||||
* These will be db specific due to typing, and minor differences
|
||||
* in databases.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
///<summary>
|
||||
/// <para>
|
||||
/// This is a convenience function that collapses 5 repetitive
|
||||
/// lines for defining SqliteParameters to 2 parameters:
|
||||
/// column name and database type.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// It assumes certain conventions like :param as the param
|
||||
/// name to replace in parametrized queries, and that source
|
||||
/// version is always current version, both of which are fine
|
||||
/// for us.
|
||||
/// </para>
|
||||
///</summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="type"></param>
|
||||
///<returns>a built sqlite parameter</returns>
|
||||
public static SqliteParameter createSqliteParameter(string name, Type type)
|
||||
{
|
||||
SqliteParameter param = new SqliteParameter();
|
||||
param.ParameterName = ":" + name;
|
||||
param.DbType = dbtypeFromType(type);
|
||||
param.SourceColumn = name;
|
||||
param.SourceVersion = DataRowVersion.Current;
|
||||
return param;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Type conversion functions
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/// <summary>
|
||||
/// Type conversion function
|
||||
/// </summary>
|
||||
/// <param name="type">a type</param>
|
||||
/// <returns>a DbType</returns>
|
||||
public static DbType dbtypeFromType(Type type)
|
||||
{
|
||||
if (type == typeof (String))
|
||||
{
|
||||
return DbType.String;
|
||||
}
|
||||
else if (type == typeof (Int32))
|
||||
{
|
||||
return DbType.Int32;
|
||||
}
|
||||
else if (type == typeof (UInt32))
|
||||
{
|
||||
return DbType.UInt32;
|
||||
}
|
||||
else if (type == typeof (Int64))
|
||||
{
|
||||
return DbType.Int64;
|
||||
}
|
||||
else if (type == typeof (UInt64))
|
||||
{
|
||||
return DbType.UInt64;
|
||||
}
|
||||
else if (type == typeof (Double))
|
||||
{
|
||||
return DbType.Double;
|
||||
}
|
||||
else if (type == typeof (Boolean))
|
||||
{
|
||||
return DbType.Boolean;
|
||||
}
|
||||
else if (type == typeof (Byte[]))
|
||||
{
|
||||
return DbType.Binary;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DbType.String;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="type">a Type</param>
|
||||
/// <returns>a string</returns>
|
||||
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
|
||||
public static string sqliteType(Type type)
|
||||
{
|
||||
if (type == typeof (String))
|
||||
{
|
||||
return "varchar(255)";
|
||||
}
|
||||
else if (type == typeof (Int32))
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
else if (type == typeof (UInt32))
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
else if (type == typeof (Int64))
|
||||
{
|
||||
return "varchar(255)";
|
||||
}
|
||||
else if (type == typeof (UInt64))
|
||||
{
|
||||
return "varchar(255)";
|
||||
}
|
||||
else if (type == typeof (Double))
|
||||
{
|
||||
return "float";
|
||||
}
|
||||
else if (type == typeof (Boolean))
|
||||
{
|
||||
return "integer";
|
||||
}
|
||||
else if (type == typeof (Byte[]))
|
||||
{
|
||||
return "blob";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
155
OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs
Normal file
155
OpenSim/Data/SQLiteLegacy/SQLiteXInventoryData.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using Mono.Data.SqliteClient;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Data.SQLiteLegacy
|
||||
{
|
||||
/// <summary>
|
||||
/// A MySQL Interface for the Asset Server
|
||||
/// </summary>
|
||||
public class SQLiteXInventoryData : IXInventoryData
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private SQLiteGenericTableHandler<XInventoryFolder> m_Folders;
|
||||
private SqliteItemHandler m_Items;
|
||||
|
||||
public SQLiteXInventoryData(string conn, string realm)
|
||||
{
|
||||
m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
|
||||
conn, "inventoryfolders", "InventoryStore");
|
||||
m_Items = new SqliteItemHandler(
|
||||
conn, "inventoryitems", String.Empty);
|
||||
}
|
||||
|
||||
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
|
||||
{
|
||||
return m_Folders.Get(fields, vals);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetItems(string[] fields, string[] vals)
|
||||
{
|
||||
return m_Items.Get(fields, vals);
|
||||
}
|
||||
|
||||
public bool StoreFolder(XInventoryFolder folder)
|
||||
{
|
||||
return m_Folders.Store(folder);
|
||||
}
|
||||
|
||||
public bool StoreItem(XInventoryItem item)
|
||||
{
|
||||
return m_Items.Store(item);
|
||||
}
|
||||
|
||||
public bool DeleteFolders(string field, string val)
|
||||
{
|
||||
return m_Folders.Delete(field, val);
|
||||
}
|
||||
|
||||
public bool DeleteItems(string field, string val)
|
||||
{
|
||||
return m_Items.Delete(field, val);
|
||||
}
|
||||
|
||||
public bool MoveItem(string id, string newParent)
|
||||
{
|
||||
return m_Items.MoveItem(id, newParent);
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||
{
|
||||
return m_Items.GetActiveGestures(principalID);
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
||||
{
|
||||
return m_Items.GetAssetPermissions(principalID, assetID);
|
||||
}
|
||||
}
|
||||
|
||||
public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem>
|
||||
{
|
||||
public SqliteItemHandler(string c, string t, string m) :
|
||||
base(c, t, m)
|
||||
{
|
||||
}
|
||||
|
||||
public bool MoveItem(string id, string newParent)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
|
||||
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
|
||||
cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
|
||||
|
||||
return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true;
|
||||
}
|
||||
|
||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
|
||||
|
||||
cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
|
||||
cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
|
||||
|
||||
return DoQuery(cmd);
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
||||
{
|
||||
SqliteCommand cmd = new SqliteCommand();
|
||||
|
||||
cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
|
||||
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
||||
cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
|
||||
|
||||
IDataReader reader = ExecuteReader(cmd, m_Connection);
|
||||
|
||||
int perms = 0;
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]);
|
||||
}
|
||||
|
||||
reader.Close();
|
||||
CloseCommand(cmd);
|
||||
|
||||
return perms;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,8 @@ namespace OpenSim.Data.Tests
|
||||
public class DataTestUtil
|
||||
{
|
||||
public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
|
||||
public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue;
|
||||
//public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue;
|
||||
public const uint UNSIGNED_INTEGER_MAX = INTEGER_MAX;
|
||||
|
||||
public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
|
||||
public const int INTEGER_MAX = int.MaxValue;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
@@ -164,9 +164,9 @@ namespace OpenSim.Framework.Communications.Clients
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
|
||||
m_log.DebugFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
|
||||
// ignore, really
|
||||
}
|
||||
finally
|
||||
@@ -176,7 +176,6 @@ namespace OpenSim.Framework.Communications.Clients
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData)
|
||||
|
||||
@@ -88,15 +88,7 @@ namespace OpenSim.Framework.Communications.Services
|
||||
m_welcomeMessage = welcomeMess;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the user is already logged in, try to notify the region that the user they've got is dead.
|
||||
/// </summary>
|
||||
/// <param name="theUser"></param>
|
||||
public virtual void LogOffUser(UserProfileData theUser, string message)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Called when we receive the client's initial XMLRPC login_to_simulator request message
|
||||
/// </summary>
|
||||
@@ -1056,7 +1048,13 @@ namespace OpenSim.Framework.Communications.Services
|
||||
|
||||
protected abstract RegionInfo RequestClosestRegion(string region);
|
||||
protected abstract RegionInfo GetRegionInfo(ulong homeRegionHandle);
|
||||
protected abstract RegionInfo GetRegionInfo(UUID homeRegionId);
|
||||
protected abstract RegionInfo GetRegionInfo(UUID homeRegionId);
|
||||
|
||||
/// <summary>
|
||||
/// If the user is already logged in, try to notify the region that the user they've got is dead.
|
||||
/// </summary>
|
||||
/// <param name="theUser"></param>
|
||||
public abstract void LogOffUser(UserProfileData theUser, string message);
|
||||
|
||||
/// <summary>
|
||||
/// Prepare a login to the given region. This involves both telling the region to expect a connection
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// A console that uses cursor control and color
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public class LocalConsole : CommandConsole
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
@@ -100,24 +100,40 @@ namespace OpenSim.Framework.Console
|
||||
private int SetCursorTop(int top)
|
||||
{
|
||||
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
|
||||
// to set a cursor row position with a currently invalid column, mono will throw an exception.
|
||||
// Therefore, we need to make sure that the column position is valid first.
|
||||
// to set a cursor row position with a currently invalid column, mono will throw an exception.
|
||||
// Therefore, we need to make sure that the column position is valid first.
|
||||
int left = System.Console.CursorLeft;
|
||||
|
||||
if (left < 0)
|
||||
{
|
||||
System.Console.CursorLeft = 0;
|
||||
else if (left >= System.Console.BufferWidth)
|
||||
System.Console.CursorLeft = System.Console.BufferWidth - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bw = System.Console.BufferWidth;
|
||||
|
||||
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
|
||||
if (bw > 0 && left >= bw)
|
||||
System.Console.CursorLeft = bw - 1;
|
||||
}
|
||||
|
||||
if (top < 0)
|
||||
{
|
||||
top = 0;
|
||||
if (top >= System.Console.BufferHeight)
|
||||
top = System.Console.BufferHeight - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bh = System.Console.BufferHeight;
|
||||
|
||||
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
|
||||
if (bh > 0 && top >= bh)
|
||||
top = bh - 1;
|
||||
}
|
||||
|
||||
System.Console.CursorTop = top;
|
||||
|
||||
return top;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the cursor column.
|
||||
@@ -129,23 +145,38 @@ namespace OpenSim.Framework.Console
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The new cursor column.
|
||||
/// </returns>
|
||||
/// </returns>
|
||||
private int SetCursorLeft(int left)
|
||||
{
|
||||
// From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
|
||||
// to set a cursor column position with a currently invalid row, mono will throw an exception.
|
||||
// Therefore, we need to make sure that the row position is valid first.
|
||||
// to set a cursor column position with a currently invalid row, mono will throw an exception.
|
||||
// Therefore, we need to make sure that the row position is valid first.
|
||||
int top = System.Console.CursorTop;
|
||||
|
||||
if (top < 0)
|
||||
{
|
||||
System.Console.CursorTop = 0;
|
||||
else if (top >= System.Console.BufferHeight)
|
||||
System.Console.CursorTop = System.Console.BufferHeight - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bh = System.Console.BufferHeight;
|
||||
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
|
||||
if (bh > 0 && top >= bh)
|
||||
System.Console.CursorTop = bh - 1;
|
||||
}
|
||||
|
||||
if (left < 0)
|
||||
{
|
||||
left = 0;
|
||||
if (left >= System.Console.BufferWidth)
|
||||
left = System.Console.BufferWidth - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bw = System.Console.BufferWidth;
|
||||
|
||||
// On Mono 2.4.2.3 (and possibly above), the buffer value is sometimes erroneously zero (Mantis 4657)
|
||||
if (bw > 0 && left >= bw)
|
||||
left = bw - 1;
|
||||
}
|
||||
|
||||
System.Console.CursorLeft = left;
|
||||
|
||||
@@ -183,7 +214,7 @@ namespace OpenSim.Framework.Console
|
||||
System.Console.Write("{0}", prompt);
|
||||
|
||||
SetCursorTop(new_y);
|
||||
SetCursorLeft(new_x);
|
||||
SetCursorLeft(new_x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children);
|
||||
|
||||
public delegate void DelinkObjects(List<uint> primIds);
|
||||
public delegate void DelinkObjects(List<uint> primIds, IClientAPI client);
|
||||
|
||||
public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag);
|
||||
|
||||
@@ -1101,6 +1101,7 @@ namespace OpenSim.Framework
|
||||
void InPacket(object NewPack);
|
||||
void ProcessInPacket(Packet NewPack);
|
||||
void Close();
|
||||
void Close(bool sendStop);
|
||||
void Kick(string message);
|
||||
|
||||
/// <summary>
|
||||
@@ -1142,7 +1143,7 @@ namespace OpenSim.Framework
|
||||
|
||||
void SendInstantMessage(GridInstantMessage im);
|
||||
|
||||
void SendGenericMessage(string method, List<string> message);
|
||||
void SendGenericMessage(string method, List<byte[]> message);
|
||||
|
||||
void SendLayerData(float[] map);
|
||||
void SendLayerData(int px, int py, float[] map);
|
||||
|
||||
@@ -25,13 +25,17 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class MainServer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static BaseHttpServer instance = null;
|
||||
private static Dictionary<uint, BaseHttpServer> m_Servers =
|
||||
new Dictionary<uint, BaseHttpServer>();
|
||||
@@ -53,6 +57,8 @@ namespace OpenSim.Framework
|
||||
return m_Servers[port];
|
||||
|
||||
m_Servers[port] = new BaseHttpServer(port);
|
||||
|
||||
m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
|
||||
m_Servers[port].Start();
|
||||
|
||||
return m_Servers[port];
|
||||
|
||||
@@ -36,8 +36,295 @@ using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
{
|
||||
public class RegionMeta7WindlightData : ICloneable
|
||||
{
|
||||
public UUID regionID = UUID.Zero;
|
||||
public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f);
|
||||
public float waterFogDensityExponent = 4.0f;
|
||||
public float underwaterFogModifier = 0.25f;
|
||||
public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f);
|
||||
public float fresnelScale = 0.40f;
|
||||
public float fresnelOffset = 0.50f;
|
||||
public float refractScaleAbove = 0.03f;
|
||||
public float refractScaleBelow = 0.20f;
|
||||
public float blurMultiplier = 0.040f;
|
||||
public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f);
|
||||
public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f);
|
||||
public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4");
|
||||
public Vector4 horizon = new Vector4(0.25f, 0.25f, 0.32f, 0.32f);
|
||||
public float hazeHorizon = 0.19f;
|
||||
public Vector4 blueDensity = new Vector4(0.12f, 0.22f, 0.38f, 0.38f);
|
||||
public float hazeDensity = 0.70f;
|
||||
public float densityMultiplier = 0.18f;
|
||||
public float distanceMultiplier = 0.8f;
|
||||
public UInt16 maxAltitude = 1605;
|
||||
public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
|
||||
public float sunMoonPosition = 0.317f;
|
||||
public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f);
|
||||
public float eastAngle = 0.0f;
|
||||
public float sunGlowFocus = 0.10f;
|
||||
public float sunGlowSize = 1.75f;
|
||||
public float sceneGamma = 1.0f;
|
||||
public float starBrightness = 0.0f;
|
||||
public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
|
||||
public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f);
|
||||
public float cloudCoverage = 0.27f;
|
||||
public float cloudScale = 0.42f;
|
||||
public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f);
|
||||
public float cloudScrollX = 0.20f;
|
||||
public bool cloudScrollXLock = false;
|
||||
public float cloudScrollY = 0.01f;
|
||||
public bool cloudScrollYLock = false;
|
||||
public bool drawClassicClouds = true;
|
||||
|
||||
public delegate void SaveDelegate(RegionMeta7WindlightData wl);
|
||||
public event SaveDelegate OnSave;
|
||||
public void Save()
|
||||
{
|
||||
if (OnSave != null)
|
||||
OnSave(this);
|
||||
}
|
||||
public object Clone()
|
||||
{
|
||||
return this.MemberwiseClone(); // call clone method
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class SimpleRegionInfo
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// The port by which http communication occurs with the region (most noticeably, CAPS communication)
|
||||
/// </summary>
|
||||
public uint HttpPort
|
||||
{
|
||||
get { return m_httpPort; }
|
||||
set { m_httpPort = value; }
|
||||
}
|
||||
protected uint m_httpPort;
|
||||
|
||||
/// <summary>
|
||||
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
|
||||
/// </summary>
|
||||
public string ServerURI
|
||||
{
|
||||
get { return m_serverURI; }
|
||||
set { m_serverURI = value; }
|
||||
}
|
||||
protected string m_serverURI;
|
||||
|
||||
public string RegionName
|
||||
{
|
||||
get { return m_regionName; }
|
||||
set { m_regionName = value; }
|
||||
}
|
||||
protected string m_regionName = String.Empty;
|
||||
|
||||
protected bool Allow_Alternate_Ports;
|
||||
public bool m_allow_alternate_ports;
|
||||
protected string m_externalHostName;
|
||||
|
||||
protected IPEndPoint m_internalEndPoint;
|
||||
protected uint? m_regionLocX;
|
||||
protected uint? m_regionLocY;
|
||||
protected uint m_remotingPort;
|
||||
public UUID RegionID = UUID.Zero;
|
||||
public string RemotingAddress;
|
||||
public UUID ScopeID = UUID.Zero;
|
||||
|
||||
public SimpleRegionInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
||||
{
|
||||
m_regionLocX = regionLocX;
|
||||
m_regionLocY = regionLocY;
|
||||
|
||||
m_internalEndPoint = internalEndPoint;
|
||||
m_externalHostName = externalUri;
|
||||
}
|
||||
|
||||
public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
|
||||
{
|
||||
m_regionLocX = regionLocX;
|
||||
m_regionLocY = regionLocY;
|
||||
|
||||
m_externalHostName = externalUri;
|
||||
|
||||
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
|
||||
}
|
||||
|
||||
public SimpleRegionInfo(RegionInfo ConvertFrom)
|
||||
{
|
||||
m_regionName = ConvertFrom.RegionName;
|
||||
m_regionLocX = ConvertFrom.RegionLocX;
|
||||
m_regionLocY = ConvertFrom.RegionLocY;
|
||||
m_internalEndPoint = ConvertFrom.InternalEndPoint;
|
||||
m_externalHostName = ConvertFrom.ExternalHostName;
|
||||
m_remotingPort = ConvertFrom.RemotingPort;
|
||||
m_httpPort = ConvertFrom.HttpPort;
|
||||
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
|
||||
RemotingAddress = ConvertFrom.RemotingAddress;
|
||||
RegionID = UUID.Zero;
|
||||
ServerURI = ConvertFrom.ServerURI;
|
||||
}
|
||||
|
||||
public uint RemotingPort
|
||||
{
|
||||
get { return m_remotingPort; }
|
||||
set { m_remotingPort = value; }
|
||||
}
|
||||
|
||||
/// <value>
|
||||
/// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
|
||||
///
|
||||
/// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
|
||||
/// </value>
|
||||
public IPEndPoint ExternalEndPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
// Old one defaults to IPv6
|
||||
//return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
|
||||
|
||||
IPAddress ia = null;
|
||||
// If it is already an IP, don't resolve it - just return directly
|
||||
if (IPAddress.TryParse(m_externalHostName, out ia))
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
|
||||
// Reset for next check
|
||||
ia = null;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
|
||||
{
|
||||
if (ia == null)
|
||||
ia = Adr;
|
||||
|
||||
if (Adr.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
ia = Adr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
throw new Exception(
|
||||
"Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
|
||||
e + "' attached to this exception", e);
|
||||
}
|
||||
|
||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||
}
|
||||
|
||||
set { m_externalHostName = value.ToString(); }
|
||||
}
|
||||
|
||||
public string ExternalHostName
|
||||
{
|
||||
get { return m_externalHostName; }
|
||||
set { m_externalHostName = value; }
|
||||
}
|
||||
|
||||
public IPEndPoint InternalEndPoint
|
||||
{
|
||||
get { return m_internalEndPoint; }
|
||||
set { m_internalEndPoint = value; }
|
||||
}
|
||||
|
||||
public uint RegionLocX
|
||||
{
|
||||
get { return m_regionLocX.Value; }
|
||||
set { m_regionLocX = value; }
|
||||
}
|
||||
|
||||
public uint RegionLocY
|
||||
{
|
||||
get { return m_regionLocY.Value; }
|
||||
set { m_regionLocY = value; }
|
||||
}
|
||||
|
||||
public ulong RegionHandle
|
||||
{
|
||||
get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
|
||||
}
|
||||
|
||||
public int getInternalEndPointPort()
|
||||
{
|
||||
return m_internalEndPoint.Port;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs()
|
||||
{
|
||||
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
||||
kvp["uuid"] = RegionID.ToString();
|
||||
kvp["locX"] = RegionLocX.ToString();
|
||||
kvp["locY"] = RegionLocY.ToString();
|
||||
kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
|
||||
kvp["external_port"] = ExternalEndPoint.Port.ToString();
|
||||
kvp["external_host_name"] = ExternalHostName;
|
||||
kvp["http_port"] = HttpPort.ToString();
|
||||
kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
|
||||
kvp["internal_port"] = InternalEndPoint.Port.ToString();
|
||||
kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
|
||||
kvp["server_uri"] = ServerURI;
|
||||
|
||||
return kvp;
|
||||
}
|
||||
|
||||
public SimpleRegionInfo(Dictionary<string, object> kvp)
|
||||
{
|
||||
if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
|
||||
{
|
||||
int port = 0;
|
||||
Int32.TryParse((string)kvp["external_port"], out port);
|
||||
IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
|
||||
ExternalEndPoint = ep;
|
||||
}
|
||||
else
|
||||
ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||
|
||||
if (kvp["external_host_name"] != null)
|
||||
ExternalHostName = (string)kvp["external_host_name"];
|
||||
|
||||
if (kvp["http_port"] != null)
|
||||
{
|
||||
UInt32 port = 0;
|
||||
UInt32.TryParse((string)kvp["http_port"], out port);
|
||||
HttpPort = port;
|
||||
}
|
||||
|
||||
if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
|
||||
{
|
||||
int port = 0;
|
||||
Int32.TryParse((string)kvp["internal_port"], out port);
|
||||
IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
|
||||
InternalEndPoint = ep;
|
||||
}
|
||||
else
|
||||
InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||
|
||||
if (kvp["alternate_ports"] != null)
|
||||
{
|
||||
bool alts = false;
|
||||
Boolean.TryParse((string)kvp["alternate_ports"], out alts);
|
||||
m_allow_alternate_ports = alts;
|
||||
}
|
||||
|
||||
if (kvp["server_uri"] != null)
|
||||
ServerURI = (string)kvp["server_uri"];
|
||||
}
|
||||
}
|
||||
|
||||
public class RegionInfo
|
||||
{
|
||||
// private static readonly log4net.ILog m_log
|
||||
@@ -73,6 +360,7 @@ namespace OpenSim.Framework
|
||||
private bool m_clampPrimSize = false;
|
||||
private int m_objectCapacity = 0;
|
||||
private string m_regionType = String.Empty;
|
||||
private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData();
|
||||
protected uint m_httpPort;
|
||||
protected string m_serverURI;
|
||||
protected string m_regionName = String.Empty;
|
||||
@@ -211,6 +499,21 @@ namespace OpenSim.Framework
|
||||
set { m_regionSettings = value; }
|
||||
}
|
||||
|
||||
public RegionMeta7WindlightData WindlightSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_windlight == null)
|
||||
{
|
||||
m_windlight = new RegionMeta7WindlightData();
|
||||
}
|
||||
|
||||
return m_windlight;
|
||||
}
|
||||
|
||||
set { m_windlight = value; }
|
||||
}
|
||||
|
||||
public int NonphysPrimMax
|
||||
{
|
||||
get { return m_nonphysPrimMax; }
|
||||
|
||||
282
OpenSim/Framework/SLUtil.cs
Normal file
282
OpenSim/Framework/SLUtil.cs
Normal file
@@ -0,0 +1,282 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public static class SLUtil
|
||||
{
|
||||
#region SL / file extension / content-type conversions
|
||||
|
||||
public static string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
switch ((AssetType)assetType)
|
||||
{
|
||||
case AssetType.Texture:
|
||||
return "image/x-j2c";
|
||||
case AssetType.Sound:
|
||||
return "application/ogg";
|
||||
case AssetType.CallingCard:
|
||||
return "application/vnd.ll.callingcard";
|
||||
case AssetType.Landmark:
|
||||
return "application/vnd.ll.landmark";
|
||||
case AssetType.Clothing:
|
||||
return "application/vnd.ll.clothing";
|
||||
case AssetType.Object:
|
||||
return "application/vnd.ll.primitive";
|
||||
case AssetType.Notecard:
|
||||
return "application/vnd.ll.notecard";
|
||||
case AssetType.Folder:
|
||||
return "application/vnd.ll.folder";
|
||||
case AssetType.RootFolder:
|
||||
return "application/vnd.ll.rootfolder";
|
||||
case AssetType.LSLText:
|
||||
return "application/vnd.ll.lsltext";
|
||||
case AssetType.LSLBytecode:
|
||||
return "application/vnd.ll.lslbyte";
|
||||
case AssetType.TextureTGA:
|
||||
case AssetType.ImageTGA:
|
||||
return "image/tga";
|
||||
case AssetType.Bodypart:
|
||||
return "application/vnd.ll.bodypart";
|
||||
case AssetType.TrashFolder:
|
||||
return "application/vnd.ll.trashfolder";
|
||||
case AssetType.SnapshotFolder:
|
||||
return "application/vnd.ll.snapshotfolder";
|
||||
case AssetType.LostAndFoundFolder:
|
||||
return "application/vnd.ll.lostandfoundfolder";
|
||||
case AssetType.SoundWAV:
|
||||
return "audio/x-wav";
|
||||
case AssetType.ImageJPEG:
|
||||
return "image/jpeg";
|
||||
case AssetType.Animation:
|
||||
return "application/vnd.ll.animation";
|
||||
case AssetType.Gesture:
|
||||
return "application/vnd.ll.gesture";
|
||||
case AssetType.Simstate:
|
||||
return "application/x-metaverse-simstate";
|
||||
case AssetType.Unknown:
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
|
||||
public static sbyte ContentTypeToSLAssetType(string contentType)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case "image/x-j2c":
|
||||
case "image/jp2":
|
||||
return (sbyte)AssetType.Texture;
|
||||
case "application/ogg":
|
||||
return (sbyte)AssetType.Sound;
|
||||
case "application/vnd.ll.callingcard":
|
||||
case "application/x-metaverse-callingcard":
|
||||
return (sbyte)AssetType.CallingCard;
|
||||
case "application/vnd.ll.landmark":
|
||||
case "application/x-metaverse-landmark":
|
||||
return (sbyte)AssetType.Landmark;
|
||||
case "application/vnd.ll.clothing":
|
||||
case "application/x-metaverse-clothing":
|
||||
return (sbyte)AssetType.Clothing;
|
||||
case "application/vnd.ll.primitive":
|
||||
case "application/x-metaverse-primitive":
|
||||
return (sbyte)AssetType.Object;
|
||||
case "application/vnd.ll.notecard":
|
||||
case "application/x-metaverse-notecard":
|
||||
return (sbyte)AssetType.Notecard;
|
||||
case "application/vnd.ll.folder":
|
||||
return (sbyte)AssetType.Folder;
|
||||
case "application/vnd.ll.rootfolder":
|
||||
return (sbyte)AssetType.RootFolder;
|
||||
case "application/vnd.ll.lsltext":
|
||||
case "application/x-metaverse-lsl":
|
||||
return (sbyte)AssetType.LSLText;
|
||||
case "application/vnd.ll.lslbyte":
|
||||
case "application/x-metaverse-lso":
|
||||
return (sbyte)AssetType.LSLBytecode;
|
||||
case "image/tga":
|
||||
// Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA
|
||||
return (sbyte)AssetType.ImageTGA;
|
||||
case "application/vnd.ll.bodypart":
|
||||
case "application/x-metaverse-bodypart":
|
||||
return (sbyte)AssetType.Bodypart;
|
||||
case "application/vnd.ll.trashfolder":
|
||||
return (sbyte)AssetType.TrashFolder;
|
||||
case "application/vnd.ll.snapshotfolder":
|
||||
return (sbyte)AssetType.SnapshotFolder;
|
||||
case "application/vnd.ll.lostandfoundfolder":
|
||||
return (sbyte)AssetType.LostAndFoundFolder;
|
||||
case "audio/x-wav":
|
||||
return (sbyte)AssetType.SoundWAV;
|
||||
case "image/jpeg":
|
||||
return (sbyte)AssetType.ImageJPEG;
|
||||
case "application/vnd.ll.animation":
|
||||
case "application/x-metaverse-animation":
|
||||
return (sbyte)AssetType.Animation;
|
||||
case "application/vnd.ll.gesture":
|
||||
case "application/x-metaverse-gesture":
|
||||
return (sbyte)AssetType.Gesture;
|
||||
case "application/x-metaverse-simstate":
|
||||
return (sbyte)AssetType.Simstate;
|
||||
case "application/octet-stream":
|
||||
default:
|
||||
return (sbyte)AssetType.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
public static sbyte ContentTypeToSLInvType(string contentType)
|
||||
{
|
||||
switch (contentType)
|
||||
{
|
||||
case "image/x-j2c":
|
||||
case "image/jp2":
|
||||
case "image/tga":
|
||||
case "image/jpeg":
|
||||
return (sbyte)InventoryType.Texture;
|
||||
case "application/ogg":
|
||||
case "audio/x-wav":
|
||||
return (sbyte)InventoryType.Sound;
|
||||
case "application/vnd.ll.callingcard":
|
||||
case "application/x-metaverse-callingcard":
|
||||
return (sbyte)InventoryType.CallingCard;
|
||||
case "application/vnd.ll.landmark":
|
||||
case "application/x-metaverse-landmark":
|
||||
return (sbyte)InventoryType.Landmark;
|
||||
case "application/vnd.ll.clothing":
|
||||
case "application/x-metaverse-clothing":
|
||||
case "application/vnd.ll.bodypart":
|
||||
case "application/x-metaverse-bodypart":
|
||||
return (sbyte)InventoryType.Wearable;
|
||||
case "application/vnd.ll.primitive":
|
||||
case "application/x-metaverse-primitive":
|
||||
return (sbyte)InventoryType.Object;
|
||||
case "application/vnd.ll.notecard":
|
||||
case "application/x-metaverse-notecard":
|
||||
return (sbyte)InventoryType.Notecard;
|
||||
case "application/vnd.ll.folder":
|
||||
return (sbyte)InventoryType.Folder;
|
||||
case "application/vnd.ll.rootfolder":
|
||||
return (sbyte)InventoryType.RootCategory;
|
||||
case "application/vnd.ll.lsltext":
|
||||
case "application/x-metaverse-lsl":
|
||||
case "application/vnd.ll.lslbyte":
|
||||
case "application/x-metaverse-lso":
|
||||
return (sbyte)InventoryType.LSL;
|
||||
case "application/vnd.ll.trashfolder":
|
||||
case "application/vnd.ll.snapshotfolder":
|
||||
case "application/vnd.ll.lostandfoundfolder":
|
||||
return (sbyte)InventoryType.Folder;
|
||||
case "application/vnd.ll.animation":
|
||||
case "application/x-metaverse-animation":
|
||||
return (sbyte)InventoryType.Animation;
|
||||
case "application/vnd.ll.gesture":
|
||||
case "application/x-metaverse-gesture":
|
||||
return (sbyte)InventoryType.Gesture;
|
||||
case "application/x-metaverse-simstate":
|
||||
return (sbyte)InventoryType.Snapshot;
|
||||
case "application/octet-stream":
|
||||
default:
|
||||
return (sbyte)InventoryType.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion SL / file extension / content-type conversions
|
||||
|
||||
/// <summary>
|
||||
/// Parse a notecard in Linden format to a string of ordinary text.
|
||||
/// </summary>
|
||||
/// <param name="rawInput"></param>
|
||||
/// <returns></returns>
|
||||
public static string ParseNotecardToString(string rawInput)
|
||||
{
|
||||
return string.Join("\n", ParseNotecardToList(rawInput).ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a notecard in Linden format to a list of ordinary lines.
|
||||
/// </summary>
|
||||
/// <param name="rawInput"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> ParseNotecardToList(string rawInput)
|
||||
{
|
||||
string[] input = rawInput.Replace("\r", "").Split('\n');
|
||||
int idx = 0;
|
||||
int level = 0;
|
||||
List<string> output = new List<string>();
|
||||
string[] words;
|
||||
|
||||
while (idx < input.Length)
|
||||
{
|
||||
if (input[idx] == "{")
|
||||
{
|
||||
level++;
|
||||
idx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (input[idx]== "}")
|
||||
{
|
||||
level--;
|
||||
idx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 0:
|
||||
words = input[idx].Split(' '); // Linden text ver
|
||||
// Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
|
||||
if (words.Length < 3)
|
||||
return output;
|
||||
|
||||
int version = int.Parse(words[3]);
|
||||
if (version != 2)
|
||||
return output;
|
||||
break;
|
||||
case 1:
|
||||
words = input[idx].Split(' ');
|
||||
if (words[0] == "LLEmbeddedItems")
|
||||
break;
|
||||
if (words[0] == "Text")
|
||||
{
|
||||
int len = int.Parse(words[2]);
|
||||
idx++;
|
||||
|
||||
int count = -1;
|
||||
|
||||
while (count < len)
|
||||
{
|
||||
// int l = input[idx].Length;
|
||||
string ln = input[idx];
|
||||
|
||||
int need = len-count-1;
|
||||
if (ln.Length > need)
|
||||
ln = ln.Substring(0, need);
|
||||
|
||||
output.Add(ln);
|
||||
count += ln.Length + 1;
|
||||
idx++;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
words = input[idx].Split(' '); // count
|
||||
if (words[0] == "count")
|
||||
{
|
||||
int c = int.Parse(words[1]);
|
||||
if (c > 0)
|
||||
return output;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,9 @@ namespace OpenSim.Framework.Serialization
|
||||
m_bw.Write(header);
|
||||
|
||||
// Write out data
|
||||
m_bw.Write(data);
|
||||
// An IOException occurs if we try to write out an empty array in Mono 2.6
|
||||
if (data.Length > 0)
|
||||
m_bw.Write(data);
|
||||
|
||||
if (data.Length % 512 != 0)
|
||||
{
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0} {1}", e.Message, e.StackTrace);
|
||||
m_log.Error(string.Format("[BASE HTTP SERVER]: OnRequest() failed with "), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1572,7 +1572,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
public void Start()
|
||||
{
|
||||
m_log.Info("[BASE HTTP SERVER]: Starting up HTTP Server");
|
||||
StartHTTP();
|
||||
}
|
||||
|
||||
@@ -1580,7 +1579,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
try
|
||||
{
|
||||
m_log.Debug("[BASE HTTP SERVER]: Spawned main thread OK");
|
||||
//m_httpListener = new HttpListener();
|
||||
NotSocketErrors = 0;
|
||||
if (!m_ssl)
|
||||
|
||||
@@ -29,11 +29,11 @@ namespace OpenSim
|
||||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.6.9";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
private const string VERSION_NUMBER = "0.6.9CM";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Post_Fixes;
|
||||
|
||||
public enum Flavour
|
||||
{
|
||||
{
|
||||
Unknown,
|
||||
Dev,
|
||||
RC1,
|
||||
|
||||
@@ -27,9 +27,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
@@ -45,6 +48,111 @@ namespace OpenSim.Framework
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Thread LockedByThread;
|
||||
/// <value>
|
||||
/// An advanced lock for inventory data
|
||||
/// </value>
|
||||
private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
|
||||
/// <summary>
|
||||
/// Are we readlocked by the calling thread?
|
||||
/// </summary>
|
||||
public bool IsReadLockedByMe()
|
||||
{
|
||||
if (m_itemLock.RecursiveReadCount > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lock our inventory list for reading (many can read, one can write)
|
||||
/// </summary>
|
||||
public void LockItemsForRead(bool locked)
|
||||
{
|
||||
if (locked)
|
||||
{
|
||||
if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
|
||||
{
|
||||
if (!LockedByThread.IsAlive)
|
||||
{
|
||||
//Locked by dead thread, reset.
|
||||
m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_itemLock.RecursiveReadCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
|
||||
m_itemLock.ExitReadLock();
|
||||
}
|
||||
if (m_itemLock.RecursiveWriteCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
|
||||
m_itemLock.ExitWriteLock();
|
||||
}
|
||||
|
||||
while (!m_itemLock.TryEnterReadLock(60000))
|
||||
{
|
||||
m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
|
||||
if (m_itemLock.IsWriteLockHeld)
|
||||
{
|
||||
m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_itemLock.RecursiveReadCount>0)
|
||||
{
|
||||
m_itemLock.ExitReadLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lock our inventory list for writing (many can read, one can write)
|
||||
/// </summary>
|
||||
public void LockItemsForWrite(bool locked)
|
||||
{
|
||||
if (locked)
|
||||
{
|
||||
//Enter a write lock, wait indefinately for one to open.
|
||||
if (m_itemLock.RecursiveReadCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
|
||||
m_itemLock.ExitReadLock();
|
||||
}
|
||||
if (m_itemLock.RecursiveWriteCount > 0)
|
||||
{
|
||||
m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
|
||||
m_itemLock.ExitWriteLock();
|
||||
}
|
||||
while (!m_itemLock.TryEnterWriteLock(60000))
|
||||
{
|
||||
m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
|
||||
if (m_itemLock.IsWriteLockHeld)
|
||||
{
|
||||
m_itemLock = new System.Threading.ReaderWriterLockSlim();
|
||||
}
|
||||
}
|
||||
|
||||
LockedByThread = Thread.CurrentThread;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_itemLock.RecursiveWriteCount > 0)
|
||||
{
|
||||
m_itemLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ICloneable Members
|
||||
|
||||
@@ -52,13 +160,12 @@ namespace OpenSim.Framework
|
||||
{
|
||||
TaskInventoryDictionary clone = new TaskInventoryDictionary();
|
||||
|
||||
lock (this)
|
||||
m_itemLock.EnterReadLock();
|
||||
foreach (UUID uuid in Keys)
|
||||
{
|
||||
foreach (UUID uuid in Keys)
|
||||
{
|
||||
clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
|
||||
}
|
||||
clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
|
||||
}
|
||||
m_itemLock.ExitReadLock();
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
@@ -996,19 +996,19 @@ namespace OpenSim.Framework
|
||||
{
|
||||
string os = String.Empty;
|
||||
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
{
|
||||
os = Environment.OSVersion.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
os = ReadEtcIssue();
|
||||
}
|
||||
|
||||
if (os.Length > 45)
|
||||
{
|
||||
os = os.Substring(0, 45);
|
||||
}
|
||||
// if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
// {
|
||||
// os = Environment.OSVersion.ToString();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// os = ReadEtcIssue();
|
||||
// }
|
||||
//
|
||||
// if (os.Length > 45)
|
||||
// {
|
||||
// os = os.Substring(0, 45);
|
||||
// }
|
||||
|
||||
return os;
|
||||
}
|
||||
@@ -1441,4 +1441,4 @@ namespace OpenSim.Framework
|
||||
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,12 +164,12 @@ namespace OpenSim
|
||||
m_config.Source = new IniConfigSource();
|
||||
m_config.Source.Merge(DefaultConfig());
|
||||
|
||||
m_log.Info("[CONFIG] Reading configuration settings");
|
||||
m_log.Info("[CONFIG]: Reading configuration settings");
|
||||
|
||||
if (sources.Count == 0)
|
||||
{
|
||||
m_log.FatalFormat("[CONFIG] Could not load any configuration");
|
||||
m_log.FatalFormat("[CONFIG] Did you copy the OpenSim.ini.example file to OpenSim.ini?");
|
||||
m_log.FatalFormat("[CONFIG]: Could not load any configuration");
|
||||
m_log.FatalFormat("[CONFIG]: Did you copy the OpenSim.ini.example file to OpenSim.ini?");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
@@ -182,8 +182,8 @@ namespace OpenSim
|
||||
|
||||
if (!iniFileExists)
|
||||
{
|
||||
m_log.FatalFormat("[CONFIG] Could not load any configuration");
|
||||
m_log.FatalFormat("[CONFIG] Configuration exists, but there was an error loading it!");
|
||||
m_log.FatalFormat("[CONFIG]: Could not load any configuration");
|
||||
m_log.FatalFormat("[CONFIG]: Configuration exists, but there was an error loading it!");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
@@ -257,20 +257,17 @@ namespace OpenSim
|
||||
|
||||
if (!IsUri(iniPath))
|
||||
{
|
||||
m_log.InfoFormat("[CONFIG] Reading configuration file {0}",
|
||||
Path.GetFullPath(iniPath));
|
||||
m_log.InfoFormat("[CONFIG]: Reading configuration file {0}", Path.GetFullPath(iniPath));
|
||||
|
||||
m_config.Source.Merge(new IniConfigSource(iniPath));
|
||||
success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[CONFIG] {0} is a http:// URI, fetching ...",
|
||||
iniPath);
|
||||
m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", iniPath);
|
||||
|
||||
// The ini file path is a http URI
|
||||
// Try to read it
|
||||
//
|
||||
try
|
||||
{
|
||||
XmlReader r = XmlReader.Create(iniPath);
|
||||
@@ -281,7 +278,7 @@ namespace OpenSim
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.FatalFormat("[CONFIG] Exception reading config from URI {0}\n" + e.ToString(), iniPath);
|
||||
m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), iniPath);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ namespace OpenSim
|
||||
|
||||
protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
|
||||
|
||||
private List<string> m_permsModules;
|
||||
|
||||
private bool m_securePermissionsLoading = true;
|
||||
|
||||
/// <value>
|
||||
/// The config information passed into the OpenSimulator region server.
|
||||
/// </value>
|
||||
@@ -188,6 +192,11 @@ namespace OpenSim
|
||||
CreatePIDFile(pidFile);
|
||||
|
||||
userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
|
||||
|
||||
m_securePermissionsLoading = startupConfig.GetBoolean("SecurePermissionsLoading", true);
|
||||
|
||||
string permissionModules = startupConfig.GetString("permissionmodules", "DefaultPermissionsModule");
|
||||
m_permsModules = new List<string>(permissionModules.Split(','));
|
||||
}
|
||||
|
||||
base.StartupSpecific();
|
||||
@@ -345,11 +354,50 @@ namespace OpenSim
|
||||
}
|
||||
else m_log.Error("[MODULES]: The new RegionModulesController is missing...");
|
||||
|
||||
if (m_securePermissionsLoading)
|
||||
{
|
||||
foreach (string s in m_permsModules)
|
||||
{
|
||||
if (!scene.RegionModules.ContainsKey(s))
|
||||
{
|
||||
bool found = false;
|
||||
foreach (IRegionModule m in modules)
|
||||
{
|
||||
if (m.Name == s)
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
m_log.Fatal("[MODULES]: Required module " + s + " not found.");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scene.SetModuleInterfaces();
|
||||
// First Step of bootreport sequence
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.ColdStart(1,scene);
|
||||
scene.SnmpService.LinkDown(scene);
|
||||
}
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Loading prins", scene);
|
||||
}
|
||||
|
||||
// Prims have to be loaded after module configuration since some modules may be invoked during the load
|
||||
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Creating region texture", scene);
|
||||
}
|
||||
|
||||
// moved these here as the terrain texture has to be created after the modules are initialized
|
||||
// and has to happen before the region is registered with the grid.
|
||||
scene.CreateTerrainTexture(false);
|
||||
@@ -357,6 +405,10 @@ namespace OpenSim
|
||||
// TODO : Try setting resource for region xstats here on scene
|
||||
MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo));
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Grid Registration in progress", scene);
|
||||
}
|
||||
try
|
||||
{
|
||||
scene.RegisterRegionWithGrid();
|
||||
@@ -365,11 +417,20 @@ namespace OpenSim
|
||||
{
|
||||
m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace);
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.Critical("Grid registration failed. Startup aborted.", scene);
|
||||
}
|
||||
// Carrying on now causes a lot of confusion down the
|
||||
// line - we need to get the user's attention
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Grid Registration done", scene);
|
||||
}
|
||||
|
||||
// We need to do this after we've initialized the
|
||||
// scripting engines.
|
||||
scene.CreateScriptInstances();
|
||||
@@ -377,6 +438,11 @@ namespace OpenSim
|
||||
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
|
||||
scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("ScriptEngine started", scene);
|
||||
}
|
||||
|
||||
m_sceneManager.Add(scene);
|
||||
|
||||
if (m_autoCreateClientStack)
|
||||
@@ -385,6 +451,10 @@ namespace OpenSim
|
||||
clientServer.Start();
|
||||
}
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("Initializing region modules", scene);
|
||||
}
|
||||
if (do_post_init)
|
||||
{
|
||||
foreach (IRegionModule module in modules)
|
||||
@@ -396,6 +466,12 @@ namespace OpenSim
|
||||
|
||||
mscene = scene;
|
||||
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("The region is operational", scene);
|
||||
scene.SnmpService.LinkUp(scene);
|
||||
}
|
||||
|
||||
scene.StartTimer();
|
||||
|
||||
return clientServer;
|
||||
@@ -404,6 +480,11 @@ namespace OpenSim
|
||||
private void ShutdownRegion(Scene scene)
|
||||
{
|
||||
m_log.DebugFormat("[SHUTDOWN]: Shutting down region {0}", scene.RegionInfo.RegionName);
|
||||
if (scene.SnmpService != null)
|
||||
{
|
||||
scene.SnmpService.BootInfo("The region is shutting down", scene);
|
||||
scene.SnmpService.LinkDown(scene);
|
||||
}
|
||||
IRegionModulesController controller;
|
||||
if (ApplicationRegistry.TryGet<IRegionModulesController>(out controller))
|
||||
{
|
||||
|
||||
@@ -98,6 +98,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// </summary>
|
||||
public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector
|
||||
{
|
||||
/// <value>
|
||||
/// Debug packet level. At the moment, only 255 does anything (prints out all in and out packets).
|
||||
/// </value>
|
||||
protected int m_debugPacketLevel = 0;
|
||||
|
||||
#region Events
|
||||
|
||||
public event GenericMessage OnGenericMessage;
|
||||
@@ -348,6 +353,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
protected PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates;
|
||||
private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates;
|
||||
private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates;
|
||||
|
||||
/// <value>
|
||||
/// List used in construction of data blocks for an object update packet. This is to stop us having to
|
||||
/// continually recreate it.
|
||||
/// </value>
|
||||
protected List<ObjectUpdatePacket.ObjectDataBlock> m_fullUpdateDataBlocksBuilder;
|
||||
|
||||
/// <value>
|
||||
/// Maintain a record of all the objects killed. This allows us to stop an update being sent from the
|
||||
/// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
|
||||
/// ownerless phantom.
|
||||
///
|
||||
/// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock
|
||||
///
|
||||
/// </value>
|
||||
protected HashSet<uint> m_killRecord;
|
||||
|
||||
// protected HashSet<uint> m_attachmentsQueued;
|
||||
// protected HashSet<uint> m_attachmentsSent;
|
||||
|
||||
private int m_moneyBalance;
|
||||
private int m_animationSequenceNumber = 1;
|
||||
private bool m_SendLogoutPacketWhenClosing = true;
|
||||
@@ -437,6 +462,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_avatarTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
|
||||
m_primTerseUpdates = new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
|
||||
m_primFullUpdates = new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>(m_scene.Entities.Count);
|
||||
m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
|
||||
m_killRecord = new HashSet<uint>();
|
||||
// m_attachmentsQueued = new HashSet<uint>();
|
||||
// m_attachmentsSent = new HashSet<uint>();
|
||||
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
|
||||
@@ -466,22 +495,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
public void SetDebugPacketLevel(int newDebug)
|
||||
{
|
||||
m_debugPacketLevel = newDebug;
|
||||
}
|
||||
|
||||
#region Client Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Shut down the client view
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
Close(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shut down the client view
|
||||
/// </summary>
|
||||
public void Close(bool sendStop)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[CLIENT]: Close has been called for {0} attached to scene {1}",
|
||||
Name, m_scene.RegionInfo.RegionName);
|
||||
|
||||
// Send the STOP packet
|
||||
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
|
||||
OutPacket(disable, ThrottleOutPacketType.Unknown);
|
||||
if (sendStop)
|
||||
{
|
||||
// Send the STOP packet
|
||||
DisableSimulatorPacket disable = (DisableSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.DisableSimulator);
|
||||
OutPacket(disable, ThrottleOutPacketType.Unknown);
|
||||
}
|
||||
|
||||
IsActive = false;
|
||||
|
||||
@@ -638,8 +680,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public void ProcessSpecificPacketAsync(object state)
|
||||
{
|
||||
AsyncPacketProcess packetObject = (AsyncPacketProcess)state;
|
||||
packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
|
||||
|
||||
packetObject.result = packetObject.Method(packetObject.ClientView, packetObject.Pack);
|
||||
}
|
||||
|
||||
#endregion Packet Handling
|
||||
@@ -814,16 +855,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
public void SendGenericMessage(string method, List<string> message)
|
||||
public void SendGenericMessage(string method, List<byte[]> message)
|
||||
{
|
||||
GenericMessagePacket gmp = new GenericMessagePacket();
|
||||
gmp.MethodData.Method = Util.StringToBytes256(method);
|
||||
gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
|
||||
int i = 0;
|
||||
foreach (string val in message)
|
||||
foreach (byte[] val in message)
|
||||
{
|
||||
gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
|
||||
gmp.ParamList[i++].Parameter = Util.StringToBytes256(val);
|
||||
gmp.ParamList[i++].Parameter = val;
|
||||
}
|
||||
OutPacket(gmp, ThrottleOutPacketType.Task);
|
||||
}
|
||||
@@ -1022,6 +1063,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public virtual void SendLayerData(float[] map)
|
||||
{
|
||||
Util.FireAndForget(DoSendLayerData, map);
|
||||
|
||||
// Send it sync, and async. It's not that much data
|
||||
// and it improves user experience just so much!
|
||||
DoSendLayerData(map);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1034,16 +1079,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
try
|
||||
{
|
||||
//for (int y = 0; y < 16; y++)
|
||||
//{
|
||||
// for (int x = 0; x < 16; x++)
|
||||
// {
|
||||
// SendLayerData(x, y, map);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Send LayerData in a spiral pattern. Fun!
|
||||
SendLayerTopRight(map, 0, 0, 15, 15);
|
||||
for (int y = 0; y < 16; y++)
|
||||
{
|
||||
for (int x = 0; x < 16; x+=4)
|
||||
{
|
||||
SendLayerPacket(x, y, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -1051,51 +1093,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
private void SendLayerTopRight(float[] map, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// Row
|
||||
for (int i = x1; i <= x2; i++)
|
||||
SendLayerData(i, y1, map);
|
||||
|
||||
// Column
|
||||
for (int j = y1 + 1; j <= y2; j++)
|
||||
SendLayerData(x2, j, map);
|
||||
|
||||
if (x2 - x1 > 0)
|
||||
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
|
||||
}
|
||||
|
||||
void SendLayerBottomLeft(float[] map, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// Row in reverse
|
||||
for (int i = x2; i >= x1; i--)
|
||||
SendLayerData(i, y2, map);
|
||||
|
||||
// Column in reverse
|
||||
for (int j = y2 - 1; j >= y1; j--)
|
||||
SendLayerData(x1, j, map);
|
||||
|
||||
if (x2 - x1 > 0)
|
||||
SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a set of four patches (x, x+1, ..., x+3) to the client
|
||||
/// </summary>
|
||||
/// <param name="map">heightmap</param>
|
||||
/// <param name="px">X coordinate for patches 0..12</param>
|
||||
/// <param name="py">Y coordinate for patches 0..15</param>
|
||||
// private void SendLayerPacket(float[] map, int y, int x)
|
||||
// {
|
||||
// int[] patches = new int[4];
|
||||
// patches[0] = x + 0 + y * 16;
|
||||
// patches[1] = x + 1 + y * 16;
|
||||
// patches[2] = x + 2 + y * 16;
|
||||
// patches[3] = x + 3 + y * 16;
|
||||
private void SendLayerPacket(int x, int y, float[] map)
|
||||
{
|
||||
int[] patches = new int[4];
|
||||
patches[0] = x + 0 + y * 16;
|
||||
patches[1] = x + 1 + y * 16;
|
||||
patches[2] = x + 2 + y * 16;
|
||||
patches[3] = x + 3 + y * 16;
|
||||
|
||||
// Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
|
||||
// OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
// }
|
||||
float[] heightmap = (map.Length == 65536) ?
|
||||
map :
|
||||
LLHeightFieldMoronize(map);
|
||||
|
||||
try
|
||||
{
|
||||
Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
}
|
||||
catch
|
||||
{
|
||||
for (int px = x ; px < x + 4 ; px++)
|
||||
SendLayerData(px, y, map);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a specified patch to a client
|
||||
@@ -1115,7 +1141,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches);
|
||||
layerpack.Header.Reliable = true;
|
||||
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Task);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -1476,7 +1502,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
kill.ObjectData[0].ID = localID;
|
||||
kill.Header.Reliable = true;
|
||||
kill.Header.Zerocoded = true;
|
||||
OutPacket(kill, ThrottleOutPacketType.State);
|
||||
|
||||
lock (m_primFullUpdates.SyncRoot)
|
||||
{
|
||||
m_killRecord.Add(localID);
|
||||
OutPacket(kill, ThrottleOutPacketType.State);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3375,8 +3406,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
|
||||
objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data);
|
||||
|
||||
OutPacket(objupdate, ThrottleOutPacketType.Task);
|
||||
|
||||
// We need to record the avatar local id since the root prim of an attachment points to this.
|
||||
// m_attachmentsSent.Add(data.AvatarLocalID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3426,8 +3459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue();
|
||||
}
|
||||
|
||||
// HACK: Using the task category until the tiered reprioritization code is in
|
||||
OutPacket(terse, ThrottleOutPacketType.Task);
|
||||
OutPacket(terse, ThrottleOutPacketType.State);
|
||||
}
|
||||
|
||||
public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
|
||||
@@ -3480,8 +3512,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// if (text.IndexOf("\n") >= 0)
|
||||
// text = text.Remove(text.IndexOf("\n"));
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Placing request to send full info about prim {0} text {1} to client {2}",
|
||||
// data.localID, text, Name);
|
||||
// "[CLIENT]: Queueing send full info about prim {0}, attachment {1}, text {2} to client {3}",
|
||||
// data.localID, data.attachment, text, Name);
|
||||
|
||||
if (data.priority == double.NaN)
|
||||
{
|
||||
@@ -3499,6 +3531,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return;
|
||||
|
||||
ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data);
|
||||
|
||||
// if (data.attachment)
|
||||
// m_attachmentsQueued.Add(data.localID);
|
||||
|
||||
lock (m_primFullUpdates.SyncRoot)
|
||||
m_primFullUpdates.Enqueue(data.priority, objectData, data.localID);
|
||||
@@ -3518,21 +3553,56 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
outPacket.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[count];
|
||||
m_fullUpdateDataBlocksBuilder.Clear();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
outPacket.ObjectData[i] = m_primFullUpdates.Dequeue();
|
||||
ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue();
|
||||
|
||||
// string text = Util.FieldToString(outPacket.ObjectData[i].Text);
|
||||
// if (text.IndexOf("\n") >= 0)
|
||||
// text = text.Remove(text.IndexOf("\n"));
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}",
|
||||
// outPacket.ObjectData[i].ID, text, Name);
|
||||
if (!m_killRecord.Contains(block.ID))
|
||||
{
|
||||
// if (m_attachmentsQueued.Contains(block.ID))
|
||||
// {
|
||||
// string text = Util.FieldToString(block.Text);
|
||||
// if (text.IndexOf("\n") >= 0)
|
||||
// text = text.Remove(text.IndexOf("\n"));
|
||||
//
|
||||
// if (m_attachmentsSent.Contains(block.ParentID))
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Sending full info about attached prim {0} text {1}",
|
||||
// block.ID, text);
|
||||
//
|
||||
// m_fullUpdateDataBlocksBuilder.Add(block);
|
||||
//
|
||||
// m_attachmentsSent.Add(block.ID);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
|
||||
// block.ID, text, block.ParentID);
|
||||
//
|
||||
// lock (m_primFullUpdates.SyncRoot)
|
||||
// m_primFullUpdates.Enqueue(double.MaxValue, block, block.ID);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
m_fullUpdateDataBlocksBuilder.Add(block);
|
||||
// }
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// m_log.WarnFormat(
|
||||
// "[CLIENT]: Preventing full update for {0} after kill to {1}", block.ID, Name);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
OutPacket(outPacket, ThrottleOutPacketType.State);
|
||||
outPacket.ObjectData = m_fullUpdateDataBlocksBuilder.ToArray();
|
||||
|
||||
OutPacket(outPacket, ThrottleOutPacketType.State);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
|
||||
@@ -3904,6 +3974,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_propertiesPacketTimer.Stop();
|
||||
|
||||
if (m_propertiesBlocks.Count == 0)
|
||||
return;
|
||||
|
||||
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[m_propertiesBlocks.Count];
|
||||
|
||||
int index = 0;
|
||||
@@ -4469,6 +4542,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data)
|
||||
{
|
||||
// if (data.attachment)
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Creating prim update block for {0}, parent {1}, priority {2}",
|
||||
// data.localID, data.parentID, data.priority);
|
||||
|
||||
byte[] objectData = new byte[60];
|
||||
data.pos.ToBytes(objectData, 0);
|
||||
data.vel.ToBytes(objectData, 12);
|
||||
@@ -4846,6 +4924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
(x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
|
||||
(x.CameraUpAxis != lastarg.CameraUpAxis) ||
|
||||
(x.ControlFlags != lastarg.ControlFlags) ||
|
||||
(x.ControlFlags != 0) ||
|
||||
(x.Far != lastarg.Far) ||
|
||||
(x.Flags != lastarg.Flags) ||
|
||||
(x.State != lastarg.State) ||
|
||||
@@ -5213,7 +5292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
args.Channel = ch;
|
||||
args.From = String.Empty;
|
||||
args.Message = Utils.BytesToString(msg);
|
||||
args.Type = ChatTypeEnum.Shout;
|
||||
args.Type = ChatTypeEnum.Region; //Behaviour in SL is that the response can be heard from any distance
|
||||
args.Position = new Vector3();
|
||||
args.Scene = Scene;
|
||||
args.Sender = this;
|
||||
@@ -6084,7 +6163,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
DelinkObjects handlerDelinkObjects = OnDelinkObjects;
|
||||
if (handlerDelinkObjects != null)
|
||||
{
|
||||
handlerDelinkObjects(prims);
|
||||
handlerDelinkObjects(prims, this);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -7017,32 +7096,89 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
taskID = new UUID(transfer.TransferInfo.Params, 48);
|
||||
UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
|
||||
UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
|
||||
// requestID, itemID, taskID, Name);
|
||||
|
||||
if (!(((Scene)m_scene).Permissions.BypassPermissions()))
|
||||
{
|
||||
if (taskID != UUID.Zero) // Prim
|
||||
{
|
||||
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
|
||||
if (part == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
|
||||
Name, requestID, itemID, taskID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (part.OwnerID != AgentId)
|
||||
return true;
|
||||
|
||||
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
return true;
|
||||
|
||||
TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID);
|
||||
if (ti == null)
|
||||
return true;
|
||||
|
||||
if (ti.OwnerID != AgentId)
|
||||
return true;
|
||||
|
||||
if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
|
||||
return true;
|
||||
|
||||
if (ti.AssetID != requestID)
|
||||
TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
|
||||
if (tii == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
|
||||
Name, requestID, itemID, taskID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tii.Type == (int)AssetType.LSLText)
|
||||
{
|
||||
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
|
||||
return true;
|
||||
}
|
||||
else if (tii.Type == (int)AssetType.Notecard)
|
||||
{
|
||||
if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Change this code to allow items other than notecards and scripts to be successfully
|
||||
// shared with group. In fact, all this permissions checking should move to an IPermissionsModule
|
||||
if (part.OwnerID != AgentId)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
|
||||
Name, requestID, itemID, taskID, part.OwnerID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
|
||||
Name, requestID, itemID, taskID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tii.OwnerID != AgentId)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
|
||||
Name, requestID, itemID, taskID, tii.OwnerID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((
|
||||
tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
|
||||
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
|
||||
Name, requestID, itemID, taskID);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tii.AssetID != requestID)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
|
||||
Name, requestID, itemID, taskID, tii.AssetID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Agent
|
||||
{
|
||||
@@ -7078,7 +7214,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
if (assetRequestItem.AssetID != requestID)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
|
||||
Name, requestID, itemID, assetRequestItem.AssetID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7625,12 +7766,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
newTaskItem.GroupPermissions = updatetask.InventoryData.GroupMask;
|
||||
newTaskItem.EveryonePermissions = updatetask.InventoryData.EveryoneMask;
|
||||
newTaskItem.NextPermissions = updatetask.InventoryData.NextOwnerMask;
|
||||
|
||||
// Unused? Clicking share with group sets GroupPermissions instead, so perhaps this is something
|
||||
// different
|
||||
//newTaskItem.GroupOwned=updatetask.InventoryData.GroupOwned;
|
||||
newTaskItem.Type = updatetask.InventoryData.Type;
|
||||
newTaskItem.InvType = updatetask.InventoryData.InvType;
|
||||
newTaskItem.Flags = updatetask.InventoryData.Flags;
|
||||
//newTaskItem.SaleType=updatetask.InventoryData.SaleType;
|
||||
//newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;;
|
||||
//newTaskItem.SalePrice=updatetask.InventoryData.SalePrice;
|
||||
newTaskItem.Name = Util.FieldToString(updatetask.InventoryData.Name);
|
||||
newTaskItem.Description = Util.FieldToString(updatetask.InventoryData.Description);
|
||||
newTaskItem.CreationDate = (uint)updatetask.InventoryData.CreationDate;
|
||||
@@ -7638,7 +7782,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
newTaskItem, updatetask.UpdateData.LocalID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -10941,7 +11085,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
LLUDPServer.LogPacketHeader(false, m_circuitCode, 0, packet.Type, (ushort)packet.Length);
|
||||
#endregion BinaryStats
|
||||
|
||||
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true);
|
||||
OutPacket(packet, throttlePacketType, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -10954,6 +11098,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// handles splitting manually</param>
|
||||
protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
|
||||
{
|
||||
if (m_debugPacketLevel >= 255)
|
||||
m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
|
||||
|
||||
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
|
||||
}
|
||||
|
||||
@@ -11025,10 +11172,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="Pack">OpenMetaverse.packet</param>
|
||||
public void ProcessInPacket(Packet Pack)
|
||||
{
|
||||
// m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack);
|
||||
if (m_debugPacketLevel >= 255)
|
||||
m_log.DebugFormat("[CLIENT]: Packet IN {0}", Pack.Type);
|
||||
|
||||
if (!ProcessPacketMethod(Pack))
|
||||
m_log.Warn("[CLIENT]: unhandled packet " + Pack);
|
||||
m_log.Warn("[CLIENT]: unhandled packet " + Pack.Type);
|
||||
|
||||
PacketPool.Instance.ReturnPacket(Pack);
|
||||
}
|
||||
@@ -11228,9 +11376,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
m_groupPowers.Clear();
|
||||
|
||||
for (int i = 0; i < GroupMembership.Length; i++)
|
||||
if (GroupMembership != null)
|
||||
{
|
||||
m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers;
|
||||
for (int i = 0; i < GroupMembership.Length; i++)
|
||||
{
|
||||
m_groupPowers[GroupMembership[i].GroupID] = GroupMembership[i].GroupPowers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11268,8 +11419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// }
|
||||
}
|
||||
|
||||
//check to see if asset is in local cache, if not we need to request it from asset server.
|
||||
//m_log.Debug("asset request " + requestID);
|
||||
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
|
||||
|
||||
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
|
||||
|
||||
@@ -11550,6 +11700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public PacketMethod method;
|
||||
public bool Async;
|
||||
}
|
||||
|
||||
public class AsyncPacketProcess
|
||||
{
|
||||
public bool result = false;
|
||||
@@ -11592,4 +11743,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,6 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
byte flags = buffer.Data[0];
|
||||
bool isResend = (flags & Helpers.MSG_RESENT) != 0;
|
||||
bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
|
||||
bool isZerocoded = (flags & Helpers.MSG_ZEROCODED) != 0;
|
||||
LLUDPClient udpClient = outgoingPacket.Client;
|
||||
|
||||
if (!udpClient.IsConnected)
|
||||
@@ -522,23 +523,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
int dataLength = buffer.DataLength;
|
||||
|
||||
// Keep appending ACKs until there is no room left in the buffer or there are
|
||||
// no more ACKs to append
|
||||
uint ackCount = 0;
|
||||
uint ack;
|
||||
while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack))
|
||||
// NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here
|
||||
if (!isZerocoded)
|
||||
{
|
||||
Utils.UIntToBytesBig(ack, buffer.Data, dataLength);
|
||||
dataLength += 4;
|
||||
++ackCount;
|
||||
}
|
||||
// Keep appending ACKs until there is no room left in the buffer or there are
|
||||
// no more ACKs to append
|
||||
uint ackCount = 0;
|
||||
uint ack;
|
||||
while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack))
|
||||
{
|
||||
Utils.UIntToBytesBig(ack, buffer.Data, dataLength);
|
||||
dataLength += 4;
|
||||
++ackCount;
|
||||
}
|
||||
|
||||
if (ackCount > 0)
|
||||
{
|
||||
// Set the last byte of the packet equal to the number of appended ACKs
|
||||
buffer.Data[dataLength++] = (byte)ackCount;
|
||||
// Set the appended ACKs flag on this packet
|
||||
buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS);
|
||||
if (ackCount > 0)
|
||||
{
|
||||
// Set the last byte of the packet equal to the number of appended ACKs
|
||||
buffer.Data[dataLength++] = (byte)ackCount;
|
||||
// Set the appended ACKs flag on this packet
|
||||
buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS);
|
||||
}
|
||||
}
|
||||
|
||||
buffer.DataLength = dataLength;
|
||||
|
||||
@@ -105,10 +105,10 @@ namespace OpenSim.Region.ClientStack
|
||||
|
||||
if (m_networkServersInfo.HttpUsesSSL && (m_networkServersInfo.HttpListenerPort == m_networkServersInfo.httpSSLPort))
|
||||
{
|
||||
m_log.Error("[HTTP]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
|
||||
m_log.Error("[REGION SERVER]: HTTP Server config failed. HTTP Server and HTTPS server must be on different ports");
|
||||
}
|
||||
|
||||
m_log.Info("[REGION]: Starting HTTP server");
|
||||
m_log.InfoFormat("[REGION SERVER]: Starting HTTP server on port {0}", m_httpServerPort);
|
||||
m_httpServer.Start();
|
||||
|
||||
base.StartupSpecific();
|
||||
@@ -134,4 +134,4 @@ namespace OpenSim.Region.ClientStack
|
||||
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,6 +406,11 @@ namespace Flotsam.RegionModules.AssetCache
|
||||
return asset;
|
||||
}
|
||||
|
||||
public AssetBase GetCached(string id)
|
||||
{
|
||||
return Get(id);
|
||||
}
|
||||
|
||||
public void Expire(string id)
|
||||
{
|
||||
if (m_LogLevel >= 2)
|
||||
|
||||
229
OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
Normal file
229
OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
|
||||
{
|
||||
#region Stream Handler
|
||||
|
||||
public delegate byte[] StreamHandlerCallback(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse);
|
||||
|
||||
public class StreamHandler : BaseStreamHandler
|
||||
{
|
||||
StreamHandlerCallback m_callback;
|
||||
|
||||
public StreamHandler(string httpMethod, string path, StreamHandlerCallback callback)
|
||||
: base(httpMethod, path)
|
||||
{
|
||||
m_callback = callback;
|
||||
}
|
||||
|
||||
public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
return m_callback(path, request, httpRequest, httpResponse);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Stream Handler
|
||||
|
||||
public class GetTextureModule : IRegionModule
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private Scene m_scene;
|
||||
private IAssetService m_assetService;
|
||||
|
||||
#region IRegionModule Members
|
||||
|
||||
public void Initialise(Scene pScene, IConfigSource pSource)
|
||||
{
|
||||
m_scene = pScene;
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
{
|
||||
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
|
||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
}
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "GetTextureModule"; } }
|
||||
public bool IsSharedModule { get { return false; } }
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UUID capID = UUID.Random();
|
||||
|
||||
m_log.Info("[GETTEXTURE]: /CAPS/" + capID);
|
||||
caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private byte[] ProcessGetTexture(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
// TODO: Change this to a config option
|
||||
const string REDIRECT_URL = null;
|
||||
|
||||
// Try to parse the texture ID from the request URL
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string textureStr = GetOne(query, "texture_id");
|
||||
|
||||
if (m_assetService == null)
|
||||
{
|
||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return null;
|
||||
}
|
||||
|
||||
UUID textureID;
|
||||
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
||||
{
|
||||
AssetBase texture;
|
||||
|
||||
if (!String.IsNullOrEmpty(REDIRECT_URL))
|
||||
{
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
texture = m_assetService.GetCached(textureID.ToString());
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
SendTexture(httpRequest, httpResponse, texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
string textureUrl = REDIRECT_URL + textureID.ToString();
|
||||
m_log.Debug("[GETTEXTURE]: Redirecting texture request to " + textureUrl);
|
||||
httpResponse.RedirectLocation = textureUrl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fetch locally or remotely. Misses return a 404
|
||||
texture = m_assetService.Get(textureID.ToString());
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
SendTexture(httpRequest, httpResponse, texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
|
||||
}
|
||||
|
||||
httpResponse.Send();
|
||||
return null;
|
||||
}
|
||||
|
||||
private void SendTexture(OSHttpRequest request, OSHttpResponse response, AssetBase texture)
|
||||
{
|
||||
string range = GetOne(request.Headers, "Range");
|
||||
if (!String.IsNullOrEmpty(range))
|
||||
{
|
||||
// Range request
|
||||
int start, end;
|
||||
if (TryParseRange(range, out start, out end))
|
||||
{
|
||||
end = Utils.Clamp(end, 1, texture.Data.Length);
|
||||
start = Utils.Clamp(start, 0, end - 1);
|
||||
|
||||
m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
if (end - start < texture.Data.Length)
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
||||
response.ContentLength = end - start;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
|
||||
response.Body.Write(texture.Data, start, end - start);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("Malformed Range header: " + range);
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Full content request
|
||||
response.ContentLength = texture.Data.Length;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryParseRange(string header, out int start, out int end)
|
||||
{
|
||||
if (header.StartsWith("bytes="))
|
||||
{
|
||||
string[] rangeValues = header.Substring(6).Split('-');
|
||||
if (rangeValues.Length == 2)
|
||||
{
|
||||
if (Int32.TryParse(rangeValues[0], out start) && Int32.TryParse(rangeValues[1], out end))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
start = end = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string GetOne(NameValueCollection collection, string key)
|
||||
{
|
||||
string[] values = collection.GetValues(key);
|
||||
if (values != null && values.Length > 0)
|
||||
return values[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
private int m_shoutdistance = 100;
|
||||
private int m_whisperdistance = 10;
|
||||
private List<Scene> m_scenes = new List<Scene>();
|
||||
|
||||
private List<string> FreezeCache = new List<string>();
|
||||
private string m_adminPrefix = "";
|
||||
internal object m_syncy = new object();
|
||||
|
||||
internal IConfig m_config;
|
||||
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance);
|
||||
m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance);
|
||||
m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance);
|
||||
m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", "");
|
||||
}
|
||||
|
||||
public virtual void AddRegion(Scene scene)
|
||||
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
return;
|
||||
}
|
||||
|
||||
DeliverChatToAvatars(ChatSourceType.Agent, c);
|
||||
if (FreezeCache.Contains(c.Sender.AgentId.ToString()))
|
||||
{
|
||||
if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping)
|
||||
c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DeliverChatToAvatars(ChatSourceType.Agent, c);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnChatFromWorld(Object sender, OSChatMessage c)
|
||||
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
|
||||
{
|
||||
string fromName = c.From;
|
||||
string fromNamePrefix = "";
|
||||
UUID fromID = UUID.Zero;
|
||||
string message = c.Message;
|
||||
IScene scene = c.Scene;
|
||||
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
fromPos = avatar.AbsolutePosition;
|
||||
fromName = avatar.Name;
|
||||
fromID = c.Sender.AgentId;
|
||||
|
||||
if (avatar.GodLevel > 200)
|
||||
{
|
||||
fromNamePrefix = m_adminPrefix;
|
||||
}
|
||||
break;
|
||||
|
||||
case ChatSourceType.Object:
|
||||
@@ -227,7 +241,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
s.ForEachScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType);
|
||||
ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
|
||||
if (Presencecheck != null)
|
||||
{
|
||||
if (Presencecheck.IsEitherBannedOrRestricted(c.SenderUUID) != true)
|
||||
{
|
||||
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix+fromName, c.Type, message, sourceType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -264,27 +286,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
fromName = avatar.Name;
|
||||
sourceType = ChatSourceType.Agent;
|
||||
}
|
||||
else if (c.SenderUUID != UUID.Zero)
|
||||
{
|
||||
fromID = c.SenderUUID;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
|
||||
|
||||
((Scene)c.Scene).ForEachScenePresence(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
// ignore chat from child agents
|
||||
if (presence.IsChildAgent) return;
|
||||
|
||||
IClientAPI client = presence.ControllingClient;
|
||||
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
|
||||
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
|
||||
});
|
||||
if (c.Scene != null)
|
||||
{
|
||||
((Scene)c.Scene).ForEachScenePresence
|
||||
(
|
||||
delegate(ScenePresence presence)
|
||||
{
|
||||
// ignore chat from child agents
|
||||
if (presence.IsChildAgent) return;
|
||||
|
||||
IClientAPI client = presence.ControllingClient;
|
||||
|
||||
// don't forward SayOwner chat from objects to
|
||||
// non-owner agents
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
|
||||
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -313,5 +343,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||
presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
|
||||
fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
|
||||
}
|
||||
|
||||
Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
|
||||
public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target)
|
||||
{
|
||||
System.Threading.Timer Timer;
|
||||
if (flags == 0)
|
||||
{
|
||||
FreezeCache.Add(target.ToString());
|
||||
System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen);
|
||||
Timer = new System.Threading.Timer(timeCB, target, 30000, 0);
|
||||
Timers.Add(target, Timer);
|
||||
}
|
||||
else
|
||||
{
|
||||
FreezeCache.Remove(target.ToString());
|
||||
Timers.TryGetValue(target, out Timer);
|
||||
Timers.Remove(target);
|
||||
Timer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEndParcelFrozen(object avatar)
|
||||
{
|
||||
UUID target = (UUID)avatar;
|
||||
FreezeCache.Remove(target.ToString());
|
||||
System.Threading.Timer Timer;
|
||||
Timers.TryGetValue(target, out Timer);
|
||||
Timers.Remove(target);
|
||||
Timer.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,10 +146,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||
}
|
||||
|
||||
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
|
||||
{
|
||||
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||
{
|
||||
try
|
||||
{
|
||||
ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
|
||||
|
||||
if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0)
|
||||
{
|
||||
avatar.Invulnerable = false;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(agentID);
|
||||
|
||||
if (sp != null)
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
sp.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
{
|
||||
ScenePresence presence = presenceList[i];
|
||||
|
||||
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
||||
if (!presence.IsChildAgent && presence.Firstname == firstName && presence.Lastname == lastName)
|
||||
{
|
||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||
break;
|
||||
@@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
}
|
||||
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarID);
|
||||
if (sp != null)
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
{
|
||||
ScenePresence sp = m_scene.GetScenePresence(avatarID);
|
||||
|
||||
if (sp != null)
|
||||
if (sp != null && !sp.IsChildAgent)
|
||||
sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
|
||||
}
|
||||
|
||||
@@ -206,4 +206,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,13 +163,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
|
||||
|
||||
private void RetrieveInstantMessages(IClientAPI client)
|
||||
{
|
||||
if (m_RestURL != "")
|
||||
{
|
||||
m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
|
||||
if (m_RestURL == String.Empty)
|
||||
return;
|
||||
|
||||
List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
|
||||
m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
|
||||
|
||||
List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
|
||||
"POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
|
||||
|
||||
if (msglist != null)
|
||||
{
|
||||
foreach (GridInstantMessage im in msglist)
|
||||
{
|
||||
// client.SendInstantMessage(im);
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
{
|
||||
// Check if this is ours to handle
|
||||
//
|
||||
m_log.Info("OnFridInstantMessage");
|
||||
//m_log.Info("OnFridInstantMessage");
|
||||
if (msg.dialog != (byte) InstantMessageDialog.InventoryOffered)
|
||||
return;
|
||||
|
||||
|
||||
@@ -131,8 +131,8 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
{
|
||||
// Start http server
|
||||
// Attach xmlrpc handlers
|
||||
m_log.Info("[REMOTE_DATA]: " +
|
||||
"Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
|
||||
m_log.Info("[XML RPC MODULE]: " +
|
||||
"Starting up XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
|
||||
BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort);
|
||||
httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
|
||||
httpServer.Start();
|
||||
@@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
// This should no longer happen, but the check is reasonable anyway
|
||||
if (null == m_openChannels)
|
||||
{
|
||||
m_log.Warn("[RemoteDataReply] Attempt to open channel before initialization is complete");
|
||||
m_log.Warn("[XML RPC MODULE]: Attempt to open channel before initialization is complete");
|
||||
return newChannel;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[RemoteDataReply]: Channel or message_id not found");
|
||||
m_log.Warn("[XML RPC MODULE]: Channel or message_id not found");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("UNABLE TO REMOVE COMPLETED REQUEST");
|
||||
m_log.Error("[XML RPC MODULE]: UNABLE TO REMOVE COMPLETED REQUEST");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -728,4 +728,4 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
|
||||
return ReqID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,6 +229,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
return asset;
|
||||
}
|
||||
|
||||
public AssetBase GetCached(string id)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
return m_Cache.Get(id);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public AssetMetadata GetMetadata(string id)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
|
||||
@@ -165,6 +165,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||
return asset;
|
||||
}
|
||||
|
||||
public AssetBase GetCached(string id)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
return m_Cache.Get(id);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public AssetMetadata GetMetadata(string id)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user