Re: Register an extension step in Calabash

A follow up on the modifications I mentioned below. I created issue  
134 and provided a patch:
<http://code.google.com/p/xmlcalabash/issues/detail?id=134>

Basically, the patch proposes to replace the  
implementationClass(QName):String method of the XProcConfiguration by  
two methods:

public boolean isStepAvailable(QName type)
public XProcStep newStep(XProcRuntime runtime,XAtomicStep step)

This is the minimal refactoring to allow subclassing of the  
XProcConfiguration class to override the methods and change how step  
implementations are maintained and created.

The design could be made even more flexible if the XProcConfiguration  
maintained by default a map of XProcStepFactory instead of a map of  
class names. The API caller could register his own factory instance  
instead of relying on reflection to declare the step implementation  
class.

BR,
Romain.

Le 24 nov. 10 à 11:39, Romain Deltour a écrit :

> You can provide your own configuration file. Calabash will load the  
> configuration in order from:
> 1. /etc/configuration.xml
> 2. .calabash in your home directory
> 3. .calabash in your current working directory
> (see the XProcConfiguration#loadConfiguration() method)
>
> Using the command line, you can also define the configuration file  
> using the -c|--config switch.
>
> Now, there is no way (as far as I could see) to use an API to  
> declare your own step. Calabash basically uses the class name and  
> reflection to load the step instance with the XAtomicStep#run()  
> method.
>
> For our project, I experimented with using OSGi to dynamically  
> register a step to Calabash as an OSGi service. It worked quite  
> well, but required some slight refactoring of the aforementioned  
> step registration process. I intend to contribute this latter  
> modification as soon as I clean them a bit (probably later this week).
>
> BR,
> Romain.
>
> Le 24 nov. 10 à 11:25, Florent Georges a écrit :
>
>> Hi,
>>
>> I am looking for the way to write an extension step for
>> Calabash.  As far as I understand, I can simply extend
>> DefaultStep (or anyway implement XProcStep).  But I don't see
>> where I can register it.
>>
>> The only way I can find from now is to add it to the file
>> /etc/configuration.xml.  Which means modifying a file in the
>> Calabash JAR :-(
>>
>> I have not found any method, say on XProcConfiguration, to
>> register an extension step.  Is it possible without modifying
>> configuration.xml?
>>
>> Regards,
>>
>> -- 
>> Florent Georges
>> http://fgeorges.org/
>>
>

Received on Thursday, 25 November 2010 14:23:04 UTC