Core J2EE Patterns - ActionMap XML

I am reading through Core J2EE Patterns and I'm confused about a coupel fo thing and hoping someone can shed some light for me.
1. I'm confused on how to actually implement the Map, refered to on page 208, which hold references to handles that represent target resoruces.
2. In the example micro-architecture in chapter, page 603, references an XML file called HireEmployeeActionMap.xml. I believe this to be the action mapping file, but it's not clear how it is used. More imortant, the class in example 9.4 simply has a coment that I should "Get real commandstring from mapfile usign Action", while being helpful that it is included, is not so helpful if you don't actually know how to go about reading this XML file.
More to the point, here is my task:
I have a servlet (existing code from someone else) that I am going to refactor and make more expandable by implementing some of the J2EE patterns I've been reading about. My understanding of the patterns is varied, of course.
This servlet does one basic thing. It accepts an HTTP transaction from an app that sends it request parameters (liek a form) to perform a specific transaction, of which there are about 12. Each transaction requests a different task to be peformed, of course. Speifically, data lookups in a various enterprise system or placing requests into various system queuss and such.
Right now this sevlet has a huge if/else block checking for each transaction ID sent in the parameters and then calls a method to handle that transaction (calling delegates, facades, and services in the down path).
I'd like to refactor this so that I have an CommandMapper that uses an CommandMap to map out each transaction ID to an Command class specific to that transaction. This way, I can write the application controller once and then when new transactions are needed, I simply add the new comand to the CommandMap XML file and add the new Command class (and delegates, facades, ejbs, etc.) and I'm done. No regression testing on the other transactions because there was no core code modified.
So I went looking for exmaples of how to implement CommandFactory and CommandMap and I'm stumped. I also can't find any good examples of reading an XML file for this purpose. Any help would be greatyl appreciated.

One more thought: my questions above have nothing to do with the classes and interfaces found in javax.activation. I'm going from the book mentioned above.

Similar Messages

  • Welcome to this forum on "Core J2EE Patterns" by the Sun Java Center

    Welcome to this forum on Core J2EE Patterns by the Sun Java Center!
    CONTEXT:
    This forum is intended for discussing the patterns from the Sun Java Center J2EE Pattern Catalog and other topics discussed in our book, Core J2EE Patterns.
    We, the authors of the book, welcome you to this forum.
    WHO WE ARE:
    We are Enterprise Java Architects from the Sun Java Center (SJC), which is the Java consulting organization of Sun Microsystems. We are a world-wide group of architects focusing on all consulting related to Java technologies.
    Visit our web-site for more information on SJC:
    http://www.sun.com/service/sunps/jdc/index.html
    BACKGROUND:
    Over the last few years, we at SJC have worked with our customers in architecting, designing, and implementing solutions on the J2EE platform. We have worked on documenting the J2EE patterns for over two years and released the patterns for public review in Beta form via the Java Developer Connection in May, 2001.
    The beta version of the patterns is available online as The Sun Java Center J2EE Pattern Catalog at:
    http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/
    Subsequent to the release, we received great feedback and comments from hundreds of reviewers. We then worked towards incorporating the feedback into the pattern documentation. One of the common comments was about the lack of code examples in the online documentation. The latest pattern documentation provides many code examples and incorporates all the feedback received so far.
    BOOK INFORMATION:
    Core J2EE Patterns, the book, was released at JavaOne 2001 during June 4-9, and will be available in stores around the end of June 2001.
    The book includes the complete updated Sun Java Center J2EE Pattern Catalog with 15 patterns covering these J2EE technologies: Java Server Pages (JSP), Servlets, Enterprise JavaBeans (EJB), and Java Message Service (JMS). In addition to the J2EE Pattern Catalog, the book also provides other chapters that discuss design considerations,
    bad practices, and J2EE Refactorings. Example code is included for all patterns and strategies.
    If you wish to view the complete table of contents or order the book, please visit one of the following online bookstores:
    Fatbrain.com: http://www1.fatbrain.com/asp/bookinfo/bookinfo.asp?theisbn=0130648841
    Amazon.com: http://www.amazon.com/exec/obidos/ASIN/0130648841
    COMMUNITY:
    The online community for discussing the patterns included in our book Core J2EE Patterns has grown over the past year, since our first presentation at JavaOne 2000. This community is supported by our LISTSERV and is available for public participation at:
    http://archives.java.sun.com/j2eepatterns-interest.html
    You can view the past discussions on this list at the above URL.
    FORUM LOGISTICS:
    John and Dan are on the east coast and Deepak is on the west coast. We will be tuned into the forum and answering the messages periodically between June 19 and June 25, 2001. If you want to discuss the J2EE Patterns after June 25, you are invited to join the aforementioned J2EE Patterns Interest list.
    FORUM DISCLAIMER:
    All responses to questions posed in this News Group are given on an "as is" basis. We believe the solutions or explanations given here are correct, but do not guarantee that responses will be complete, without error and/or work for all platforms and system configurations.
    The forum is now open! Let the discussion begin...
    John Crupi - Chief Java Architect
    Dan Malks - Enterprise Java Architect
    Deepak Alur - Enterprise Java Architect
    ---Authors of Core J2EE Patterns

    Rajakannan,
    There are numerous ways to implement a templating mechanism in support of the composite view pattern, included in the catalog as a presentation-tier pattern.
    The goal is to avoid simply having monolithic views with all the formatting code embedded directly withing the view. If we have common subviews that are shared across several or more views then we end up with a copy-and-paste type of reuse...undesirable. So, modularity is one issue. Another major force when considering the Composite View pattern is that we may want to manage the layout of our pages and the content of our pages separately. We may have some logical regions defined, such as a search panel and main body, and a subview that plugs into those logical regions that map to a physical page (ie: x.jsp and y.jsp). We may then want to vary one independent of the other...ie: we may want to modify the layout of the page w/o changing the content and we may want to vary the content w/o touching the layout.
    There are a number of implementation strategies that can be used to implement the Composite View pattern, ranging from relatively simple to much more sophisticated. We describe each in our book and include source code examples.
    The example in the book that allows for supporting all the issues described above is implemented using the "Custom Tag View Management Strategy" and uses a tag library written by David Geary, that supports the Composite View pattern. The library is also included in David's new book, Adv. JavaServer Pages, Prentice Hall, 2001.
    Again, it's simply one implementation and, as you mention, there are many different ways to implement this strategy.
    Thanks for your question,
    Dan

  • The "ValueList Handler" pattern in "Core j2ee patterns(2nd ed)"

    In the book "Core j2ee patterns(2nd ed)", it suggests that the "ValueList Handler" pattern can be used when the resultset from database is huge.
    Basically, this is what it will do:
    1) obtain a resultset from database query
    2) cache the full resultset using a valueList
    3) create a subList from the valueList
    4) present the subList to the front end
    To me, caching the full resultset in a valueList is no different from sending the full resultset to the front end. Both of them wasted a lot of resources. I am wondering why anyone would want to do the step(2) above. Why don't we go from (1) to (3) directly since we usually know which subset of the results the users are interested in even before we do the query.

    Hi
    Same problem I also need to clarify. Please some one
    explain in detail which approach give high
    performance.
    BR
    SenakaExactly, I don't understand why that "ValueList Handler" pattern qualified itself as a j2ee pattern since it has so much negative perfomance impacts.
    On a website like Amazon, thousands of queries are performed daily. To cache the full resultset of every query simply wouldn't work.
    I think the most efficient way is to write a disconnected resultset so it won't tie to the database. The disconnected resultset will only contains those data to be display on the front end.
    I would really like to see somthing like the following in the JDBC API.
    ResultSet rs = null; // some resultset
    ResultSetFilter filter = null;  // a filter to filter resultsets
    // obtain a disconnected resultset from java.sql.ResultSet
    DisconnectedResultset drs = DisconnectedResultset.filter(rs, filter);
    // close the original resultset
    rs.close();In the above, anything that meets the condition specified in the filter will be stored in the disconnected resultset. After we created a disconnected resultset, it is safe to close the original resultset to release any database resources.

  • Question of using Struts for the J2EE pattern

    I am now using Struts for the development. I have 3 questions about J2EE
    pattern by the use of Struts:
    1) How can I use Struts to create the Front Controller? In the book
    descibing Front Controller, it is a servlet file which receives the request
    and then dispatches to the appropriate view according to the request.
    However, in using Struts, should I use the same way? However, I found that
    in using Struts, I can call the controller class which subclass
    ActionServlet, all the views forwarded are declared in the
    struts-config.xml. Am I right in this method?
    2) In the project, there is a Front Controller which dispatches the request
    to the appropriate view (jsp file). Of course, I use Struts to do this.
    However, I expect that the user is impossible for going to the view (jsp
    page) directly by typing the address of the jsp file. I hope that the user
    can go to the view through the controller only. How can I do this?
    3) There is a problem by using browser - when a user browses a site, he can
    press the 'back' button to the previous page, and then click the 'forward'
    button also. How can I prevent this by using Struts? I found that in some
    sites, when the user clicks the 'back' button, an error page displays. How
    can I do this? Thanks!
    Many Thanks!
    Stephen

    I'll take a stab at number 2 and number 3.......
    2) You could have the controller object place a "flag" in the request that is dispatched to the JSP. Make the JSP check for that flag to ensure that this request came from the controller object. If the request comes from anywhere other than the controlle object, you can display an error page, or you could redirect them back to the controller. You could also use the HTTPSessionObject to place flags for users and have the JSP check there.
    3) Keep a log of the user's activities in the HTTPSession. Whenever a page is invoked, have it check to see if the user has already been here, and if it is appropriate for the user to be here again.
    Hope this helps!!
    I'm not really a java programmer, I just play one on TV.

  • How to design using J2EE pattern?

    I am new to J2EE and I would like some ideas on how I should design the following system in J2EE pattern. I am required to use JSP pages + EJB to implement a very simple online shopping system. And I already created the following classes:
    This is the EJB object interface.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public interface ShoppingSystem extends EJBObject {
         public boolean LoginAsCust(String id,String pwd) throws RemoteException;
         public boolean LoginAsAdmin(String id,String pwd) throws RemoteException;
         public Vector getMusicCategories() throws RemoteException;
         public Vector getCategoryItems(String category) throws RemoteException;
         public MusicRecording getMusicRecording(String id) throws RemoteException;
    }This is the home interface.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    public interface ShoppingSystemHome extends EJBHome {
         public ShoppingSystemHome create() throws RemoteException, CreateException;
    }This is the session bean objects.
    package assignment;
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public class ShoppingSystemBean implements SessionBean {
         // data item to hold a reference to a passed Session context
         private SessionContext ctx;
         // save the session context
         public void setSessionContext(SessionContext x) { ctx = x;}
         // the various method implementations
         // imposed on us by interface
         public void ejbCreate() {}
         public void ejbActivate() {}
         public void ejbPassivate() {}
         public void ejbRemove() {}
         public boolean LoginAsCust(String id,String pwd) throws RemoteException{
         public boolean LoginAsAdmin(String id,String pwd) throws RemoteException{
         public Vector getMusicCategories() throws RemoteException{
         public Vector getCategoryItems(String category) throws RemoteException{
    public MusicRecording getMusicRecording(String id) throws RemoteException{
    }I will probably need to create a shopping cart class and a database accessor class. What I would like to know is , do I need to divide the shopping cart class into three components: Home interface, EJB object interface, SessionBean object.
    Please give me some ideas on how I can develop this system using EJB. (This is just a school assignment)
    Thanks.

    know is , do I need to divide the shopping cart class
    into three components: Home interface, EJB object
    interface, SessionBean object.Shopping cart is a typical example of a stateful session bean. So you need to write a session bean. And, of course, every session bean consists of three things: remote interface, home interface and bean class.
    Please give me some ideas on how I can develop this
    system using EJB. (This is just a school assignment)In this case you can tell them to fuk off.

  • Error converting j2EE-Specific ejb xml to object representation

    I am trying to webservice using Sun one. I got four entity beans and two sessions. I exposed the business of the session beans as webservice function.
    I tested the individual sesion beans they are working fine.
    When I created a webservice, and when I am trying to deploy the web service the follwing error occured.
    I tried to run the verrfier tool, but is not loading the file...it s getting stucked up.
    Here,
    BSApp -- J2ee application in which webservice is included
    BSManagerContrl --- is one of the two session bean which i created
    Book -- is the entity bean
    I also checked the module of the session bean to verify whether i included the Book enity bean or not. Other wise I would i successfully tested the session bean.
    Thank you
    [b][b]Deployment Error -- Error while running ejbc -- Fatal Error from EJB Compiler -- Failed to load
    deployment descriptot for BSApp
    Cause: Error converting j2EE-Specific ejb xml to object representation
    BSManagerContrl_EJBModule.jar
    app_BSApp BSManagerContrl_EJBModule
    Referencing error: This bundle has no bean of name [Book]
    <ejb><ejb-name>Book</ejb-name><jndi-name>ejb/Book</jndi-name><pass-by-refernece>false</pass-by-reference><cmp><mapping-properties>

    Hi parsuram,
    Its not coming up anymore. All i did was re-map the table under Sun AS Mappings under properties for the EJBModule. Its really strange. Thanks a lot for your concern. I really appreciate it.

  • J2ee patterns

    Hi, anyone can tell me wich j2ee patterns are really necessary to learn, I'm asking so coz there many patterns already implemented in many framework. which of those should I learn for my future applications, thanx...

    ramesh_bhojan wrote:
    Well, all the design patterns are unique and may have their own advantages.....
    However, as a beginner u may concentrate on Singleton pattern(which is actually a creational pattern) and the Factory Pattern.(The Factory Class)...
    going forward.... u may learn bout the other design patterns available... as all of them are interesting in some way or other...Singleton has been largely discredited:
    http://code.google.com/p/google-singleton-detector/
    %

  • Cor design pattern

    I use cor design pattern little different than what I see in google.
    here is m y cor
         public static  abstract  class CORHandler    {
              CORHandler  nextHandler;
              public void process(){
                   if(canHandleRequest()){
                        handleRequest();
                   }else {
                        if(nextHandler!=null) nextHandler.process();
              protected abstract  boolean canHandleRequest();
              protected abstract void  handleRequest();
              public void setNextHandler(CORHandler  corHandler){
                   nextHandler=corHandler;
         }this serves most of my need and also I can override process method for change behaviour .
    this code helps me save lots of if/else conditions , I am not passing any object to the method here reason is I use this always as inner class inside a method so I can access all final fields
    advice me is this right when applying cor pattern?

    Making it a base class increases connectivity to no good purpose.
    It violates the concept of inheritance by making the objects COR classes which is not what they are.
    It violates the principal of COR in that the intent is to handle a responsibility not all responsibilities. This same problem obscures the pattern as well by eliminating the objects to be acted upon.

  • Exposing J2EE services as  XML

    We are planning to expose our business systems to our partners through XML based
    API. What are the options do I have?.
    I don't need WSDL or UDDI as our partner's are of limited number.
    We are looking at SOAP, XML-RPC. I am looking at weblogic web services, glue and
    ClearCase.
    Has anybody done production grade system exposing XML API on J2EE platform.?.
    What technologies did they use?.
    Thanks,
    Nilesh Shah

    We are planning to expose our business systems to our partners through XML based
    API. What are the options do I have?.
    I don't need WSDL or UDDI as our partner's are of limited number.
    We are looking at SOAP, XML-RPC. I am looking at weblogic web services, glue and
    ClearCase.
    Has anybody done production grade system exposing XML API on J2EE platform.?.
    What technologies did they use?.
    Thanks,
    Nilesh Shah

  • Display and Edit Patterns in XML Tags

    Using LiveCycle E2 V9.
    The display and or Edit Patterns are not reflected in the XML of a submitted form.
    While these display properly on the Adobe form on-screen, e.g.
    $150,000.00 when the fields are are submitted the XML tag as reflects 150000.000000
    Please advise whether there is something that I am doing incorrectly and or a fix for this?
    Thank you!

    Formatted displays for numbers is never the same as the actual field value. This approach allows a user to see a formatted numeric value but the data remains as a number in floating point, integer, or binary value for further calculations as a number. If this were to change, then one would need to parse the numeric value as a character string back to a numeric value before performing any calculation.
    There are specific forums for LiveCycle Designer.

  • Pulling validation pattern from XML schema in LCD

    Hi team,
    We have deisgned a fillable PDF form uding Live Cycle Designer ES2.
    The form contains fields of different data types.
    We have created a data connection on the form (using LCD) to bind it to a XML Schema
    The XML schema has different types of validations for different data types.
    When we treid to bind the XML schema to PDF form using LCD, most of the validations were pulled in. Example, numeric lenghth check, string length check, minoccurs , maxoccurs
    But few validations were not pulled from Schema like Pattern validations on string.
    Please guide us on how to achieve this using LiveCycle Designer ES2.
    Cheers,
    Kavi

    Hi Kavi,
    The pattern from the XML Schema can not be automatically copied across, I assume because of the differences in the XML Schema pattern regex and a JavaScript regex.  If you did use a compatible subset I you could write a macro to add the pattern to the validation event.  One difference is a XML Schema pattern always assumes a ^  and $ to match the beginning and end.  Have you seen this document http://partners.adobe.com/public/developer/en/livecycle/lc_designer_XML_schemas.pdf,
    Regards
    Bruce

  • New J2EE Pattern

    Introducing Shine Pattern
    A brief history of Shine
    When we started to do a project we encountered an important problem. Developing a project with amateur developers is very dangerous. Because new developers don't care about some important things, and if the project manager, technical architect or head developer don’t care about those points, the project will fail.
    In 2008 the university manager to assess the student progress situation wants them to develop an enterprise project. Because most of students haven’t enough experiences in implementing software project, we did primary analysis and during implementing project we try to don't help them. Unfortunately output of the project was re-programming the project. This problem kept our mind busy for a long time until we try to create a standard and comprehensive pattern for completing a project. After doing this job we do many enterprise projects with this pattern and the result was 50% saving time of developing and extending the project. So we decided to offer this pattern for developers in SourgeForge website.
    The problems which make the projects to are:
    •     Not to follow a standard architecture
    •     Not to care about naming rules in forms, classes, pages...
    •     Creating useless classes in frameworks such as Struts, Spring and also JSF
    •     Using complexity classes
    •     Implementing logic layer in the UI layer
    •     Plethora of dependency on UI
    •     Gaffes of web designer
    •     Creating meaningless pages
    •     Not to care about security points
    •     Creating complexity in distributed application on the network by using RMI, Corba, JMS
    •     Plethora engaging with frameworks XML adjustments
    Shine's parts
    Shine pattern has been developed for variety of application. This pattern has these parts:
    •     Maplet: a framework for doing web projects which are coincidence with MVC architecture. This framework helps developers to follow a standard pattern for developing a web application. Maplet helps developers to save time of developing and extending.
    •     JShooter: a framework that makes reflects oriented programming an easy job for developers. Meanwhile it helps distributing application on the network.
    •     JConnection: This package helps developers to work with JDBC and Hibernate easier than before.
    •     Util: This package helps developers in these subjects:
    1-     File System
    2-     Runtime
    3-     Compiler
    4-     System Information
    5-     Web Socket
    6-     MD5
    7-     Thread
    8-     Validation
    9-     XML Parsing
    10-     Web uploading
    Suggestion
    Our suggestion is that before producing any new part for your application search our Util package. There are lots of classes in this package that help you in different fields. This package will be developed by java open source developers in every version of Shine.

    thanks for share.i like it . http://www.usedconecrusher.com
    Edited by: 783365 on 2010-7-20 下午6:23

  • OC4J j2ee data-source.xml

    Hi Friends,
    I am very confused with lots of ORACLE_HOME in EBS :(
    Where do I find the PATH directory where the data-source.xml is located for
    the installed OC4J/j2ee. Can you call it as $J2EE_HOME or $OC4J_HOME?
    Thanks a lot

    If you are integrating BAM to EBS via BPEL Sensors, you create the connection in the Enterprise Manager tool or modify oc4j-ra.xml on the SOA Suite:
    Oracle Application Server Adapter for Oracle Applications User's Guide
    Configuring Connection Information
    http://download.oracle.com/docs/cd/E10291_01/doc.1013/e05440/T430238T430340.htm#T464886

  • J2EE pattern

    Hi,
    Is there any newsgroup for J2EE design patterns.
    TIA
    -VSK

    This may interest you:
    http://www.theserverside.com/discussion/index.jsp
    VSK wrote:
    Hi,
    Is there any newsgroup for J2EE design patterns.
    TIA
    -VSK

  • Applying REGEX-pattern into XML File

    I have the following problem:
    I have an xml-file. let's say...
    <NODE><NODE1 attr1="a1" attr2="a2">
         <NAME> abc</NAME>
         <VERSION> 1.0</VERSION>
    </NODE1>
    <NODE2 attr1="a3" attr2="a4">
         <NAME> xyz</NAME>
         <VERSION> 3.1</VERSION>
    </NODE2></NODE>I need to know "HOW can I get the values of <NAME></NAME> and <VERSION></VERSION> without using DOM.
    Since my xml-file is pretty big and DOM will take much Memory, i want to avoid it.
    Can anybody suggest some "Regex pattern" so that i can apply it on the xml-file (after converting into String)
    Thanks in Advance

    That worked perfectly. I assumed ( insert comment here ) that the members of the Properties objects were Strings, and therefore followed the same rules where "\" characters are concerned.
    Thank you for pointing out the difference between the two objects, I am not sure how long it would have taken me to figure that out.
    Regards,
    John Gooch

Maybe you are looking for

  • How to create custom profile provider for fba user

    Hello Every One   I have one SharePoint 2010 web application and on this FBA is configured. With help of code how can I get and set custom property for a user in  "aspnet_Profile" table in Database. I have also try this config setting in web.config b

  • Single user mode locks up hard

    Is anyone else having this type of problem? I had it with both Panther and now also with Tiger. I've filed a bug on this with apple, but they closed it citing the usual "you have third party ram" argument. The ram has zero issues with anything else a

  • Display filesystem in Webdynpro Java Tree UI

    Hi, I want to display a filesystem structure and its files in a Webdynpro Java Tree UI. I am using Netweaver CE 7.11. The root node of this tree should be the local filesystem on C:\ or a network share for example, which the users can browse and sele

  • DB13 error: permission denied

    hi all, We want to take backup of our Production server through DB13. but when we start backup it generate error " 11/2/2010     1:15:13 PM     Job started 11/2/2010     1:15:13 PM     Step 001 started (program RSDBAJOB, variant &0000000000010, user

  • MacBook Pro don't remember my wireless network

    i have restored my mac from backup. and my airport don't remember my wireless network... what should i do? any suggestions? Thanks