mn8 Language Reference | Index    

MemHandler

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

Description

Helper concept to use mn8 environment variables. Mem Handler concept can get and set mn8 environment variables.

URL format is : mem://<path>

Possible options :

Usage

Set the crow password in mn8 environment and displays it.

            "crowp" to "mem:/passwd/crow"
            $x from "mem:/passwd/crow"
            print $x
                crowp

print the '/passwd/' passwords where password contains ro string

                $x from "mem:/passwd/" options "filter"=Simplex.create("*ro*")
                print $x

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

Constructor List

create (String $url)
top

Method List

static LogicalacceptsURI (String $uri)
LogicalcloseConnection
ConceptgetContent
Logicalinitialize (Map )
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 : The url to the location in the memory where the data will be stored.

Creates a new MemHandler with the given $url.

top

Detailed Method Info

static acceptsURI (String $uri)
Parameters:
$uri : The uri which will be tested if it is acceptable by this handler.
Returns: Logical

Returns true if the given $uri is acceptable by this handler, false otherwise.

                print MemHandler.acceptsURI("mem://user/passwds")
                -- the result is --
                true
            

top
closeConnection
Returns: Logical

Returns true and close this connection.

                $url = "mem://user/passwds/crow"                                                                            
                $mem = MemHandler.create( $url )                                                                              
                if $mem.acceptsURI( $url ) then [                                                                           
                    $m typeof Map                                                                                           
                    if ( $mem.initialize( $m ) ) then [                                                                         
                        if ( $mem.openConnection ) then [                                                                     
                            $mem.setContent("crowp")                                                                        
                            print $mem.getContent                                                                           

                            $mem.closeConnection                                                                            

                        ]                                                                                                   
                    ]                                                                                                       
                ]
                -- the result is --
                crowp
            

top
getContent
Returns: Concept
Exceptions:
badURLException :
(Warning)
If the specified URL isn't valid.

Returns the content of this handler.

                $url = "mem://user/passwds/crow"                                                                            
                $mem = MemHandler.create( $url )                                                                              
                if $mem.acceptsURI( $url ) then [                                                                           
                    $m typeof Map                                                                                           
                    if ( $mem.initialize( $m ) ) then [                                                                         
                        if ( $mem.openConnection ) then [                                                                     
                            $mem.setContent("crowp")                                                                        

                            print $mem.getContent                                                                           

                            $mem.closeConnection                                                                            
                        ]                                                                                                   
                    ]                                                                                                       
                ]
                -- the result is --
                crowp
            

top
initialize (Map )
Parameters:
: Contains a filter with which the returned content will be filtered.
Returns: Logical

Returns true.

                $url = "mem://user/passwds/crow"                                                                            
                $mem = MemHandler.create( $url )                                                                              
                if $mem.acceptsURI( $url ) then [                                                                           
                    $m typeof Map                                                                                           

                    if ( $mem.initialize( $m ) ) then [                                                                         

                        if ( $mem.openConnection ) then [                                                                     
                            $mem.setContent("crowp")                                                                        
                            print $mem.getContent                                                                           
                            $mem.closeConnection                                                                            
                        ]                                                                                                   
                    ]                                                                                                       
                ]
                -- the result is --
                crowp
            

top
openConnection
Returns: Logical

Returns true.

                $url = "mem://user/passwds/crow"                                                                            
                $mem = MemHandler.create( $url )                                                                              
                if $mem.acceptsURI( $url ) then [                                                                           
                    $m typeof Map                                                                                           
                    if ( $mem.initialize( $m ) ) then [                                                                         

                        if ( $mem.openConnection ) then [                                                                     

                            $mem.setContent("crowp")                                                                        
                            print $mem.getContent                                                                           
                            $mem.closeConnection                                                                            
                        ]                                                                                                   
                    ]                                                                                                       
                ]
                -- the result is --
                crowp
            

top
setContent (Concept $value)
Parameters:
$value :The value to be set.
Returns: Logical
Exceptions:
bindException :
(Error)
If unable to put $value to mn8 environment.

Returns true if sets the content successfully to the given $value, false otherwise.

                $url = "mem://user/passwds/crow"                                                                            
                $mem = MemHandler.create( $url )                                                                              
                if $mem.acceptsURI( $url ) then [                                                                           
                    $m typeof Map                                                                                           
                    if ( $mem.initialize( $m ) ) then [                                                                         
                        if ( $mem.openConnection ) then [                                                                     

                            $mem.setContent("crowp")                                                                        

                            print $mem.getContent                                                                           
                            $mem.closeConnection                                                                            
                        ]                                                                                                   
                    ]                                                                                                       
                ]
                -- the result is --
                crowp
            

top