mn8 Language Reference | Index    

BEEPHandler

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

Description

BEEP URL handler concept for all URIs starting with "beep://".
This concept is able to execute specified SEP command on specified BEEP server.

URL format is : beep://<userName>:<passwd>@<hostName>:<port>/<DBName>?sep=<sepCommand>

Possible options :

If these options are specified then the userName and the passwd will be overwrited in the URL.

Usage

Execute a fetch SEP command on BEEP server and shows the results.

                 $resp from "beep://guest:guest@localhost/XMLDB?sep=<request reqno='1'><fetch><union><intersect>
                 <compare subtree='xmlrpctest/1><path/><value></value></compare>
                 <intersect></union></fetch></request>"

                 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
                ]
             

Version: 0.1
Authors:Szabo Csaba ()
Location:
Inherits: Concept, URIHandler

Constructor List

create (String $url)
top

Method List

static LogicalacceptsURI (String $url)
LogicalcloseConnection
ConceptgetContent
Logicalinitialize (Map $options)
LogicalopenConnection
LogicalsetContent (Concept $value)
top
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
Methods inherited from: URIHandler
acceptsURI, closeConnection, getContent, initialize, openConnection, setContent

Detailed Constructor Info

create (String $url)
Parameters:
$url :URI string

Creates the URL handler concept

top

Detailed Method Info

static acceptsURI (String $url)
Parameters:
$url :URI string
Returns: Logical

Determines whether this implementation can handle the URI.

            print BEEPHandler.acceptsURI("beep://guest:guest@host:port/DB")
            -- the result is --
            true
            

top
closeConnection
Returns: Logical

Flag to close the connection

            $sep = "<request reqno='1'><fetch><union><intersect><compare subtree='xmlrpctest/1><path/><value></value>
            </compare><intersect></union></fetch></request>"
            $url = "beep://localhost/XMLDB?sep=" + $sep
            $beep = BEEPHandler.create($url)
            if $beep.acceptsURI($url) then [
              $m typeof Map
              $m.add("user", "guest")
              $m.add("pwd", "guest")
              if ($beep.initialize($m)) then [
                if ($beep.openConnection) then [
                  print $beep.getContent
                  $beep.closeConnection
                ]
              ]
            ]
            -- the result is --
            The content of xmlrpctest/1 document will be returned:
            <testxml>
              <homedir path="/home/user"/>
            </testxml>
            

top
getContent
Returns: Concept
Exceptions:
executeSEPException :
(Error)
If unable to execute SEP command on BEEP server.

Get all informations from the URL.

            $sep = "<request reqno='1'><fetch><union><intersect><compare subtree='xmlrpctest/1><path/><value></value>
            </compare><intersect></union></fetch></request>"
            $url = "beep://localhost/XMLDB?sep=" + $sep
            $beep = BEEPHandler.create($url)
            if $beep.acceptsURI($url) then [
              $m typeof Map
              $m.add("user", "guest")
              $m.add("pwd", "guest")
              if ($beep.initialize($m)) then [
                if ($beep.openConnection) then [
                  print $beep.getContent
                  $beep.closeConnection
                ]
              ]
            ]
            -- the result is --
            The content of xmlrpctest/1 document will be returned:
            <testxml>
              <homedir path="/home/user"/>
            </testxml>
            

top
initialize (Map $options)
Parameters:
$options :Map concept with user and password informations
Returns: Logical
Exceptions:
badURLException :
(Error)
If the URL to the BEEP server isn't valid.

Initializes the URL useing the user informations

            $sep = "<request reqno='1'><fetch><union><intersect><compare subtree='xmlrpctest/1><path/><value></value>
            </compare><intersect></union></fetch></request>"
            $url = "beep://localhost/XMLDB?sep=" + $sep
            $beep = BEEPHandler.create($url)
            if $beep.acceptsURI($url) then [
              $m typeof Map
              $m.add("user", "guest")
              $m.add("pwd", "guest")
              if ($beep.initialize($m)) then [
                if ($beep.openConnection) then [
                  print $beep.getContent
                  $beep.closeConnection
                ]
              ]
            ]
            -- the result is --
            The content of xmlrpctest/1 document will be returned:
            <testxml>
              <homedir path="/home/user"/>
            </testxml>
            

top
openConnection
Returns: Logical
Exceptions:
connectionException :
(Error)
If unable to connect to specified XML database.

Opens the BEEPClient connection

            $sep = "<request reqno='1'><fetch><union><intersect><compare subtree='xmlrpctest/1><path/><value></value>
            </compare><intersect></union></fetch></request>"
            $url = "beep://localhost/XMLDB?sep=" + $sep
            $beep = BEEPHandler.create($url)
            if $beep.acceptsURI($url) then [
              $m typeof Map
              $m.add("user", "guest")
              $m.add("pwd", "guest")
              if ($beep.initialize($m)) then [
                if ($beep.openConnection) then [
                  print $beep.getContent
                  $beep.closeConnection
                ]
              ]
            ]
            -- the result is --
            The content of xmlrpctest/1 document will be returned:
            <testxml>
              <homedir path="/home/user"/>
            </testxml>
            

top
setContent (Concept $value)
Parameters:
$value :The content of the specified document.
Returns: Logical
Exceptions:
storeException :
(Error)
If unable to set the content specified document.

Flag which shows if the content was sets

top