You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matt Kendall <ma...@iname.com> on 2005/11/12 00:15:43 UTC

Help with Component Configuration

I'm trying to write a component that will connect to CVS. I'm using a
component because I need to interact with it from several different
sitemap components, so I figured that this was easiest.

The problem I'm having is that Cocoon doesn't seem to pick up the
configuration that I'm placing in cocoon.xconf. The component seems to
get registered OK, but it doesn't get passed the configuration
information. As soon as I try to use the component, in an Action for
the moment, I errors due to an empty configuration object inside of
CVSComponentImpl.  If I do a toString on the configuration object, I
get "::<no value>:@-".

I'm really not sure what I'm doing wrong. Hopefully it's something
incredibly simple.

Here's the relevant bits:

===System===
Cocooon 2.1.7
Just testing with the default Jetty container for now.

===CVSComponent.java===
package com.pega.cocoon.components;
import org.apache.avalon.framework.component.Component;
public interface CVSComponent extends Component {
  public final static String ROLE = CVSComponent.class.getName();
  public boolean updateRepo(String repo);
}

===CVSComponentImpl.java===
package com.pega.cocoon.components;
import ...
public class CVSComponentImpl extends AbstractLogEnabled implements
		CVSComponent, Configurable, Initializable {

	public void configure(Configuration config) throws ConfigurationException {
		this.config = config;
	}

	public void initialize() throws Exception {
            //config.getChildren().length == 0 here.
	}

}

===user.xroles===
<role-list>
  <role name="com.pega.cocoon.components.CVSComponent"
    shorthand="cvs"
    default-class="com.pega.cocoon.components.CVSComponentImpl"/>
</role-list>

===cocoon.xconf===
<cocoon version="2.1" user-roles="/WEB-INF/user.xroles">
...
<cvs>
  <repo name="devcvs2411"
    hostname="devcvs"
    method="pserver"
    password="pegasys"
    port="2411"
    repository="/cvsroot/rules0402"
    user="kendm"
    localpath="D:/programs/cocoon/build/webapp/cvs"/>
 </cvs>
...
</cocoon>

Thanks!!
Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help with Component Configuration

Posted by Matt Kendall <ma...@iname.com>.
Yes, I had seen it, but thanks for the response. I need multiple
repositories, and I'm actually more interested in the metadata
provided by CVS (diff reports, logs, etc) than just browsing files in
a CVSSource. I have viewcvs for that. That's another reason that I'm
making this a component rather than a source.

I did think of one other thing: is there anything that you need to do
to components to initialize them? My understanding was the the Avalon
framework would initialize the components on a sort of "as needed"
basis. That suspicion was born out of the fact that my component's
Initialize method doesn't get called until the action that I'm using
is encountered in the sitemap. But maybe I'm wrong and there's
something that you need to do to make the component read its
configuration?

Thanks,
Matt

On 11/12/05, Bertrand Delacretaz <bd...@apache.org> wrote:
> Le 12 nov. 05, à 00:15, Matt Kendall a écrit :
>
> > I'm trying to write a component that will connect to CVS. I'm using a
> > component because I need to interact with it from several different
> > sitemap components, so I figured that this was easiest....
>
> Have you looked at the CVSSource at
> http://cocoondev.org/main/117/8.html ?
>
> -Bertrand
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help with Component Configuration

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 12 nov. 05, à 00:15, Matt Kendall a écrit :

> I'm trying to write a component that will connect to CVS. I'm using a
> component because I need to interact with it from several different
> sitemap components, so I figured that this was easiest....

Have you looked at the CVSSource at 
http://cocoondev.org/main/117/8.html ?

-Bertrand


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Extending the XML Serializer [solved]

Posted by Geert Josten <Ge...@daidalos.nl>.
Found the answer on 
http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/transform/sax/package-summary.html:

Use
	super.processingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, "");
and
         super.processingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, "");

:-)

Geert

Geert Josten wrote:
> Hi,
> 
> I have extended the XML Serializer to make it write named entities. But 
> they come out like "&amp;ent;".
> 
> Is there a way to disable the 'output escaping'? Or is there another 
> convenient way of making this work?
> 
> Regards,
> Geert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Extending the XML Serializer

Posted by Geert Josten <Ge...@daidalos.nl>.
Hi,

I have extended the XML Serializer to make it write named entities. But they come out like "&amp;ent;".

Is there a way to disable the 'output escaping'? Or is there another convenient way of making this work?

Regards,
Geert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help with Component Configuration

Posted by Matt Kendall <ma...@iname.com>.
I have absolutely no idea what I changed, but it works now. I just
incrementally rewrote the component and it works now.

Thanks for everyone's input!

Matt

On 11/14/05, Upayavira <uv...@odoko.co.uk> wrote:
> Matt Kendall wrote:
> > Right, I'm trying to use the Serviceable interface with my action and
> > to get my component through the lookup() method. Here's my action:
> >
> > public class CVSUpdateAction extends AbstractAction implements Serviceable {
> >       private CVSComponent cvs;
> >       public Map act(Redirector redirector, SourceResolver source,
> >                       Map objectModel, String src, Parameters parameters)
> >                       throws Exception {
> >               Map map = new FastHashMap(1);
> >
> >               map.put("updated", new Boolean(cvs.updateRepo(parameters
> >                               .getParameter("repo"))));
> >
> >               return map;
> >       }
> >
> >       public void service(ServiceManager manager) throws ServiceException {
> >               cvs = (CVSComponent) manager.lookup(CVSComponent.ROLE);
> >       }
> > }
>
> One hint I only discovered recently - if you're using Cocoon 2.1.X,
> ensure that your component implements the Component interface, otherwise
> you'll get messy stuff happening with proxies. Don't now whether that
> has anything to do with your problem though.
>
> Regards, Upayavira
>
>
>
> > On 11/12/05, Joerg Heinicke <jo...@gmx.de> wrote:
> >
> >>On 12.11.2005 00:15, Matt Kendall wrote:
> >>
> >>
> >>>I'm trying to write a component that will connect to CVS. I'm using a
> >>>component because I need to interact with it from several different
> >>>sitemap components, so I figured that this was easiest.
> >>>
> >>>The problem I'm having is that Cocoon doesn't seem to pick up the
> >>>configuration that I'm placing in cocoon.xconf. The component seems to
> >>>get registered OK, but it doesn't get passed the configuration
> >>>information. As soon as I try to use the component, in an Action for
> >>>the moment, I errors due to an empty configuration object inside of
> >>>CVSComponentImpl.  If I do a toString on the configuration object, I
> >>>get "::<no value>:@-".
> >>>
> >>>I'm really not sure what I'm doing wrong. Hopefully it's something
> >>>incredibly simple.
> >>
> >>How do you look up your component? Pure instantiation (new
> >>CVSComponentImpl()) is not sufficient.
> >>
> >>Jörg
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >>For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help with Component Configuration

Posted by Upayavira <uv...@odoko.co.uk>.
Matt Kendall wrote:
> Right, I'm trying to use the Serviceable interface with my action and
> to get my component through the lookup() method. Here's my action:
> 
> public class CVSUpdateAction extends AbstractAction implements Serviceable {
> 	private CVSComponent cvs;
> 	public Map act(Redirector redirector, SourceResolver source,
> 			Map objectModel, String src, Parameters parameters)
> 			throws Exception {
> 		Map map = new FastHashMap(1);
> 	
> 		map.put("updated", new Boolean(cvs.updateRepo(parameters
> 				.getParameter("repo"))));
> 
> 		return map;
> 	}
> 
> 	public void service(ServiceManager manager) throws ServiceException {
> 		cvs = (CVSComponent) manager.lookup(CVSComponent.ROLE);
> 	}
> }

One hint I only discovered recently - if you're using Cocoon 2.1.X,
ensure that your component implements the Component interface, otherwise
you'll get messy stuff happening with proxies. Don't now whether that
has anything to do with your problem though.

Regards, Upayavira



> On 11/12/05, Joerg Heinicke <jo...@gmx.de> wrote:
> 
>>On 12.11.2005 00:15, Matt Kendall wrote:
>>
>>
>>>I'm trying to write a component that will connect to CVS. I'm using a
>>>component because I need to interact with it from several different
>>>sitemap components, so I figured that this was easiest.
>>>
>>>The problem I'm having is that Cocoon doesn't seem to pick up the
>>>configuration that I'm placing in cocoon.xconf. The component seems to
>>>get registered OK, but it doesn't get passed the configuration
>>>information. As soon as I try to use the component, in an Action for
>>>the moment, I errors due to an empty configuration object inside of
>>>CVSComponentImpl.  If I do a toString on the configuration object, I
>>>get "::<no value>:@-".
>>>
>>>I'm really not sure what I'm doing wrong. Hopefully it's something
>>>incredibly simple.
>>
>>How do you look up your component? Pure instantiation (new
>>CVSComponentImpl()) is not sufficient.
>>
>>Jörg
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help with Component Configuration

Posted by Matt Kendall <ma...@iname.com>.
Right, I'm trying to use the Serviceable interface with my action and
to get my component through the lookup() method. Here's my action:

public class CVSUpdateAction extends AbstractAction implements Serviceable {
	private CVSComponent cvs;
	public Map act(Redirector redirector, SourceResolver source,
			Map objectModel, String src, Parameters parameters)
			throws Exception {
		Map map = new FastHashMap(1);
	
		map.put("updated", new Boolean(cvs.updateRepo(parameters
				.getParameter("repo"))));

		return map;
	}

	public void service(ServiceManager manager) throws ServiceException {
		cvs = (CVSComponent) manager.lookup(CVSComponent.ROLE);
	}
}

On 11/12/05, Joerg Heinicke <jo...@gmx.de> wrote:
> On 12.11.2005 00:15, Matt Kendall wrote:
>
> > I'm trying to write a component that will connect to CVS. I'm using a
> > component because I need to interact with it from several different
> > sitemap components, so I figured that this was easiest.
> >
> > The problem I'm having is that Cocoon doesn't seem to pick up the
> > configuration that I'm placing in cocoon.xconf. The component seems to
> > get registered OK, but it doesn't get passed the configuration
> > information. As soon as I try to use the component, in an Action for
> > the moment, I errors due to an empty configuration object inside of
> > CVSComponentImpl.  If I do a toString on the configuration object, I
> > get "::<no value>:@-".
> >
> > I'm really not sure what I'm doing wrong. Hopefully it's something
> > incredibly simple.
>
> How do you look up your component? Pure instantiation (new
> CVSComponentImpl()) is not sufficient.
>
> Jörg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Help with Component Configuration

Posted by Joerg Heinicke <jo...@gmx.de>.
On 12.11.2005 00:15, Matt Kendall wrote:

> I'm trying to write a component that will connect to CVS. I'm using a
> component because I need to interact with it from several different
> sitemap components, so I figured that this was easiest.
> 
> The problem I'm having is that Cocoon doesn't seem to pick up the
> configuration that I'm placing in cocoon.xconf. The component seems to
> get registered OK, but it doesn't get passed the configuration
> information. As soon as I try to use the component, in an Action for
> the moment, I errors due to an empty configuration object inside of
> CVSComponentImpl.  If I do a toString on the configuration object, I
> get "::<no value>:@-".
> 
> I'm really not sure what I'm doing wrong. Hopefully it's something
> incredibly simple.

How do you look up your component? Pure instantiation (new 
CVSComponentImpl()) is not sufficient.

Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org