Okay, I've set this up in my ApplicationServlet's init() method

Registry myRegistry = RegistryBuilder.constructDefaultRegistry();
PCTAdminApplicationServlet.asm = 
(ApplicationStateManager)myRegistry.getService(ApplicationStateManager.class);


then i have this in a new method I made called getAdminVisit()

---------------
AdminVisit aVisit = (AdminVisit) PCTAdminApplicationServlet.asm.get("visit");
   
   if (aVisit == null)
     aVisit = new AdminVisit();
   
   PCTAdminApplicationServlet.asm.store("visit", aVisit);
   
   return aVisit;
--------------

However, I get a null pointer exception on the very first line there. Any 
ideas? I find where Tapestry and Hivemind meet is very hard to get any 
documentation on, it's like a fringe area...

Thanks,
Greg

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of Dennis Sinelnikov
Sent: Friday, December 08, 2006 9:45 PM
To: users@tapestry.apache.org
Subject: Re: Getting rid of .getVisit()


[EMAIL PROTECTED] wrote:
> Unfortunately I'm stuck with JDK 1.4 since our appserver is Websphere 5.1 :-(
> 
> -----Original Message-----
> From: Jesse Kuhnert [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 08, 2006 3:34 PM
> To: Tapestry users
> Subject: Re: Getting rid of .getVisit()
> 
> 
> Not if you use annotations. Unlike xml - annotations can actually be
> inherited very easily.
> 
> On 12/8/06, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
>> So every .page file needs this? :o
>>
>>
>>
>> -----Original Message-----
>> From: Jesse Kuhnert [mailto:[EMAIL PROTECTED]
>> Sent: Friday, December 08, 2006 3:27 PM
>> To: Tapestry users
>> Subject: Re: Getting rid of .getVisit()
>>
>>
>> You can have it "injected" into something via a .page/.jwc file by
>> doing something like:
>>
>> <inject property="registration" type="state" object="registration-data"/>
>>
>> (http://tapestry.apache.org/tapestry4.1/usersguide/state.html) or you
>> use an annotation to do the same:
>>
>>  @InjectState
>>   public abstract MyAppVisit getVisit();
>>
>> http://tapestry.apache.org/tapestry4.1/tapestry-annotations/index.html#InjectState
>>
>> On 12/8/06, [EMAIL PROTECTED]
>> <[EMAIL PROTECTED]> wrote:
>>> Thanks, I'll start tackling the hivemodule.xml I suppose to just create an 
>>> instance of my class instead of whatever default Visit tap provides.
>>>
>>> How do I go about actually retrieving this object with Hivemind?
>>>
>>> Wh
>>>
>>> -----Original Message-----
>>> From: Jesse Kuhnert [mailto:[EMAIL PROTECTED]
>>> Sent: Friday, December 08, 2006 3:11 PM
>>> To: Tapestry users
>>> Subject: Re: Getting rid of .getVisit()
>>>
>>>
>>> I'll have to check into that particular claim in the current
>>> documentation to be sure. Previously I think a HashMap was created by
>>> default but since removal of the (as of 4.0 deprecated visit)
>>> functionality all of that logic may be moot.
>>>
>>> An easy example of doing this can be found here, you want to look at
>>> the very first block of xml in the file for <configuration> :
>>>
>>> http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/WEB-INF/hivemodule.xml?view=markup
>>>
>>> I'll gmail start this email either way and try to make sure that page
>>> of documentation is updated , as well as hopefully providing a
>>> friendlier online example than that had by browsing svn source.
>>>
>>> On 12/8/06, [EMAIL PROTECTED]
>>> <[EMAIL PROTECTED]> wrote:
>>>> Alright so I'm making the jump to 4.1, which totally kills 
>>>> BasePage.getVisit()! I knew I should of cleaned up my act in 4.0 :)
>>>>
>>>> Can anyone help me switch over? I'm reading this page
>>>>
>>>> http://tapestry.apache.org/tapestry4.1/usersguide/state.html#state.aso
>>>>
>>>> I'm confused if I need to actually do some hivemind stuff.. it says it 
>>>> still provides a default Visit object... so can I use that default object 
>>>> somehow?
>>>>
>>>> Thanks,
>>>> Greg
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>
>>> --
>>> Jesse Kuhnert
>>> Tapestry/Dojo team member/developer
>>>
>>> Open source based consulting work centered around
>>> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> --
>> Jesse Kuhnert
>> Tapestry/Dojo team member/developer
>>
>> Open source based consulting work centered around
>> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

Another option would be to create a singleton to hold onto tapestry's 
hivemind registry, you can do this in your ApplicationServlet. Then 
access ApplicationStateManager object via the registry, thus set/get 
your Visit state object at any point in the app.

i.e.  Visit visit = 
(Visit)((ApplicationStateManager)this.myRegistry.getService(ApplicationStateManager.class)).get("visit");

hth,
Dennis


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to