Re: event framework question

[email protected]
Newsgroups gmane.comp.java.smartfrog.user
Message-ID <[email protected]>
The language does not currently allow you to have references to other bits
of the description to build up a reference. In the recognition that this
is a short-coming, I have in the past written an additional function "Ref"
which allows you to do this by turnning a string into a reference - I have
been intending to check it in, but have not yet done so. I will send you
the code once I have ported it to the latest version (I will also check it
in as part of the release).

The syntax ends up looking a little strange, but it does work..

Your example would look like

    foo extends Ref {
        lazy true;
	reference ("HOST " ++ installEnv:serverName
                  ++ ":" ++ installEnv:serverProcessName
                  ++ ":start");
    }

If this proves a commonly used feature, I can add more direct syntactic
support to make it look a little better - as an operator call asRef, for
example.

Patrick

>
> Hi Patrick,
>
> thanks a lot - now it works. As a follow up I have another question:
> I want to parameterize
>
> foo LAZY HOST host1.cern.ch:receive:start;
>
> I.e. I have a "base component" which looks like
>
> installEnv extends {
>
> serverName "host10.cern.ch";
> serverProcessName "server";
> }
>
> It gets included into the prevevious (below) mentionend components. Thus
> on the sender component I'd like to do something like:
>
> sendTo:foo LAZY HOST
> (installEnv:serverName):(installEnv:serverProcessName):start;
>
> This doesn't work... What would be the right syntax to do something like
> that ?
>
> Thanks again,
> Andreas
>
>
> On Tue, 21 Sep 2004 [email protected] wrote:
>
>>
>> Hi Andreas,
>>
>> The question to ask is what the component on host1 is called.
>>
>> Components are named in one of two ways:
>>   1) having an sfProcessComponentName attribute set
>>   2) using the name given on the sfStart command line (this one takes
>> precedence.
>>
>> Consequently, the top level component (the root - what was sfConfig in
>> the
>> description) is called receive, and it contains the start component. The
>> foo link should therefore read
>>
>>         foo LAZY HOST host1.cern.ch:receive:start;
>>
>> If you ever get this kind of issue, you can start the management console
>> pointing to, in this case, host1 to see what is named, and how.
>>
>> Patrick
>>
>>
>> >
>> > I have two components get deployed on 2 different machines. On
>> component
>> > is supposed to send a message to the other.
>> > Now I start sfDaemon on host1.cern.ch and host2.cern.ch (these are
>> > not the real hostnames... I changed them for privacy) First
>> > I deploy the receive component on host host1.cern.ch. In sfParse this
>> > component looks as follows:
>> >
>> > sfCodeBase "default";
>> > sfClass "org.smartfrog.sfcore.compound.CompoundImpl";
>> > start extends  {
>> > 	sfCodeBase "default";
>> > 	sfClass "ch.cern.openlab.smartfrog.pbs.PBSserverStart";
>> > 	sendTo extends LAZY ;
>> > 	registerWith extends LAZY ;
>> > 	verbose true;
>> > }
>> >
>> > I deploy this component with "sfStart host1.cern.ch receive
>> > pbsServerStart.sf" and it works fine. The second component looks as
>> > follows:
>> >
>> > sfCodeBase "default";
>> > sfClass "org.smartfrog.sfcore.compound.CompoundImpl";
>> > send extends  {
>> > 	sfCodeBase "default";
>> > 	sfClass "ch.cern.openlab.smartfrog.pbs.PBSnodeStart";
>> > 	sendTo extends LAZY  {
>> > 		foo LAZY HOST host1.cern.ch:start;
>> > 	}
>> > 	registerWith extends LAZY ;
>> > }
>> >
>> > When I deploy this component on host2.cern.ch with "sfStart
>> > host2.cern.ch send test.sf" I get
>> >
>> > SmartFrog 3.04.004_beta
>> > (C) Copyright 1998-2004 Hewlett-Packard Development Company, LP
>> >  - FAILED when trying DEPLOY of 'send',  [test.sf],
>> > host:host2.cern.ch
>> >    Error:
>> >     SmartFrogLifecycleException:: sfDeploy: HOST
>> > host2.cern.ch:rootProcess:send:send
>> >     cause: SmartFrogResolutionException::
>> java.net.UnknownHostException:
>> > host1.cern.ch:start
>> >        source: HOST host2.cern.ch:rootProcess:send:send
>> >        path(45)
>> >     data: Failed object class:
>> ch.cern.openlab.smartfrog.pbs.PBSnodeStart
>> >     Command line SFACT: 'send:DEPLOY:test.sf::host2.cern.ch:'
>> >     To String: ' name:send,  type:DEPLOY,  url:test.sf,
>> > host:host2.cern.ch,  resultType:FAILED,
>> > resultExceptionMessage:sfDeploy: HOST
>> > host2.cern.ch:rootProcess:send:send'
>> >
>> > It seems to me that the line
>> >
>> > sendTo extends LAZY  {
>> >                 foo LAZY HOST host1.cern.ch:start;
>> >         }
>> >
>> > gives not the right reference ... (on host2.cern.ch "ping
>> host1.cern.ch"
>> > works). What could be the reason for my problem ?
>> >
>> > Thanks a lot,
>> > Andreas
>> >
>




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.