Question about commond pattern

Hi!
can somebody tell me about any good resource where i can get knowledge of designing controller on basis of command pattern and an example will help me a lot....
I want to develop a controller for my application which except's data from swing client and calls the appropriate business components (session beans) to perform the requested task , asked by customer.....
Also i need to design Factories for my objects and need good resource to get started from....
thanx in advance
sajjad ahmed paracha

Also take a look at Struts on apache.org. You can either use Struts directly or, if you want to develop your own, look at how they architected things as a starting point.
- Saish

Similar Messages

  • Questions about DAO pattern

    Hi,
    I am a junior programmer and I am trying to understand somewhat more about best practices and design patterns.
    I am looking for more information regarding the DAO pattern, not the easy examples you find everywhere on the internet, but actual implementations of real world examples.
    Questions:
    1) Does a DAO always map with a single table in the database?
    2) Does a DAO contain any validation logic or is all validation logic contained in the Business Object?
    3) In a database I have 2 tables: Person and Address. As far as I understand the DAO pattern, I now create a PersonDAO and an AddressDAO who will perform the CRUD operations for the Person and Address objects. PersonDAO only has access to the Person table and AddressDAO only has access to the Address table. This seems correct to me, but what if I must be able to look up all persons who live in the same city? What if I also want to look up persons via their telephone numbers? I could add a findPersonByCity and findPersonByTelephoneNumber method to the PersonDAO, but that would result in the PersonDAO also accessing the Address table in the database (even though there already is an AddressDAO). Is that permitted? And why?
    I hope someone can help me out.
    Thanks for your time!
    Jeroen

    That is exactly what I am trying to do. I am writing it all myself to get a better understanding of it.
    Please bear with me, because there are some things I dont understand in your previous answer.
    1) Each BO validates his corresponding DTO and exposes operations to persist that DTO. Each DTO will be persisted in the database via his corresponding DAO. So this would be:
    - in PersonBO
    public void save(PersonDTO personDTO) {
    this.validate(personDTO); // does not validate the nested address DTOs
    this.personDAO.save(personDTO); // does not save the nested address DTOs
    - in AddressBO
    public void save(AddressDTO addressDTO) {
    this.validate(addressDTO);
    this.addressDAO.save(addressDTO);
    Am I viewing it from the right side now?
    2) Imagine a form designed to insert a new person in the database, it contains all fields for the Person DTO and 2 Address DTOs.
    How would I do this using my Business Objects?
    This is how I see it:
    // fill the DTOs
    daoManager.beginTransaction();
    try {
    personBO.setDao(daoManager.getDao(PersonDAO.class));
    personBO.save(personDTO); // save 1
    addressBO.setDao(daoManager.getDao(AddressDAO.class));
    addressBO.save(personDTO.getAddress(1)); // save 2
    addressBO.save(personDTO.getAddress(2)); // save 3
    daoManager.commit();
    catch(Exception e) {
    daoManager.rollBack();
    If I insert the transaction management inside the DAOs, I can never rollback save 1 when save 2 or save 3 fail.
    It can be that I am viewing it all wrong, please correct me if that is the case.
    Thanks!
    Jeroen

  • Question about bridge pattern

    its definition is "decouple an abstraction from its implementation so that the two can vary independently". I don't understand what "abstraction and the implementation vary independently" really mean and how .
    Before another question pls see the below class diagram of bridge pattern:
    http://images.cnblogs.com/cnblogs_com/zhenyulu/Pic91.gif
    My question is whether not using abstraction and just keeping implementation hierarchy can do the same thing? Interface and its implementation itself(polymorphism) can make extending easily and be well subject to open-closed principle,can't they?
    Sorry for my bad English.
    Edited by: fxbird on 2011-7-17 上午5:13

    fxbird wrote:
    jschell wrote:
    fxbird wrote:
    I think it's very common in j2ee development. Certainly isn't if someone is using a container.
    If someone is creating a container then I would suspect that such a pattern might be useful.
    However if someone is creating a container then there are going to be a lot of useful patterns. And lot of classes as well.
    And in total of the entire scope of creating a container the bridge would be a very small part.
    So it certainly isn't going to be "common".Hello jschell , what do you mean by 'container'? You phrased your comment about J2EE. A common idiom is to refer to a J2EE (actually newer name is JEE) server as a JEE container. Not sure why specifically that word is used but maybe because such servers are said to 'contain' applications.
    In my previous reply, the architecture I mentioned is ss(spring+struts2.x),the pattern I mentioned is a standard way. You either do not understand what I said or you do not understand what happens in those implementations.
    If I have 100,000 classes and 3 of them are implementing the bridge pattern then it is not "common".
    If I have 100,000 classes and 3,000 of them implement many bridge patterns (and not generated) then one could say it is "common".
    And having done some JEE applications I seriously doubt there is an implicit need to use the bridge pattern.
    The bridge pattern is intended to deal with a complex situation. Since there are more simple JEE applications than complex ones then it seems unlikely that there is a "common" need for it in JEE applications.
    Actual I've not been understood why it's used this way---define business interface, from my perspective, it doesn't have to define it, simply writing a business class and calling dao method is enough. I assume bo interface thing is a bridge pattern.I don't know why they would use the bridge pattern nor even if they really do. I wouldn't be surprised that it is used and I can also suppose that the use would be a good idea. Although it is quite possible as well that it is used incorrectly in some places.

  • Question about design pattern - business delegate

    hi guys
    i have got a question to ask about the delegate pattern. usually, we use it to decouple between presentation client and businessservice tiers. for instance, the service tier has an session ejb, and delegate wrapps the ejb. and the web client calls delegate to access service. is the delegate only used by the presentation tier? within the service tier, we can have many ejbs that work together to get tasks done. do we still use delegates in the service tier? what is ur suggestion? thanks

    Try the Patterns and OO Design forum.

  • Question about design pattern - business delegate: repost

    hi guys
    i have got a question to ask about the delegate pattern. usually, we use it to decouple between presentation client and businessservice tiers. for instance, the service tier has an session ejb, and delegate wrapps the ejb. and the web client calls delegate to access service. is the delegate only used by the presentation tier? within the service tier, we can have many ejbs that work together to get tasks done. do we still use delegates in the service tier? what is ur suggestion? thanks

    thanks, but i don't think i follow what u said.
    bascially i was asking if it was still a good idea to use delegates to communicate between ejbs the same way presentation tier calls service tier. i.e. SessionEJBA calls DelegateB to access SessionEJBB. or SessionEJBA calls SessionEJBB directly including the lookup, etc.

  • Copyright Question about Adobe Patterns

    I have created illustrations for a book and am using Adobe Photoshop Elements to "color in" my drawings. In addition to the patterns which came with my program, I have downloaded patterns from Adobe Exchange. How would you suggest I reference/give credit to Adobe in my publication since these patterns are under copyright protection?

    Unless you sell it as your own creation (that is the pattern template/ swatches, not the result), the usage of provided content is covered in the EULA. No need to make any extra mention of specific stuff beyond perhaps a generic © Adobe for the relevant parts. For third-party content that may be different, but you should find the relevant info from the authors there...
    Mylenium

  • Question about DAO pattern

    Greetings.
    If I'm using EJB's in my application when does DAO fits in?? I mean, it is DAO an alternative to EJB's or a complement ??
    Thanks in advance.

    DAO fits in if you are using entity beans using bean managed persistence. In this case, the DAO brokers the database calls during the EJB's lifecycle. The other instance when you would use DAO would be if you forgo entity beans altogether. In this model, stateful or stateless session beans would use DAO's to broker the database calls directly, outside of the normal entity bean lifecycle. The DAO pattern can also be used with POJO's (plain 'ole Java objects).
    The only instance where DAO would not apply is in the case of a container managed entity bean. In this case, there is no need to write a DAO, as the container will persist the bean for you.
    - Saish
    "My karma ran over your dogma." - Anon

  • Question about ServiceLocator pattern

    Hi,
    I was wondering what would be the most approproate way to modify the serviceLocator pattern (from the core j2ee patterns book) to handle multiple initialContext? I.e, how do I modify the ServiceLocator to get the home from multiple remote servers?
    Do I get the client to pass in the InitialContext to be used?
    If I cache the homes - what should you use as the key? I.e. what can uniqeuly identify an InitialContext?
    Cheers,
    Nim

    An InitialContext is probably uniquely identified by the provider URL. I'd rather set up some kind of mapping, though, so that you just say "service this" and "service that", and the ServiceLocator, through configuration info, figures out what JNDI service to lookup as well as what to ask for.

  • A question about singleton pattern

    Will a singleton instance be a bottleneck of an application when many client address this instacne?
    and How can I do to deal with this problem?
    help me!

    Unless the singleton has synchronized methods or blocks of code that are synchronized there should be no bottle neck, as multi threads can access it at the same time.

  • PL/SQL web service: question about stub

    hello,
    I'm currently learning how to work with PL/SQL Web Services.
    I have a question about stubs. The point is, I can deploy a web service to the OC4J server and it works. It also works when I create a stub following the WSDL I made with creating the PL/SQL web service. If I go to the endpoint in my webbrowser, the functionality is the same, with or without using a stub.
    My question is: what is the function of the stub?

    A stub is leveraged by a client application to communicate with a corresponding server side object (in this case, the web service implementation). If you think back to CORBA or RMI applications they follow a similar pattern.
    In the case of a web service you would use the stub to write a client application that could invoke the methods of the remote service and return the responses as java data types. The methods the stub class offers are the same as the methods of the web service interface. It's a common way for providing RPC like functionality.

  • A question about some of the features

    I have Vista so therefore am unable to use the trial version of photoshop elements. Before I go ahead and purchase the software, I had a few questions about its features.
    I'll mainly be using photoshop to create digital scrapbooks. I know that photoshop comes equipped with themes and images, but I would like to know if I can use my own backgrounds and images. If I am able to use my own backgrounds, can they tile?
    Another thing I would like to know is if I can create my own projects with custom dimensions.
    Lastly, I'll be using photoshop to sprite. Is elements well suited for spriting? More specifically, does it have a color selection/replacement tool?

    I use PSE for digital scrapbooking. Instead of using the "built in"
    creations and albums, just create your own PSD files with layers of
    whatever images/embellishments/background papers you want. You can
    specify whatever size of creation you want when you create your PSD file
    (you only have the choice of certain sizes when you use the built in
    stuff).
    Not sure about what you mean about making your backgrounds tile, but I
    think it is possible. You can take a "background" paper, do a selection,
    and then define a pattern and fill it. Or, if you mean layer your
    background papers - yes you can do that too. (Here is my online
    scrapbook pages, all of which were done in PSE 4 or 5:
    http://www.scrappersguide.com/forums/gallery/showgallery.php?cat=500&ppuser=413)
    You can select by color (using the magic wand tool) and you can replace
    color, but it may not work exactly as you expect. (I also don't know
    what spriting is.) But, many people just use a hue/saturation adjustment
    layer to change colors.
    -Trish

  • Question about sql batch process in java app

    hi all
    i have few questions about using batch process in the java.sql package. the addBatch method can take sql statements like inserts or updates. can we use a mixture of insert and update then? can we use prepared statement for this? it's just for performance consideration. thanks in advance.

    hi all
    i have few questions about using batch process in the
    java.sql package. the addBatch method can take sql
    statements like inserts or updates. addBatch() is a method that has no parameters. It doesn't 'add' sql statements.
    can we use a
    mixture of insert and update then? can we use
    prepared statement for this? it's just for
    performance consideration. thanks in advance.The point of batching is that you take something that is invariant and then 'add' a variant part.
    Thus a single insert has an invariant part (the table and specific columns) and a variant part (the data for each row by column.)
    You can use anything that is valid SQL (for jdbc, driver, database) and use it presuming your database allows that particular usage in batching. But that does require some regular pattern - it won't work if your usage is random. Nor will it work if some statements need to be executed only some of the time. Finally also note that transaction processing will often require smaller chunks - you can't insert a million rows in one batch.

  • Newbie question about loading servlets on tomcat

    I have what is probably a very basic question about loading simple servlets on to tomcat to test its installation. I have followed instructions from numerous tutorials to the letter but still I can't get it to work.
    I have installed tomcat on win2k in c:\tomcat. I set up the jdk, environment vars (JAVA_HOME, CATALINA_HOME, TOMCAT_HOME) which all point at the correct dirs. I can compile a servlet without errors. I can also place a test jsp and html file into the root directory and they both work fine.
    However, now I am trying a test servlet and no matter what I do it gives me a 404. I have a servlet class file called "HelloServlet.class" which I placed into the %install_dir%\webapps\ROOT\WEB-INF\classes directory. I try to reference it using this url:
    http://localhost/servlet/HelloServlet
    Tomcat is configured to use port 80 and has been restarted after adding the servlet class file. Does anyone have a clue why this is not working for me?
    Many thanks
    Marc

    You have to add in the web.xml file that it is in the WEB-INF dir, the information about your servlet. An example:
    <web-app>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    </web-app>

  • Question about using new battery in old Powerbook

    I have a pre-intel Powerbook G4, and the battery is pretty much toast (lasts about 15 minutes now). I have ordered a new battery for it, and I have this question about using it:
    Am I smarter to keep the new strong battery out of the PB most days (as I usually work with it plugged in at home) and just pop it in when I know I will be out surfing on batteries? Or is it just as good living in my laptop 24/7 and only occasionally being called upon to do its job?
    Current bad Battery Information below:
    Battery Installed: Yes
    First low level warning: No
    Full Charge Capacity (mAh): 1144
    Remaining Capacity (mAh): 1115
    Amperage (mA): 0
    Voltage (mV): 12387
    Cycle Count: 281
    thanks folks, Shereen

    Hi, Shereen. Every Powerbook battery wants to be used — drained and then recharged — at least every couple of weeks. If you've always used your Powerbook on AC power nearly all the time, and not followed that pattern of discharging and recharging the battery every week or two, it's possible that your use habits have shortened the lifespan and prematurely diminished the capacity of your old battery. Of course it's also possible that your battery is merely old, as a battery's capacity also diminishes with age regardless of how it's used. You didn't say how old the battery is in years, so this may or may not be an issue. I mention it only because it can be an issue.
    For general information on handling a battery for the longest possible lifespan, see this article. My advice on the basis of that article and long experience reading these forums is that it would be OK to do as you propose, but I doubt that you'd derive any significant benefit from it. You would still want to be sure of putting the new battery through a charge/discharge cycle every week or two, even if you didn't have a reason to use the Powerbook away from home or your desk, because sitting unused outside the computer is just as bad for a battery as sitting unused inside it. And you should never remove the battery from your computer when it's completely or almost completely discharged and let it sit that way any longer than a day or two.
    Message was edited by: eww

  • Question about "Native ISO" and Color Grading in PP

    I have a question about "Native ISO" in the real world and how it relates to color grading.  I was shooting 35mm film before all these digital cameras became flat-out amazing practically overnight.  Then the goal was always to shoot with the lowest ISO possible to achieve the least amount of grain (unless you were making an artistic decision to get that look).  If I was shooting outside plus had a nice lighting package I'd shoot 5201/50 ASA (Daylight) and 5212/100 ASA (Tungsten) 99 times out of 100.
    I've recently been shooting a lot with the Blackmagic 4K and have read that its "Native ISO" is 400.  Because of my film background this seems counter-intuitive.  Yesterday I was shooting for a client and had the camera at an f16 with a 200 ISO.  Because of what I'd read, I was tempted stop down to an f22 and change my ISO to 400... but the "little film voice in my head" just wouldn't let me do it.  It kept telling me "Higher ISO means more noise... stay at 200 and you will get a cleaner image".
    So how does it work with "Native ISO"?  Should I really shoot at a 400 ISO every chance I get in order to capture the best image for how the camera is calibrated?  Will it really give me more latitude when color grading?  Or would I still get a cleaner image staying at ISO 200?   I've Googled around quite, but haven't found any articles that answer specifically this question.  Would love to hear from someone who knows a bit more on the subject or has a link that could point me in the right direction.
    Thanks much.

    Hey, shooter ... yea, interesting discussion and always nice to learn. Great pic, too!
    jamesp2 ...
    Great answer. I've followed quite a bit of the discussion about the BM cams as well, one does feel a need to check out the possibilities for that next beastie one will need to acquire. But ... which one?
    I've always been a bit of a hard-case about testing testing testing. For instance, what happens with dome down or use of a flat diffuser vs. dome in the up position in metering? Back in the film days, we had our own lab and did our own printing as well as the um ... difficult images ... from other studios. I needed to know how to get exactly the same diffuse highlight no matter whether it was a "standard" light 3:1 studio shot, or a near-profile with no fill that needs dark shadows. I tested & burned through boxes of medium-format polaroid & 120 film and a lot of color paper. Finding? To get the same print time no matter the contrast or lighting style, needed to be metered either with the flat disc (Minolta) or dome-down (Sekonic) and held at the highlight-location pointed at the main light source. I could meter and nail the exposure every time. Ahh no, insist so many ... one must have the dome on/up and pointed at the camera! Right. Do that, change the contrast, and see what happens to your diffuse forehead highlight on a densitometer ... and see how your printing exposure times change. Oh, and you've just moved your center-of-exposure up or down on the film's H&D curve, which will also change the way the shadows & highlights print. In truth, though it was subtle, we had realistically no matter latitude for a best-case image with pro neg film as one had with chromes. You could probably get away with being "off" easier, but it still wasn't dead-on.
    So wading into video ... oi vey, you may have noticed the things claimed here there & everywhere ... this setting is God's Gift to Humanity but no, it's total crap ... this sensor is totally flawed but someone else is certain it's the finest piece out there. Yes, opinions will be all over ... but ... in film, it was the densitometer. In video, it's the scopes. Truth. And getting to that can be a right pain. I've seen quite a few contradictory comments about using the BM cams in film mode and also at ISO 200. Yours above gives the most ... comforting? ... explanation (for me) because of your reference to your scopes & the waveform patterns. Thank you.
    Love to learn ...
    Neil

Maybe you are looking for

  • F110 APP run Error

    Hi Experts, When I try to run F110. Below Error shown. I pasted  Error Job log below: Job started Step 001 started (program SAPF110S, variant &0000000002020, user ID SAPUSER) Log for proposal run for payment on 12.07.2014, identification WIP4 Informa

  • Edit tax form by field like in v4

    Editing tax form by field. In Adobe v4, I was able to edit a tax form generated by my tax software (Lacerte) by a field. Although this was not a fill-in field, I was able to click on that field and edit only that field. With the new versions [7 & 8],

  • Create a "draggable" image in Flash CS6 Pro

    Hi folks, Firstly, whilst the answer would be great, i'm also hoping for people to point me in the right direction for finding these answers myself... I'm new to CS6, and relatively innexperienced with flash in general (certainly new to AS3). I'm wor

  • New iPhoto will not give me the option to edit with external source.....

    WHY fix something that isn't broke.  The new iPhoto is HORRIBLE!!!!!!!!!!!!   There is no option to edit your photos in adobe photoshop....UNBELIEVABLE!!!!!!!!

  • Reversar un proceso de producción

    Hola a todos Por error se realizó un proceso de producción incorporando 2 componentes que no corresponden. ¿Cómo se debe proceder para reversar la operación, a fin de que los componentes vuelvan al inventario y el producto final salga de éste?. Agrad