mn8 Language Reference | Index    

DSClient

SUMMARY: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTORS SUMMARY  NO OPERATORS  METHODS SUMMARYDETAIL: NO ATTRIBUTES  NO ELEMENTS  CONSTRUCTOR DETAILS  NO OPERATORS  METHOD DETAILS

Description

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 :

Usage

            $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 !!!"
            ]
        

Version: 0.1
Authors:Szabo Csaba
Inherits: Concept

Constructor List

create (String $host)
create (String $host, String $port)
create
top

Method List

DSResponseaddGroup (String $group)
DSResponseaddUser (String $username, String $password, String $home, String $group, String $groups)
DSResponseblockUser (String $username)
DSResponsechangeStoreType (String $subtree, String $mode, Logical $recursive)
DSResponsesetNamingFlag (String $subtree, String $naming, Logical $recursive)
DSResponsechmod (String $mode, String $subtree, Logical $recursive)
DSResponsechown (String $owner, String $subtree, Logical $recursive)
DSResponsecopy (String $src, String $dest, Logical $recursive)
DSResponsedelGroup (String $gname)
DSResponsedelUser (String $name)
DSResponsefetch (String $subtree, String $path, String $value)
DSResponselist (String $subtree)
DSResponselistGroup (String $group, String $user)
DSResponselistUser (String $name)
Logicallogin (String $dbName)
Logicallogin (String $dbName, String $userName, String $password)
Logicallogout
DSResponsemakeSubtree (String $subtree)
DSResponsemodGroup (String $oldName, String $newName)
DSResponsemodUser (String $oldName, String $newName, String $password, String $home, String $group, String $groups)
DSResponsemove (String $src, String $dest)
DSResponseremoveSubtree (String $subtree, Logical $force)
DSResponsestore (String $action, String $path, String  $block)
DSResponseunblockUser (String $userName)
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getConceptsAtPath, getErrorHandler, getInheritedConcepts, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML

Detailed Constructor Info

create (String $host)
Parameters:
$host :The host name to be connected.

Constructs a new DSClient with the given host name on the default port.

top
create (String $host, String $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.

top
create

Constructs a new DSClient with the default host name on the default port.

top

Detailed Method Info

addGroup (String $group)
Parameters:
$group :The group name to add.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
Unable to execute the SEP command.

Adds the specified group to the specified database.

top
addUser (String $username, String $password, String $home, String $group, String $groups)
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.

Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Adds the specified user to the specified database.

top
blockUser (String $username)
Parameters:
$username :The user's name to block.
Returns: DSResponse
Exceptions:
executeFailed :
(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.

top
changeStoreType (String $subtree, String $mode, Logical $recursive)
Parameters:
$subtree :The subtree which mode will be changed.
$mode :The store mode. (strict/flexible/free/free_tag)
$recursive :If true change recursivelly.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Change subtree store mode.

top
setNamingFlag (String $subtree, String $naming, Logical $recursive)
Parameters:
$subtree :The subtree which naming flag will be changed.
$naming :The naming flag. (auto/manual)
$recursive :If true change recursivelly.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Set subtree naming flag.

top
chmod (String $mode, String $subtree, Logical $recursive)
Parameters:
$mode :The permission mode.
$subtree :The subtree which mode will be changed.
$recursive :If true change recursivelly.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Change acces permissions for subtrees and documents.

top
chown (String $owner, String $subtree, Logical $recursive)
Parameters:
$owner :The owner of document.
$subtree :The subtree which owner will be changed.
$recursive :If true change recursivelly.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Change owner

top
copy (String $src, String $dest, Logical $recursive)
Parameters:
$src :The subtree which will be copied.
$dest :The target subtree name.
$recursive :If true copy subtrees recursivelly.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Copy the subtree given as $src to the target subtree given as $dest.

top
delGroup (String $gname)
Parameters:
$gname :The group name which you want to delete.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Deletes the specified group.

top
delUser (String $name)
Parameters:
$name :The user name which you want to delete.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Deletes the specified user.

top
fetch (String $subtree, String $path, String $value)
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.

Returns: DSResponse
Exceptions:
executeFailed :
(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.

top
list (String $subtree)
Parameters:
$subtree :The subtree name to be listed.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Lists the specified subtree.

top
listGroup (String $group, String $user)
Parameters:
$group :The group name to list.
$user :The user's groups to list.
Returns: DSResponse
Exceptions:
executeFailed :
(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.

top
listUser (String $name)
Parameters:
$name :The user's name which data will be listed.
Returns: DSResponse
Exceptions:
executeFailed :
(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.

top
login (String $dbName)
Parameters:
$dbName :The database name to connenct.
Returns: Logical
Exceptions:
loginFailed :
(Error)
If unable to login to the DataStore server.

Connects to the specified database.

top
login (String $dbName, String $userName, String $password)
Parameters:
$dbName :The database name to connenct.
$userName :The user name.
$password :The user's password.
Returns: Logical
Exceptions:
loginFailed :
(Error)
If unable to login to the DataStore server.

Connects to the specified database with the given user name and password.

top
logout
Returns: Logical
Exceptions:
logouFailed :
(Error)
If unable to logout from the DataStore server.

Disconnects from DataStore server.

top
makeSubtree (String $subtree)
Parameters:
$subtree :The absolute path to the subtree with the subtree name to create.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Creates a new subtree with the given path and name.

top
modGroup (String $oldName, String $newName)
Parameters:
$oldName :The group name to change.
$newName :The new name of the group.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Modifies a group name from the oldName to the newName.

top
modUser (String $oldName, String $newName, String $password, String $home, String $group, String $groups)
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.

Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Modify existing user dates.

top
move (String $src, String $dest)
Parameters:
$src :The subtree which will be moved.
$dest :The target subtree name.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Moves the subtree given as $src to the target subtree given as $dest.

top
removeSubtree (String $subtree, Logical $force)
Parameters:
$subtree :The subtree name which will be removed.
$force :If true removes the nonempty subtrees too.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Removes the specified subtree.

top
store (String $action, String $path, String  $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.

Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Executes the specified action to the given $path.

top
unblockUser (String $userName)
Parameters:
$userName :The user's name to unblock.
Returns: DSResponse
Exceptions:
executeFailed :
(Error)
If unable to execute the SEP command.

Unblocks the specified user. After this command the user can log in again.

top