Samstag, September 11, 2004

 

Struts versus JavaServer Faces (JSF)

Many people compare Struts with JSF. My experience on both give me the opinion to say there is a complete different development approach with JSF.
The only equals between JSF and Struts are the external XML defined states of the controller. The JSF-controller concept is much more comparable with Swing-Component (MVC) and not central managed like struts. Additional, Struts is only a Servlet-Controller based on the MVC-2 Pattern and does not include UI-Components with Rendering Delegation Pattern, Statemanagement, full I18N support, component validators etc.





Freitag, September 10, 2004

 

Fetch children from any service method in ADF-Treebinding

With ADF-TreeBinding you have the only possibility to get the children nodes from the same BeanClass used to render the current node self. Therefor you must add a getter method that return a collection of childrens in the node bean. There is no possibility to delegate the call to an other service routine e.g. to a delegate class. With the proxy pattern you can solve this problem easily. You must wrap the node bean in a proxy class and delegate each call to wrapped node expect your getChildren() method. This method can use any service class to retrieve the children nodes and store the returned children's as proxies in the instance. Additional you must bind the proxy to the tree and not the node bean. This little trick make it ease to avoid the ADF-Binding restrictions.

Example code:

class MyNode implements Node {
...
int getId() {...}
String getName() {...}
List getChildren(){...}
...
}

class ProxyNode implements Node {
Node node = null;
Service service = null;
ProxyNode(Service service, Node node) {
this.node = node;
this.service = service;
}

String getName(){
// delegate to org node
return node.getName();
}

List getChildren(){
if(node.getChildren() == null){
return service.getChildrenNodes(node.getId());
}
return node.getChildren();
}
...
}


Attention, the tree binding fetch alway the actual selected node and all nodes of his children nodes to know which rendering mode to use (icon, link ...)




Mittwoch, September 08, 2004

 

J2EE Web Authentication in conjunction with BC4J and JDBC Proxy Authentication

Proxy Authentication is designd to address connection performance problems associated with three-tier. Specifically, it allows to designate an already opend connection from a pool to a specific user with his privileges without logout and login each time.
BC4J-Framwork use the Strategie Pattern to customize the login and connection process. With JDeveloper 10g there is an default Implementation to use the feature. There are only tow single steps to use this feature in conjunction with J2EE login:



String DEFAULT_PWD = "myDefaultPwd123";
HttpContainer c = HttpContainer.getInstanceFromSession(session); c.setSessionCookie("myRootAppModule",null); // More informations about getInstanceFromSession
MyEnvInfoProvider.session.setAttribute(Configuration.DB_USERNAME_PROPERTY, request.getRemoteUser());

This Example works also with an x.509 certificate: see


Example of complete Connection Strategy for BC4J

More infos about proxy authentication



Freitag, September 03, 2004

 

ADF POJO Binding

I was wondering why the native POJO binding doesn't allow creation of new objects (insert). After a look I found out there is not creation supported in the default DataControl implementation class (DCGenericDataControl) of POJO. To suppot the insert operation you must create and register your own DataControl in the DataBinding.cpx file and overwrite the createRowData(DCRowContext) method. To implement the method you can use the TopLink example found under: ../jdev/BC4J/scrc/adfmsrc.zip/oracle.adf.model/generic/toplink/TopLinkDataControl.java

Afterward you must also overwrite the isOperationSupported(...) in your DataControl to enable the MenuBar buttons (check byte parameter with DCDataControl static DCDataControl.OPER_DATA_ROW... ).

Ist not allowed to use only the new operator and insert the bean into the collection!!!

The same requirement exist for the DeleteOperation. You must also overwrite the removeRowData() Methode as above described.

A BUG in the ADF code prevent JClient to refershe automaticly the iterators and show the new data. You can fix it for your own: Unpack ../jdev/BC4J/scrc/adfmsrc.zip and uncomment the if(!containsRow(row)) in the methode insertRow(Row) and insertRowAtRangeIndex(int, Row) of oracle/adf/model/generic/DCRowSetIteratorImpl.java




This page is powered by Blogger. Isn't yours?