Package com.cbe
Class Container
- java.lang.Object
-
- com.cbe.Item
-
- com.cbe.Container
-
public class Container extends Item
class Container child class of Item and API:s towards server/edge node with create, move and data management e.t.c.
-
-
Constructor Summary
Constructors Constructor Description Container()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Container
create(java.lang.String name, ItemEventProtocol delegate)
Create's a container Inside this containerto be used for adding objects.Object
createObject(java.lang.String name, ItemEventProtocol delegate)
Creates an object with indexed tags or indexed tags + non indexed tags.Object
createObject(java.lang.String name, ItemEventProtocol delegate, Obj_KV_Map metadata)
Creates an object with indexed tags or indexed tags + non indexed tags.void
getACL(ShareEventProtocol delegate)
get the Access Control List for the Container.void
move(long destinationId, ItemEventProtocol delegate)
Move is used to move container whith its content to user specified location ex other container or to root container.QueryChain
query(Filter filter, ItemEventProtocol delegate)
Call to get a list of items in the contianer.QueryChain
query(ItemEventProtocol delegate)
Call to get a list of items in the container.QueryChain
queryWithPath(java.lang.String relativePath, ItemEventProtocol delegate)
Queries the container with a given relative path, returns container with objects.void
remove(ItemEventProtocol delegate)
Removes/deletes the container and all its content.void
rename(java.lang.String name, ItemEventProtocol delegate)
Rename the container.QueryResult
search(Filter filter, ItemEventProtocol delegate)
Search the whole container for tags related to Objects in the container structure.QueryResult
search(java.lang.String tags, ItemEventProtocol delegate)
Search the whole container for tags related to Objects in the container structure.void
setACL(ACL_Map toUserPermissions, ShareEventProtocol delegate)
set the Access control list for the container.void
share(long toUserGroup, java.lang.String description, ShareEventProtocol delegate)
Shares a container and its content to a user.void
unShare(long shareId, ShareEventProtocol delegate)
unShare the container to a specific shareId created when sharing.Object
upload(java.lang.String name, java.lang.String path, TransferUploadEventProtocol delegate)
Upload object to container with path, the object is instantly returned with a temp.Object
uploadBinary(java.lang.String name, byte[] data, TransferUploadEventProtocol delegate)
Upload object to container with binary data:-
Methods inherited from class com.cbe.Item
ACLMap, aclTag, created, dataLoaded, deleted, description, driveId, getShareFromUserId, getShareIds, getUserFromShareId, id, idLoaded, name, oldParentId, ownerId, parentId, path, type, updated, username
-
-
-
-
Method Detail
-
create
public Container create(java.lang.String name, ItemEventProtocol delegate)
Create's a container Inside this containerto be used for adding objects.- Parameters:
name
- for the container.delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
move
public void move(long destinationId, ItemEventProtocol delegate)
Move is used to move container whith its content to user specified location ex other container or to root container.- Parameters:
destinationId
- : id of the container to which it should be moved to.delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
rename
public void rename(java.lang.String name, ItemEventProtocol delegate)
Rename the container.- Parameters:
name
- (new name).delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
remove
public void remove(ItemEventProtocol delegate)
Removes/deletes the container and all its content.- Parameters:
delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
createObject
public Object createObject(java.lang.String name, ItemEventProtocol delegate, Obj_KV_Map metadata)
Creates an object with indexed tags or indexed tags + non indexed tags.- Parameters:
name
- Name of the object.delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.metadata
- (Optional) Metadata is a map with the tag (key), the value of that tag and if it is indexed or not
-
createObject
public Object createObject(java.lang.String name, ItemEventProtocol delegate)
Creates an object with indexed tags or indexed tags + non indexed tags.- Parameters:
name
- Name of the object.delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
upload
public Object upload(java.lang.String name, java.lang.String path, TransferUploadEventProtocol delegate)
Upload object to container with path, the object is instantly returned with a temp. id. Once the respons from the server is called back the object gets updated with the correct unique object id:- Parameters:
name
- .path
- .delegate
- , TransferDelegate is a callback delegate to the user defined/implementation of the callbacks on TransferUploadEventProtocol.
-
uploadBinary
public Object uploadBinary(java.lang.String name, byte[] data, TransferUploadEventProtocol delegate)
Upload object to container with binary data:- Parameters:
name
- .data
- byte array of the object.
delegate
- , TransferDelegate is a callback delegate to the user defined/implementation of the callbacks on TransferUploadEventProtocol.
-
query
public QueryChain query(ItemEventProtocol delegate)
Call to get a list of items in the container. Implement onQueryLoaded to from CBE::ItemDelegatePtrto recieve the callback.- Parameters:
delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
query
public QueryChain query(Filter filter, ItemEventProtocol delegate)
Call to get a list of items in the contianer. Implement onQueryLoaded to from CBE::ItemDelegatePtrto recieve the callback.- Parameters:
filter
-delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
queryWithPath
public QueryChain queryWithPath(java.lang.String relativePath, ItemEventProtocol delegate)
Queries the container with a given relative path, returns container with objects. ex: /Documents/Pictures will return objects and subContainers for Documents and Pictures.
- Parameters:
delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
search
public QueryResult search(java.lang.String tags, ItemEventProtocol delegate)
Search the whole container for tags related to Objects in the container structure.
EX: Key = Name, Value Contract/Object/Song => Name:Contract1.
Search handles tags in combination of conjunctions of keys and/or key values seperated by |.
EX: Name:*|Country:Sweden|Country:Norway, this would search for objects with key Name but any value and where key Country is either Sweden or Norway.- Parameters:
tags
- is a string of key tags or key:value pairs that are seperated by |.delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
search
public QueryResult search(Filter filter, ItemEventProtocol delegate)
Search the whole container for tags related to Objects in the container structure.
EX: Key = Name, Value Contract/Object/Song => Name:Contract1.
Search handles tags in combination / conjunction of keys and/or key values seperated by |.
EX: Name:*|Country:Sweden|Country:Norway, this would search for objects with key Name but any value and where key Country is either Sweden or Norway.- Parameters:
filter
- is a CBE::Filter on which you can set how you want data to be ordered when searching, remember to set the queryString to be keys/tags or key:value pairs that are seperated by |.delegate
- , ItemDelegate is a callback delegate to the user defined/implementation of the callbacks on ItemEventProtocol.
-
setACL
public void setACL(ACL_Map toUserPermissions, ShareEventProtocol delegate)
set the Access control list for the container. For containers set does set the whole container tree, so all its' sub items as well. Remeber this is set and not update so everytime you set all ids' that should be there should be added.- Parameters:
toUserPermissions
- is a std::map of uint64_t and signed int (userId and permission), simply setting the permission you want to a valid user id that you want. CBE::permission_status_t is defined in Types.h.delegate
- , shareDelegate is a callback delegate to the user defined/implementation of the callbacks on ShareEventProtocol.
-
getACL
public void getACL(ShareEventProtocol delegate)
get the Access Control List for the Container.- Parameters:
delegate
- , shareDelegate is a callback delegate to the user defined/implementation of the callbacks on ShareEventProtocol.
-
share
public void share(long toUserGroup, java.lang.String description, ShareEventProtocol delegate)
Shares a container and its content to a user. This provides the user the ability to access what has been shared to them via the listAvailableShares command. To allow users to view and change shared information see ACLs.
Note: At present Shareing the container gives the user read permissions for the container and all its sub-items, this might change in the future.- Parameters:
toUserGroup
- takes a user id or group id to share to.description
- names the specific share between you and the user/group.delegate
- , delegate is a callback delegate to the user defined/implementation of the callbacks on ShareEventProtocol.
-
unShare
public void unShare(long shareId, ShareEventProtocol delegate)
unShare the container to a specific shareId created when sharing. Each share is unique between user/group and the one sharing. This is represented with a unique share id.- Parameters:
shareId
- is as mentioned the unique id for a share between the owner and other user/group.delegate
- , delegate is a callback delegate to the user defined/implementation of the callbacks on ShareEventProtocol.
-
-