Wiki source code of XWiki API Reference

Version 457.4 by Vincent Massol on 2015/03/16

Show last authors
1 {{velocity}}
2 #set($versionStable = "6.4.2")
3 #set($versionDev = "7.0-milestone-2")
4 ##set($versionOldStable = "5.4.7")
5 {{/velocity}}
6
7 XWiki's APIs are the methods that the XWiki development team consider safe for you to use (i.e. for which backward compatibility is guaranteed). They can be called from Java or directly from your wiki pages [[using a scripting language>>DevGuide.Scripting]] (Velocity, Groovy, Python, Ruby, etc).
8
9 {{info}}
10 As users of the XWiki API you need to be aware of some important points:
11 * You should never use a class having ##internal## in its package. It means this class is not a public API and XWiki developers can change it at any time. If you depend on such a class you're on your own and the XWiki Development Team doesn't guarantee its stability.
12 * You should pay attention to the ##@Unstable## annotation. When you see code marked with this annotation it means it's a new public API that it still considered unstable and that can change at any time too. See [[Unstable Annotation>>dev:Community.DevelopmentPractices||anchor="H40UnstableAnnotation"]] for more details.
13 {{/info}}
14
15 == Scripting Reference Documentation ==
16
17 * For XWiki versions >= 6.2.5+ you should install the [[Scripting Documentation Application>>extensions:Extension.Scripting Documentation Application]] in your wiki. You can [[browse a version of it installed on xwiki.org>>ScriptingDocumentation.WebHome]] (but beware, it'll show the Scripting API available on the XWiki version installed for xwiki.org, which may differ from your locally installed XWiki version).
18 * For XWiki versions <= 5.0.x you can browse the old [[Scripting Reference Documentation>>SRD.Navigation||queryString="xpage=embed"]] (a.k.a SRD).
19
20 == How to find a class ==
21
22 You can get the maven module where to find a Java class by using [[XWiki Nexus Search page>>http://nexus.xwiki.org/nexus/index.html#nexus-search;classname~~]]. Put the complete class name and you will get all modules containing it. Nexus also allows you to see what's in those artifacts and read the javadoc.
23
24 == JavaDoc ==
25
26 XWiki is made of various extensions/modules and each module offers API for both developers coding in Java and for Scripts written in wiki pages. In the future our goal is to have Javadoc links directly from each extension page located in the [[Extensions Wiki>>extensions:Main.WebHome]]. Right now we're listing below the Javadocs for all modules.
27
28 {{velocity}}
29 #if ("$!request.versionId" != '')
30 #set ($versionId = $request.versionId)
31 #set ($versionName = $request.versionName)
32 #else
33 #set ($versionId = $versionStable)
34 #set ($versionName = "stable")
35 #end
36
37 Javadoc for version $versionId ($versionName) ([[stable: $versionStable>>||anchor="HJavaDoc" queryString="versionId=$versionStable&versionName=stable"]]#if ($versionDev), [[dev: $versionDev>>||anchor="HJavaDoc" queryString="versionId=$versionDev&versionName=dev"]]#{end}#if ($versionOldStable), [[super stable: $versionOldStable>>||anchor="HJavaDoc" queryString="versionId=$versionOldStable&versionName='super stable'"]]#{end}):
38 {{/velocity}}
39
40 {{groovy}}
41 import groovy.xml.*
42 import org.apache.commons.lang3.*
43
44 def offset = 0
45 def count = 200
46 def shouldContinue = true
47
48 while (shouldContinue) {
49 def url = "http://nexus.xwiki.org/nexus/service/local/lucene/search?g=org.xwiki.*&v=${request.versionId}&p=jar&c=javadoc&from=${offset}&count=${count}".toURL().text
50 def root = new XmlSlurper().parseText(url)
51
52 offset += count
53 def total = Integer.parseInt(root.totalCount.text())
54 shouldContinue = total > offset ? true : false
55
56 root.data.artifact.each { artifact ->
57 // Extract the last part of the group id and consider it's the repo short name
58 def groupId = artifact.groupId.text()
59 def repo = StringUtils.substringAfterLast(groupId, ".")
60 def artifactId = artifact.artifactId
61 def version = artifact.version
62 def javadocURL = "http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/${repo}/${artifactId}/${version}/${artifactId}-${version}-javadoc.jar/!/index.html"
63 println "* [[${artifactId}>>url:${javadocURL}]]"
64 }
65 }
66 {{/groovy}}
67
68 The [[full Javadoc>>http://maven.xwiki.org/site/docs/]] is also available ({{info}}but only for old versions, we need to fix this{{/info}}).
69
70 Older Javadocs of XWiki can be found in our [[Maven Release repository>>http://maven.xwiki.org/releases/]]. For example for XWiki Platform Core Javadocs, check the files suffixed by ##javadoc## for the version you wish under [[this directory>>http://maven.xwiki.org/releases/org/xwiki/platform/xwiki-platform-oldcore/]].

Get Connected