To administer the database with remote control, DataStore use some special
XML blocks ( otherwise modified SEP store and fetch command ) in each
administer program.
Have a lot of methods for :
- change the user access rights for documents and subtrees
- change the document owner
- administer the user groups
- administer the subtrees where you can store documents
- administer the users
$ds = DSClient.create()
#login to XMLDB named database with username and passwd
if $ds.login("XMLDB", "username", "passwd") then [
#create test2 subtree on root subtree and list the root subtree
$resp = $ds.makeSubtree("test2")
if $resp.hasAdditional then [
if $resp.hasInfo then [
print $resp/additional/info.toXML] else [
if $resp.hasWarning then [
print $resp/additional/warning.toXML]]]
if $resp.hasError then [
print $resp/error.toXML]
if $resp.hasBlock then [ print $resp/block.toXML]
$resp = $ds.list("/")
if $resp.hasAdditional then [
if $resp.hasInfo then [
print $resp/additional/info.toXML] else [
if $resp.hasWarning then [
print $resp/additional/warning.toXML]]]
if $resp.hasError then [
print $resp/error.toXML]
if $resp.hasBlock then [
print $resp/block.toXML]
#remove test2 subtree recursively and list the root subtree
$resp = $ds.removeSubtree("test2",true)
if $resp.hasAdditional then [
if $resp.hasInfo then [
print $resp/additional/info.toXML] else [
if $resp.hasWarning then [
print $resp/additional/warning.toXML]]]
if $resp.hasError then [
print $resp/error.toXML]
if $resp.hasBlock then [
print $resp/block.toXML]
#search the documents in the test subtree that contains the specified value
#in the specified path
$resp = $ds.fetch("test","person/name@first","Antal")
if $resp.hasAdditional then [
if $resp.hasInfo then [
print $resp/additional/info.toXML] else [
if $resp.hasWarning then [
print $resp/additional/warning.toXML]]]
if $resp.hasError then [
print $resp/error.toXML]
if $resp.hasBlock then [
print $resp/block.toXML]] else [
print "Connection failed !!!"]
DSResponse | addGroup (String $group) |
DSResponse | addUser (String $username, String $password, String $home, String $group, String $groups) |
DSResponse | blockUser (String $username) |
DSResponse | changeStoreType (String $subtree, String $mode, Logical $recursive) |
DSResponse | setNamingFlag (String $subtree, String $naming, Logical $recursive) |
DSResponse | chmod (String $mode, String $subtree, Logical $recursive) |
DSResponse | chown (String $owner, String $subtree, Logical $recursive) |
DSResponse | copy (String $src, String $dest, Logical $recursive) |
DSResponse | delGroup (String $gname) |
DSResponse | delUser (String $name) |
DSResponse | fetch (String $subtree, String $path, String $value) |
DSResponse | list (String $subtree) |
DSResponse | listGroup (String $group, String $user) |
DSResponse | listUser (String $name) |
Logical | login (String $dbName) |
Logical | login (String $dbName, String $userName, String $password) |
Logical | logout |
DSResponse | makeSubtree (String $subtree) |
DSResponse | modGroup (String $oldName, String $newName) |
DSResponse | modUser (String $oldName, String $newName, String $password, String $home, String $group, String $groups) |
DSResponse | move (String $src, String $dest) |
DSResponse | removeSubtree (String $subtree, Logical $force) |
DSResponse | store (String $action, String $path, String $block) |
DSResponse | unblockUser (String $userName) |
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Parameters: |
$host : | The host name to be connected. |
|
Constructs a new DSClient with the given host name on the default port.
Parameters: |
$host : | The host name to be connected. |
$port : | The port to be connected. |
|
Constructs a new DSClient with the given host name and port.
Constructs a new DSClient with the default host name on the default
port.
Parameters: |
$group : | The group name to add. |
|
Exceptions: |
executeSEPException :
(Error) | Unable to execute the SEP command. |
Adds the specified group to the specified database.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.addGroup("friends")
-- the result is --
DSResponse
additional
info
code: 0
The group has been added.
error
block
Parameters: |
$username : | The user's name. |
$password : | The user's password. |
$home : | The user's home directory. |
$group : |
The group name of the user's initial login group. If the group name not
exist, then a new group will be created with the given name.
|
$groups : |
A list of supplementary groups which the user is also a member of. each
group is separated from the next by a comma, with no intervening
whitespace.
|
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Adds the specified user to the specified database.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.addUser("John", "Johnpwd", "", "friends", "")
-- the result is --
DSResponse
additional
info
code: 0
The user has been added.
error
block
Parameters: |
$username : | The user's name to block. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Blocks the specified user. After this command the user can't log in
until he is not unblocked.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.blockUser("John")
-- the result is --
DSResponse
additional
info
code: 0
The user has been blocked.
error
block
Parameters: |
$subtree : | The subtree which mode will be changed. |
$mode : | The store mode. (strict/flexible/free/free_tag) |
$recursive : | If true change recursivelly. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Change subtree store mode.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.changeStoreType("/root/test", "free", TRUE)
-- the result is --
DSResponse
additional
info
code: 0
'/root/test' subtree are converted to 'free' mode.
error
block
Parameters: |
$subtree : | The subtree which naming flag will be changed. |
$naming : | The naming flag. (auto/manual) |
$recursive : | If true change recursivelly. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Set subtree naming flag.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.setNamingFlag("/root/test", "manual", TRUE)
-- the result is --
DSResponse
additional
info
code: 0
'/root/test' subtree naming flag is set to 'manual'.
error
block
Parameters: |
$mode : | The permission mode. |
$subtree : | The subtree which mode will be changed. |
$recursive : | If true change recursivelly. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Change acces permissions for subtrees and documents.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.chmod("a+rw", "/docs/txt", TRUE)
-- the result is --
DSResponse
additional
info
code: 0
Chmod command has been executed.
error
block
Parameters: |
$owner : | The owner of document. |
$subtree : | The subtree which owner will be changed. |
$recursive : | If true change recursivelly. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Change owner.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.chown("John", "/docs/txt", TRUE)
-- the result is --
DSResponse
additional
info
code: 0
Chown command has been executed.
error
block
Parameters: |
$src : | The subtree which will be copied. |
$dest : | The target subtree name. |
$recursive : | If true copy subtrees recursivelly. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Copy the subtree given as $src to the target subtree given as $dest.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.copy("/root/test", "/root/sbtree", TRUE)
-- the result is --
DSResponse
additional
info
code: 0
1 file(s) copied to '/root/sbtree'.
error
block
Parameters: |
$gname : | The group name which you want to delete. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Deletes the specified group.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.delGroup("friends")
-- the result is --
DSResponse
additional
info
code: 0
The group has been deleted.
error
block
Parameters: |
$name : | The user name which you want to delete. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Deletes the specified user.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.delUser("John")
-- the result is --
DSResponse
additional
info
code: 0
The user has been deleted.
error
block
Parameters: |
$subtree : | The subtree where the value will be searched. |
$path : |
Relative path in the XML document to the searched value. If the path is
not specified then the value will be searched in the whole document.
|
$value : |
The value to be searched. If the value is missing then you can't specify
a path. In this case all documents in the given subtree will be returned
recursively.
|
|
Exceptions: |
executeSEPException :
(Error) | Unable to execute the SEP command. |
Returns the XML document if in the subtree was specified the path to the
document else returns the document names where the specified value was
found.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.fetch("/root/test", "", "this")
print $ds.fetch("/root/test", "", "")
-- the result is --
DSResponse
additional
block
name: /root/test/1
error
DSResponse
additional
error
block
testdoc
I want to write this into the database.
Parameters: |
$subtree : | The subtree name to be listed. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Lists the specified subtree.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.list("/root/test")
-- the result is --
DSResponse
additional
info
code: 0
-rwr--- root root 2002-07-23 22:47:03 /root/test/1
error
block
Parameters: |
$group : | The group name to list. |
$user : | The user's groups to list. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
If the group name is given then returns all users in that group, else if
the user name is given then returns the group names in which the user is
in, if both is missing then returns all groups name.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.listGroup("friends", "")
-- the result is --
DSResponse
additional
info
code: 0
List of specified group users: John
error
block
Parameters: |
$name : | The user's name which data will be listed. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Lists the specified user's data or if there is no username specified then list all users name.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.listUser("John")
-- the result is --
DSResponse
additional
info
code: 0
Username : John
Home subtree :
Groups : friends,
Status :
error
block
Parameters: |
$dbName : | The database name to connenct. |
|
Exceptions: |
connectionException :
(Error) | If unable to login to the DataStore server. |
Connects to the specified database.
$ds = DSClient.create
print $ds.login("DBName")
-- the result is --
true
Parameters: |
$dbName : | The database name to connenct. |
$userName : | The user name. |
$password : | The user's password. |
|
Exceptions: |
connectionException :
(Error) | If unable to login to the DataStore server. |
Connects to the specified database with the given user name and
password.
$ds = DSClient.create
print $ds.login("DBName", "root", "root_pass")
-- the result is --
true
Exceptions: |
connectionException :
(Error) | If unable to logout from the DataStore server. |
Disconnects from DataStore server.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.logout
-- the result is --
true
Parameters: |
$subtree : | The absolute path to the subtree with the subtree name to create. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Creates a new subtree with the given path and name.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.makeSubtree("/root/test")
-- the result is --
DSResponse
additional
info
code: 0
/root/test subtree has been created.
error
block
Parameters: |
$oldName : | The group name to change. |
$newName : | The new name of the group. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Modifies a group name from the oldName to the newName.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.modGroup("friends", "buddies")
-- the result is --
DSResponse
additional
info
code: 0
The group has been updated.
error
block
Parameters: |
$oldName : | The user name whom data will be modified. |
$newName : |
The new user name if you want to change it, if not leave this empty. |
$password : |
The new password for the user if you want to change it, if not leave
this empty.
|
$home : |
The new home for the user if you want to change it, if not leave this
empty.
|
$group : |
The new group for the user if you want to change it, if not leave this
empty.
|
$groups : |
The new groups for the user if you want to change it, if not leave this
empty.
|
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Modify existing user dates.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.modUser("John", "Chris", "chrispass", "", "buddies", "")
-- the result is --
DSResponse
additional
info
code: 0
The user has been updated.
error
block
Parameters: |
$src : | The subtree which will be moved. |
$dest : | The target subtree name. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Moves the subtree given as $src to the target subtree given as $dest.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.move("/root/sbtree", "/root/test")
-- the result is --
DSResponse
additional
info
code: 0
error
block
Parameters: |
$subtree : | The subtree name which will be removed. |
$force : | If true removes the nonempty subtrees too. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Removes the specified subtree.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.removeSubtree("/root/sbtree", TRUE)
-- the result is --
DSResponse
additional
info
code: 0
/root/sbtree subtree(document) has been removed.
error
block
Parameters: |
$action : | The store action, can be write, update or delete. |
$path : |
If the action is update or delete this must be contain the document name
and subtree, else only the subtree.
|
$block : |
If the action is write or update this will be the document which will be
stored or with which will be overwrite the specified subtree in the
$path. If the action is delete leave this empty.
|
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Executes the specified action to the given $path.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
$xml = "<testdoc><text>I want to write this into the database.</text></testdoc>"
print $ds.("write", "/root/test", $xml)
-- the result is --
DSResponse
additional
info
code: 0
write action has been executed.
error
block
Parameters: |
$userName : | The user's name to unblock. |
|
Exceptions: |
executeSEPException :
(Error) | If unable to execute the SEP command. |
Unblocks the specified user. After this command the user can log in
again.
$ds = DSClient.create
$ds.login("DBName", "root", "root_pass")
print $ds.unblockUser("John")
-- the result is --
DSResponse
additional
info
code: 0
The user has been unblocked.
error
block