aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes delegate options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "delegate options" Watch "delegate options" New topic
Author

delegate options

Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Hi All,

We currently have a standalone java application. We have to package the same as an EAR and submit it to the client. The client will use a web service to invoke this application.
The standalone app has a main class which includes the method which orchestrates the entire application run. We make this main class implement an interface so external clients can use the interface as a handle.

Now the client wants a delegate to this application and does not want its web service directly using our application's exposed interface.
Can this delegate be just a simple java class or should we go for something like ejb for a mere delegate.

Do post your thoughts on the same.

Mohit
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

I feel the decision depends on how you want to release your application.
If it is a library i.e. runs along with the web service code, then no need to have a remote interface to it(via ejb or plain rmi)
If it is a standalone application, then you need to provide a remote interface for the delegate.


apigee, a better way to API!
Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Yes the application in its current form is just a standalone application and to be deployed in an application server.
In the delegate I have to make a decision whether to call the standalone app via direct invocation(synchronous) depending on the input received or route it to the batch manager which invokes the standalone app as a batch job (asynchronous).

Does it have to be a remote interface. I mean can it be something like local interface (something like EJB local interface or any other viable alternative).


-------------------------------------
I feel the decision depends on how you want to release your application.
If it is a library i.e. runs along with the web service code, then no need to have a remote interface to it(via ejb or plain rmi)
If it is a standalone application, then you need to provide a remote interface for the delegate.
------------------------------------
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Mohit:Yes the application in its current form is just a standalone application and to be deployed in an application server.


Actually, what i meant by a standalone application(also what people generally mean by standalone) was that the application runs in its own separate JVM. Which does not look so in your case.

Mohit: In the delegate I have to make a decision whether to call the standalone app via direct invocation(synchronous) depending on the input received or route it to the batch manager which invokes the standalone app as a batch job (asynchronous).

Ok, but that does not change the form in which the delegate is exposed to the api clients.

Mohit:
Does it have to be a remote interface. I mean can it be something like local interface (something like EJB local interface or any other viable alternative).

Providing a remote interface (ejb or plain old RMI) facilitates a client to call the api from a different JVM from the one running your delegate.

Okie, so, if you are deploying your application in an application server, then it is better to make the delegate as ejb with a local and remote interface.
That gives you a flexibility to scale your application i.e. choose to deploy the app in the same application server or a different one. Also, it will give you the facilities of transaction (more so if you want to club two api calls into one in the delegate, etc.), security and failover.
So, i would vote for the delegate as an ejb.
Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Thanks Nitesh.

Those responses were indeed helpful
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Check out the Session Facade design pattern for guidance on how to implement the delegate API.
 
 
subject: delegate options