00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _SUPPORT_DIRECTORYMIRROR_H
00014 #define _SUPPORT_DIRECTORYMIRROR_H
00015
00021 #include <support/ICatalogPermissions.h>
00022 #include <support/ICatalog.h>
00023 #include <support/IDatum.h>
00024 #include <support/IIterable.h>
00025 #include <support/IIterator.h>
00026 #include <support/INode.h>
00027 #include <support/Locker.h>
00028 #include <support/SortedVector.h>
00029 #include <support/KeyedVector.h>
00030 #include <support/Observer.h>
00031 #include <support/String.h>
00032 #include <support/Value.h>
00033
00034 #if _SUPPORTS_NAMESPACE
00035 namespace palmos {
00036 namespace support {
00037 #endif
00038
00043
00044
00055 class BCatalogMirror : public BnCatalogPermissions, public BnCatalog, public BnNode, public BnIterable, public BObserver
00056 {
00057 public:
00058 BCatalogMirror(const SContext& context, const SValue& args);
00059
00060
00061 virtual status_t AddEntry(const SString& name, const SValue& entry);
00062 virtual status_t RemoveEntry(const SString& name);
00063 virtual status_t RenameEntry(const SString& entry, const SString& name);
00064
00065 virtual sptr<INode> CreateNode(SString* name, status_t* err);
00066 virtual sptr<IDatum> CreateDatum(SString* name, uint32_t flags, status_t* err);
00067 virtual sptr<IIterator> NewIterator(const SValue& args, status_t* error = NULL);
00068
00069 virtual status_t Walk(SString* path, uint32_t flags, SValue* node);
00070
00071
00072 virtual sptr<INode> Attributes() const;
00073
00074 virtual SString MimeType() const;
00075 virtual void SetMimeType(const SString& value);
00076
00077 virtual nsecs_t CreationDate() const;
00078 virtual void SetCreationDate(nsecs_t value);
00079
00080 virtual nsecs_t ModifiedDate() const;
00081 virtual void SetModifiedDate(nsecs_t value);
00082
00083
00084 virtual bool Writable() const;
00085 virtual void SetWritable(bool value);
00086
00087 virtual status_t HideEntry(const SString& name);
00088 virtual status_t ShowEntry(const SString& name);
00089
00090 virtual status_t OverlayEntry(const SString& location, const SValue& item);
00091 virtual status_t RestoreEntry(const SString& location);
00092
00093 virtual status_t Merge(const sptr<ICatalog>& catalog);
00094
00095
00096 virtual void Observed(const SValue& key, const SValue& value);
00097
00098
00099 virtual SValue Inspect(const sptr<IBinder>& caller, const SValue &which, uint32_t flags);
00100 virtual status_t Link(const sptr<IBinder>& target, const SValue& bindings, uint32_t flags);
00101 virtual status_t Unlink(const wptr<IBinder>& target, const SValue& bindings, uint32_t flags);
00102
00103 protected:
00104 virtual ~BCatalogMirror();
00105
00106 private:
00107 void init_from_args(const SContext& context, const SValue& args);
00108 bool is_writable(const SString& name) const;
00109
00110 sptr<INode> m_node;
00111 sptr<ICatalog> m_catalog;
00112 sptr<IIterable> m_iterable;
00113
00114
00115
00116
00117
00118 mutable SLocker m_permissionsLock;
00119 SSortedVector<SString> m_hidden;
00120 SKeyedVector<SString, SValue> m_overlays;
00121 bool m_writable : 1;
00122 bool m_linkedToNode : 1;
00123
00124 class IteratorWrapper;
00125 friend class IteratorWrapper;
00126 };
00127
00130 #if _SUPPORTS_NAMESPACE
00131 } }
00132 #endif
00133
00134 #endif // _SUPPORT_DIRECTORYMIRROR_H