Portlet deployment
Oscar Wilde
Oscar Wilde "Disobedience, in the eyes of anyone who has read history, is man's original virtue. It is through disobedience and rebellion that progress has been made.".
Retarded
Will somebody tell these retarded people that, space is not a very special character and its very common in Indian names. Whats worse is that, its an Indian ticket booking site.
Web services and Eclipse BIRT
- Create the Java classes from the WSDL, may be using Apache AXIS WSDL2Java. (WSDL Used here -http://soap.amazon.com/schemas2/AmazonWebServices.wsdl)
- Create a new BIRT project, named AmazonSearch.
3. After the project is created, create a new blank report.
4. Add a new scripted data source to the report.
5. Add a new dataset to the report.
6. Create the needed columns in the dataset.
7. Add the code for handling open and fetch events of the dataset. This can be done using, either the report script or Java. Here java will be used.
8. Create a class named, AmazonKeywordSearchEventHandler and extend the class "org.eclipse.birt.report.engine.api.script.eventadapter.ScriptedDataSetEventAdapter".
9. Override the methods, open and fetch.
package com.amazon.events;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.eclipse.birt.report.engine.api.script.IReportContext;
import org.eclipse.birt.report.engine.api.script.IUpdatableDataSetRow;
import org.eclipse.birt.report.engine.api.script.ScriptException;
import org.eclipse.birt.report.engine.api.script.eventadapter.ScriptedDataSetEventAdapter;
import org.eclipse.birt.report.engine.api.script.instance.IDataSetInstance;
import com.amazon.soap.AmazonSearchBindingStub;
import com.amazon.soap.AmazonSearchServiceLocator;
import com.amazon.soap.Details;
import com.amazon.soap.KeywordRequest;
import com.amazon.soap.ProductInfo;
public class AmazonKeywordSearchEventHandler extends
ScriptedDataSetEventAdapter {
Details[] details;
int currPage;
int totalPages;
int currRow;
String reportParam = "harry potter";
public void open(IDataSetInstance dataSet) {
KeywordRequest keyRequest = new KeywordRequest();
keyRequest.setDevtag("14PXWE73YT3NR4PBEDR2");
keyRequest.setTag("14PXWE73YT3NR4PBEDR2");
keyRequest.setKeyword(reportParam);
keyRequest.setPage("1");
keyRequest.setMode("books");
keyRequest.setType("heavy");
try {
AmazonSearchServiceLocator abv = new AmazonSearchServiceLocator();
AmazonSearchBindingStub abs = (AmazonSearchBindingStub) abv
.getAmazonSearchPort();
ProductInfo pi = abs.keywordSearchRequest(keyRequest);
details = pi.getDetails();
totalPages = Integer.parseInt(pi.getTotalPages());
System.out.println(pi.getTotalPages());
currPage = 1;
currRow = 0;
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// details = CockpitObjects.getStatusCount();
}
public boolean fetch(IDataSetInstance dataSet, IUpdatableDataSetRow row) {
if (currPage == totalPages) {
return false;
}
if (currRow == details.length)
getMore();
Details node = details[currRow];
try {
row.setColumnValue("ProductName", node.getProductName());
row.setColumnValue("Author", node.getAuthors()[0]);
row.setColumnValue("URL", node.getUrl());
row.setColumnValue("ImageURL", node.getImageUrlSmall());
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
currRow++;
return true;
}
public void getMore() {
currPage++;
KeywordRequest keyRequest = new KeywordRequest();
keyRequest.setDevtag("14PXWE73YT3NR4PBEDR2");
keyRequest.setTag("14PXWE73YT3NR4PBEDR2");
keyRequest.setKeyword(reportParam);
keyRequest.setPage(Integer.toString(currPage));
keyRequest.setMode("books");
keyRequest.setType("heavy");
try {
AmazonSearchServiceLocator abv = new AmazonSearchServiceLocator();
AmazonSearchBindingStub abs = (AmazonSearchBindingStub) abv
.getAmazonSearchPort();
ProductInfo pi = abs.keywordSearchRequest(keyRequest);
details = pi.getDetails();
currRow = 0;
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
10. Now attach this class as the event handler for the dataset.
11. Insert the dataset in to the report layout. And modify the report to suit your needs. Thats it. Now its ready to go.
12. Now all we need to do is, make the search string as a parameter to the report.
Once that is done, override the method beforeOpen in the event handler and get the parameter value. Use this value to search for items in Amazon.
public void beforeOpen(IDataSetInstance dataSet,
IReportContext reportContext)
{
reportParam = (String) reportContext.getParameterValue("Keyword");
}
Windows Live Mail Desktop
While I like, the Windows Live Mail Desktop feed reader interface, I would like to have the "Blog" button to be configurable. As I am a Blogger user, this button (which posts to MSN spaces) is very much useless.
I like this more than the Thunderbird feed reader. In Thunderbird when I try to forward a post, it would stupidly put the post link in the message, instead of the post content. While the Windows Live Mail Desktop inserts the post content in the mail, it leaves out the post link (but most of the time I don't need the link though).
And Windows Live Mail Desktop has these views (All feeds and Unread Feeds), those are great. I can get these views in Thunderbird too, but I need to be careful while subscribing to a feed or need to constantly manage the folders).
Ok there I have a problem with the advertising bar they have in Windows Live Mail Desktop, but it goes away under a certain situation (Like I enable "Minimize to tray when I close" and then open the Windows Live Mail Desktop from the tray, the advertisement bar is no more). I think they would fix bug in the next release, but till then I will enjoy Windows Live Mail Desktop and hope that Thunderbird fixes the other things.
This could be a killer of all the Feed Readers
Unlike GMail, they do not even show ads in Reader.
Great, will Google do it?