wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Business Interface Pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Business Interface Pattern" Watch "Business Interface Pattern" New topic
Author

Business Interface Pattern

Prannav Santhosh
Greenhorn

Joined: May 09, 2009
Posts: 29
Can some one explain me what is the advantage of using this "Business Interface" pattern ?.. Thanks for your help
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It abstracts away implementation details of business logic, allowing both easier testing of things that use the interfaces, and reuse of business logic in arbitrary ways.
Prannav Santhosh
Greenhorn

Joined: May 09, 2009
Posts: 29
Hi,
I have the following code.

//My remote component interface.
public interface Test extends ILibrary,javax.ejb.EJBObject {
//no method definition here.
}



//my business interface
public interface ILibrary {

public String getName()throws RemoteException;
}


public class LibraryDelegate implements ILibrary {
ILibrary ilib=null;
LibraryDelegate(){
//lookup the ejb and get the reference to the ILibrary Interface.
}

public String getName() throws DesignException {
String s=null;
try {
s= ilib.getName();
} catch (RemoteException e) {
throw new DesignException(e.getMessage());
}

return s;
}

}

The getName() method in the above delegate class give me compilation error saying "Exception DesignExcpetion is not compatible with the throws clause in ILibrary.getName() method". Am i doing something thing wrong ? Thanks for your help.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes--you're trying to change the signature of an interface's methods.

Please start new topics for new questions.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Business Interface Pattern