File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes To the author: How to locate various data from remote portal or data sources? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "To the author: How to locate various data from remote portal or data sources?" Watch "To the author: How to locate various data from remote portal or data sources?" New topic
Author

To the author: How to locate various data from remote portal or data sources?

Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Jeff and David,

In case I need gather various data from different remote portal, what communication channel should I choose?

In addition to RMI and Web Services, are there any other ways for that?

Also, how about if the portlet needs to communicate to external data sources? What should I do?

Thanks for your opinion.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
A portlet is very much like any other web application with regard to how you use remote data sources, be it a database, a web service, or a proprietary management system.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
But are there any special ways to achieve this in Portal?

Nick
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Originally posted by Nicholas Cheung:
But are there any special ways to achieve this in Portal?

Nick


Today : you can use same web application (Datasource refer to remote database server)

In the future , WebService is best. (Today have problem about Security system)


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
We are currently using WebService already, however, we need to develop our own WebServices to access remote portals.

What we are worried about is, in case, in future, there is a standard suddenly comes out, our system becomes non-JSR compliant.

Nick
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Nicholas Cheung:
What we are worried about is, in case, in future, there is a standard suddenly comes out, our system becomes non-JSR compliant.

How many standards have you seen that have "suddenly came out"...?
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982

How many standards have you seen that have "suddenly came out"...?

I mean, in case there are new stuffs come out, not now, but in future, our system will then violate with the standard, as we dont have it now.

It is always a problem, however, as we need to make sure our Portlets could be communicated with Portlets that developed based on the new standard.

Any thoughts? Shall we really go for our own development for Portal applications communication? Or we wait?

Nick
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Portal should only any kind of view to back end systems? Isn't it?
Than you should communicate with back end system, not with the portal itself.
Am I wrong?


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Portal should only any kind of view to back end systems? Isn't it?
Than you should communicate with back end system, not with the portal itself.


Not really.

In case we have a portlet that need to get data from Yahoo, Yahoo will not allow us to access it directly (just like Web Services, only some part of the system can be accessed). Thus, we might only be able to access the portlet from Yahoo, which has already render some data for us to display.

In such sense, we will not be able to access the backend system. We can only access the portlet. It is just the same case for EJB that, EJB is going to access another EJB via EJBObject (or EJBLocalObject), but not the EJB itself. However, there is a well-defined communication methods for EJBs, while there is still no formal method for portal application communication.

Nick
Jeff Linwood
Author
Greenhorn

Joined: Apr 09, 2002
Posts: 3
Hi,

The only specification that specifically has to do with portals is the Web Services for Remote Portlets (WSRP) specification. We discuss WSRP in one chapter of our book.

With WSRP, you can have portlets executing on one server that are displayed in a portal running on another server. This is a little confusing, so let me give an example. A car company might create a "Build your own Car" portlet that lets a user pick options for a car and get a price. The car company would host the "Build your own car" portlet on its server, and then make it available over WSRP. Each car dealer would have their own portal, and they would subscribe to the "Build your own car" portlet that runs on the other server. When a customer comes to the car dealer portal, they would see the WSRP remote portlet just like any other portlet that runs locally. But when they interact with the portlet, the car dealer portal sends the request to the car manufacturer's server, which then passes the response back.

The advantage here is that the car manufacturer does all the upgrading, installation, maintenance, etc. for the "Build your own car" portlet. The car dealers only need to add the portlet through their portal's administrative interface, they do not need to install the portlet locally.

Another advantage is that this is technology-agnostic - as long as the portal understands WSRP, it doesn't matter whether it is Java, .NET, PHP, etc.

Hope this helps,
Jeff
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Hi Jeff, thanks for the detailed explanation.

In your example, I suddenly has a thought on that.

For example, the "screen" contains 4 portlets, one for wheel, one for body, one for the inner structure, and one for color. If, say, I choose a wheel, a body, a type of structure, and color in grey, and then click submit, what should happen? All 4 portlets have been updated accordingly, or only one of them being updated, and the rest 3 data lost?

Thanks

Nick
Dave Minter
Author
Greenhorn

Joined: Nov 11, 2004
Posts: 17
Originally posted by Nicholas Cheung:

For example, the "screen" contains 4 portlets, one for wheel, one for body, one for the inner structure, and one for color. If, say, I choose a wheel, a body, a type of structure, and color in grey, and then click submit, what should happen? All 4 portlets have been updated accordingly, or only one of them being updated, and the rest 3 data lost?


Only one of them will have been updated, and the rest will be left as-is. Unless you choose to have them behave differently; if they all communicate with a common back-end of information, they will all get the opportunity to update their output in response to the change.

But the general case is that actions carried out on one portlet do not affect other portlets.

Dave.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Thanks David.

I have written down my case in another thread. But anyway, to my understanding, the page presents to the user is just a plain HTML page, he has no knowledge that this page is composed of, say, 4 portlets. Thus, he might just click a button to submit data for 1 portlet, however, will the rest 3 portlets being triggered with this action, get the data, and doing the redisplay?

We have tried before but with no luck for this at all, when page refreshes, except the portlet that triggers the newly retrieved data, the data in the rest 3 portlets lost.

Are there any magic that I needed?

Nick
Dave Minter
Author
Greenhorn

Joined: Nov 11, 2004
Posts: 17


We have tried before but with no luck for this at all, when page refreshes, except the portlet that triggers the newly retrieved data, the data in the rest 3 portlets lost.


When the page refreshes all portlets receive a render request. This is their opportunity to reflect any changes in underlying data. It doesn't matter which portlet received the action that caused the refresh.

Dave.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Do I need special handling? As the current case is that the rest 3 portlets seems dont receive any render request.

Nick
Dave Minter
Author
Greenhorn

Joined: Nov 11, 2004
Posts: 17
Ah, actually I think I misunderstood your last question; you're speaking of (for instance) entering form data on four distinct portlets, aren't you?

Portlets can't share forms, so yes, in this case you'll lose changes.

There are various work-arounds for that; probably the best is to only allow form-changes to be made on one portlet at a time. You could also "force" submit any changes to a field once focus is lost.

This problem is not fundamentally different to the usual situation when you have two forms with distinct action urls on one page.

Dave.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
So, do you mean each portlet should subsribe to each other, so that whenever there are changes, every portlet knows ALL changes, and no matter which "portion" of portlet to be submitted, all changes are going to submit?

Thanks Dave.

Nick
[ November 12, 2004: Message edited by: Nicholas Cheung ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To the author: How to locate various data from remote portal or data sources?