Re: [xwiki-users] Search subwikis from main wiki
Sorry, you are right, but I see a strange behavior for the search results popup which is shown while typing. It seems it has to do with the chosen search word or something. I created a subwiki where I have a space named Testspace and in there I have a doc Testpage. Typing test in the upper right search box on the main wiki shows no results found (or similar, I'm on German language). Typing testpage shows the page as a result on the search popup. It's the same when I'm in the test wiki, test won't show results, testpage shows results. Is there any minimum size of the search word the users have to be aware of? Sorry again if there is a misunderstanding from my side and thanks for feedback in advance. 2014-11-26 16:30 GMT+01:00 Thomas Mortagne thomas.morta...@xwiki.com: Well that's exactly what the default search is doing by default. You then get on the right a filter where you can select which wiki's result you want to keep. On Wed, Nov 26, 2014 at 4:12 PM, D R rir@gmail.com wrote: Hi, is there a way to make the search function on the main wiki also search inside subwikis? Couldn't find something in the documentation. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Theme not respected on login page
Hi all, I set up a subwiki where the content is restricted to registered users. Only global users (authenticated via LDAP from the main wiki) are allowed. I also set up a color theme and logo. Now when the subwiki is accessed you are automatically redirected to the login page but there the default xwiki theme and logo is used instead of my own. I have to change the permissions for XWiki/DefaultSkin and allow unregistered users and XWikiAllGroup to make the login page respect my theme settings. Is this by design or should I create a Jira bug report? BR, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Search subwikis from main wiki
On Thu, Nov 27, 2014 at 10:21 AM, D R rir@gmail.com wrote: Sorry, you are right, but I see a strange behavior for the search results popup which is shown while typing. It seems it has to do with the chosen search word or something. I created a subwiki where I have a space named Testspace and in there I have a doc Testpage. Typing test in the upper right search box on the main wiki shows no results found (or similar, I'm on German language). Typing testpage shows the page as a result on the search popup. It's the same when I'm in the test wiki, test won't show results, testpage shows results. Is there any minimum size of the search word the users have to be aware of? There is, 3, but that's not the issue here. As long as you get the No result! message it means the search was performed but there were no results. And the reason there were no results in your case is because the live search doesn't perform prefix matching by default (for performance reasons). You can enable prefix matching: * either globally: replace '__INPUT__' with '__INPUT__*' in https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-ui/src/main/resources/XWiki/SuggestSolrMacros.xml#L91 * or per search suggest source: in the wiki administration, Search Suggest section, query property, add q=__INPUT__* on a new line, without the quotes. Hope this helps, Marius Sorry again if there is a misunderstanding from my side and thanks for feedback in advance. 2014-11-26 16:30 GMT+01:00 Thomas Mortagne thomas.morta...@xwiki.com: Well that's exactly what the default search is doing by default. You then get on the right a filter where you can select which wiki's result you want to keep. On Wed, Nov 26, 2014 at 4:12 PM, D R rir@gmail.com wrote: Hi, is there a way to make the search function on the main wiki also search inside subwikis? Couldn't find something in the documentation. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Search subwikis from main wiki
This issue http://jira.xwiki.org/browse/XWIKI-10306 is opened to improve the process of enabling prefix matching. On Thu, Nov 27, 2014 at 11:24 AM, Marius Dumitru Florea mariusdumitru.flo...@xwiki.com wrote: On Thu, Nov 27, 2014 at 10:21 AM, D R rir@gmail.com wrote: Sorry, you are right, but I see a strange behavior for the search results popup which is shown while typing. It seems it has to do with the chosen search word or something. I created a subwiki where I have a space named Testspace and in there I have a doc Testpage. Typing test in the upper right search box on the main wiki shows no results found (or similar, I'm on German language). Typing testpage shows the page as a result on the search popup. It's the same when I'm in the test wiki, test won't show results, testpage shows results. Is there any minimum size of the search word the users have to be aware of? There is, 3, but that's not the issue here. As long as you get the No result! message it means the search was performed but there were no results. And the reason there were no results in your case is because the live search doesn't perform prefix matching by default (for performance reasons). You can enable prefix matching: * either globally: replace '__INPUT__' with '__INPUT__*' in https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-ui/src/main/resources/XWiki/SuggestSolrMacros.xml#L91 * or per search suggest source: in the wiki administration, Search Suggest section, query property, add q=__INPUT__* on a new line, without the quotes. Hope this helps, Marius Sorry again if there is a misunderstanding from my side and thanks for feedback in advance. 2014-11-26 16:30 GMT+01:00 Thomas Mortagne thomas.morta...@xwiki.com: Well that's exactly what the default search is doing by default. You then get on the right a filter where you can select which wiki's result you want to keep. On Wed, Nov 26, 2014 at 4:12 PM, D R rir@gmail.com wrote: Hi, is there a way to make the search function on the main wiki also search inside subwikis? Couldn't find something in the documentation. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] command to delete a comment
Hello In a groovy macro I can access the comments on the page like this : comments = doc.getComments(); now I want to delete the last one... how can I do that? I tried : comments[0].delete(); but it doesn't work do you know what to type to make it work? Thanks a lot Adrien ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] command to delete a comment
On 27 Nov 2014 at 14:37:50, Adrien Moi (adrienmoi1...@hotmail.com(mailto:adrienmoi1...@hotmail.com)) wrote: Hello In a groovy macro I can access the comments on the page like this : comments = doc.getComments(); now I want to delete the last one... how can I do that? I tried : comments[0].delete(); but it doesn't work do you know what to type to make it work? You can get the xobjects of type XWiki.XWikiComments and remove the last one. Check $doc in the SRD. Something like $doc.getObjects(“XWiki.XWikiComments”) and then $doc.removeObject(objct). And don’t forget to save the doc in the end: $doc.save(…). Would be interesting to have a code snippet on extensions.xwiki.org showing this… Thanks -Vincent Thanks a lot Adrien ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] command to delete a comment
On 27 Nov 2014 at 14:51:40, vinc...@massol.net (vinc...@massol.net(mailto:vinc...@massol.net)) wrote: On 27 Nov 2014 at 14:37:50, Adrien Moi (adrienmoi1...@hotmail.com(mailto:adrienmoi1...@hotmail.com)) wrote: Hello In a groovy macro I can access the comments on the page like this : comments = doc.getComments(); now I want to delete the last one... how can I do that? I tried : comments[0].delete(); but it doesn't work do you know what to type to make it work? You can get the xobjects of type XWiki.XWikiComments and remove the last one. Check $doc in the SRD. Something like $doc.getObjects(“XWiki.XWikiComments”) and then $doc.removeObject(objct). And don’t forget to save the doc in the end: $doc.save(…). Would be interesting to have a code snippet on extensions.xwiki.org(http://extensions.xwiki.org) showing this… You can also check these examples: http://extensions.xwiki.org/xwiki/bin/view/Main/Tags?do=viewTagtag=comments Thanks -Vincent Thanks -Vincent Thanks a lot Adrien ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Can't delete attachment
Hi, I imported several .xar files from another xwiki instance and afterwards wanted to delete the uploaded .xar files. All but one have successfully been deleted. Everytime I delete Xwiki_New.xar from the import screen inside the administration screen and refresh the page it's there again. Also in document index I still see it in the attachments tab and not in the deleted attachments tab. Any hints? Is it safe to simply delete it from xwikiattachment table in the database with phpMyAdmin? My system is Windows Server 2003 R2 with Apache 2.4, MySQL 5, Tomcat 7, XWiki 6.3. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Can't delete attachment
You don't have any related error in the lot ? Usually issue with attachments are related to their size and the available memory. On Thu, Nov 27, 2014 at 3:27 PM, D R rir@gmail.com wrote: Hi, I imported several .xar files from another xwiki instance and afterwards wanted to delete the uploaded .xar files. All but one have successfully been deleted. Everytime I delete Xwiki_New.xar from the import screen inside the administration screen and refresh the page it's there again. Also in document index I still see it in the attachments tab and not in the deleted attachments tab. Any hints? Is it safe to simply delete it from xwikiattachment table in the database with phpMyAdmin? My system is Windows Server 2003 R2 with Apache 2.4, MySQL 5, Tomcat 7, XWiki 6.3. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Can't delete attachment
On Thu, Nov 27, 2014 at 3:44 PM, Thomas Mortagne thomas.morta...@xwiki.com wrote: You don't have any related error in the lot ? Usually issue with attachments are related to their size and the available memory. Was in the log. On Thu, Nov 27, 2014 at 3:27 PM, D R rir@gmail.com wrote: Hi, I imported several .xar files from another xwiki instance and afterwards wanted to delete the uploaded .xar files. All but one have successfully been deleted. Everytime I delete Xwiki_New.xar from the import screen inside the administration screen and refresh the page it's there again. Also in document index I still see it in the attachments tab and not in the deleted attachments tab. Any hints? Is it safe to simply delete it from xwikiattachment table in the database with phpMyAdmin? My system is Windows Server 2003 R2 with Apache 2.4, MySQL 5, Tomcat 7, XWiki 6.3. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Can't delete attachment
I didn't see the log output previously because tomcat doesn't start a new one each day. I just found it in the log that started yesterday and yes, you are right. Caused by: java.lang.OutOfMemoryError: Java heap space I wonder why that's happening because I set everything up as written in the XWiki documentation for medium setups and it's just a 10 MB file. Here is what I have in the Tomcat Service Settings: -Xms800m -Xmx800m -XX:MaxPermSize=196m I left the gui fields Initial memory pool at 128 MB and Maximum memory pool at 512 MB. Sorry but I'm new to tomcat and I didn't know exactly what the fields mean so I put the options in the Java Options box. 2014-11-27 15:44 GMT+01:00 Thomas Mortagne thomas.morta...@xwiki.com: On Thu, Nov 27, 2014 at 3:44 PM, Thomas Mortagne thomas.morta...@xwiki.com wrote: You don't have any related error in the lot ? Usually issue with attachments are related to their size and the available memory. Was in the log. On Thu, Nov 27, 2014 at 3:27 PM, D R rir@gmail.com wrote: Hi, I imported several .xar files from another xwiki instance and afterwards wanted to delete the uploaded .xar files. All but one have successfully been deleted. Everytime I delete Xwiki_New.xar from the import screen inside the administration screen and refresh the page it's there again. Also in document index I still see it in the attachments tab and not in the deleted attachments tab. Any hints? Is it safe to simply delete it from xwikiattachment table in the database with phpMyAdmin? My system is Windows Server 2003 R2 with Apache 2.4, MySQL 5, Tomcat 7, XWiki 6.3. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Link to page in edit mode without using full url (or velocity)?
Hello, Any news about this old issue?http://jira.xwiki.org/browse/XRENDERING-22 I found this thread:http://xwiki.475771.n2.nabble.com/Link-to-page-in-edit-mode-without-using-full-url-td5755205.htmlbut this way with flamingo doesn't work very well (display problem): [[labelspace.page?xpage=edit]] Thxs Pascal BASTIEN ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] SOLR and object search
On Mon, Nov 24, 2014 at 9:46 AM, Gerritjan Koekkoek gerritjankoekk...@gmail.com wrote: Hi, I'm trying to understand the new SOLR search (i did not understand the old Lucene very well) My use-case is the following. We have a special FAQ application where the object has, amongst others, the following attributes: - Subject - Topic-group - Language - Question - Answer he default search returns page-title/name, but this is in our case a non-informational, generated by the system code. So instead of Page name we would like to show: Subject You have 3 options: (1) Use Velocity to output the value of the subject property in the FAQ title. See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-blog/xwiki-platform-blog-ui/src/main/resources/Blog/BlogPostSheet.xml#L36 . (2) I doesn't make sense to have a separate String property to store the subject when you can store it in the document title. (3) Customize the entire search page just to change the way the search results are displayed As facets we would like to show Topic-group and Language, Default (on entering the page with search box) we would like to set the context-language as a search filter... So when reader is reading french the result only shows french FAQ (with a french subject title) if english only english. By checking and unchecking languages in the facets the user could extend or reduce the search. This is already the case with the default search. The context language is checked by default in the locale facet. See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-ui/src/main/resources/Main/SolrSearchConfig.xml#L74 . A challenge is the topic field, this is a list with translation key. So if user is french-language the list will show french topics, but if he/she check english as well in facets things get complicated. We have a business-rule that the english collection of FAQ's is the baseline, and most comprehensive. The other languages are only translations of the same. So another languages can not have a question not translated. So my question is: How to define the search http://extensions.xwiki.org/xwiki/bin/view/Extension/Solr+Search+Application#HForDevelopers http://design.xwiki.org/xwiki/bin/view/Design/SolrSchema http://extensions.xwiki.org/xwiki/bin/view/Extension/Solr+Search+Query+API http://lucene.apache.org/solr/ How to modify the output so page-title is no longer showing How to modify facets so only the two fields can be set See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-faq/xwiki-platform-faq-ui/src/main/resources/FAQCode/FAQSearch.xml#L49 . Hope this helps, Marius ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Can't delete attachment
On Thu, Nov 27, 2014 at 3:59 PM, D R rir@gmail.com wrote: I didn't see the log output previously because tomcat doesn't start a new one each day. I just found it in the log that started yesterday and yes, you are right. Caused by: java.lang.OutOfMemoryError: Java heap space I wonder why that's happening because I set everything up as written in the XWiki documentation for medium setups and it's just a 10 MB file. Here is what I have in the Tomcat Service Settings: -Xms800m -Xmx800m -XX:MaxPermSize=196m I left the gui fields Initial memory pool at 128 MB and Maximum memory pool at 512 MB. Sorry but I'm new to tomcat and I didn't know exactly what the fields mean so I put the options in the Java Options box. Xms is the initial memory pool and xmx is the maximum memory pool so I don't really understand which one you have. What is sure is that 128 and 512 is quite low for XWiki if that's what is actually applied. 2014-11-27 15:44 GMT+01:00 Thomas Mortagne thomas.morta...@xwiki.com: On Thu, Nov 27, 2014 at 3:44 PM, Thomas Mortagne thomas.morta...@xwiki.com wrote: You don't have any related error in the lot ? Usually issue with attachments are related to their size and the available memory. Was in the log. On Thu, Nov 27, 2014 at 3:27 PM, D R rir@gmail.com wrote: Hi, I imported several .xar files from another xwiki instance and afterwards wanted to delete the uploaded .xar files. All but one have successfully been deleted. Everytime I delete Xwiki_New.xar from the import screen inside the administration screen and refresh the page it's there again. Also in document index I still see it in the attachments tab and not in the deleted attachments tab. Any hints? Is it safe to simply delete it from xwikiattachment table in the database with phpMyAdmin? My system is Windows Server 2003 R2 with Apache 2.4, MySQL 5, Tomcat 7, XWiki 6.3. Thanks in advance, Dennis ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Link to page in edit mode without using full url (or velocity)?
On Thu, Nov 27, 2014 at 5:05 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, Any news about this old issue?http://jira.xwiki.org/browse/XRENDERING-22 I found this thread:http://xwiki.475771.n2.nabble.com/Link-to-page-in-edit-mode-without-using-full-url-td5755205.htmlbut this way with flamingo doesn't work very well (display problem): [[labelspace.page?xpage=edit]] That's not how you specify the query string in XWiki 2.1 links. Try this: [[Edit Sandbox home pageSandbox.WebHome||queryString=xpage=edit]] And check out the link syntax. Hope this helps, Marius Thxs Pascal BASTIEN ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Offer for xwiki programmers - modify xWiki for using NuoDB database for storing repository
I am a satisfied user XWiki, but I carried on porting XWiki nuodb (jdbc driver exists). If you are a developer, Who is able to do this, please contact me, I can be a sponsor of this small activity (some dollars up to $ 100 for this small task). After successfull work, the code changes will be published to public xwiki repository for all other users (open source, it's have to request, not private development). Testing capacity I can deliver for testing portation, license of NuoDB is free for developers (www.nuodb.com). Platform: native linux 64 (Centos) If you are interested, please contact me. PS: Some new features and changes of existing I have in long wishlist could be long term cooperation. Work off site, no on site needed (You provide changes as source code package of xwiki, we test it in our environment). Petr Šimbera psimb...@seznam.cz (native czech language, Czech Republic), english is ok ... ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Link to page in edit mode without using full url (or velocity)?
Yes of course!How silly I'm am (it is not the first time I fall in this trap) :-( It's work like a charm: queryString=xpage=editeditor=wikiThxs. De : Marius Dumitru Florea mariusdumitru.flo...@xwiki.com À : Pascal BASTIEN pbasnews-xw...@yahoo.fr; XWiki Users users@xwiki.org Envoyé le : Jeudi 27 novembre 2014 16h14 Objet : Re: [xwiki-users] Link to page in edit mode without using full url (or velocity)? On Thu, Nov 27, 2014 at 5:05 PM, Pascal BASTIEN pbasnews-xw...@yahoo.fr wrote: Hello, Any news about this old issue?http://jira.xwiki.org/browse/XRENDERING-22 I found this thread:http://xwiki.475771.n2.nabble.com/Link-to-page-in-edit-mode-without-using-full-url-td5755205.htmlbut this way with flamingo doesn't work very well (display problem): [[labelspace.page?xpage=edit]] That's not how you specify the query string in XWiki 2.1 links. Try this: [[Edit Sandbox home pageSandbox.WebHome||queryString=xpage=edit]] And check out the link syntax. Hope this helps, Marius Thxs Pascal BASTIEN ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Xwiki / accessing external SQL database / How to use SQL plugin ?
Hi, I did not use that extension, nor had to write SQL queries on remote databases in velocity (you usually write a component and/or script service to do that for your and expose the results to the velocity UI), but that extension seems to have an impressive amount of documentation linked from the description: http://xwikisql.gradsoft.ua/docs/XWikiSqlPluginGuide.html including code http://xwikisql.gradsoft.ua/docs/api/ua/gradsoft/xwikisql/SqlPluginApi.html#getDatabase%28java.lang.String%29 Also, googling for jetty data source gives a pretty good results https://wiki.eclipse.org/Jetty/Howto/Configure_JNDI_Datasource + https://wiki.eclipse.org/Jetty/Feature/JNDI Same for tomcat, etc. Hope this helps, Eduard On Wed, Nov 26, 2014 at 11:30 AM, m...@ow2.org m...@ow2.org wrote: Hi, We are looking for the best way to access an external SQL database using velocity exclusively (because we can't write a macro using groovy language). So, we installed and tried to use this plugin : http://extensions.xwiki.org/xwiki/bin/view/Extension/SQL+Plugin. The plugin is properly installed. Now we are unsure how to use it : there is no mention of the user which is used to connect to the database, do we have to to configure a JNDI ? How ? As a side question, what is you guys your preferred method to program xwiki pages with external database access ? Thanks -- Martin ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Registering components
Many thanks, I'll give that a go. From: Thomas Mortagne [thomas.morta...@xwiki.com] Sent: 27 November 2014 23:14 To: Bryn Jeffries Subject: Re: [xwiki-users] Registering components https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-display/xwiki-platform-display-api/src/test/java/org/xwiki/display/internal/DocumentContentDisplayerTest.java is a good up to date (we changed several time the mocking system to use in XWiki by default, it's Mockito currently) example of how to manipuated a mock of DocumentAccessBridge in a component oriented unit test. On Thu, Nov 27, 2014 at 11:42 AM, Bryn Jeffries bryn.jeffr...@sydney.edu.au wrote: Useful to know, thanks. Incidentally, are there any useful mocks, etc, for unit testing xwiki component code ( to avoid frequently restarting tomcat)? Like a mock execution context, for instance? Thanks, Bryn - Reply message - From: Thomas Mortagne thomas.morta...@xwiki.com To: XWiki Users users@xwiki.org Subject: Re: [xwiki-users] Registering components Date: Thu, Nov 27, 2014 18:38 On Thu, Nov 27, 2014 at 8:36 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: What you have in XE_WAR_HOME/WEB-INF/lib is loaded by Tomcat at startup, there is not much XWiki can do about it. But you can install your jar as an extension using Extension Manager as long as it's on some supported repository (which mean a Maven repository or XWiki repository, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Repository+Application for this last one) and you indicate your repository in xwiki.properties. Note that Extension Manager is not the best fit right now to test snapshot jars since it does not have the required special handling of SNAPSHOT needed to update to a new version of the same SNAPSHOT version. On Thu, Nov 27, 2014 at 5:20 AM, Bryn Jeffries bryn.jeffr...@sydney.edu.au wrote: Having been put off writing Java components a number of times I've decided to really tackle the problem head on. I would greatly appreciate any help in this. I've been following the advice in http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents and I have compiled a Jar identical to the Hello World example except that the class and method names differ, hopefully consistently. I've placed the jar in XE_WAR_HOME/WEB-INF/lib and written a page, which consists only of {{velocity}} $services.mycomponent.greet() {{/velocity}} The output when viewed is simple $services.alertdb.greet(), so nothing seems to have happened. However, if I restart Tomcat (and then wait a minute or so for XWiki to restart) the output is Hello, as desired. So is a restart of Tomcat always required? This wasn't mentioned in the guide. And since extensions can be added via the extension manager without a restart, is there a sneaky trick to doing the same with my own components. Also, is a restart necessary when I update the Jar, either with fixed methods or modified interface? ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne -- Thomas Mortagne -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Getting user name with a Java Component
I wrote: What's the right way to get the current user from the execution context within a Java component? Thomas Mortagne replied: For what you need the simplest in a component is usually to use org.xwiki.bridge.DocumentAccessBridge component (from xwiki-platform-bridge module) until a proper user manager api is introduced. OK, so I should not use ExecutionContext at all? It looks the the approach you're suggesting is: 1) Inject a DocumentAccessBridge instead of an Execution, e.g.: @Inject private DocumentAccessBridge bridge; 2) Get a reference to the current user (According to http://maven.xwiki.org/site/docs/xwiki-javadoc-5.0.x/org/xwiki/bridge/DocumentAccessBridge.html which might be out of date but I can't find a more recent API doc) DocumentReference userDoc = bridge.getCurrentUserReference(); 3) Presumably the document reference captures the full location of the user's profile page. The DocumentReference API doesn't appear to have a page name accessor, so presumably to extract the user name I need to pull it out of userDoc.toString(). Is this right? Conceptually I find this less intuitive than using a context object, so it's a pity if that's been deprecated. Thanks, Bryn ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Handling exceptions from components
What's the preferred way to deal with errors occuring in Java components? Is it OK to throw an exception from within the component, and can this be caught within the Velocity or Groovy code that calls it? ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Getting user name with a Java Component
On Nov 28, 2014 12:33 AM, Bryn Jeffries bryn.jeffr...@sydney.edu.au wrote: I wrote: What's the right way to get the current user from the execution context within a Java component? Thomas Mortagne replied: For what you need the simplest in a component is usually to use org.xwiki.bridge.DocumentAccessBridge component (from xwiki-platform-bridge module) until a proper user manager api is introduced. OK, so I should not use ExecutionContext at all? It looks the the approach you're suggesting is: 1) Inject a DocumentAccessBridge instead of an Execution, e.g.: @Inject private DocumentAccessBridge bridge; 2) Get a reference to the current user (According to http://maven.xwiki.org/site/docs/xwiki-javadoc-5.0.x/org/xwiki/bridge/DocumentAccessBridge.html which might be out of date but I can't find a more recent API doc) DocumentReference userDoc = bridge.getCurrentUserReference(); 3) Presumably the document reference captures the full location of the user's profile page. The DocumentReference API doesn't appear to have a page name accessor, so presumably to extract the user name I need to pull it out of userDoc.toString(). What information do you need precisely? The user alias (what the user uses to log in)? Or the user pretty name? The user alias is the name of the user profile document. bridge.getCurrentUserReference().getName() For the pretty name you need to get the value of the first_name and last_name properties from the user profile document for which you have the reference: the user reference. bridge.getProperty... Hope this helps, Marius Is this right? Conceptually I find this less intuitive than using a context object, so it's a pity if that's been deprecated. Thanks, Bryn ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users