[kepler-dev] Origin of incoming data in an Actor

ben leinfelder leinfelder at nceas.ucsb.edu
Sun Jul 18 09:55:46 PDT 2010


I agree that it's good to have actors that work for all tokens, regardless of source, but I could see it being useful to have your actor behave differently depending on the source (provided this is well-documented for any other unsuspecting user who might stumble on YourGreatestActorEver). You can follow the "upstream" connections of your actor by interrogating the ports through which the tokens pass. Say the source of your data token comes from a RExpression actor, you might choose to process the token differently than if it came from an instance of a StringExpression actor.
But like Matt suggests, perhaps it is better to craft your workflow such that the logic comes from the Tokens rather than the sources (maybe there can be an additional port on our actor that provides a switch for the actor to behave in one manner vs. another?).
-ben


On Jul 17, 2010, at 1:46 PM, Matt Jones wrote:

> Tokens can be complex structures -- so, rather than using a String, use, for example, a record token that contains your information flag, plus the string or other data you want to operate on:
> 
> {flag="myInformation", data="myDataValue"}
> 
> Alternatively, you could use arrays and other compound data structures too.  See the documentation on record tokens and arrays for details, which is in the 'Data Types' section in the Kepler User Guide, available from the Kepler 'Help' menu, or from the Kepler web site.
> 
> Matt
> 
> On Sat, Jul 17, 2010 at 12:02 PM, Ivens <ivensportugal at gmail.com> wrote:
> Hi Matt,
> 
> I liked the idea of encoding information in tokens.
> But is there way to do that without altering the original information?
> 
> avoiding:
> 
> value = "myInformation" + value.toString();
> 
> Thanks,
> Ivens
> 
> On Sat, Jul 17, 2010 at 4:52 PM, Matt Jones <jones at nceas.ucsb.edu> wrote:
> Hi Ivens,
> 
> When you find a token on your input port, you can inspect its type.  There is no additional information about where the token originated, as each actor should be able to handle any data source that emits the proper types of tokens.  You could, of course, encode data in the tokens that are output by your upstream actors that you can use in your conditional logic within your actor.
> 
> Matt
> 
> On Sat, Jul 17, 2010 at 9:46 AM, Ivens <ivensportugal at gmail.com> wrote:
> Hi,
> 
> I am coding an Actor in Java/Eclipse.
> That actor will have 1 input multiport and 1 output multiport.
> 
> The problem is:
> depending on the source of the data, i will take different action.
> 
> is there a method that return anything related to the source actor of the data?
> 
> Thanks in advance, 
> Ivens
> 
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
> 
> 
> 
> 
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev



More information about the Kepler-dev mailing list