You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by ant elder <an...@gmail.com> on 2006/04/25 11:40:25 UTC

Whats the correct way for a binding impl to get at entryPoint config?

The getComposite method in CompositeContext has been deprecated but both the
Axis2 and JSON-RPC binding are using it to get at the Module so as to find
all the entryPoints in the Module. Whats the correct way to be doing this
now?

They use code like:

        ServletContext servletContext = config.getServletContext();
        CompositeContext moduleContext = (CompositeContext)
servletContext.getAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME);
        Module module = (Module) moduleContext.getComposite();

or for the full details see initEntryPointProxys in
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java

Thanks,

   ...ant

Re: Whats the correct way for a binding impl to get at entryPoint config?

Posted by Jeremy Boynes <jb...@apache.org>.
On 4/25/06, ant elder <an...@gmail.com> wrote:
> I understand what you saying is being done wrong, but i don't understand how
> to do your alternative proposals. This has come up before and I'd really
> like to try to sort it out for both bindings this week. Could you either
> provide more concrete details (eg, how does an EntryPointContext register
> with the servlet?), or come discuss it further on IRC, I'm there now or can
> be at any other time that's convenient for you.
>

I'm in a firewall ghetto and only have access to port 80 :-(

For the registration, there are many schemes that can be used but one
would be to create a bridging service as a component in binding.js
(added to the system.fragment file). It would autowire to the
ServletHost. Each EPC would autowire to it and call a registration
method in its @Init method; the bridge would then use the ServletHost
to create a mapping for the entry point's endpoint address. When
invoked the bridge would forward the request to the EPC.

I hope that makes sense.
--
Jeremy

Re: Whats the correct way for a binding impl to get at entryPoint config?

Posted by ant elder <an...@gmail.com>.
I understand what you saying is being done wrong, but i don't understand how
to do your alternative proposals. This has come up before and I'd really
like to try to sort it out for both bindings this week. Could you either
provide more concrete details (eg, how does an EntryPointContext register
with the servlet?), or come discuss it further on IRC, I'm there now or can
be at any other time that's convenient for you.

Thanks,

   ...ant

On 4/25/06, Jeremy Boynes <jb...@apache.org> wrote:
>
> This is deprecated because the runtime implementation should not be
> discovering (on startup or on each request) what the configuration is.
> The full model is available to the builder framework and it should
> configure the runtime context with the information the context needs
> to operate. This avoids the anti-pattern where components are passed
> large configuration model objects that need to be parsed to figure out
> what they do (the injection-of-configuration anti-model as opposed to
> the injection-of-dependency we want to use).
>
> Taking your JSON binding as an example, it looks like what it is doing
> is using the JSONRPCBridge to route requests to the appropriate
> EntryPointContext based on data in the input stream. An alternative
> way that does not require the servlet to have access to the model is
> to have the EntryPointContext themselves register with the servlet;
> taking this further, the binding implementation could define a SCA
> system component that bridges to the host environment (to register URL
> mappings) and to which the EPs can autowire.
>
> --
> Jeremy
>
>
> On 4/25/06, ant elder <an...@gmail.com> wrote:
> > The getComposite method in CompositeContext has been deprecated but both
> the
> > Axis2 and JSON-RPC binding are using it to get at the Module so as to
> find
> > all the entryPoints in the Module. Whats the correct way to be doing
> this
> > now?
> >
> > They use code like:
> >
> >         ServletContext servletContext = config.getServletContext();
> >         CompositeContext moduleContext = (CompositeContext)
> > servletContext.getAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME
> );
> >         Module module = (Module) moduleContext.getComposite();
> >
> > or for the full details see initEntryPointProxys in
> >
> http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java
> >
> > Thanks,
> >
> >    ...ant
> >
> >
>

Re: Whats the correct way for a binding impl to get at entryPoint config?

Posted by Jeremy Boynes <jb...@apache.org>.
This is deprecated because the runtime implementation should not be
discovering (on startup or on each request) what the configuration is.
The full model is available to the builder framework and it should
configure the runtime context with the information the context needs
to operate. This avoids the anti-pattern where components are passed
large configuration model objects that need to be parsed to figure out
what they do (the injection-of-configuration anti-model as opposed to
the injection-of-dependency we want to use).

Taking your JSON binding as an example, it looks like what it is doing
is using the JSONRPCBridge to route requests to the appropriate
EntryPointContext based on data in the input stream. An alternative
way that does not require the servlet to have access to the model is
to have the EntryPointContext themselves register with the servlet;
taking this further, the binding implementation could define a SCA
system component that bridges to the host environment (to register URL
mappings) and to which the EPs can autowire.

--
Jeremy


On 4/25/06, ant elder <an...@gmail.com> wrote:
> The getComposite method in CompositeContext has been deprecated but both the
> Axis2 and JSON-RPC binding are using it to get at the Module so as to find
> all the entryPoints in the Module. Whats the correct way to be doing this
> now?
>
> They use code like:
>
>         ServletContext servletContext = config.getServletContext();
>         CompositeContext moduleContext = (CompositeContext)
> servletContext.getAttribute(TuscanyServletListener.MODULE_COMPONENT_NAME);
>         Module module = (Module) moduleContext.getComposite();
>
> or for the full details see initEntryPointProxys in
> http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/handler/JSONRPCEntryPointServlet.java
>
> Thanks,
>
>    ...ant
>
>