Mvc structure in the ejb layer

hello
i am familiar with the mvc structure in the web layer,but i wonder how can i implement the mvc struction in the ejb layer.
i can use the stateless session bean as the controller,but in the web layer,i can use the url to identify the different request,and path information,but in the ejb container,it seem like there isn't such machanism,how can the controller(session bean) reforward the different request?where can i find the sample code of the sessin bean controller?is it included within the petstore?
thank you!

Hi,
If u have got the code for the same, please let me know.
Seetesh

Similar Messages

  • Handling file objects in the EJB layer

    It is seen that file handling in the EJB violates the specs.
    But, I have the requirement to read and parse some xpdl(xml specification) file in EJB.
    The parsing function is already in the EJB layer and the filepath is obtained as input from jsp(in the request) in a servlet.
    Im passing the filepath as a parameter to the bean method before parsing.
    Now the requirement is to construct the File object out of xpdl file and pass it as a parameter to EJB method. How can this be achieved?

    Hi,
    I'm not sure if this is helpful or not, but I just wanted to ask: If you know you need to parse the file on the EJB side, why not just go and do it? If you can always guarantee that files will be present in the same location that the beans are deployed to, then I don't think there is anything stopping you from reading them, if you know the full path to each file?
    You wrote that the path to the file is obtained from a JSP page. If those files need to be parsed anyway, you could move the parsing code to your JSPs (servlets), and use ServletContext.getResourceAsStream to read the contents. Then you could send the contents as a parameter to your EJB call.
    One last thing: if the files are large, you might want to consider using JMS and message-driven beans to do the reading/parsing job. Your MDBs could then call the EJBs, but you would have to return your results in an asynchronous manner.
    Just a couple of thoughts.
    Mark

  • Correct Principal not showing up in the Session and Entity EJB layer

    In our app a user is authenticated via the web container. The web layer then makes
    calls to various session EJB's.
    In our session bean, calls to sessionContext.getCallerPrincipal().getName() sometimes
    returns "SYSTEM" instead of
    the principal's name that was authenticated at the web container level.
    In our entity beans, calls to entityContext.getCallerPrincipal().getName()
    sometimes returns "<anonymous>" instead of the principal's
    name.
    A) Why isn't the principal's name = context's principal's name?
    B) Can we ensure that principal's name isn't lost?
    As per the documentation, the user principal is associated with the current thread,
    so why is it that when calls are made in the same thread of execution from the
    web layer to the EJB layer we are losing the right principal. Btw, the Principal
    is always correct in the Web layer. We do not have any RunAs options set in our
    EJB deployment descriptors.
    What are we doing wrong?

    You aren't doing anything wrong. This is a bug in the webservices.
    kapil khanna wrote:
    In our app a user is authenticated via the web container. The web layer then makes
    calls to various session EJB's.
    In our session bean, calls to sessionContext.getCallerPrincipal().getName() sometimes
    returns "SYSTEM" instead of
    the principal's name that was authenticated at the web container level.
    In our entity beans, calls to entityContext.getCallerPrincipal().getName()
    sometimes returns "<anonymous>" instead of the principal's
    name.
    A) Why isn't the principal's name = context's principal's name?
    B) Can we ensure that principal's name isn't lost?
    As per the documentation, the user principal is associated with the current thread,
    so why is it that when calls are made in the same thread of execution from the
    web layer to the EJB layer we are losing the right principal. Btw, the Principal
    is always correct in the Web layer. We do not have any RunAs options set in our
    EJB deployment descriptors.
    What are we doing wrong?

  • XML over HTTP out of the EJB container

    I need to communicate with a legacy system via XML over HTTP from the EJB layer. I created a custom solution for this on a previous assignment using Castor for the marshaling etc. and standard JDK classes for the opening the HTTP connection, posting etc. I am thinking of implementing a similar solution in the using the DAO pattern. Are there any new open-source implementations for such XML/HTTP connectivity (non-SOAP)? Surely there is somethign out there!
    Thanks,
    -Chris

    In general, it is bad design to make network calls from the EJB layer, just as it is against the spec to do things such as create threads, write to the file system, etc.
    I know this doesn't answer your question but it is something to consider.

  • A fatal error occured in the PD Layer. The transaction needs to be terminat

    Hi experts,
    Do you know these error message?
    A fatal error occured in the PD Layer. The transaction needs to be terminated
    We applied note 1174283, but it didn't work.
    The problem is related to users that don´t belong to SRM structure anymore, but their shopping carts are still in sourcing process.
    Thanks
    Juliana

    Hi PM,
    Note 1269719 - display a more detailled message in abort popup
    Symptom
    In some cases, the SRM application cannot continue and must be aborted.
    Then a popup is displayed with an error message "A fatal error occured in
    the PD layer. The transaction needs to be terminated.".
    The error message is quite general, it is displayed even if a more specific
    error message is available.
    Note 1174283 - SOCO: SC data will not be saved correctly in secend step
    Symptom
    You saved some data in the second step of Sourcing Cockpit using the button
    'Save'. You closed the application and started it again.
    You selected data in the first step of SOCO or went directly to the second
    step. The system display a message: "A fatal error occured in the PD layer.
    The transaction needs to be terminated".
    regards
    Muthu

  • Is the EJB Finder Find By Where supported?

    I've been developing applications using JBOSS application server and it has Find-By-Where and Find-By-Where-Order-By as custom EJB finder options. This is where I can send in the where clause dynamically into the CMP layer and in the latter case order by a specific column set. I can't seem to do that in orion-ejb-jar.xml.
    Is this a supported tag? If not can it be added?
    Since the CMP EJBs Finders must be strictly defined ahead of time (unless you want to write the SQL your self - then why bother) on what you can and can't search on it's a real pain to add new parameters to searches. I've hacked it together and done a partial finder like this for now:
    <finder-method partial="true" query="(number = $1 OR $1 IS NULL) AND (UPPER(last_name) LIKE $2||'%' OR $2 IS NULL) AND (UPPER(first_name) = $3 OR $3 IS NULL)>
    Thanks,
    Rich

    Please look at a list on the Right side of the Forums Home page, Select Enterprise Java Beans from the list and press the GO button... You get the EJB forum list

  • Copy Group or Layer to *Below* the Selected layer

    Hey everyone,
    So I have a bit of a workflow problem. It's not a huge deal but it's one of those things that really adds up over time. Whenever I'm designing mock ups for a page I usually work from the top down. In cases of let's say laying out items in a blog roll, I will
    - Set up all the elements for the post (Title, author, date, body etc...)
    - Group them together
    - Select the group
    - Hold down Cmd/Ctrl + Option/Alt + Shift and drag down to make a duplicate group
    My problem is that the new group (or layer) appears *above* the original one, so now I have to go back into my layers panel and move Post 2 below Post 1 so the structural hiearchy of my Groups/Layers reflect (for the most part) the visual hiearchy of my design.
    Are there any keyboard shortcuts, or checkboxes I can tick to have duplicate items appear below the original in terms of layer hiearchy?
    Any help would be much appreciate!

    I don't know of anyway to have a group created below another group.  I know that if you ctrl/cmd-click to create a new layer, it will be created below the current layer.  My only suggestion is to use ctrl/cmd-[ to move the group down - just be sure the group is collapsed, otherwise your new group would go into the group below.

  • MVC structure

    I'm some what confused as to how exactly the MVC structure works. Lets say that I have to make a GUI in swing thats just an array of buttons in a grid layout. It's a square, so the number of buttons in each row and column is the same. Now, the number of rows and columns is determined by 1 command line argument. So, the GUI constructor takes in the command line argument in a different class, from the main(). Now lets say that the size of the board of buttons needs to change in increments of 1 depending on the left and right arrow keys. (Left for -1 amount of rows and columns and right for +1 amount of rows and columns ). So I implement a controller class that has a keyListener. Now, I need a model class to keep track of how big the board of buttons is. How would I get the controller class to update the model, which would then update my GUI in the view? Do I make get and set methods in the model that are then called in the controller when the keys are pressed? Would I even pass the command line argument straight to the to view or would I just pass it to the model, then the model passes it to the GUI in the view. Thanks..

    Why not set it up to work just like Swing does? If you look at the code for button models (the DefaultButtonModel class) and for the button (AbstractButton), you'll see much information is passed by using listeners together with getters and setters. So the controller could update the model by calling a setter method, then the model would update the GUI by firing its changelisteners. The GUI which registered a changelistener with the model would receive the notification, check the model's state and make changes accordingly. The model skeleton could look something like this:
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    public class SimpleModel
        private int sideLength = 0;
        List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>();
        public void setSideLength(int sl)
            sideLength = sl;
            fireChangeListeners();
        public int getSideLength()
            return sideLength;
        public void addChangeListener(ChangeListener cl)
            changeListenerList.add(cl);
        public boolean removeChangeListener(ChangeListener cl)
            return changeListenerList.remove(cl);
        private void fireChangeListeners()
            for (ChangeListener listener : changeListenerList)
                listener.stateChanged(new ChangeEvent(this));
    }One other aside: since you're using Swing here, not AWT, avoid using KeyListeners and instead use KeyBinding.

  • Migrate the EJBs from JVM to OC4J...?

    We are plan to migrate the EJBs modules from Oracle8i JServer to OC4J.
    From now we have developed the EJBs by using JDeveloper as the following
    conditions;
    - JVM: Oracle8i JServer (8.1.6.3.0)
    - EJBs: Session Beans only
    - IDE tool: JDeveloper 3.2
    And now we wanna migrate or re-deploy to the OC4J. Is there any good
    suggestions or idea to do it? Also I wanna know sth to considerate...
    Thanks in advance for any advice
    Phyllis
    null

    It would be good for you to migrate to OC4J as performance in OC4J is a lot better. Here is a little migration writeup I had done sometime back. It is work in progress. Hope this helps.
    Migrating EJB components from Database EJB container to OC4J
    Author: Ashok Banerjee [[email protected]]
    Oracle recommends the new J2EE containers in Oracle9iAS (OC4J) for deploying J2EE components. The goal of this paper is to recommend ways to migrate existing EJB applications, from database EJB container, to OC4J.
    The database EJB container runs on the aurora session based Java Virtual Machine, whereas the new container runs on standard JDK (version 1.2.2 onward) .
    The database EJB container runs in a database session. The database is itself the middle tier, in such a configuration. Users therefore have a logically three tiered architecture, that runs physically on two tiers. The database serves as both the middle tier and the backend. In such situations users would use the "kprb" driver (used for requests made from within the database). No further authentication is needed if the backend database is the same as the middle tier. Users can also use one database as the middle tier and another database as the backend.
    In OC4J the middle tier does not require a database installation on the middle tier. This helps make the middle tier lightweight. OC4J is also seen to significantly faster than the EJB container inside the database. Since OC4J runs on regular JDK the user can run OC4J on the Java Virtual Machine which is best for his/her specific needs. OC4J however has a limitation in that does not support pure CORBA clients. Currently OC4J does not support RMI over IIOP either.
    To migrate existing EJB applications from inside the database to OC4J the set of changes is minimal.
    Code changes
    1. Change all references in the code and any configuration files using JDBC URLs from kprb driver to either thin or oci. "kprb" driver is only for applications running inside the database. The new OC4J runs outside the database and therefore it must use thin or oci driver.
    2. The database EJB container clientside JNDI lookups were like:
    env.put (Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    env.put (Context.SECURITY_PRINCIPAL, user);
    env.put (Context.SECURITY_CREDENTIALS, password);
    env.put (Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
    Context ic = new InitialContext (env);
    while in OC4J container the lookup code should read:
    env.setProperty("java.naming.factory.initial","com.evermind.server.ApplicationClientInitialContextFactory");
    env.setProperty("java.naming.provider.url","ormi://localhost");
    env.setProperty("java.naming.security.principal","username");
    env.setProperty("java.naming.security.credentials","password");
    Context ic = new InitialContext (env);
    3) Remove all references to oracle.aurora.* classes - they will not work with OC4J. These classes are specific to the container in the database.
    4) Check for client demarcation of Bean Managed Transactions and remember that transaction in OC4J cannot be propagated across tiers. In other words client demarcated transaction will work provided the client is another EJB or a servlet in the same OC4J instance. This is also listed in the "Current Limitations" section.
    Build changes
    1. For EJB in the database we use loadjava to load classes into the database - this step is not necessary any longer for middle tier EJBs. The user merely needs to ensure that the classes are in the classpath.
    2. Similarly the concept of resolver specification in the database EJB container ceases to be useful in OC4J. To make classes "findable" the user sets the classpath. In OC4J any jars in the $OC4J_HOME/lib directory are on the server side classpath of the application classloader. The user can also include classes in their own ear files before they deploy the ear. [If you do not know about the resolver specification, then you have not used it and do not need to know about it].
    3. The database J2EE container did not have support for .ear files. The OC4J container supports J2EE standard .ear files. Both makefiles and ANT files are available in the code samples on OTN which show how to build ear files and also provides samples for the structure of the EAR files.
    EAR File contains META-INF/application.xml
    META-INF/orion-application.xml [optional]
    applicationEjb.jar
    applicationweb.war
    applicationEjb.jar contains
    META-INF/ejb-jar.xml
    META-INF/orion-ejb-jar.xml
    EJB classes
    applicationWeb.war contains
    WEB-INF/web.xml
    WEB-INF/orion-web.xml
    WEB-INF/lib/jar files needed
    WEB-INF/classes class files needed for JSP servlets
    For further information on how to write the xml files etc. please refer to their respective DTDs.
    Both web.xml and ejb-jar.xml should be unaffected by the migration.
    4. The deployejb tool used to deploy EJB to the database has been deprecated. In OC4J EJBs are deployed as shown below:
    % java -jar admin.jar ormi://localhost:<rmi-port> userName password -deploy -file ejbdemo.ear -deploymentName jndiName
    5. The ApplicationClientContainer does not need aurora_client.jar in the classpath instead it needs oc4j.jar in the classpath.
    Configuration Changes:
    1. In the database EJB container the configurations exist in database tables but in OC4J the configuration exists in industry standard XML files. By default these files are located at $OC4J_HOME/config directory. Users can start their OC4J instance with a different configuration using the -config switch to specify a different server.xml file.
    %java -jar oc4j.jar -config config1/server1.xml
    2. In the database EJB container scalability was achieved using the MTS architecture and session based Java Virtual Machine. In OC4J scalability is achieved by clustering and using the loadbalancer. For more details on loadbalancer please read <link to loadbalancer.doc>
    3. The bindds tool used to bind data-sources to the JNDI namespace of the database EJB container is deprecated. In OC4J datasources are bound to the the namespace using the data-sources.xml in $OC4J_HOME/config. Non oracle data-sources can also be bound to the namespace. A typical entry in data-sources.xml could look like:
    <data-source
    class="com.evermind.sql.DriverManagerDataSource"
    name="OracleDS"
    location="jdbc/OracleCoreDS"
    xa-location="jdbc/xa/OracleXADS"
    ejb-location="jdbc/OracleDS"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="scott"
    password="tiger"
    url="jdbc:oracle:thin:@dlsun1688:5521:jis2"
    inactivity-timeout="30"
    />
    4. Database EJB container used database authentication (database roles and database users) to authenticate users to the middle tier. OC4J uses principals.xml file to list groups and users and perform authentication. One can also implement UserManagers for OC4J to perform more complex authentication.
    5. The ports used by OC4J for RMI, JMS and HTTP are all specified in rmi.xml, jms.xml, web-site.xml.
    6. Both OC4J and the database container SSL (client authentication as well as server authentication).
    7. The database EJB container could only be remotely debugged using a jdb like interface by starting a debugagent on the server, and a debugproxy on the client. OC4J containers on the other hand run on JDK and can be debugged with any debugger. This is very useful for debugging EJB/Servlet application running in the server.
    8. The database EJB container comes with a database and hence has AQ (Advanced Queue) available for JMS. With OC4J there is a default in memory JMS implementation. OC4J server program can also connect to other JMS implementations(including AQ) using jms.xml. However a JNDI context may need to be implemented for AQ.
    Current Limitations
    1. The OC4J container at present does not support 2 phase commit.
    2. The OC4J container at present does not support transaction context propagation across tiers. Hence client demarcated transactions are not supported in OC4J except where the client demarcating the transaction is in the same container, for example an EJB having its transaction demarcated by another EJB or servlet, in the same container.
    3. In the classic container Oracle did not support RMI-IIOP tunneling through HTTP however in OC4J RMI over HTTP is supported.
    null

  • Exclude an layer from the adjustment layer

    Hi ,
    i don't know why adobe still didn't add this option to after effects !!!!!!!!
    we have alot of problems with this
    i can't just keep pre-comping stuff !!!!!
    adding a simple column between the 'track mat' and the 'parent' to exclude the selected layer from an adjustment layer in top of it will simple thing's Up .
    please consider this option
    My bests

    Hey guys.
    I was stuck with the same problem, so I found a way to solve it with minimal changes.
    I have a silly 2d animation representing days and nights passing by. To improve the sensation, I put an adjustment layer to tint all layers below every time the moon rises. But the adjustment layers also tints the sun and moon and with my current structure, full of overlaps, it will be a pain to reorder and mask all layers. So I simply duplicate the layer that I was working on and rename it to "MEGA LUMA MASK" and put them just above the adjustment layer. Inside this new duplicated layer, I tint all layers to total black, except for the moons and suns, which I tint to total white. What I got was a perfect luma mask that respects all overlaps without needing to touch the structure. Finally I just set the track matte of the adjustment layers to Luma Inverted!
    No pre composes (kinda), no crazy masks. Of course an adjustment layer exception system would be better, but it's a clean, fast and versatile solution.

  • The command "Layer Via Copy" not currently available

    When I use some purchased actions in CS4, I sometimes get "the command 'layer via copy' not currently available."  Does anyone know why?

    No-one will be able to tell you without seeing the Actions. There have been changes to Photoshops layering structure over the years, meaning that some older Actions recorded on older versions will encounter problems.
    "Layer via copy' not currently available" suggests that either a group or nothing is selected in the layers panel. 

  • Which layer is the target layer?

    How can I determine which layer among those in the ->layersDescriptor structures corresponds to the target layer?
    In photoshop cc x64 pc
    -- all the read channel numbers seem to be unique
    -- all channels have ->target=1
    (edit after more work with layersDescriptor)
    the information presented has a lot of errors and omissions, such that it's impossible
    in principal to display layers the same way as photoshop does.  Invisible "pass through"
    layers are listed as visible.  Layers with "stroke" special effects are indistinguishable
    from normal layers.

    Layers with "stroke" special effects are indistinguishable
    from normal layers.
    Here is how to find stroke (keyFrameFX, descLayer is starting layer descriptor, in this case code also look if effects are visible)
    hasKey=0;
        error = sPSActionDescriptor->HasKey(descLayer, keyLayerEffects, &hasKey);
        if (error) goto returnError;
        error = sPSActionDescriptor->GetBoolean(descLayer, keyLayerFXVisible, &effVisible);
        if (error) goto returnError;
        if (hasKey && effVisible){
                error = sPSActionControl->StringIDToTypeID("classLayerFXVisible", &runtimeClassID);
                if (error) goto returnError;
                error = sPSActionDescriptor->GetObject(descLayer, keyLayerEffects, &runtimeClassID, &descEFFECTS);
                if (error) goto returnError;
                // FRAME
                error = sPSActionDescriptor->HasKey(descEFFECTS, keyFrameFX, &hasKey);
                if (error) goto returnError;
                if (hasKey)
                    error = GetFrameAttributes(index, info);
                //etc.
    Regards,
    Momir Zecevic

  • Handler classes in the controller layer?

    Hello!
    I am using the mvc pattern and i just want to know if i should put the handler classes i.e. EmployeeHandler in the controller layer.
    Thank you!

    mattias_westerberg wrote:
    I am using the mvc pattern and i just want to know if i should put the handler classes i.e. EmployeeHandler in the controller layer.It doesn't sound like it should to me, depending on what your EmployeeHandler class does. An EmployeeHandler class sounds to me like it would provide a sort of service layer for managing employee objects, in which case it should be more closely associated with the business model than, say, the traffic cop.
    ~

  • (264361962) Q ADVC-27 How do you pass the security info to access the EJB?

    Q<ADVC-27> How do you pass the security info to access the EJB?
    A<ADVC-27> Authentication for web service users must occur at the web layer. This
    means providing appropriate web resource definitions and restrictions in the web.xml
    file for your project. The most common and useful form of security for application
    interaction is via client-side certificates. Then the client identity is transmitted
    to the EJB is the same way as in regular J2EE environments. There is a complete description
    on security on e-docs:
    http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
    Adam

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (119093)

  • MVC structure- need to follow?

    I am new to sap ui5. I need to develop an mobile app using sap ui5 mobile. Do i need to follow MVC structure for it ?Whats the benifits if i follow mvc in my coding.

    Hi Meera,
    just read this part of the official SAPUI5 documentation for some general information.
    Regards
    Michael

Maybe you are looking for

  • Show One Page at a Time Default

    Is there a way every time I open a pdf document the default view will go to "show one page at a time" function? I am using Adobe Acrobate 9

  • Images do not showing

    Hi, We currentlly have 2 domain users. LASC and LAJAO. The LAJAO domain users can't see graphics and not even the templet collors. Need some HELP!!!

  • Blacklist application for Nokia X3

    Hi all. I'd like to know if there is a blacklist application for Nokia  X3 and where I can buy or download this application. I want to reject calls from specific numbers and I think the blacklist application is the only way .. Am I correct ? I'm from

  • Itunes keeps giving me error message when i connect ipod to itunes

    my ipod touch when i connnect it to itunes keeps giving me an error message that reads " itunes could not connect to this ipod because an unknown error occured". Can someone please help me?.

  • New battery, charger is amber, says no battery connected. any help?

    The status lights on my battery say everything is good and the charger is amber which means theres a battery charging but my battery meter has an x in it and says no battery is connected.