Re: @Symbol and web context-params

2012-06-21 Thread Michael Prescott
Yes - sorry I wasn't clear.  Thanks for your help.

On 21 June 2012 18:30, Thiago H de Paula Figueiredo wrote:

> On Thu, 21 Jun 2012 16:36:38 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>  That's crazy talk.
>>
>
> Did it work?
>
>
>> Thanks. :-)
>>
>> On 21 June 2012 15:09, Thiago H de Paula Figueiredo > >wrote:
>>
>>  On Thu, 21 Jun 2012 15:11:04 -0300, Michael Prescott <
>>> michael.r.presc...@gmail.com> wrote:
>>>
>>>  MyModule {

  // Doesn't work
  @Symbol("paramname")
  private String param;
 }

 It works as an annotation on a method parameter, though!


>>> Have you tried to add @Inject to the field?
>>>
>>>
>>> --
>>> Thiago H. de Paula Figueiredo
>>>
>>> --**
>>> --**-
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@tapestry.**a**pache.org
>>> 
>>> >
>>>
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: @Symbol and web context-params

2012-06-21 Thread Thiago H de Paula Figueiredo
On Thu, 21 Jun 2012 16:36:38 -0300, Michael Prescott  
 wrote:



That's crazy talk.


Did it work?



Thanks. :-)

On 21 June 2012 15:09, Thiago H de Paula Figueiredo  
wrote:



On Thu, 21 Jun 2012 15:11:04 -0300, Michael Prescott <
michael.r.presc...@gmail.com> wrote:


MyModule {

 // Doesn't work
 @Symbol("paramname")
 private String param;
}

It works as an annotation on a method parameter, though!



Have you tried to add @Inject to the field?


--
Thiago H. de Paula Figueiredo

--**--**-
To unsubscribe, e-mail:  
users-unsubscribe@tapestry.**apache.org

For additional commands, e-mail: users-h...@tapestry.apache.org





--
Thiago H. de Paula Figueiredo

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: @Symbol and web context-params

2012-06-21 Thread Michael Prescott
That's crazy talk.

Thanks. :-)

On 21 June 2012 15:09, Thiago H de Paula Figueiredo wrote:

> On Thu, 21 Jun 2012 15:11:04 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>> MyModule {
>>
>>  // Doesn't work
>>  @Symbol("paramname")
>>  private String param;
>> }
>>
>> It works as an annotation on a method parameter, though!
>>
>
> Have you tried to add @Inject to the field?
>
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: @Symbol and web context-params

2012-06-21 Thread Thiago H de Paula Figueiredo
On Thu, 21 Jun 2012 15:11:04 -0300, Michael Prescott  
 wrote:

MyModule {

  // Doesn't work
  @Symbol("paramname")
  private String param;
}

It works as an annotation on a method parameter, though!


Have you tried to add @Inject to the field?

--
Thiago H. de Paula Figueiredo

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: @Symbol and web context-params

2012-06-21 Thread Michael Prescott
Steve, I need two web-apps running side by side, not two tapestry apps
within the same webapp. :-)  No problems there.

In any case, I figured out why what I was doing wasn't working, I was
trying to do

MyModule {

  // Doesn't work
  @Symbol("paramname")
  private String param;
}

It works as an annotation on a method parameter, though!

Thanks for your help.

On 21 June 2012 14:07, Steve Eynon  wrote:

> > because i need multiple apps running side by side.
>
> Err...
>
>
> http://tapestry.apache.org/configuration.html#Configuration-SegregatingApplicationsIntoFolders
> says, "At this time, it is still not possible to run multiple Tapestry
> 5 applications within the same web application."
>
> Other than that there's a ServletContextSymbolProvider which makes
> ServletContext init-parameters accessible as symbols. If that's no
> use, you could write your own SymbolProvider based on the above -
> which is only around 6 lines of code.
>
> Steve.
>
>
> On 22 June 2012 01:43, Michael Prescott 
> wrote:
> > I'm hoping to use tapestry-hibernate, and also flyway to do db
> migrations,
> > and I'm having trouble injecting the data source from the servlet
> container
> > into each of these.
> >
> > With tapestry-spring, I was able to have spring read web context params,
> > and go from there.  But in my tapestry module, @Symbol doesn't appear to
> > read context params.
> >
> > Is there an orthodox way to go about this?
> >
> > I don't want to hard-code the data source name in, say, a
> > hibernate.cfg.xml, because i need multiple apps running side by side.
> >
> > Gratefully,
> >
> > Michael
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: @Symbol and web context-params

2012-06-21 Thread Steve Eynon
> because i need multiple apps running side by side.

Err...

http://tapestry.apache.org/configuration.html#Configuration-SegregatingApplicationsIntoFolders
says, "At this time, it is still not possible to run multiple Tapestry
5 applications within the same web application."

Other than that there's a ServletContextSymbolProvider which makes
ServletContext init-parameters accessible as symbols. If that's no
use, you could write your own SymbolProvider based on the above -
which is only around 6 lines of code.

Steve.


On 22 June 2012 01:43, Michael Prescott  wrote:
> I'm hoping to use tapestry-hibernate, and also flyway to do db migrations,
> and I'm having trouble injecting the data source from the servlet container
> into each of these.
>
> With tapestry-spring, I was able to have spring read web context params,
> and go from there.  But in my tapestry module, @Symbol doesn't appear to
> read context params.
>
> Is there an orthodox way to go about this?
>
> I don't want to hard-code the data source name in, say, a
> hibernate.cfg.xml, because i need multiple apps running side by side.
>
> Gratefully,
>
> Michael

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: @Symbol and web context-params

2012-06-21 Thread Michael Prescott
Nevermind. :-)  Turns out that my problem was just that I was trying to use
@Symbol on a module field, instead of on a method parameter.

Michael

On 21 June 2012 13:43, Michael Prescott wrote:

> I'm hoping to use tapestry-hibernate, and also flyway to do db migrations,
> and I'm having trouble injecting the data source from the servlet container
> into each of these.
>
> With tapestry-spring, I was able to have spring read web context params,
> and go from there.  But in my tapestry module, @Symbol doesn't appear to
> read context params.
>
> Is there an orthodox way to go about this?
>
> I don't want to hard-code the data source name in, say, a
> hibernate.cfg.xml, because i need multiple apps running side by side.
>
> Gratefully,
>
> Michael
>


Re: @Symbol and web context-params

2012-06-21 Thread Thiago H de Paula Figueiredo


On Thu, 21 Jun 2012 14:43:53 -0300, Michael Prescott  
 wrote:


I'm hoping to use tapestry-hibernate, and also flyway to do db  
migrations,
and I'm having trouble injecting the data source from the servlet  
container

into each of these.

With tapestry-spring, I was able to have spring read web context params,
and go from there.  But in my tapestry module, @Symbol doesn't appear to
read context params.

Is there an orthodox way to go about this?

I don't want to hard-code the data source name in, say, a
hibernate.cfg.xml, because i need multiple apps running side by side.


I'd create a hibernate.cfg.xml with the configurations which are shared by  
all apps. Each one would have a Tapestry-IoC module class that contributes  
a HibernateConfigurer that adds the application-specific configurations.  
Or you could have a singe HibernateConfigurer implementation that picks  
and adds the correct configurations using some logic inside it.


--
Thiago H. de Paula Figueiredo

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



@Symbol and web context-params

2012-06-21 Thread Michael Prescott
I'm hoping to use tapestry-hibernate, and also flyway to do db migrations,
and I'm having trouble injecting the data source from the servlet container
into each of these.

With tapestry-spring, I was able to have spring read web context params,
and go from there.  But in my tapestry module, @Symbol doesn't appear to
read context params.

Is there an orthodox way to go about this?

I don't want to hard-code the data source name in, say, a
hibernate.cfg.xml, because i need multiple apps running side by side.

Gratefully,

Michael