batBot:ActionFrom WikiJavaAfter each request it should be performed a configurable action on the returned HTML
ManagerUser:DonGiulio is the manager for this requirement. Send DonGiulio an email Feature Groupsconfigurationthe action to be performed should be assigned for each request, so that each request has it's own action. add the command element in the config.xmlmake the fileHelper manage the command Elementcall the actionthe request should call the action right after receiving the response to the request. The action should be executed on a separate thread.
create a dummy actionthe action just does nothing, but it does it in multithreading with synchronized methods .
extract interface from the dummy actionthe interface is necessary so we can generate many dummy actions and implement the command pattern
create the new bean in the applicationcontext.xmlWe want to create these objects via Spring
create getAction in BatBotResourceFactory.javaso we get the factory method for obtaining actions
note that the action is specified in the request object via a String. a first approximation should be that that string is given to the getAction(String actionName) method, who uses that string straight away as the name for the Bean in Spring. in this way we already don't need to re-compile each time we create a new action, adding it to the beans will suffice
make the action do somethingconvert the HTTPHelper Class to return a response objectall the info about the response obtained should be packed in the Response Object.
make the Action Interface get a Response Object as parameterusing the object the Action will be able to run and perform its tasks
Create a new Action printing the output from the request into a Filejust another more complex dummy action to show that we can actually do whatever we like.
modify the config.xmlAdd to the action in the configuration the parameters for configuring the action. the action has no alias in the XSTREAM so the element is mentioned using the fully qualified name. Remove the beans from the application contextif we use xstream for deserializing the object then we don't need Spring to take care of it.
Split the action from its executorthe serialiser tries to persist all the fields inherited from Thread generating a CircularReferenceException. The object persisted can't be the one executing the thread. we must implement the executor in a separate class..
the Request creates and starts the executorpassing to the executor the Action object, which contains all the info (and the methods) about the action requested.
make sure that each request can call only one Action per timeusing synchronization. it depends on the action if forget about successive call while it was running and consider only the last call, or forget about everything. this is for another featureGroup. What we want now is just to make sure that calls to the action while the action was running are queued. and passed to the action after it's done. More tasks here=== See also |
