If you don't want to use annotations, you'll have to use an <inject> element in your component/page specification file:
http://jakarta.apache.org/tapestry/UsersGuide/hivemind.html#hivemind.inject -----Original Message----- From: Rui Pacheco [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 10:15 AM To: Tapestry users Subject: Re: ServletContext What is the exact syntax to do the injection of the component on the page? The examples on Tapestry's website only talk about using page definitions and I want to inject the DataSource directly on my page component. On the other hand, the @Inject syntax isnt recognized. On 5/17/06, Schulte Marcus <[EMAIL PROTECTED]> wrote: > > Sorry, now I see what you mean. > Actually you'll need *both*. > 1. the hivemodule snippet configuring the DataSource from you .jar > 2. A class like the one sketched by James or in my last mail which uses > the DataSource from 1. And the hivemodule snippet blessing this class as > hivemind service. > > To add to the confusion: you could inject the DataSource from 1. directly > into your components/pages using sth. like: > @Inject("service:module.IdDatasource") > > does this make it clearer? > > > -----Original Message----- > > From: Rui Pacheco [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, May 17, 2006 12:55 PM > > To: Tapestry users > > Subject: Re: ServletContext > > > > > > I am sorry for being so thick, but I still dont understand > > how to use my > > pool based on the examples on Jakarta's website and yours. > > I have a jar file with my connection pool. I have defined the > > service in the > > hivemodule.xml as described above (at least on gmail its above). > > > > My problem is how to use my connection pool on my business classes. > > > > Your example seems to contradict the example given above, as > > you use as a > > construct class something written by you, and I should be > > using the main > > class for the .jar file. > > > > > > On 5/17/06, James Carman <[EMAIL PROTECTED]> wrote: > > > > > > HiveMind has already created the DataSource for you. He > > has set up a > > > "service point" which implements the javax.sql.DataSource interface. > > > HiveMind will inject this into any other service > > implementation in the > > > registry that has a "setter" defined for a property of type > > > javax.sql.DataSource (the setter doesn't have to be in the "service > > > interface" but merely on the implementation class itself. > > So, all you > > > have > > > to do to use it is... > > > > > > public class MyDaoImpl implements MyDao > > > { > > > private DataSource dataSource; > > > > > > public void setDataSource( DataSource dataSource ) > > > { > > > this.dataSource = dataSource; > > > } > > > // MyDao interface methods here... > > > } > > > > > > In your hivemodule.xml file... > > > > > > <service-point id="MyDao" interface="com.myco.MyDao"> > > > <invoke-factory> > > > <construct class="com.myco.MyDaoImpl" /> > > > </invoke-factory> > > > </service-point> > > > > > > -----Original Message----- > > > From: Rui Pacheco [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, May 17, 2006 6:20 AM > > > To: Tapestry users > > > Subject: Re: ServletContext > > > > > > For the sake of simplicity, lets assume I'm also using dbcp > > > > > > How do you retrieve a new connection from the Registry? > > > According to the HiveMind examples, I wound have to create > > an instance of > > > DataSource and retrieve that from the registry, and then go > > on. Is that > > > it? > > > > > > Well, can you or someone else provide an example of the > > implementation? > > > :) > > > > > > On 5/17/06, Schulte Marcus <[EMAIL PROTECTED]> wrote: > > > > > > > > This works for apache dbcp ... I hope it's similar for proxool > > > > > > > > <service-point id="IdDatasource" interface="javax.sql.DataSource"> > > > > <invoke-factory> > > > > <construct class="org.apache.commons.dbcp.BasicDataSource"> > > > > <set property="driverClassName" > > value="oracle.jdbc.driver.OracleDriver > > > " > > > > /> > > > > > > > > <set property="url" value="${db.url}" /> > > > > <set property="username" value="${db.user}" /> > > > > <set property="password" value="${db.password}" /> > > > > </construct> > > > > </invoke-factory> > > > > </service-point> > > > > > > _____________________________________________________________________ > > > > Default Config für Testumgebung > > > > <contribution configuration-id="hivemind.FactoryDefaults"> > > > > <default symbol="db.url" > > value="jdbc:oracle:thin:@server:1521:sid" /> > > > > <default symbol="db.user" value="user" /> > > > > <default symbol="db.password" value="pass" /> > > > > </contribution> > > > > > > > > > -----Original Message----- > > > > > From: Rui Pacheco [mailto:[EMAIL PROTECTED] > > > > > Sent: Tuesday, May 16, 2006 3:54 PM > > > > > To: Tapestry users > > > > > Subject: Re: ServletContext > > > > > > > > > > > > > > > I dont doubt HiveMind would be the right way to go, but the > > > > > learning curve > > > > > seems to be a bit too steep for my timeframe. > > > > > Can I insist on an example using ServletContextListener, ie, > > > > > something that > > > > > being all in Java would be more in my reach? > > > > > > > > > > On the other hand, if someone has configured a > > connection pool (any or > > > > > Proxool in particular) using HiveMind and is willing to share > > > > > the example, I > > > > > would be more than gratefull. > > > > > > > > > > > > > > > On 5/16/06, Hugo Palma <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > In that case, why don't you configure Proxool as a > > service in you > > > > > > hivemodule.xml file ? That's where your service > > > > > configuration should take > > > > > > place. > > > > > > > > > > > > My ServletContextListener suggestion usually works well > > > > > when you have a > > > > > > properties bundle that you want to place outside the war so > > > > > that it can be > > > > > > easily changed. In your case i think the most > > appropriate is to use > > > > > > hivemind > > > > > > configurations to do the job. > > > > > > Am i making sense here ? > > > > > > > > > > > > On 5/16/06, Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > Ok... > > > > > > > The properties file holds configuration data for Proxool, > > > > > the connection > > > > > > > pool I'm using with my application. > > > > > > > > > > > > > > On 5/16/06, James Carman <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > First of all, what does that properties file > > contain? You know, > > > > > > > HiveMind > > > > > > > > is > > > > > > > > a configuration microkernel, so you can do a lot of > > > > > configuration with > > > > > > > > HiveMind. > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > > > From: Rui Pacheco [mailto:[EMAIL PROTECTED] > > > > > > > > Sent: Tuesday, May 16, 2006 9:02 AM > > > > > > > > To: Tapestry users > > > > > > > > Subject: Re: ServletContext > > > > > > > > > > > > > > > > Could you or someone else give me an example on > > how to do that? > > > > > > > > > > > > > > > > On 5/16/06, Hugo Palma <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > I would implement such a feature using a > > > > > ServletContextListener. > > > > > > > > Something > > > > > > > > > like the HiveUtils SystemPropertyInitListener class. > > > > > > > > > > > > > > > > > > Cheers > > > > > > > > > > > > > > > > > > Hugo > > > > > > > > > > > > > > > > > > On 5/16/06, Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > > > Hi all > > > > > > > > > > > > > > > > > > > > I was planning on storing a properties file inside > > > > > my WEB-INF > > > > > > > > directory > > > > > > > > > > and > > > > > > > > > > then read it using getResourceAsStream from > > > > > ServletContext, but > > > > > > > > > apparently > > > > > > > > > > I > > > > > > > > > > can't access the ServletContext from inside Tapestry. > > > > > > > > > > Is there another way to read the properties file or > > > > > how to get to > > > > > > my > > > > > > > > > > ServletContext? > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Cumprimentos, > > > > > > > > > > Rui Pacheco > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Cumprimentos, > > > > > > > > Rui Pacheco > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > > > > > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Cumprimentos, > > > > > > > Rui Pacheco > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Cumprimentos, > > > > > Rui Pacheco > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > -- > > > Cumprimentos, > > > Rui Pacheco > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > Cumprimentos, > > Rui Pacheco > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Cumprimentos, Rui Pacheco --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]