1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
10 #include <IceUtil/IceUtil.h>
11 #include <FilesystemI.h>
15 // Slice Node::name() operation
18 Filesystem::NodeI::name(const Ice::Current
&)
25 Filesystem::NodeI::NodeI(const Ice::CommunicatorPtr
& communicator
, const string
& name
, const DirectoryIPtr
& parent
) :
26 _name(name
), _parent(parent
)
28 // Create an identity. The root directory has the fixed identity "RootDir"
31 _id
.name
= IceUtil::generateUUID();
39 // NodeI activate() member function
42 Filesystem::NodeI::activate(const Ice::ObjectAdapterPtr
& a
)
44 NodePrx thisNode
= NodePrx::uncheckedCast(a
->add(this, _id
));
47 _parent
->addChild(thisNode
);
51 // Slice File::read() operation
54 Filesystem::FileI::read(const Ice::Current
&)
59 // Slice File::write() operation
62 Filesystem::FileI::write(const Filesystem::Lines
& text
, const Ice::Current
&)
69 Filesystem::FileI::FileI(const Ice::CommunicatorPtr
& communicator
, const string
& name
, const DirectoryIPtr
& parent
) :
70 NodeI(communicator
, name
, parent
)
74 // Slice Directory::list() operation
77 Filesystem::DirectoryI::list(const Ice::Current
& c
)
82 // DirectoryI constructor
84 Filesystem::DirectoryI::DirectoryI(const Ice::CommunicatorPtr
& communicator
, const string
& name
,
85 const DirectoryIPtr
& parent
) :
86 NodeI(communicator
, name
, parent
)
90 // addChild is called by the child in order to add
91 // itself to the _contents member of the parent
94 Filesystem::DirectoryI::addChild(const NodePrx
& child
)
96 _contents
.push_back(child
);