Re: [Asterisk-java-devel] BaseAgiScript
Brought to you by:
srt
From: Steve P. <sp...@ge...> - 2007-02-04 21:43:48
|
Stefan Reuter wrote: > Steve Prior wrote: >> I think it should be possible to create utility classes which have the >> methods in BaseAgiScript, but aren't actually decendants of AgiScript. >> What I propose is that all the new methods in BaseAgiScript be moved to >> a new class named something like AgiUtil (or whatever) and then >> BaseAgiScript would be declared to implement AgiScript and extend that >> new class name. > > These methods are already available in AgiChannel - if that helps. What I saw was that the code in BaseAGIScript calls getChannel() which is implemented in BaseAGIScript itself. Not that getChanel is very complicated, but I don't see why a user of the API would have to implement their own version of getChannel() themselves if they were implementing utility classes instead of the main class extending BaseAGIScript. > >> This would allow me to declare a class which extends that new class >> which could provide generic Agi utilities which aren't tied to a >> specific project. For example I've now got a couple of methods for >> voice recognition processing which need to call the methods currently in >> BaseAgiScript, but aren't tied to a specific script and this class >> shouldn't implement the service method. > > Why don't you directly extend BaseAgiScript and declare your utility > methods there? In fact as a workaround I've done exactly that, but this means that I needed to implement a dummy void service(AgiRequest request, AgiChannel channel) Not the end of the world, but it really comes down to a bit of a disconnect between a class which can perform operations as part of an AGI script and one which actually is an AGI script. A utility class can perform operations on behalf of the AGI script which invoked it, but by itself is not an AGI script as mandated by extending BaseAGIScript (which requires the service method). So it seemed to me that conceptually there are classes which can perform operations on behalf of an AGI Script (which is the code currently in BaseAgiScript) and then there are classes which can perform those operations which are also in fact AGI scripts. So my thought was to make a new base class named something like BaseAgiOperations into which the current code from BaseAgiScript would be moved. Then the entire code for BaseAgiScript would be: public abstract class BaseAgiScript extends BaseAgiOperations implements AgiScript { } So a utility class like I'm proposing would extend BaseAgiOperations and not have to implementing a useless service(...) method. Any client code which currently extends BaseAgiScript would behave just as it does now (no compatibility problem at all). Steve > > =Stefan > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |