Hi,
I'm trying to extend Spring, and in the process supply a new schema.
Here's the background (reason) for my extension. I want to extend the SimpleRemoteStatelessSessionProxyFactoryBean to allow a list of MethodInterceptors to be set. These interceptors should be called before the proxy is called (and subsequently the EJB). I'm using these interceptors to move context from a local thread into a request context.
So I've made an extension of RemoteStatelessSessionBeanDefinitionParser (which actually can't be extended, as it for some reason is package private. so I had to extend AbstractSingleBeanDefinitionParser and duplicate the business logic from the subimplementations) and a separate NamespaceHandler.
So, here's the issue. I have to implement the postProcess to process the custom element I have called "method-interceptors". It's defined like this in my xsd:
My context.xml:Code:<xsd:element name="method-interceptors" minOccurs="0" maxOccurs="1"> <xsd:complexType> <xsd:sequence> <xsd:element ref="beans:list"/> </xsd:sequence> </xsd:complexType> </xsd:element>
This is my postProcess-code:Code:....(part of remote-slsb-extension)... <myscema:method-interceptor> <list><bean ref="myInterceptorBean"/></list> </myscema:method-interceptor> ..
At the todo, I want to get the List of bean-refs that is in my context.xml and set it on my bean. But I can't figure out how. The parameters provided through the method doesn't really help me. Obviously, I'm just being stupid...but instead of waisting more time trying to find out this myself I thought I'd give the forum a go. Basically what I want is a way to convert this nodeList into a javalist and set it on my bean instance...Code:protected void postProcess(BeanDefinitionBuilder definitionBuilder, Element element) { NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if(METHOD_INTERCEPTORS.equals(node.getLocalName())){ //Get the listNode Node listNode = node.getFirstChild(); NodeList interceptors = listNode.getChildNodes(); //TODO: Implement } } }


Reply With Quote
