[xwiki-devs] Creating a macro component
I'm having a difficult time adding a java macro and getting it to get invoked. I first found this page and created my class and created a META-INF/plexus/components.xml per the 'tutorial' here: http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in+the+... I then found this tutorial for components (http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation. However, I am unable to get my macro code to get called when pages are rendered. Is there something else I'm missing? I've verified all the relevant files are in my jar. -- Glenn
Hi Glenn, On May 13, 2009, at 10:22 PM, <[email protected]> <[email protected]
wrote:
I'm having a difficult time adding a java macro and getting it to get invoked.
I first found this page and created my class and created a META-INF/ plexus/components.xml per the 'tutorial' here: http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in+the+...
I then found this tutorial for components (http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents ) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing it though.
However, I am unable to get my macro code to get called when pages are rendered.
What version of XE are you using? What error do you get? Thanks -Vincent
Is there something else I'm missing? I've verified all the relevant files are in my jar.
--
Glenn
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:33 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
Hi Glenn,
On May 13, 2009, at 10:22 PM, <[email protected]> <[email protected]
wrote:
I'm having a difficult time adding a java macro and getting it to get invoked.
I first found this page and created my class and created a META-INF/ plexus/components.xml per the 'tutorial' here: http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in +the+new+rendering+engine
I then found this tutorial for components (http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents ) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing it though.
However, I am unable to get my macro code to get called when pages are rendered.
What version of XE are you using?
I'm using XE 1.8.2
What error do you get?
I don't get any error at all. The macro just shows up on the page as I spelled it: {mymacro} Is there an easy way to list recognized components?
Thanks -Vincent
Is there something else I'm missing? I've verified all the relevant files are in my jar.
--
Glenn
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On May 13, 2009, at 10:52 PM, <[email protected]> <[email protected]
wrote:
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:33 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
Hi Glenn,
On May 13, 2009, at 10:22 PM, <[email protected]> <[email protected]
wrote:
I'm having a difficult time adding a java macro and getting it to get invoked.
I first found this page and created my class and created a META-INF/ plexus/components.xml per the 'tutorial' here: http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in +the+new+rendering+engine
I then found this tutorial for components (http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents ) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing it though.
However, I am unable to get my macro code to get called when pages are rendered.
What version of XE are you using?
I'm using XE 1.8.2
What error do you get?
I don't get any error at all. The macro just shows up on the page as I spelled it: {mymacro}
Are you using xwiki syntax 2.0 for that page? If so the syntax is {{mymacro/}}
Is there an easy way to list recognized components?
From java yes, from velocity no. From java just implement Composable and call lookupList(Macro.ROLE) on the component manager. Thanks -Vincent [snip]
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:54 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
On May 13, 2009, at 10:52 PM, <[email protected]> <[email protected]
wrote:
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:33 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
Hi Glenn,
On May 13, 2009, at 10:22 PM, <[email protected]> <[email protected]
wrote:
I'm having a difficult time adding a java macro and getting it to get invoked.
I first found this page and created my class and created a META- INF/ plexus/components.xml per the 'tutorial' here:
http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in
+the+new+rendering+engine
I then found this tutorial for components
(http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing it though.
However, I am unable to get my macro code to get called when pages are rendered.
What version of XE are you using?
I'm using XE 1.8.2
What error do you get?
I don't get any error at all. The macro just shows up on the page as I spelled it: {mymacro}
Are you using xwiki syntax 2.0 for that page? If so the syntax is {{mymacro/}}
Yes, I tried that form as well. Is the 2.0 syntax automatically recognized or is there a switch somewhere? It must be something simple but I just can't see where it's going wrong. Is there an example zip of a java macro I could build to test with?
Is there an easy way to list recognized components?
From java yes, from velocity no. From java just implement Composable and call lookupList(Macro.ROLE) on the component manager.
On May 13, 2009, at 11:03 PM, <[email protected]> wrote:
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:54 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
On May 13, 2009, at 10:52 PM, <[email protected]> <[email protected]
wrote:
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:33 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
Hi Glenn,
On May 13, 2009, at 10:22 PM, <[email protected]> <[email protected]
wrote:
I'm having a difficult time adding a java macro and getting it to get invoked.
I first found this page and created my class and created a META- INF/ plexus/components.xml per the 'tutorial' here:
http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in
+the+new+rendering+engine
I then found this tutorial for components
(http://platform.xwiki.org/xwiki/bin/view/DevGuide/ WritingComponents
) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing it though.
However, I am unable to get my macro code to get called when pages are rendered.
What version of XE are you using?
I'm using XE 1.8.2
What error do you get?
I don't get any error at all. The macro just shows up on the page as I spelled it: {mymacro}
Are you using xwiki syntax 2.0 for that page? If so the syntax is {{mymacro/}}
Yes, I tried that form as well. Is the 2.0 syntax automatically recognized or is there a switch somewhere?
If you're asking this question is means you're not using xwiki syntax 2.0.... ;) See http://platform.xwiki.org/xwiki/bin/view/Features/PageEditing for how to use the 2.0 syntax. Thanks -Vincent
It must be something simple but I just can't see where it's going wrong. Is there an example zip of a java macro I could build to test with?
Is there an easy way to list recognized components?
From java yes, from velocity no. From java just implement Composable and call lookupList(Macro.ROLE) on the component manager.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 2:27 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
On May 13, 2009, at 11:03 PM, <[email protected]> wrote:
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:54 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
On May 13, 2009, at 10:52 PM, <[email protected]> <[email protected]
wrote:
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Wednesday, May 13, 2009 1:33 PM To: XWiki Developers Subject: Re: [xwiki-devs] Creating a macro component
Hi Glenn,
On May 13, 2009, at 10:22 PM, <[email protected]> <[email protected]
wrote:
I'm having a difficult time adding a java macro and getting it to get invoked.
I first found this page and created my class and created a META- INF/ plexus/components.xml per the 'tutorial' here:
http://dev.xwiki.org/xwiki/bin/view/Drafts/Tutorial+to+Write+a+Macro+in
+the+new+rendering+engine
I then found this tutorial for components
(http://platform.xwiki.org/xwiki/bin/view/DevGuide/ WritingComponents
) and created a META-INF/components.txt file and added an @Component("mymacro") annotation to the macro implementation.
Both ways are correct. The annotation way is the newer way of doing it though.
However, I am unable to get my macro code to get called when pages are rendered.
What version of XE are you using?
I'm using XE 1.8.2
What error do you get?
I don't get any error at all. The macro just shows up on the page as I spelled it: {mymacro}
Are you using xwiki syntax 2.0 for that page? If so the syntax is {{mymacro/}}
Yes, I tried that form as well. Is the 2.0 syntax automatically recognized or is there a switch somewhere?
If you're asking this question is means you're not using xwiki syntax 2.0.... ;)
See http://platform.xwiki.org/xwiki/bin/view/Features/PageEditing for how to use the 2.0 syntax.
You're right about the 2.0 syntax. After switching to 2.0 syntax I started getting error messages on the macro code which proved helpful. It turns out my problem was I had accidently made my constructor protected so it was essentially unconstructable. Thanks for the suggestions along the way. I have some more questions I'll ask with a new thread. -- Glenn
Thanks -Vincent
It must be something simple but I just can't see where it's going wrong. Is there an example zip of a java macro I could build to test with?
Is there an easy way to list recognized components?
From java yes, from velocity no. From java just implement Composable and call lookupList(Macro.ROLE) on the component manager.
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
glenn_engel@agilent.com -
Vincent Massol