RE: RE: Event Processing at servlet startup..
Kirk Daries <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <D09B591872D1D611AF2B0010B5A1AAD07BE4A3@WCSMAIL> |
Hi Jake, >>You mean besides ApplicationGateway? Oops. That was a bit unclear. I mean only one ApplicationGateway for the entire system. All requests for ALL the applications are routed through it. Exactly what a controller is supposed to do. >>This is one-time setup, right? Correct, this a one time setup only. At the moment, Id just like to set some static variables that will be used by database operations. It's read from our configuration db table(a seed table) which we use to map logical names to key values in foreign key tables. In the future... I might need to add some futher functionality to the 'startup event' >> Or is it set up per/user? I use the barracuda event hierarchy to do this. I've created listeners which fire when a user logs in. >This is one-time setup, right? Or is it set up per/user? If the former, then why not use a servlet context listener? Any setup done in contextInitialized() is *guaranteed* by the servlet spec to be available >before any requests are taken by servlets. That also separates the setup from the rest of your system so the rest of your app need not know anything about it except that they will just assume that some >other process made the resources available. I'll look into creating using 'contextInitialized'. At the moment.. we'll be using Tomcat 3.3 in production. I hope it has this facility. Regards KD -----Original Message----- From: Jacob Kjome [mailto:[email protected]] Sent: 17 June 2003 03:48 To: [email protected] Subject: RE: [Barracuda] RE: Event Processing at servlet startup.. At 08:50 AM 6/17/2003 +0200, you wrote: Since each developer is responsible for 1 or more applications, we rely on the functionality I added to ApplicationAssembler which allow's multiple processing of the assembler xml files. This way... developers can work in the proverbial little black room and not have to worry about/have to wait for other developers. Once we deploy to test/production. The latest source is obtained from cvs and deployed to the correct context dir. Upon servlet startup, the application assembler processes everyone's assembler files. Just wanted to note that Barracuda1.2.0 loads multiple application assembler files in a non-File IO way but only supports that under servlet 2.3. So, if you are using any modern Servlet environment, things should work for you in the same way as it did with your previous changes, except that it will work in a perfectly servlet-spec compatible way. Applicable release notes are from... http://www.barracudamvc.org/Barracuda/docs/changes.html <http://www.barracudamvc.org/Barracuda/docs/changes.html> <quote> DefaultApplicationAssembler no longer uses File IO to load configuration files. This makes Barracuda more inline with the servlet spec which provides no guarantee of access to the file system within a webapp. This means Barracuda should successfully deploy directly from a .war file. Additionally, DefaultApplicationAssembler will now load multiple assembler files (under servlet-2.3) given a pattern to match such as '/WEB-INF/event-' or '/WEB-INF/event*.xml'. </quote> You could also have these all in a directory such as /WEB-INF/assemberfiles/ . Just don't forget to add the trailing slash if you do that. Now.. to get to your question. We have only one servlet for the entire system. It's generic and know's nothing about the system. You mean besides ApplicationGateway? All it's know's is to load any config files it finds and does the setting up. Database pooling, and what ever it finds. Now. What I'd like to do... is to be able to set static variables based on database information. E.g. <ACTUAL CODE SNIPPET HERE> public static int STATUS_NOT_OPEN; public static int STATUS_BUDGETING_ONLY; public static int STATUS_BUDGETING_AND_PAYMENTS; public static int STATUS_POSTING_ONLY; public static int STATUS_FROZEN; public static int STATUS_CLOSED; public static int ACTION_INITIAL; public static int ACTION_ADJUSTMENT; public static int ACTION_TRANSFER; Remember.... These variables are set based on a few database tables and their key values. Each Application requires this sort of setup. However, since our servlet know's nothing about any of the applications.... Up till now... I've had to hack it abit. When the very first user log's in. I check to see if the static variables are setup. If not.. I load them. Each application has a Login_listener which is mapped to the login event. It's not Ideal as far as I'm concerned. That's why I'd like to have some sort of startup event fired which notifies all applications that they can now start processing their own initialization. I hope that makes sense. This is one-time setup, right? Or is it set up per/user? If the former, then why not use a servlet context listener? Any setup done in contextInitialized() is *guaranteed* by the servlet spec to be available before any requests are taken by servlets. That also separates the setup from the rest of your system so the rest of your app need not know anything about it except that they will just assume that some other process made the resources available. The object respository assembler should actually be a servlet context listener IMO. Jake