Re: Call for translations
Hey Igor, It may be a silly detail, but in Dutch, "Cancel" is "Annuleren", not "Afbreken" which is the translation of "Abort". Also, the "integer-format-exception" should not be "een heel getal" but "een geheel getal". This is the usual way the word "integer" is rendered in Dutch. Then, a very subtle thing is the incorrect-captcha message. Right now, it says "Voer de tekst in zoals weergegeven op het plaatje." which someone may understand as "Enter the text just as displayed in the picture" which is a bit silly if you take it literally. I think it should be "Voer de tekst in die is weergegeven in het plaatje." which literally translates to "Enter the text that is displayed in the picture." Regards, Tom. On 07/26/2011 11:53 PM, Igor Drobiazko wrote: Dear community, I just checked the translations for the messages produced by Tapestry. It looks like a plenty of translations for various locales are missing. Please check out the following issue and help us by providing missing translations. https://issues.apache.org/jira/browse/TAP5-1590 Thank you - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Grid with multiple forms
Op 28-2-2011 1:08, Thiago H. de Paula Figueiredo schreef: On Sun, 27 Feb 2011 19:42:35 -0300, Tom van Dijk wrote: the list of "A" items. I very quickly ran into problems with the combination of nested zones, loops, forms and actions, partially because the client IDs of the zones and forms tended to change and after I edited something, the page was broken. Provide explicit ids for all components and this problem should go away. Um, it became ZoneId_1 and ZoneId_2 and so forth. Or do I miss something here? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Grid with multiple forms
Op 27-2-2011 14:13, Thiago H. de Paula Figueiredo schreef: On Sat, 26 Feb 2011 18:47:06 -0300, Tom van Dijk wrote: What exactly makes you bang your head? Just the fact that I can't get my head around this thing. I'm still curious to know more about it. Well, what I want is very simple, there's a very simple database with just a few tables and just a few columns in each table. I want to make an AJAX admin panel for that database, so all editors on the same page. I don't use the Grid component because I like to have a bit more control over the result (I started with the Grid components for a prototype, but I'm a bit past that stage and it's easier for my client if it's all on one page.) The database structure is a simple hierarchy. Objects of type A contain objects of type B, which contain objects of type C. So when the admin wants to edit A, I need to update the zones with editors for B and C, and if I edit the name of a "A" I want it to be updated in the list of "A" items. I very quickly ran into problems with the combination of nested zones, loops, forms and actions, partially because the client IDs of the zones and forms tended to change and after I edited something, the page was broken. Right now my client is using a hack, where he needs to press the "refresh" buttons I put at different places that sometimes generate fatal errors. Whenever she gets an error, she can just click Refresh and it works again. It's terrible, so I thought to fall back to what I know about javascript (I've created a very similar AJAX database manager before and it's not too much work if it's small and you know what you're doing) and combine it with what Tapestry offers with the templates/page classes etc. Well, my "Render block" thread is a result of that, where I thought it would be a great idea to have tapestry render the blocks and that I could then put them into the right divs (this time without them changing IDs when I know that they are unique and unnecessary to change) right away. Apparently, that's not the way it should be done. So now I'm trying to use zones and forms and I'm considering to use a MultiZoneUpdate with one zone to be an update to a "dummy" zone that will contain javascript calls, as I didn't yet discover how to do a post-success hook in javascript... aargh. Deadline: long ago. But my client doesn't seem to care, they didn't even look at my prototype for 2 months after I gave it to them so the complete lack of pressure doesn't help me much either. (The joys of web development) And writer's block. Every time I type a few lines of code, I want to do something else, like drink beer. I don't drink beer myself, but I know it's hard to compete with it for time. :P - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Multipe databases support
OK, I uploaded a small pdf that explains the basics of my idea to http://www.tvandijk.nl/pub/multiconf.pdf You can pull from my multiconf branch, git://hetdiana.dyndns.org/tapestry5.git. Tom. Op 26-2-2011 21:40, Tom van Dijk schreef: My Multiple database support version of Tapestry is still working and being updated every few days. I just need to find time to promote it and document it on the developer mail list I suppose. Right now I'm banging my head against Tapestry's JS/AJAX/Rendering concepts that won't stick into my head so I'm motivated to work on Tapestry for a few minutes every hour or so, which doesn't help things. :S - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Grid with multiple forms
Op 26-2-2011 22:43, Thiago H. de Paula Figueiredo schreef: On Sat, 26 Feb 2011 17:40:21 -0300, Tom van Dijk wrote: My Multiple database support version of Tapestry is still working and being updated every few days. I just need to find time to promote it and document it on the developer mail list I suppose. Right now I'm banging my head against Tapestry's JS/AJAX/Rendering concepts that won't stick into my head What exactly makes you bang your head? Just the fact that I can't get my head around this thing. And writer's block. Every time I type a few lines of code, I want to do something else, like drink beer. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Grid with multiple forms
My Multiple database support version of Tapestry is still working and being updated every few days. I just need to find time to promote it and document it on the developer mail list I suppose. Right now I'm banging my head against Tapestry's JS/AJAX/Rendering concepts that won't stick into my head so I'm motivated to work on Tapestry for a few minutes every hour or so, which doesn't help things. :S Op 26-2-2011 20:41, Jonathan Barker schreef: Preface: I've been around since the alpha days of T4, and I try to keep up my reading on the list, but I usually only pop my head to contribute up when something is painfully familiar - like security manager issues with Tomcat on Debian, or the occasional Spring issues. I'm associated with a couple of JIRA issues, and there's some code in tapestry-spring-security from the Acegi days that I contributed that is an adaptation of old Acegi taglib code. The documentation has improved immensely, and the quality of help on the list is amazing. This has not been a single-guru project for quite some time :-) Half of what I do uses more than one database, and I like Spring transaction management, so I almost always have that baggage. Historically, most of my development has been internal and productivity related - only more recently has appearance been much of an issue. So, what has hit me? I routinely get bitten by something related to whether I'm managing a service with Spring, or Tapestry-ioc. More specifically, when Spring services depend on Tapestry services. Things are getting better on this front. Select models. Mostly, this problem has gone away for me because I use a chunk of code from the wiki that I know you don't like :-) and I agree with your points. However, it works, it has allowed me to do some funky stuff with augmenting lists (where I need to preserve an original selection even if it is not in the currently available options), and I don't have high volumes to deal with. It would not be good for inclusion in Tapestry however. Recently, I've done a couple of simple Facebook apps. I needed to generate absolute URL's (including http://server.domain/) for assets. There was an option tapestry-force-absolute-uris, and I've contributed my own BaseURLSource before to handle some development vs. production switches, so I thought that would cover it. Unfortunately, I found (after looking at Tapestry source) I needed to override the AssetPathConstructor to get the right URLs for my image files. So, it's great that I could do it, but that would not be nice for a newbie. (Note: I see there have been some changes with T5.2 but I don't know if they resolve my issues). I also recently built a validation and import page that includes multiple progressive displays as each phase is completed. Some move automatically from one to the next, and others require manual verification (acceptance of warnings). Cool, and it makes sense to me, but getting the blocks right, and making it so that it degrades nicely takes a bit of effort. Perhaps there's a good example now, but my first attempt at graceful degradation took some head-scratching. I've always found forms containing loops or grids, or loops containing forms to be a particular challenge. In extreme cases, what I'm really looking for I guess is a DataGrid. I wonder if this is an area where pairing with a company that sells such a component to build a Tapestry wrapper would be an idea. I had considered it, but it wasn't enough of a need, because I had flexible requirements. (Specific case: grid largely read-only, but a comment (text box) and status (drop down) in each row need to be editable. The grid needs to retain sorting ability, and keep information between refreshes or changes in sorting, but only have the comment and status information updated as a batch for the whole grid.) We all have our comfort zones. For some, javascript is second nature. I dread it - probably because of experiences years ago. For some, filters, advice, (insert your favorite design pattern here), are very familiar, and there have been conversations on the list about the best way to implement or override a particular piece of functionality. At the framework level, options need to be carefully weighed. When you're just trying to get something done, I recall a quotation, "When the need arises, the nearest object becomes a hammer." My wish list? Multiple database support - there was some great conversation last year on the list with Tom van Dijk. Transaction management on par with Spring. Why don't I ask more questions on the list? If I can't find my answer in a search, I can probably figure it out myself in about the same time it would take to generate a simplified version of whatever I'm working on to post to the list. Or perhaps I should say that in formulating an intelligent
Re: Rendering a Block
Hi, Well, it is an AJAX request. The X-Requested-With header is properly set, isXHR() will return true. I'm executing it in Javascript, just a normal call. It's supposed to return a form that I can then display in any DIV that I want, and I don't want to use zones here. So I would think I should add a method in my Page class, "getStuff" or something like that. And I basically want to call that method, which returns a Block, from Javascript and get the actual rendered HTML to put in any DIV of my choice. How? Tom. Op 26-2-2011 16:35, Josh Canfield schreef: Hi Tom. You can definitely return a block as the result of an AJAX request. If it's not an AJAX request then you will get an error about not having a result processor. Make sure that the zone parameter is set on the link you are using to initiate the zone update, and that javascript is turned on. You can check the request for isXHR to make sure tapestry thinks you are doing an ajax request. Josh On Feb 26, 2011 5:52 AM, "Tom van Dijk" wrote: Hello, I want to do something that should be simple but appears to be complex. I want to render a Block and return the result. The context is a website in which I want to use Javascript to fill a. I don't want to use a zone for this. What I did was make a in the .tml file. Now what I want to do is send an event to the page, and return the rendered block using JSON. A bit like this: @Inject private Block theBlock; Object onTheEvent() { return theBlock; } I figured out that this doesn't work, because BlockImpl is not handled. Okay, I have to return a StreamResponse. What I would like is: @Inject private final BlockRenderer renderer; Object onTheEvent() { return new TextStreamResponse("text/html", renderer.render(theBlock)); } Obviously the BlockRenderer service does not exist, but I would want it to exist. Or something similar. Who can help me out? Tom. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Rendering a Block
Hello, I want to do something that should be simple but appears to be complex. I want to render a Block and return the result. The context is a website in which I want to use Javascript to fill a . I don't want to use a zone for this. What I did was make a in the .tml file. Now what I want to do is send an event to the page, and return the rendered block using JSON. A bit like this: @Inject private Block theBlock; Object onTheEvent() { return theBlock; } I figured out that this doesn't work, because BlockImpl is not handled. Okay, I have to return a StreamResponse. What I would like is: @Inject private final BlockRenderer renderer; Object onTheEvent() { return new TextStreamResponse("text/html", renderer.render(theBlock)); } Obviously the BlockRenderer service does not exist, but I would want it to exist. Or something similar. Who can help me out? Tom. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Discussion
I have problems taking someone seriously who bases his argumentation on the looks of one of the developers and on exaggerated (indicator of bad reasoning) vague claims (bad reasoning) of many (bad reasoning, come up with better statistics) experiences. I would rather see compelling arguments against Tapestry that we could counter by improving the product, than criticism that would only be resolved by buying Howard a new haircut, which really wouldn't improve his coding or his vision of Tapestry. Op 21-12-2010 11:48, George Banus schreef: Hi, I am a newbie to Tapestry and while googling to learn more about tapestry, I found this discussion going on at http://www.theserverside.com/news/thread.tss?thread_id=61537. Some of the comments look very disappointing. Is Tapestry really used for serious projects? George - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Things in a loop go null
Alright, I suppose can add a context. But I find that it's not only the "Product" that's null, but also stuff like zones. What I have, is a component inside a loop. Now within the component, I have a zone that I want to update as follows: zone="overviewOfStuff"> ... Because it's in a loop, the zone id changes every iteration. The above piece of code would not actually refresh the zone, but only the first zone in the loop. I can change it to: zone="${overviewOfStuff.clientId}"> ... ... a list of stuff ... Obviously I need property bindings to @InjectComponent @Property Zone overviewOfStuff; This works, but when I press refresh, the event handler of the component is called and obviously, Zone is null. There is also no way to retrieve the client Id. Right, how do I do it? Regards, Tom. Op 15-12-2010 13:18, Igor Drobiazko schreef: Because the product set inside the loop is lost, when the user clicks on the ActionLink. You need to provide a context for your ActionLink in order to restore the state. On Wed, Dec 15, 2010 at 1:13 PM, Tom van Dijk wrote: Hi, In an application, I'm making an editor for products in a group and my client wants everything in one page. So, there are product groups, with products in each group and every product has a number of subproperties, and so on (4 levels deep). So what I get is a loop inside a loop inside a loop. I have a loop with a custom component in it: The Product Editor has @Parameter (required=true) Product product; Now the Product Editor component has an actionLink, and in onActionFromActionLink, product is null. Why? Sincerely, Tom. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.or - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Things in a loop go null
Hi, In an application, I'm making an editor for products in a group and my client wants everything in one page. So, there are product groups, with products in each group and every product has a number of subproperties, and so on (4 levels deep). So what I get is a loop inside a loop inside a loop. I have a loop with a custom component in it: The Product Editor has @Parameter (required=true) Product product; Now the Product Editor component has an actionLink, and in onActionFromActionLink, product is null. Why? Sincerely, Tom. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: @Transactional needed in tapestry-hibernate?
Modifying CommitAfter in that way isn't too hard, but what should happen if an exception is thrown? e.g. enter A change things 1 enter B change things 2 exit B change things 3 throw exception what should be committed? Op 11-12-2010 21:04, Howard Lewis Ship schreef: At the very least, I've been thinking of having @CommitAfter determine when there is a prior @CommitAfter method further up the stack, and not commit in that case (letting the outermost @CommitAfter perform the overall commit). On Sat, Dec 11, 2010 at 10:01 AM, Thiago H. de Paula Figueiredo< thiag...@gmail.com> wrote: On Sat, 11 Dec 2010 15:12:25 -0200, Christian Köberl< tapestry.christian.koeb...@gmail.com> wrote: Currently, there is only the @CommitAfter annotation in tapestry-hibernate. This is good for simple use cases but not sufficient for complex cases. Agreed. Therefore Spring introduced @Transactional, would this also make sense for tapestry-hibernate? I don't think it makes sense to mix tapestry-hibernate and spring-tx. If you need something that tapestry-hibernate doesn't handle, use spring-tx for that. In addition, Tapestry-Hibernate handles Hibernate only. In addition, @Transactional has many options which tapestry-hibernate doesn't. I'd like to see (maybe even write) a transaction manager package built on Tapestry-IoC and using the EJB 3 annotations, with some way to support other annotations too (including @CommitAfter and Spring's @Transactional. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: tapestry-hibernate, hsqldb and registry shutdown
Wouldn't registryWillShutdown be used to /prepare/ the session (request a session object) which can then be used in registryDidShutdown? It's the same thread, after all. Op 29-11-2010 21:52, Kalle Korhonen schreef: Perhaps you should read this as well: http://www.mail-archive.com/users@tapestry.apache.org/msg41237.html. But overall, not necessarily a good idea to shut down services before their time. For your specific case though, why not just use h2 (http://h2database.com) and DB_CLOSE_ON_EXIT=TRUE instead and be done with the issue. Kalle On Mon, Nov 29, 2010 at 12:43 PM, Paul Stanton wrote: Javier, I agree re registryIsShuttingDown .. that is what i'm looking for. something that is called after new httprequests have been stopped, but before the registry becomes broken. there would need to be some ordered configuration to control the process however. i'm guessing this doesn't currently exist, should i create a jira issue? in the mean time i have solved my problem by recording the connection info at startup so i don't need to inject a service at shutdown: public class DbShutdownImpl implements DbShutdown, RegistryShutdownListener { private Properties hibConfig; private final static Logger LOG = Logger.getLogger(DbShutdownImpl.class); public DbShutdownImpl(HibernateSessionSource sessionSource) { hibConfig = sessionSource.getConfiguration().getProperties(); } @PostInjection public void startupService(RegistryShutdownHub shutdownHub) { shutdownHub.addRegistryShutdownListener(this); } @Override public void registryDidShutdown() { Connection con = null; try { String driver = hibConfig.getProperty("hibernate.connection.driver_class"); String url = hibConfig.getProperty("hibernate.connection.url"); String username = hibConfig.getProperty("hibernate.connection.username"); String password = hibConfig.getProperty("hibernate.connection.password"); con = JdbcUs.getConnection(driver, url, username, password); JdbcUs.executeUpdate("SHUTDOWN", con); LOG.debug("database shutdown cleanly"); } catch (Throwable e) { LOG.error("database shutdown failed", e); } finally { JdbcUs.closeQuietly(con); } } } NOTE: This won't work for everyone. p. On 29/11/2010 11:16 PM, Javier Molina wrote: Overriding the filter might look ugly, but it was designed for that; see the comments on destroy() and destroy(Registry registry). You might find it less ugly to have a ServletContextListener and do the cleanup in contextDestroyed. The real solution would be to have a registryIsShuttingDown() notification, fired before registryDidShutdown(). I haven't found it, though. El 29/11/10 12:53, Tom van Dijk escribió: Which service would that be? Could you provide a stack trace? Perhaps you could make your service contribute to RegistryStartup as well, to make sure the DbShutdownImpl service is realized and that the sessionSource is realized. The "startupService" would then be the registry startup method. I agree that modifying TapestryFilter is an ugly solution and should be avoided if possible. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: tapestry-hibernate, hsqldb and registry shutdown
Well, designed or not, I suppose overriding the filter is not a modular solution. You can't add a third party library and expect it to work, instead the application developer needs to do additional work by modifying web.xml and on top of that, if you use your service without tapestry-core, it won't work. You really need to listen to the Registry shutdown if you want to write your service as a general solution. Regarding that last thing, the code of shutdown in the Registry is as follows: public synchronized void shutdown() { lock.lock(); registryShutdownHub.fireRegistryDidShutdown(); SerializationSupport.clearProvider(this); } Your idea would look like this: public synchronized void shutdown() { lock.check(); registryShutdownHub.fireRegistryWillShutdown(); lock.lock(); registryShutdownHub.fireRegistryDidShutdown(); SerializationSupport.clearProvider(this); } I suppose that the reason the lock is locked is that you want to guarantee that somehow that services that are listening to registryDidShutdown aren't used anymore after receiving the shutdown event. However, you may need certain services to be instantiated at registry shutdown. In case of per-thread services, there is no way to do this pre-shutdown work, so a RegistryWillShutdown thing might be useful. The actual implementation would require an additional service interface, RegistryWillShutdownListener (well, one could add a method to RegistryShutdownListener but then lots of code will break because not all methods are implemented). Perhaps a committer might be willing to look at it. Op 29-11-2010 13:16, Javier Molina schreef: Overriding the filter might look ugly, but it was designed for that; see the comments on destroy() and destroy(Registry registry). You might find it less ugly to have a ServletContextListener and do the cleanup in contextDestroyed. The real solution would be to have a registryIsShuttingDown() notification, fired before registryDidShutdown(). I haven't found it, though. El 29/11/10 12:53, Tom van Dijk escribió: Which service would that be? Could you provide a stack trace? Perhaps you could make your service contribute to RegistryStartup as well, to make sure the DbShutdownImpl service is realized and that the sessionSource is realized. The "startupService" would then be the registry startup method. I agree that modifying TapestryFilter is an ugly solution and should be avoided if possible. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: hibernatesessionmanager produces redundant exception
Well, the thing is that an injected Session is retrieved from the HibernateSessionManager. This service is a per-thread service, so every request (has a seperate, new thread and thus) has its own HibernateSessionManager. This service automatically starts a new transaction. (see also https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionManagerImpl.java) This basically makes sense, because usually what you want is a transaction per thread and transaction control using the HibernateSessionManager's control. It appears that what you want to do manual transaction management. Wouldn't it be an option to get a HibernateSessionSource injected and use that service (which is not per-thread, but global) to acquire sessions? That way, the HibernateSessionManager part will be skipped. You may be right that TAP5-137 still needs fixing. Apparently, the HibernateSessionManagerImpl assumes that it's the only one controlling transactions. I believe that when transactions are manipulated /outside/ of the HibernateSessionManagerImpl, this /may/ cause issues. Maybe a developer could look at it. Op 29-11-2010 19:50, Yury Luneff schreef: Greetings. I made a simple example playing with hibernate spatial / etc. I have following event handler on my page (tapestry 5.1.0.5): public void onClick() { Stop stop = new Stop(); WKTReader fromText = new WKTReader(); Geometry poly = null; Transaction tx = null; try { logger.debug("hello, world"); tx = session.beginTransaction(); poly = fromText.read("POINT(1 2)"); stop.setPoint((Point) poly); session.save(stop); tx.commit(); } catch (Exception e) { logger.error("exception: " + e.getMessage()); tx.rollback(); } finally { } } Where session is org.hibernate.Session injected as tapestry-hibernate-core provided. Every time this event handler is called i receive an exception: [WARN] TapestryIOCModule.PerthreadManager Error invoking listener org.apache.tapestry5.internal.hibernate.hibernatesessionmanageri...@1bab2a6: Transaction not successfully started org.hibernate.TransactionException: Transaction not successfully started at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:149) at org.apache.tapestry5.internal.hibernate.HibernateSessionManagerImpl.threadDidCleanup(HibernateSessionManagerImpl.java:65) at org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl.cleanup(PerthreadManagerImpl.java:86) at org.apache.tapestry5.ioc.internal.RegistryImpl.cleanupThread(RegistryImpl.java:344) at org.apache.tapestry5.ioc.internal.RegistryWrapper.cleanupThread(RegistryWrapper.java:36) at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:133) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) I suppose this is because playing with Session should be performed in services, but i'm not sure. What am I doing wrong? Why does HibernateSessionManager say "rollback" on transaction he doesn't know anything about? public void threadDidCleanup() { transaction.rollback(); session.close(); } There is a bug in JIRA about that (more or less): https://issues.apache.org/jira/browse/TAP5-137 The behavior of this example doesn't have anything to do with hibernate spatial, there is no exceptions i
Re: tapestry-hibernate, hsqldb and registry shutdown
Which service would that be? Could you provide a stack trace? Perhaps you could make your service contribute to RegistryStartup as well, to make sure the DbShutdownImpl service is realized and that the sessionSource is realized. The "startupService" would then be the registry startup method. I agree that modifying TapestryFilter is an ugly solution and should be avoided if possible. On Mon, 29 Nov 2010 21:06:50 +1100, Paul Stanton wrote: > same error, different service which can't be injected. > > On 29/11/2010 8:13 PM, Tom van Dijk wrote: >> What if you do this: >> >> public class DbShutdownImpl implements DbShutdown, >> RegistryShutdownListener >> { >> @Inject >> private HibernateSessionSource sessionSource; >> >> private final static Logger LOG = >> Logger.getLogger(DbShutdownImpl.class); >> >> @PostInjection >> public void startupService(RegistryShutdownHub shutdownHub) >> { >> // make sure session source is real >> sessionSource.getSession(); >> shutdownHub.addRegistryShutdownListener(this); >> } >> >> @Override >> public void registryDidShutdown() >> { >> LOG.error("shutdown called"); >> Session sess = sessionSource.getSession(); >> Transaction tr = sess.beginTransaction(); >> sess.createSQLQuery("SHUTDOWN").executeUpdate(); >> tr.commit(); >> sess.close(); >> } >> } >> >> >> >> >> >> Op 29-11-2010 6:28, Paul Stanton schreef: >>> Hi all, >>> >>> I'm using tapestry-hibernate and an embedded HSQLDB database. >>> >>> As you might know, it's important to tell HSQLDB to shutdown when you >>> are terminating the vm. >>> >>> You do this by executing a proprietary SQL query "SHUTDOWN" before >>> closing your last connection. >>> >>> Ideally I'd like to use hibernate to execute the SQL query since it >>> is already configured to connect to the database. >>> >>> Currently I am trying to do it like so: >>> >>> public class DbShutdownImpl implements DbShutdown, >>> RegistryShutdownListener >>> { >>> @Inject >>> private Session session; >>> >>> private final static Logger LOG = >>> Logger.getLogger(DbShutdownImpl.class); >>> >>> @PostInjection >>> public void startupService(RegistryShutdownHub shutdownHub) >>> { >>> shutdownHub.addRegistryShutdownListener(this); >>> } >>> >>> @Override >>> @CommitAfter >>> public void registryDidShutdown() >>> { >>> LOG.error("shutdown called"); >>> session.createSQLQuery("SHUTDOWN").executeUpdate(); >>> } >>> } >>> >>> However, I am getting the exception: >>> >>> java.lang.RuntimeException: Exception constructing service 'Session': >>> Proxy for service Session is no longer active because the IOC >>> Registry has been shut down. >>> at >>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78) >>> at >>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57) >>> at $Session_12c96175d35.delegate($Session_12c96175d35.java) >>> at $Session_12c96175d35.createSQLQuery($Session_12c96175d35.java) >>> at >>> mypackage.DbShutdownImpl.registryDidShutdown(DbShutdownImpl.java:29) >>> at >>> org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl.fireRegistryDidShutdown(RegistryShutdownHubImpl.java:57) >>> at >>> org.apache.tapestry5.ioc.internal.RegistryImpl.shutdown(RegistryImpl.java:411) >>> at >>> org.apache.tapestry5.ioc.internal.RegistryWrapper.shutdown(RegistryWrapper.java:41) >>> at >>> org.apache.tapestry5.TapestryFilter.destroy(TapestryFilter.java:169) >>> >>> I understand that the registry is shutting down and therefore won't >>> handle new requests for managed services. >>> >>> How do I get around this problem without creating my own JDBC >>> connection in my shutdown handler? >>> >>> Regards, p. >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: tapestry-hibernate, hsqldb and registry shutdown
What if you do this: public class DbShutdownImpl implements DbShutdown, RegistryShutdownListener { @Inject private HibernateSessionSource sessionSource; private final static Logger LOG = Logger.getLogger(DbShutdownImpl.class); @PostInjection public void startupService(RegistryShutdownHub shutdownHub) { // make sure session source is real sessionSource.getSession(); shutdownHub.addRegistryShutdownListener(this); } @Override public void registryDidShutdown() { LOG.error("shutdown called"); Session sess = sessionSource.getSession(); Transaction tr = sess.beginTransaction(); sess.createSQLQuery("SHUTDOWN").executeUpdate(); tr.commit(); sess.close(); } } Op 29-11-2010 6:28, Paul Stanton schreef: Hi all, I'm using tapestry-hibernate and an embedded HSQLDB database. As you might know, it's important to tell HSQLDB to shutdown when you are terminating the vm. You do this by executing a proprietary SQL query "SHUTDOWN" before closing your last connection. Ideally I'd like to use hibernate to execute the SQL query since it is already configured to connect to the database. Currently I am trying to do it like so: public class DbShutdownImpl implements DbShutdown, RegistryShutdownListener { @Inject private Session session; private final static Logger LOG = Logger.getLogger(DbShutdownImpl.class); @PostInjection public void startupService(RegistryShutdownHub shutdownHub) { shutdownHub.addRegistryShutdownListener(this); } @Override @CommitAfter public void registryDidShutdown() { LOG.error("shutdown called"); session.createSQLQuery("SHUTDOWN").executeUpdate(); } } However, I am getting the exception: java.lang.RuntimeException: Exception constructing service 'Session': Proxy for service Session is no longer active because the IOC Registry has been shut down. at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:78) at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:57) at $Session_12c96175d35.delegate($Session_12c96175d35.java) at $Session_12c96175d35.createSQLQuery($Session_12c96175d35.java) at mypackage.DbShutdownImpl.registryDidShutdown(DbShutdownImpl.java:29) at org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl.fireRegistryDidShutdown(RegistryShutdownHubImpl.java:57) at org.apache.tapestry5.ioc.internal.RegistryImpl.shutdown(RegistryImpl.java:411) at org.apache.tapestry5.ioc.internal.RegistryWrapper.shutdown(RegistryWrapper.java:41) at org.apache.tapestry5.TapestryFilter.destroy(TapestryFilter.java:169) I understand that the registry is shutting down and therefore won't handle new requests for managed services. How do I get around this problem without creating my own JDBC connection in my shutdown handler? Regards, p. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: ObjectProvider called to often
Hallo Sebastian, Well, you will always need the ObjectProvider, and it in turn will always need a number of services, either virtual or realized. Maybe there is a way to draw dependency diagrams so you can really see what is going on (but as far as I know, this information isn't available from the IoC right now, it's on my list of things to do and be excited about) But again, these services aren't actually instantiated yet; at least not until they are needed. Op 22-11-2010 22:20, Sebastian Hennebrueder schreef: Hi Tom, I wasn't surprised by the number of services to be prepared either as proxy or to be created. I just don't see a reason why the object provider which I add as last provider is called for framework internal services. There is just no need to call it at all for those services. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: ObjectProvider called to often
And obviously, I meant "every service that it somehow depends on" instead of the other thing which is not true. Op 22-11-2010 0:34, Tom van Dijk schreef: Well, no, you will see that a lot of services depend on each other, so in order to create an object that just happens to depend on stuff like object providers, many other services need to be created. This is not an inefficiency in Tapestry (The services are first only "virtual" before they are realized) but it may be that the lifecycle it not efficient in guice/tapestry integration as it is in tapestry. When you ask for a service, every service that somehow depends on it (via field/constructor initialization) is created as a VIRTUAL object. Then when they are actually used (you call a method) they are REALIZED (by the virtual proxy object). This is why it's not inefficient to create all these virtual proxies. That part is easy. And when they are actually used, well, then you need to have the realized object anyway, so it's still efficient. Op 21-11-2010 23:59, Sebastian Hennebrueder schreef: Hello, I added an object provider to integrate the Guice IOC Framework. Though I have added it at the end, it is called for many Tapestry related pieces. Is this not a very big inefficiency? my integration stuff in AppModule public static void contributeMasterObjectProvider(OrderedConfiguration configuration) { configuration.add("GuiceObjectProvider", new GuiceObjectProvider(), "after:*"); } Here is the list of services asked to build: 23:56:54,194 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.PipelineBuilder 23:56:54,224 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.PropertyShadowBuilder 23:56:54,243 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.RequestGlobals 23:56:54,263 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.ApplicationGlobals 23:56:54,270 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ChainBuilder 23:56:54,275 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Environment 23:56:54,280 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.StrategyBuilder 23:56:54,285 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.PropertyAccess 23:56:54,293 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Request 23:56:54,311 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Response 23:56:54,318 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.EnvironmentalShadowBuilder 23:56:54,323 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.EndOfRequestEventHub 23:56:54,335 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.DefaultImplementationBuilder 23:56:54,345 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.TypeCoercer 23:56:54,346 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.ComponentClassResolver 23:56:54,362 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Request 23:56:54,384 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.ComponentInstantiatorSource 23:56:54,389 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.UpdateListenerHub 23:56:54,407 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.RequestGlobals 23:56:54,408 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.ComponentClassTransformer 23:56:54,412 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.InternalRequestGlobals 23:56:54,417 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ClasspathURLConverter 23:56:54,434 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.ComponentInstantiatorSource 23:56:54,435 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ClassNameLocator 23:56:54,445 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ClasspathURLConverter - To unsubscribe, e-mail: users-unsubscr...@t
Re: ObjectProvider called to often
Well, no, you will see that a lot of services depend on each other, so in order to create an object that just happens to depend on stuff like object providers, many other services need to be created. This is not an inefficiency in Tapestry (The services are first only "virtual" before they are realized) but it may be that the lifecycle it not efficient in guice/tapestry integration as it is in tapestry. When you ask for a service, every service that somehow depends on it (via field/constructor initialization) is created as a VIRTUAL object. Then when they are actually used (you call a method) they are REALIZED (by the virtual proxy object). This is why it's not inefficient to create all these virtual proxies. That part is easy. And when they are actually used, well, then you need to have the realized object anyway, so it's still efficient. Op 21-11-2010 23:59, Sebastian Hennebrueder schreef: Hello, I added an object provider to integrate the Guice IOC Framework. Though I have added it at the end, it is called for many Tapestry related pieces. Is this not a very big inefficiency? my integration stuff in AppModule public static void contributeMasterObjectProvider(OrderedConfiguration configuration) { configuration.add("GuiceObjectProvider", new GuiceObjectProvider(), "after:*"); } Here is the list of services asked to build: 23:56:54,194 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.PipelineBuilder 23:56:54,224 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.PropertyShadowBuilder 23:56:54,243 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.RequestGlobals 23:56:54,263 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.ApplicationGlobals 23:56:54,270 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ChainBuilder 23:56:54,275 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Environment 23:56:54,280 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.StrategyBuilder 23:56:54,285 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.PropertyAccess 23:56:54,293 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Request 23:56:54,311 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Response 23:56:54,318 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.EnvironmentalShadowBuilder 23:56:54,323 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.EndOfRequestEventHub 23:56:54,335 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.DefaultImplementationBuilder 23:56:54,345 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.TypeCoercer 23:56:54,346 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.ComponentClassResolver 23:56:54,362 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.Request 23:56:54,384 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.ComponentInstantiatorSource 23:56:54,389 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.UpdateListenerHub 23:56:54,407 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.services.RequestGlobals 23:56:54,408 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.ComponentClassTransformer 23:56:54,412 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.InternalRequestGlobals 23:56:54,417 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ClasspathURLConverter 23:56:54,434 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.internal.services.ComponentInstantiatorSource 23:56:54,435 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ClassNameLocator 23:56:54,445 DEBUG GuiceObjectProvider:24 - guice asked to provide: interface org.apache.tapestry5.ioc.services.ClasspathURLConverter - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5.2.2 IOC: Non public service implementations
I think there is a problem with invoking constructors of package private classes. There would be IllegalAccessExceptions. On Thu, 4 Nov 2010 14:37:21 +0100 (MET), "nille hammer" wrote: > Hi List, > > long time no write. > > I have got used to defining a public interface for my services paired with > a package-private implementation. Tapestry's autobinding with ServiceBinder > complains about the implementations not being public. I do not want to make > the implementations public. So I am afraid I will have to write builder > methods in the Module class. Can someone confirm that or perhaps show me a > way to use autobinding with non public implementations? > > Thanks in advance, > nillehammer > > == > http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org