BBjEnterpriseNamespace::getName

Description

In BBj 13.0 and higher, this method retrieves the name of the BBjEnterpriseNamespace.

Syntax

Return Value

Method

string

getName()

Parameters

None.

Return Value

This method retrieves the name of the BBjEnterpriseNamespace.

Remarks

None.

Example

sysgui=unt
open (sysgui)"X0"
api! = bbjapi()
sysgui!=api!.getSysGui()


rem retrieve a namespace, get value of count

rem host and authentication information
host$="server"
port=2552
user$="user"
password$="password"

switch argc
  case 1
    rem  run from command line with no namespace name
    prefix$ = "basis.eng.test.namespace"
    sharedNSName$ = prefix$+".test"
    sharedNS! = api!.getBBjEnterpriseNamespace(host$,port, sharedNSName$, user$,password$)
    break

  case 2
    rem  run from command line with a namespace name
    prefix$ = argv(1)
    sharedNSName$ = prefix$+".test"
    sharedNS! = api!.getBBjEnterpriseNamespace(host$,port, sharedNSName$, user$,password$)
    break

  case 3
    rem  run from within MDI
    prefix$ = "basis.eng.test"
    sharedNSName$ = prefix$+"."+argv(1)
    sharedNS! = api!.getBBjEnterpriseNamespace(host$,port, sharedNSName$, user$,password$)
    break

swend

count = sharedNS!.getValue("count", err=setCount)
privateNS! = api!.getNewNamespace(prefix$)
privateNS!.setValue("count",0)
name$ = "client-" + privateNS!.getName()

rem
rem retrieve position
rem

x = sharedNS!.getValue("x", err = setXY)
y = sharedNS!.getValue("y", err = setXY)

rem
rem increment position
rem

sharedNS!.setValue("x", x+50)
sharedNS!.setValue("y", y+50)

rem
rem create window
rem


window! = sysgui!.addWindow(x,y,300,200,name$)
plus! = window!.addButton(1,5,10,90,30,"Increment")
minus! = window!.addButton(2,105,10,90,30,"Decrement")
window!.addStaticText(101,5,50,290,30,"sharedCount:   ")
window!.addStaticText(102,5,70,290,30,"privateCount:  ")
sharedCount! = window!.addStaticText(103,200,50,290,15,str(count))
privateCount! = window!.addStaticText(104,200,70,290,15,str(0))


break! = window!.addButton(3,5,110,90,30,"Break")
break!.setCallback(break!.ON_BUTTON_PUSH,"onBreak")


rem
rem set callback for controls
rem
plus!.setCallback(plus!.ON_BUTTON_PUSH, "onPlus")
minus!.setCallback(plus!.ON_BUTTON_PUSH, "onMinus")
window!.setCallback(window!.ON_ACTIVATE, "onActivate")

rem set callback that is to be called when count changes
sharedNS!.setCallbackForVariable("count", "showCount")
privateNS!.setCallbackForVariable("count", "showCount")

rem call onActivate to set tell others we have activated
gosub onActivate

callback(ON_CLOSE,done,sysgui!.getContext())

process_events

onPlus:
sharedNS!.setValue("count", 1 + sharedNS!.getValue("count"))
privateNS!.setValue("count", 1 + privateNS!.getValue("count"))
return


onMinus:
sharedNS!.setValue("count", -1 + sharedNS!.getValue("count"))
privateNS!.setValue("count", -1 + privateNS!.getValue("count"))
count = count - 1
return

onActivate:
print "onActivate called"
sharedNS!.setValue("activeClientNS", privateNS!.getName())
sharedNS!.setValue("activeClientName",name$)
return

showCount:
sharedcount!.setText(str(sharedNS!.getValue("count")))
privatecount!.setText(str(privateNS!.getValue("count")))
return

onBreak:
escape
return


done:
release

setXY:
x = 100
y = 100
sharedNS!.setValue("x", x)
sharedNS!.setValue("y", y)
retry

setCount:
count = 0
sharedNS!.setValue("count", count)
retry

See Also

BBjAPI

BBjEnterpriseNamespace

BBjNamespace

Object Variables

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.