Thank you for visiting! If you liked the site, please add a bookmark, else add a critical comment! Would you like to visit Greece? Traditional Greek flag This real estate site is only available in Greek! The holy mountain

Thursday 28 July 2011

Processing XML with JDeveloper 11g, by Deepak Vohra

On the bright side, the text is well written, showing step by step instructions how to proceed with coding in each autonomous chapter. Each code snippet is explained line by line. Some basics of xpath and xquery are presented as well. What is surprising is an introduction to Berkeley DB XML in chapter 13: Storing XML in Oracle Berkeley DB XML. One can find more information on the internet documentation. For a comparison of Oracle Berkeley DB and relational database systems, refer to 'A Comparison of Oracle Berkeley DB and Relational Database Management Systems'. As far as trying the book source code is concerned, in chapter 6 about JSTL XML tag library, the code example runs in the Glassfish, but not in the Weblogic application server; probably due to an older library version than xalan-j_2_7_1 jar. Needless to say there were incompatibilities found: the windows version does not run as is, in windows 7 64 bit, it needs rebuilding via a C++ IDE such as .Net; the embebded weblogic server does not start after setting up the Berkeley DB XML: I quote:
Berkeley DB XML requires some Windows environment variables (CLASSPATH and PATH) to be modified. The following Oracle Berkeley DB XML JAR files get added to the CLASSPATH environment variable:
C:\Program Files\Oracle\Berkeley DB XML 2.4.13\jar\dbxmlexamples.jar;
C:\Program Files\Oracle\Berkeley DB XML 2.4.13\jar\dbxml.jar;
C:\Program Files\Oracle\Berkeley DB XML 2.4.13\jar\db.jar
The following bin directory gets added to the PATH environment variable:
C:\Program Files\Oracle\Berkeley DB XML 2.4.13\bin
On the dark side, the book is rather old, some code about converting XML to excel spreadsheets via poi in chapter12 for example, is deprecated, the version of the Oracle Berkeley DB mentioned is 2.4.13 and so on. No errata page is available on the internet. Moreover, it is unusual to find in a java class source file, two or more classes defined together, as in the following code snippet for DOM3Filter.java:

package dom3ls;

import org.w3c.dom.*;
import org.w3c.dom.ls.*;
import oracle.xml.parser.v2.*;
import org.w3c.dom.traversal.*;
import java.io.*;


public class DOM3Filter {


public void filter() {
try {


DOMImplementationLS impl = new XMLDOMImplementation();
LSParser parser =
impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS,
null);
InputFilter inputFilter = new InputFilter();
parser.setFilter(inputFilter);
Document document =
parser.parseURI("file://c:/DOM3.0/catalog.xml");


LSSerializer domWriter = impl.createLSSerializer();
OutputFilter outputFilter = new OutputFilter();
domWriter.setFilter(outputFilter);
LSOutput lsOutput = impl.createLSOutput();
OutputStream outputStream =
new FileOutputStream(new File("filter-output.xml"));
lsOutput.setByteStream(outputStream);
domWriter.write(document, lsOutput);

} catch (IOException e) {
System.out.println("IOException " + e.getMessage());
}

catch (DOMException e) {
System.out.println("DOMException " + e.getMessage());
}

}


public static void main(String[] args) {

DOM3Filter dom3Filter = new DOM3Filter();
dom3Filter.filter();
}


private class InputFilter implements LSParserFilter {
public short acceptNode(Node node) {
return NodeFilter.FILTER_ACCEPT;
}

public int getWhatToShow() {
return NodeFilter.SHOW_ALL;
}

public short startElement(Element element) {
System.out.println("Element Parsed " + element.getTagName());
return NodeFilter.FILTER_ACCEPT;
}
}


private class OutputFilter implements LSSerializerFilter {
public short acceptNode(Node node) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element)node;
if (element.getTagName().equals("journal"))
if (element.getAttribute("date").equals("May-June 2008"))
return NodeFilter.FILTER_REJECT;
}
return NodeFilter.FILTER_ACCEPT;
}

public int getWhatToShow() {
return NodeFilter.SHOW_ALL;
}
}
}
All in all, the book is rather old, but its structured, step by step approach makes it a good introduction to processing XML. The vast majority of its source code is more or less reusable.Thus, it could serve well as an introduction to XML.

Thursday 30 June 2011

Vacation in Agioi Apostoloi, Kalamos

 In this new post a destination near to Athens will be briefly presented as an alternative to a daily excursion to the provinces of Attica; far away of the hectic life and the demonstrations of the busy city centre.
A view of the sea from the Panorama area

The place is called Kalamos,  its port Ag.Apostoloi  (the greek for Saint Apostles) and its distance from Athens centre is less than 50 Km, roughly an hour's journey by private car or public, fully air conditioned,  KTEL bus. You can find more about the geographical position here:
http://www.panoramio.com/photo/8841766 I think the images of the sea speak for themselves.

A view from Kalamos Beach hotel

As far as accommodation is  concerned,  there are two hotels  in the Agona area by the beach: the newer and therefore more expensive Delphinia (Greek for dolphins) and the older but cheaper Kalamos  Beach, which now mostly hosts tourists groups from Russia and the eastern Europe. There also are  plenty of rooms, or flats to let by  the seaside, in addition to whole houses for rent. Prices are as low as 270 euros per month for a 100 square meters house. Many German pensioners live in the Agona area all the year round.
During the winter, there might be so heavy snowfall that the landscape resembles that of the Swiss alps. That might happen once in  five years. In such case, no traffic is allowed due to bad weather, one must have made beforehand food, fuel provisions  to last for a period of a few days. Having a power generator in case of a power outage or some extra wood logs for the fireplace is always a good idea. I am sure the locals will be suitable to offer you advice or help during the winter season.

Landscape during winter

When the weather is good, besides swimming, fishing or chatting with the anglers, sailing, sunbathing and enjoying the clean sea, one could visit the woods, the vineyards to consult with the expert wine makers, go sightseeing to the nearby site of Amphiarion which once served as an oracle, the monasteries, Oropos town or the island of Evia and so on. Finally,  a word of caution: during the  hot weekends, especially on Sundays; it is very crowded, there is difficulty in driving a private car in such narrow streets. Thus, during the weekend getting the bus is the ideal suggestion, for trouble free amusement. It is fully recommended to visit this place during working week days, for having your share of carefree fun in the sun!

Further references:
http://www.athensguide.org/blog/2008/11/ktel.html

Friday 10 June 2011

Comments on EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g, by Deepak Vohra

On the bright side, the text is well written,  providing a brief synopsis of the ejb 3, (not 3.01 which is the current) background and following a block by block explanation of each snippet of source code used. Apart from using the oracle db, the text presents an example of MySql db server and Eclipse too. The applications are usually tested and deployed to the Weblogic server version 10.1.x.x. g  via ant scripts.
On the dark side the source code consists of orphan files, neither ears, nor whole JDeveloper workspaces; as it is usual in oracle university courses solutions. Moreover, the code seems to be what is printed in the text and has some errors. For example: in chapter 2, on page 33 the  modified ejb-jar.xml deployment descriptor reads like this:

<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM CatalogBean AS a WHERE a.catalogId = ?1
</ejb-ql>

meaning that the <![CDATA[ tag is not closed properly, as it is easily understood when these lines are pasted to the editor window. In chapter 4,in CatalogTestSessionEJBBean the method is not persistEntity(catalog), but persistCatalog(catalog) and so on. After some investigation or debugging, one persistent reader will probably end up with a working application.  A mistake which occurs numerous times is the number 2 missing from any sql statement with a VARCHAR2 datatype.  Therefore, it seems that gathering the source code of the book was maybe only an afterthought.  Furthermore, some screenshots and relevant text instructions, apply only to older versions of JDeveloper, other than the current 11.1.2. More advanced topics such as tuning, are beyond the scope of this book.

All in all, the text could be a valuable introduction to combining ejb 3 and fusion for JDeveloper funs. This is recommended for zealots of ADF business components, in order to compare both model tier technologies, especially performance. As it was written back in 2010, ejb technology has somehow superceded it. Thus, if you are a Netbeans fun, you will probably think that is an obsolete book. However, the current JDeveloper version does not seem to support ejb 3.01, so to loyal JDevepoper fanatics, it won't make any difference at all!