aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/perl/lib/OpenSim/AssetServer.pm
diff options
context:
space:
mode:
authorAdam Frisby2008-03-25 16:29:54 +0000
committerAdam Frisby2008-03-25 16:29:54 +0000
commit8c05b81d6860d8e0da4098cc6f59f630d7c53037 (patch)
tree3325e09660ee8ad5a12cc19c8da6c4bd8bff5c21 /share/perl/lib/OpenSim/AssetServer.pm
parent* On Ray casting. Now returning the face normal of the collision face. (diff)
downloadopensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.zip
opensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.tar.gz
opensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.tar.bz2
opensim-SC-8c05b81d6860d8e0da4098cc6f59f630d7c53037.tar.xz
* Committing Lulurun's Cgi/Perl implementation of the UGAI servers.
* I love you long time.
Diffstat (limited to 'share/perl/lib/OpenSim/AssetServer.pm')
-rw-r--r--share/perl/lib/OpenSim/AssetServer.pm87
1 files changed, 87 insertions, 0 deletions
diff --git a/share/perl/lib/OpenSim/AssetServer.pm b/share/perl/lib/OpenSim/AssetServer.pm
new file mode 100644
index 0000000..6418166
--- /dev/null
+++ b/share/perl/lib/OpenSim/AssetServer.pm
@@ -0,0 +1,87 @@
1package OpenSim::AssetServer;
2
3use strict;
4use MIME::Base64;
5use XML::Simple;
6use OpenSim::Utility;
7use OpenSim::AssetServer::AssetManager;
8
9# !!
10# TODO: delete asset
11#
12
13sub getAsset {
14 my ($asset_id, $param) = @_;
15 # get asset
16 my $asset_id_string = &OpenSim::Utility::UUID2HEX($asset_id);
17 my $asset = &OpenSim::AssetServer::AssetManager::getAssetByUUID($asset_id_string);
18 $asset->{assetUUID} = $asset_id;
19 # make response
20 return &_asset_to_xml($asset);
21}
22
23sub saveAsset {
24 my $xml = shift;
25 my $asset = &_xml_to_asset($xml);
26 &OpenSim::AssetServer::AssetManager::saveAsset($asset);
27 return ""; # TODO: temporary solution of "success!"
28}
29
30# ##################
31# private functions
32sub _asset_to_xml {
33 my $asset = shift;
34 my $asset_data = &MIME::Base64::encode_base64($asset->{data});
35 return << "ASSET_XML";
36<AssetBase>
37 <Data>
38$asset_data
39 </Data>
40 <FullID>
41 <UUID>$asset->{assetUUID}</UUID>
42 </FullID>
43 <Type>$asset->{assetType}</Type>
44 <InvType>$asset->{invType}</InvType>
45 <Name>$asset->{name}</Name>
46 <Description>$asset->{description}</Description>
47 <Local>$asset->{local}</Local>
48 <Temporary>$asset->{temporary}</Temporary>
49</AssetBase>
50ASSET_XML
51}
52
53sub _xml_to_asset {
54 my $xml = shift;
55 my $xs = new XML::Simple();
56 my $obj = $xs->XMLin($xml);
57print STDERR $obj->{FullID}->{UUID} . "\n";
58 my %asset = (
59 "id" => &OpenSim::Utility::UUID2BIN($obj->{FullID}->{UUID}),
60 "name" => $obj->{Name},
61 "description" => $obj->{Description},
62 "assetType" => $obj->{Type},
63 "invType" => $obj->{InvType},
64 "local" => $obj->{Local},
65 "temporary" => $obj->{Temporary},
66 "data" => &MIME::Base64::decode_base64($obj->{Data}),
67 );
68 return \%asset;
69}
70
711;
72
73__END__
74
75{
76 Data => "PFNjZW5lT2JqZWN0R3JvdXA+PFJvb3RQYXJ0PjxTY2VuZU9iamVjdFBhcnQgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeG1sbnM6eHNkPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSI+PExhc3RPd25lcklEPjxVVUlEPmI5Y2I1OGU4LWYzYzktNGFmNS1iZTQ3LTAyOTc2MmJhYTY4ZjwvVVVJRD48L0xhc3RPd25lcklEPjxPd25lcklEPjxVVUlEPmI5Y2I1OGU4LWYzYzktNGFmNS1iZTQ3LTAyOTc2MmJhYTY4ZjwvVVVJRD48L093bmVySUQ+PEdyb3VwSUQ+PFVVSUQ+MDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDA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L1BhdGhSYWRpdXNPZmZzZXQ+PFBhdGhSZXZvbHV0aW9ucz4wPC9QYXRoUmV2b2x1dGlvbnM+PFBhdGhUYXBlclg+MDwvUGF0aFRhcGVyWD48UGF0aFRhcGVyWT4wPC9QYXRoVGFwZXJZPjxQYXRoVHdpc3Q+MDwvUGF0aFR3aXN0PjxQYXRoVHdpc3RCZWdpbj4wPC9QYXRoVHdpc3RCZWdpbj48VGV4dHVyZUVudHJ5PkFBQUFBQUFBQUFDWm1RQUFBQUFBQlFBQUFBQUFBQUFBZ0Q4QUFBQ0FQd0FBQUFBQUFBQUFBQUFBQUFBPTwvVGV4dHVyZUVudHJ5PjxFeHRyYVBhcmFtcz5BQT09PC9FeHRyYVBhcmFtcz48UHJvZmlsZVNoYXBlPkNpcmNsZTwvUHJvZmlsZVNoYXBlPjwvU2hhcGU+PFNjYWxlPjxYPjAuNTwvWD48WT4wLjU8L1k+PFo+MC41PC9aPjwvU2NhbGU+PFVwZGF0ZUZsYWc+MDwvVXBkYXRlRmxhZz48L1NjZW5lT2JqZWN0UGFydD48L1Jvb3RQYXJ0PjxPdGhlclBhcnRzIC8+PC9TY2VuZU9iamVjdEdyb3VwPgA=",
77 Description => {},
78 FullID => { UUID => "feb7e249-e462-499f-a881-553b9829539a" },
79 InvType => 6,
80 Local => "false",
81 Name => "Primitive",
82 Temporary => "false",
83 Type => 6,
84 "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema",
85 "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
86}
87