2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef WRTDEVICEAPIS_FILESYSTEM_IMANAGER_H_
17 #define WRTDEVICEAPIS_FILESYSTEM_IMANAGER_H_
22 #include <dpl/noncopyable.h>
23 #include <Commons/EventReceiver.h>
24 #include <Filesystem/EventResolve.h>
25 #include <Filesystem/EventCopy.h>
26 #include <Filesystem/EventMove.h>
27 #include <Filesystem/EventRemove.h>
28 #include <Filesystem/EventFind.h>
29 #include <Filesystem/Enums.h>
30 #include <Filesystem/INode.h>
31 #include <Filesystem/IPath.h>
33 namespace WrtDeviceApis {
34 namespace Filesystem {
36 typedef std::vector<IPathPtr> LocationPaths;
37 typedef std::vector<LocationType> LocationTypes;
40 public Commons::EventRequestReceiver<EventResolve>,
41 public Commons::EventRequestReceiver<EventCopy>,
42 public Commons::EventRequestReceiver<EventMove>,
43 public Commons::EventRequestReceiver<EventRemove>,
44 public Commons::EventRequestReceiver<EventFind>
47 static IManager& getInstance();
48 static bool fileExists(const std::string &file);
50 virtual ~IManager() = 0;
54 * @return Valid path or empty shared pointer.
56 virtual IPathPtr getBasePath() const = 0;
59 * Gets path for specified location type.
60 * @param type Location type @see
61 * WrtDeviceApis::Api::Filesystem::LocationType.
62 * @return Valid path or empty shared pointer.
64 virtual IPathPtr getLocationPath(LocationType type) const = 0;
67 * Gets paths to default locations.
68 * @return Paths to predefined virtual locations.
70 virtual LocationPaths getLocationPaths() const = 0;
73 * Gets locations supported by platform.
74 * @return Supported locations.
76 virtual LocationTypes getLocations() const = 0;
79 * Gets filesystem node.
80 * @param event Get node event @see Api::Filesystem::EventGetNode.
81 * @remarks Asynchronous.
83 virtual void getNode(const EventResolvePtr& event) = 0;
86 * Gets maximum length of filesystem path.
87 * @return Maximum path length.
89 virtual std::size_t getMaxPathLength() const = 0;
92 * Copies node to specified destination.
93 * @param event Copy node event @see Api::Filesystem::EventCopy.
94 * @remarks Asynchronous.
96 virtual void copy(const EventCopyPtr& event) = 0;
99 * Moves node to specified destination.
100 * @param event Move node event @see Api::Filesystem::EventMove.
101 * @remarks Asynchronous.
103 virtual void move(const EventMovePtr& event) = 0;
107 * @param event Remove node event @see Api::Filesystem::EventRemove.
108 * @remarks Asynchronous.
110 virtual void remove(const EventRemovePtr& event) = 0;
114 * @param event Find nodes event @see Api::Filesystem::EventFind.
115 * @remarks Asynchronous.
117 virtual void find(const EventFindPtr& event) = 0;
120 * Checks if node at specified path has supplied access rights.
121 * @param path Path to the node.
122 * @param accessType Access right(s) to check @see AccessType. Multiple
124 * can be passed using OR operator.
125 * @return True if specified node has supplied access rights, false
128 virtual bool access(const IPathPtr& path,
129 int accessType) const = 0;
131 virtual void addOpenedNode(const INodePtr& node) = 0;
132 virtual void removeOpenedNode(const INodePtr& node) = 0;
133 virtual bool checkIfOpened(const IPathPtr& path) const = 0;
138 virtual void OnRequestReceived(const EventResolvePtr& event) = 0;
139 virtual void OnRequestReceived(const EventCopyPtr& event) = 0;
140 virtual void OnRequestReceived(const EventMovePtr& event) = 0;
141 virtual void OnRequestReceived(const EventRemovePtr& event) = 0;
142 virtual void OnRequestReceived(const EventFindPtr& event) = 0;
148 #endif // WRTDEVICEAPIS_FILESYSTEM_IMANAGER_H_