Nub: command not found...

22 views
Skip to first unread message

Georgios Petasis

unread,
Oct 8, 2011, 12:28:08 PM10/8/11
to wub-dis...@googlegroups.com
Hi all,

Any idea why this code fails?

package require Site
package require Nub
## Initialise Site...
Site init home $DocumentRoot config $SiteConfiguration
Nub domain /system/ Direct object test
Site start

invalid command name "Nub"
while executing
"Nub domain /system/ Direct object test"
(file "server.tcl" line 31)

Regards,

George

Colin McCormack

unread,
Oct 8, 2011, 6:39:49 PM10/8/11
to wub-dis...@googlegroups.com, Georgios Petasis
Hi George,

::Nub doesn't come into existence until the server starts. You can put
things like this into the local.tcl script, or another script whose name
is parameterised by the 'local' site var, but otherwise it's not available.

Recommend calling Site.tcl to start the server, and putting the nubs
into site.config, as follows:

/system/ {
domain Direct
object test
}

If you want the startup to 'new' an instance of class Test for you, then:

/system/ {
domain Direct
object Test param val param val ...
}

If you want it to 'create' an instance of class Test for you, then:

/system/ {
domain Direct
object Test ::test param val param val ...
}

Colin.

Georgios Petasis

unread,
Oct 9, 2011, 3:09:29 AM10/9/11
to Colin McCormack, wub-dis...@googlegroups.com
Dear Colin,

I know about the static configuration in site.config, but I was hoping
for something more dynamic than that. Like creating nubs on the fly. I
think this functionality was available in Wub in the past. It has been
dropped?

I want to expose an HTTP REST API for an application. The nubs that must
be exposed are the "systems" and "collections" of that application, that
can be dynamically created.
What are my alternatives in supporting this?

Regards,

George

Colin McCormack

unread,
Oct 9, 2011, 4:27:50 AM10/9/11
to Georgios Petasis, wub-dis...@googlegroups.com
On 09/10/11 18:09, Georgios Petasis wrote:
> Dear Colin,
>
> I know about the static configuration in site.config, but I was hoping
> for something more dynamic than that. Like creating nubs on the fly. I
> think this functionality was available in Wub in the past. It has been
> dropped?

It has not been dropped, it just can't appear there. Put it in
local.tcl and it should work just fine.

> I want to expose an HTTP REST API for an application. The nubs that
> must be exposed are the "systems" and "collections" of that
> application, that can be dynamically created.
> What are my alternatives in supporting this?

I would use Direct domain for anything that looks like a bunch of
commands. Have a look in the Direct.tcl file - there's quite a bit of
documentation there on how it works.

Colin.

Georgios Petasis

unread,
Oct 9, 2011, 9:38:10 AM10/9/11
to wub-dis...@googlegroups.com, Colin McCormack
Στις 9/10/2011 11:27, ο/η Colin McCormack έγραψε:
> On 09/10/11 18:09, Georgios Petasis wrote:
>> Dear Colin,
>>
>> I know about the static configuration in site.config, but I was
>> hoping for something more dynamic than that. Like creating nubs on
>> the fly. I think this functionality was available in Wub in the past.
>> It has been dropped?
>
> It has not been dropped, it just can't appear there. Put it in
> local.tcl and it should work just fine.
Yes, this worked!

Regards,

George

Reply all
Reply to author
Forward
0 new messages