blob: abbc06b0cd49b7f4f9153fe8b12e0980cc821e13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// **********************************************************************
//
// Copyright (c) 2002
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
#include <IcePatch/NodeI.h>
#include <IcePatch/Util.h>
using namespace std;
using namespace Ice;
using namespace IcePatch;
IcePatch::NodeI::NodeI(const ObjectAdapterPtr& adapter) :
_adapter(adapter)
{
}
IcePatch::DirectoryI::DirectoryI(const ObjectAdapterPtr& adapter) :
NodeI(adapter)
{
}
NodeDescPtr
IcePatch::DirectoryI::describe(const Ice::Current& current)
{
DirectoryDescPtr desc = new DirectoryDesc;
desc->directory = DirectoryPrx::uncheckedCast(_adapter->createProxy(current.identity));
return desc;
}
NodeDescSeq
IcePatch::DirectoryI::getContents(const Ice::Current& current)
{
StringSeq paths = readDirectory(identityToPath(current.identity));
NodeDescSeq result;
result.reserve(paths.size());
StringSeq::const_iterator p;
for (p = paths.begin(); p != paths.end(); ++p)
{
string suffix = getSuffix(*p);
if (suffix == "md5" || suffix == "bz2")
{
continue;
}
NodePrx node = NodePrx::uncheckedCast(_adapter->createProxy(pathToIdentity(*p)));
try
{
result.push_back(node->describe());
}
catch (const ObjectNotExistException&)
{
//
// Ignore. This can for example happen if the node
// locator cannot call stat() on the file.
//
}
}
return result;
}
IcePatch::FileI::FileI(const ObjectAdapterPtr& adapter) :
NodeI(adapter)
{
}
NodeDescPtr
IcePatch::FileI::describe(const Ice::Current& current)
{
FileDescPtr desc = new FileDesc;
desc->file = FilePrx::uncheckedCast(_adapter->createProxy(current.identity));
desc->md5 = getMD5(identityToPath(current.identity));
return desc;
}
ByteSeq
IcePatch::FileI::getBytesBZ2(Ice::Int pos, Ice::Int num, const Ice::Current& current)
{
return IcePatch::getBytesBZ2(identityToPath(current.identity), pos, num);
}
|