> I need some more help. Now I have trried to write an Inputmodule. What
> is the right way to access a cocoon component there?
>
> I tried to get a componetmanager from the Map, but it does return a
> EnvironmentDescription:
>
> public class HibernateFactoryInputModule extends AbstractInputModule
> {
I think you want this inputModule to be ThreadSafe, although I am not aware
what you want to achieve, think ThreadSafe would be better. You should also
implement Serviceable to get the ServiceManager to lookup your
PersistenceFactory interface. Add something like
Now, add something like
private PersistenceFactory m_pf;
public void service(ServiceManager manager) throws ServiceException {
m_manager = manager;
m_pf = (PersistenceFactory) m_manager.lookup(PersistenceFactory.ROLE);
}
> public Object getAttribute(String arg0, Configuration
> arg1, Map arg2)
plz, change arg0 into "name", arg1 into "modeConf" and arg2 into "objectModel".
> throws ConfigurationException
> {
> Object object =
> arg2.get("org.apache.cocoon.components.CocoonComponentManager");
Not sure what you want with this, but not sure what you want anyway. So,
suppose you want to call something from your PersistenceFactory interface based
on the serverName from here and return the Object (a String for example). So,
we could do:
Request request = ObjectModelHelper.getRequest(objectModel);
String serverName = request.getServerName();
return
m_pf.get_Something_From_Persistence_According_Server_Which_Returns_String_For_Example_and_I_always_and_up_with_very_long_functions(serverName);
Hope this helps you out,
Regards Ard
> try
> {
> if (object instanceof CocoonComponentManager)
> {
> CocoonComponentManager new_name =
> (CocoonComponentManager) object;
> new_name.toString();
> }
> }
> catch (Exception e)
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> finally
> {
> }
> return object;
> }
> ....
> ....
>
>
>
>
> On 9/11/06, Ard Schrijvers <[EMAIL PROTECTED]> wrote:
> >
> > > Hello,
> > > Ive a problem with accessing a component. Maybe someone
> can help me:
> > >
> > > The component is defined in cocoon.xconf with:
> > > <component class="de.cocoon.hibernate.HibernateFactory"
> > > role="de.cocoon.persistantfactory.PersistenceFactory"/>
> > >
> > > and I can access it in the flowscript with:
> > > var factory =
> > > cocoon.getComponent(Packages.de.cocoon.persistantfactory.Persi
> > > stenceFactory.ROLE);
> > >
> > > Now I want to access it in an JXTemplateGenerator in the sitemap:
> > > The call at the moment is:
> > > <map:generate type="jx" src="blocks.xml">
> > > <map:parameter name="contextPath"
> > > value="{request:contextPath}"/>
> > > <map:parameter name="sitemapAsBase"
> > > value="{baselink:SitemapBaseLink}"/>
> > > <map:parameter name="requestAsBase"
> > > value="{baselink:RequestBaseLink}"/>
> > > <map:parameter name="base-url"
> value="{global:base-url}"/>
> > > </map:generate>
> > >
> > > but in blocks.xml I only have request, session, context
> and so on. So
> > > how can i access it there? Is there a parameter for the
> cocoon object?
> >
> > Suppose yo uwant to access your
> de.cocoon.persistantfactory.PersistenceFactory, right? You
> can just add an inputModule, that looksup your
> de.cocoon.hibernate.HibernateFactory, and returns what you
> are asking for. Look at other inputModules, shouldn't be to hard,
> >
> > Regards Ard
> >
> > > Thanks a lot
> > > Wotan von Klass
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]