Using an EJB as a source for a Model

Hi,
Before starting with this post content it might be helpful to give you the desired output of what I am trying to do. Basically I need to have an HTML table that is populated from an EJB.
The current proposed solution is as follows: the Model that is associated with a TiledView will be used as client for the EJB. The Model will make use of the methods in the EJB to get different java.util.Collection objects for different Helper classes based on the find criteria.
For example, if the EJB represent a book and there is a home method to retrieve a list of books based of the book category. In this case the Model will act as a client of the EJB, retrieve the list of books and use the different methods in the Model, such as insert and retrieve, to get the list of books and to add a book up on request.
I know that my post might not be clear. But as I said, all that is needed is to have a TiledView that displays books information, which are retrieved from an EJB, and allow a user to select a book to display its information.
My suggested solution could be completely wrong, not visible and reflect a bad design. Please if any one went through such a situation give me a hint.
Regards,
Basil Mahdi

Basil,
This is some material I snipped from an internal Sun forum I posted to regarding a simple EJB Jato integration example.
I hate to give just any EJB JATO example because frankly there are so many different use cases with EJBs that no one example will match up against your needs. You can use an EJB
- in a Custom Model Operation you can encapsulate an EJB Method invocation
- in a Custom Command you can encapsulate any arbitrary code include calling an EJB
- as the backingstore for a CustomModel
- use a BeanAdapterModel to adapt to the value/transfer beans which are uses as parameters or return values of EJB methods
- use an ObjectAdapterModel to adapt an EJB directly by assigning the EJB reference in setObject() in the constructor of the OAM
As you can see, an EJB is just another business object API...its just that you acquire the reference with a few lines of ugly JDNI and Home interface APIs.
Nevertheless, here is some guidance. I would like to reinforce that there is no direct solution for adapting an EJB from BAM; EJBs are not JavaBeans. What is a solution is to have the parameters or return values of your EJBs use value/transfer object patterns in the form of JavaBeans. The BAM may be used to adapt to these parameters or return value of the EJB.
In short, when using BAM in a tileview to work with an EJB, there is little difference than using BAM at any other time, you the developer, must manage/code the placement of the EJB parameters directly into the BAM or in a scoped attribute to be used by the BAM.
In another example, you may have a SLSB which models an employee called EmployeeSupport. You may have a transfer object (JavaBean) of type EmployeeRecord. You may have operations on the EJB including:
public EmployeeRecord findEmployee(String employeeID);
public EmployeeRecord[] findEmployees(String location);
public void updateEmployee(EmployeeRecord);
One could create a BAM in the studio called EmployeeModel
You would set the JavaBean class to EmployeeRecord
You would run the Design Action to bootstrap the properties of EmployeeRecord as fields on the model
Now you have a model which is ready to adapt to EmployeeRecord bean.
Feel free to add material to the EmployeeModel to make a richer API; for instance you could encapsulate some EJB'ish code in their to act as a service locator for a EmployeeSupprt SLSB.
protected static EmployeeSupport support;
static {
javax.naming.Context context = new javax.naming.InitialContext();
Object objref = context.lookup("ejb/EmployeeSupport");
EmployeeSupportHome home = (EmployeeSupportHome)
javax.rmi.PortableRemoteObject.narrow(objref,EmployeeSupportHome .class);
support = home.create();
public static EmployeeSupport getEmployeeSupport() {
return support;
If you really wanted to hide the EJB'ishness of the EmployeeSupport you could even wrap the behavior and handle exceptions, etc.
public static EmployeeRecord findEmployee(String employeeID) {
return getEmployeeSupport().findEmployee(employeeID);
public static EmployeeRecord[] findEmployees(String location) {
return getEmployeeSupport().findEmployees(location);
public static void updateEmployee(EmployeeRecord record) {
return getEmployeeSupport().updateEmployee(record);
You could even help the view developer latch EJB transfer objects into the model for adaption; saving them from the effort
public void adaptEmployee(String employeeID) {
setBean(findEmployee(employeeID));
public void adaptLocation(String location) {
setBean(findEmployees(location));
public void save() {
updateEmployee((EmployeeRecord)getBean());
Create a search ViewBean, place a text field on it for an EmployeeID and button labeled Find. Leave the EmployeeID model binding default (to use a DefaultModel memory model). Open the handle request event method on the viewbean for the Find button.
public void handleFindRequest....{
EmployeeModel model = .....;
model.adaptEmployee(getEmployeeIDChild().getValue());
// display Edit page which has fields for editing the employee record
Create an edit ViewBean, with editable fields bound to the EmployeeModel; add an button labeled update
public void handleUdpateRequest....{
EmployeeModel model = .....;
model.save();
// do whatever is next ....
Notice that the we are jumping across request boundaries in this example. Using just default model reference configurations, the EmployeeModel will be created brand new during the Update request and there will be no bean currently adapted. Most likely, you would want to have the model (and hence its adapted bean) stored in HttpSession across at least these related requests. In this case the model reference used by the search ViewBean would have "store in session" true. and the model reference in the edit ViewBean would have "look in session" true.
What we recommend is that someone who understands the business tier design take the responsibility to create a set of "business delegates" as JATO models. An advanced technique would be to encapsulate these models in a component library JAR which multiple web applications can reuse. As you can imagine, there are so many ways to do the same thing. You could just as easily make a CustomModel or SimpleCustomModel to adapt to your EJB. You can also, if your EJB uses primitives or JavaBeans (or graphs of JavaBeans) for all parameters, use the ObjectAdapterModel to directly connect to an EJB.

Similar Messages

  • Can you use SQL as a data source for a project in the same way you can in Excel?

    Excel allows you to create a data source that executes a SQL stored procedure, display that data as a table in a spreadsheet and have that data automatically refresh each time you open the spreadsheet. Is it possible to do the same thing in MS Project, displaying
    the data from the stored procedure as a series of tasks?
    Here's what I'm trying to do - I have a stored procedure that pulls task data meeting a specific criteria from all projects in Project Server. We're currently displaying this data as an Excel report. However, the data includes start dates and durations so
    it would be nice to be able to display it as a Gantt Chart. I've played around with creating a Gantt chart in Excel and have been able to do a very basic one, but it doesn’t quite fit our needs.

    No, You can not use sql as a data source for a project.
    You have 3 options to achieve it:
    1. You can create a Sharepoint list with desired column ,fill desired data in that list then you can create a MS project from Sharepoint List.
    2. You can create a SSRS report in which you can display grantt chart Joe has given you that link.
    3. You can write a macro in MPP which will take data from your excel. In excel you will fetch data from your stored procedure. write a schedule which will run every day to update your data or
    create an excel report in which will update automatically and write macro in mpp which will fetch the data then publish it so that it would be available to team members.
    kirtesh

  • Use different "fx-border-image-source" for first tab and remaining tabs

    Hi,
    I'm using something like this
    .tab {
    -fx-padding: 0px 5px -2px 5px;
    -fx-background-insets: 0 -20 0 0;
    -fx-background-color: transparent;
    -fx-text-fill: #c4d8de;
    -fx-border-image-source: url("images/tab5.png");
    -fx-border-image-slice: 20 20 20 20 fill;
    -fx-border-image-width: 20 20 20 20;
    -fx-border-image-repeat: stretch;
    -fx-font-size: 22px;
    .tab:selected {
    -fx-border-image-source: url("images/tab-selected5.png");
    -fx-text-fill: #333333;
         -fx-background-color: red;*/
    to customize the tab appearance of a TabPane.
    That worked well. But I need to use a different set of images for just the first tab. Does anyone know a way to accomplish that?
    Thanks.

    How can I "fix up" the first tab of tab panes that are created after I "fixed up" the first tab of the initial tab pane?
    My app allows user to create new tab panes at any moment during program execution.Not easy to answer this one.
    The best answer would be to use structural pseudoclasses, but (as David points out), they are not yet implemented.
    The trick here is how to identify the first tab of each tab pane so that it can be styled separately from the other panes.
    Doing the styling without a dynamic lookup is preferrable to using a dynamic lookup (i.e. when the first tab is created give it a specific style, e.g. tab0).
    This is how the charts work, where they set style classes based on series of data, e.g. series0, series1 - this allows you to independently style each series of data.
    However the chart stuff has all of that built into the implementation, whereas the tabs don't. To achieve that you would likely need to go into the TabSkin code (http://openjdk.java.net/projects/openjfx/) find out where and how it generates the Tab nodes and write a custom tab skin or extension of the existing one which assigns a numeric style class to each new tab in a pane (e.g tab0, tab1, etc). In other words, not particularly easy if you are unfamilar with the tab skin implementation. You could log a javafx jira feature request to have those style classes set on tabs - file it here => http://javafx-jira.kenai.com.
    In the meantime a simple alternative is to use the dynamic lookup method in my previous post and a hack such that whenever you add a new tab pane to the scene you do something like the following:
    new Timeline(
      new KeyFrame(
        Duration.millis(50),
        new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent arg0) {
            Node tab = newTabPane.lookup(".tab");
            if (tab != null) tab.getStyleClass().add("first-tab");
    ).play();The reason for the Timeline is that I don't really know at what stage the css layout pass is executed. I know that when you initially show the stage and then do a lookup, the css pass seems to have already been done and the lookup will work. But for something that is dynamically added or modified after the scene is displayed - I have no idea when the css layout pass occurs, other than it's some time in the future and not at the time that you add the tabPane to the scene. So, the Timeline introduces a short delay to (hopefully) give the css layout pass time to execute and allow the lookup to work (not return null). Not the best or most efficient solution, but should work for you.

  • Can Discoverer be used as an XML Data source for XMLP ?

    I am wondering if Discoverer can generate an XML Data Source for XMPL.
    I have heard that Discoverer Viewer can have XML as an output. Is there a way of using this XML output with XMLP and, if yes, how to batch both steps ?

    Hi
    My understanding is that Discoverer does not generate XML data as an ouput that XMLP can consume. The XML is does generate is actually an XML RDF for Oracle Reports.
    XMLP is integrated thou, when you export your Disco report to PDF thats XMLP doing the conversion to PDF for you.
    Regards, Tim

  • WIS 10883 using large Excel File as source for report in WebI RichClient

    Hi,
    I'm trying to use a relatively large Excel 2003 file, say 7000 rows and 19 columns, as a source for a report in WebI Rich Client. When selecting a range of only 1500 records and 19 columns everything works, when accessing the full 7000 (or originally 30,000) I get this error message.
    Does anybody know of a size limit for this and if so an option to adjust it? The only resources for this very limited.
    Thanks
    Norman Ruppert

    Tina,
    I'm not sure why you are so negative to having Excel in the mix.
    Excel is only used at development time - its mearly used as a design interface to build the xcelsius model that feeds data and controls components within the flash file that xcelsius generates. 
    Excel is not used at run time in any way (unless one uses a third party connector to use an XLS as a data source of course).
    If you attempt to use xceslius without using the OLE embeded Excel sheet at design time you will only be able to create VERY simplistic dashboards.
    The new connectivity in version 4 just removes a design step to make development simpler my combining direct to components - but behind the sceens i believe it is really only connecting to a hidden part of the model not shown the the Excel interface at design time!
    i think we would all agree that having excel can be a pain at design time (especially those that used/use live office!) but it does offer a pretty good interface for building very intuative looking models behind your flash components.
    cheers,
    Jeremy.

  • Using Answers result set as source for BIP

    Hi, I'm running into a strange issue that I think is related to a configuration problem. I'm trying to use an OBIEE Answers result set as the source of data for a BI Publisher report. On the data model I choose Oracle BI Answers, but then when I click on the icon to select the answers result set - a blank window opens. It doesn't show either the USERS or SHARED directories for me to start drilling to find the answers result.
    Here's some details:
    1. BI Publisher security is set to use OBIEE server security. This appears to work properly, if I instead choose to write SQL directly against the OBIEE server, everything is working fine.
    2. I am able to integrate BIP reports onto OBIEE dashboards with no issues, so the integration is at least working in that direction
    3. I see this problem in DEV and STAGE, but it works fine in PRODUCTION
    Obviously some sort of config issue, but I'd like to point our server admin group in the right direction. Any idea what could be hosed up?
    Thanks!
    Scott

    Hi ,
    Check the settings in
    Admin>Oracle BI Presentation Services is configured or not..
    Thanks,
    Ananth

  • How to use web service as data source for forge or endeca ?

    hi,
    is there any way to use webservice as data source in pipeline ?
    i have requirment to get data from web service and dump it in endeca. for this i need some idea on how can be this achieved. is it possible to do so?

    Crawling is part of the CAS, which is kind of the data ingest process in Endeca as you would know. There are a bunch of OOTB Crawlers available like FileSystem based, XML Crawlers, etc., and there could be a case where you have to write your own and thats what I am suggesting because the XML crawl thats OOTB expects a specific format which isnt really mentioned in the Documentation. Please refer to CASDevGuide for more information. CAS, PlatformServices and ToolsAndFrameworks should be running when you start off with Endeca, you can see that from
    ps -ef | grep java
    on your machine

  • Problem using canopus advc55 as a source for photoshop/premiere elements 13?

    I have installed photoshop elements 13 on an imac yosemite.
    I have been using canopus advc55 as a digital video convertor to transfer vhs videos to digital.
    It works with imovie.
    However elements 13 does not recognise advc 55 as a source.
    Can anyone advise whether this is possible or not.

    Duplicate question deleted, now that this one has been moved
    Version 13 no longer captures from a tape camera
    http://helpx.adobe.com/premiere-elements/kb/removed-features-formats-elements.html
    $10 DV and HDV for Mac Firewire capture http://www.lifeflix.com/

  • Is "live" SFP can use also as a light source for testing ?

    Hey all
    Can anyone recommend an oftic power meter with an LC or SC port? I just need to test for link on singlemode 1550 / 1310
    Can i use the end GBIC as a light source?
    I mean just to plug one end of the fiber run into the actual network equipment (switch/router with GLC-LH-SM / GLC-ZX-SM GBIC) and at the other side use a power meter to verify link and to check if i got the correct ligth level ?
    Thanks!

    For a power meter, you might take a look at the products offered by FIS (Fiber Instrument Sales). EXFO tyically make a quality unit, but FIS also has their own private labelled product (less expensive).  There are also many other brands, most available with connector adapters to allow LC or SC testing. You could also purchase hybrid test patch cords so you only need one connector type on the power meter. 
    A GBIC/SFP transceiver can be used as a light source (just stay away from using an EDFA optical amplified output.  Follow the test procedure described by THEFOA.ORG. 
    Hope this helps!

  • Using iPod as external file source for iTunes

    I have a laptop and a HUGE iTunes library which is stored on an external HDD.
    I'm taking the laptop on vacation (and not the external drive) which means that I won't have an iTunes library while on the trip.
    I don't want to transfer GB of audio files onto my laptop HDD just for a trip but I would like to use iTunes.
    I wonder if I can -
    1a. Set my iPod to act as a portable drive (I forget what this setting is called)
    1b. Mount my iPod as an external drive
    2. Create a new iTunes library on the laptop HDD
    3. Set the preferences to import songs data but to leave the files where they are (I forget what this setting is called exactly).
    4. Import files found on the iPod external drive.
    I realize that iTunes would only be able to play music when the the ipod was mounted as a HDD.
    Does that sound like it would work? Is there anything I'm forgetting?
    Thanks.

    You don't have to do any of that. Is your iPod large enough to hold your entire library? If so, all you have to do is set your iPod to MANUAL manage. Under manual manage, you can now hook the iPod up to ANY computer running iTunes and play the stuff directly from the iPod in iTunes.
    To be safe, you still may want to start a new library on your laptop and just leave it empty. Then you can switch to that library when on vacation, play anything you want out of the iPod and not have to worry about accidentally messing something up with your normal library if/when it tried to access stuff from the external drive that is not with you.
    When you get home, switch back to your normal library and change the iPod back to Auto update. Nice thing about this is when you change back to auto, your iPod will sync back to your original library and all the updates like ratings, play counts, last date played, etc. will sync back.
    You can test it out right now. Just change your iPod to manual manage, APPLY, then go ahead and play right out of the iPod in iTunes.
    Cheers,
    Patrick

  • Using Web Service a Data Source for my Report

    Hi All,
    I'm trying to use a Web service as a PDS for my Oracle9ias reports.
    I have a few questions on this.
    1) Can the webservice Return a Complex data type e.g java.util.Vector? If Yes, How does the report extract data frm the Vecor?
    2) If the first option isn't feasible, Can I go for a array of objects as return values provided those objects are serializable?Again how would the report extract data from array of objects?
    3) OR is it advisable to go for Document style web service that returns me an XML document?
    Regards,
    Ritesh

    hi,
    what do do you mean by that???
    i hope i helped....
    http://greekoraclebi.blogspot.com/
    ///////////////////////////////////////

  • Use Querystring to define result source for searching

    I am migrating a site from SP2010 to SP2013. One of page contain a search result webpart. By define the querystring like this:
    SearchResult.aspx?k=Scope:Hotnews
    It will return only the defined scope results.
    However, SP2013 no longer provide Scope. Can I perform similiar trick with querystring? I have setup a Result Source "Hotnews" on my SP2013 farm. But I don't know the syntax in querystring or is it even supported. Could you please guide me? Thanks.

    Hi  Mark,
    According to your description, my understanding is that you want to set the result source of your search result web part to a custom result source "Hotnews" in SharePoint Server 2013.
    For achieving  your demand, you can limit search results of your search result web part as below shows:
    Reference:
    http://techmikael.blogspot.com/2013/04/limiting-search-results-in-sharepoint.html
    Also you can have a look at these blogs:
    http://www.eliostruyf.com/dynamically-changing-result-source-sharepoint-2013-search-center/
    http://blog.mastykarz.nl/programmatically-working-keyword-search-queries-sharepoint-2013/
    http://technologybooth.blogspot.com/2013/08/keyword-query-in-sharepoint-2013.html
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Eric Tao
    TechNet Community Support

  • Can't use compiler constant to set source for embed tag in ASC2.0

    Hi.
    I'm poring an application to ASC2.0. The code I'm talking about is being compiled as a flash movie, but I'm sure it applies to AIR also.
    So we have some code like this:
    class Test
      [Embed(source=CONFIG::FILE,mimeType="application/octet-stream")]
      private var TextClass:Class;
      public function test():String
        var ba:ByteArray = new TextClass();
        var str:String = ba.readUTFBytes(ba.length);
        return str;
    CONFIG::FILE is set as compiler options like this
        <define append="true">
          <name>CONFIG::FILE</name>
          <value>'../../../../TEXT.txt'</value>
        </define>
    This code compiles, but at runtime, the TextClass is null. If I replace the embed line with this, it works.
    [Embed(source="../../../../TEXT.txt",mimeType="application/octet-stream")]
    If I change the source string location, compilation fails. If I change the content of the compile constant, it does not fail, regardless if it points to a correct location or not.
    Seems like another ASC2.0 bug. I suggest to open a forum that deals with ASC2.0 specifically.

    OK. I know why. Its because although i create the version entity before i called the SQL. the new version entity hasn't been stored in the database, its still in the container. My colleague and me checked this by setting up a timestamp in the Version table and compared it with the time in the log. when i called SQL, the entry hasn't been created!

  • Using external database as source for Quicktime annotation automator action

    Hi
    I have approximately 1500 quicktime files which require annotations added to them (title, author etc).
    I've been provided a spreadsheet with all the neccessary data. And I know there is an automator action that can add annotations to quicktime files but was wondering if either of the following was possible:
    1) Can I get the an automator script to use this spreadsheet as a source for the values it is to enter.
    OR
    2) If I can get automator to add the files name to the annotations section (under title)
    Greatly appreciate any help you can provide.
    Regards

    HI
    Make sure you select the Initialize or Run methods, depending on where you try to define the database connection it will not let you do it.
    Good practice would be to define the database and the connection in the initialize section, the SQL and execute in the Run section and the disconnect in the Finish section, however that could change depending on your needs.
    Regards
    Alex

  • Using external database as source for automator

    Hi
    I have approximately 1500 quicktime files which require annotations added to them (title, author etc).
    I've been provided a spreadsheet with all the neccessary data. And I know there is an automator action that can add annotations to quicktime files but was wondering if either of the following was possible:
    1) Can I get the an automator script to use this spreadsheet as a source for the values it is to enter.
    OR
    2) If I can get automator to add the files name to the annotations section (under title)
    Greatly appreciate any help you can provide.
    Regards

    The thing to remember is that with the new Apple TV, all these things had to be written from scratch. The code that made these things work on the old Apple TV can't just be ported to the new one, but it had to be re-written.
    The situation you describe, which if I understand you would require the Apple TV playing some content on streamed from iTunes and also Airplayed to an Airport Express, whilst the iTunes library is also streaming another track to a different set of speakers sounds like an incidental benefit, rather than what it was originally designed to do (and, I would suggest a fairly niche use as well).
    I have to admit, it's the one thing that has been suggested as a use for the old ability to stream from the Apple TV to Airplay devices that can't now be easily recreated (although an iOS device could be used to set up the second stream). My initial feeling is that the demand for this ability would be too low for Apple to be convinced to add it, but I could be wrong.
    EDIT to say that, on reflection, this ability could be useful where a household relies on Airport Express to play music in different rooms and where people want to listen to different content from the same library.
    In this case, I think that the best solution if Apple wanted to make this easy would be to either allow iTunes to send more than one stream controlled from the computer, or to allow the remote app to get the Airport Express to pull the stream in the same way that Apple TV does.
    Using the Apple TV as a kind of bridge is a fairly inelegant work round.
    Message was edited by: KeithJenner

Maybe you are looking for