Skip to content
Snippets Groups Projects
Commit 4e9f8f7c authored by Vincent Massol's avatar Vincent Massol
Browse files

[Misc] Improve javadoc

parent 130f992f
No related branches found
No related tags found
No related merge requests found
......@@ -49,14 +49,14 @@
public abstract class AbstractPackager
{
/**
* @param databaseName some database name (TODO: find out what this name is really)
* @param wikiId id of the wiki for which to prepare the XWiki Context (e.g. {@code xwiki})
* @param hibernateConfig the Hibernate config fill containing the database definition (JDBC driver, username and
* password, etc)
* @return a valid XWikiContext using the passed Hibernate configuration and passed database name
* @throws Exception failed to initialize context.
* @todo Replace the Hibernate config file with a list of parameters required for the packaging operation
*/
public XWikiContext createXWikiContext(String databaseName, File hibernateConfig) throws Exception
public XWikiContext createXWikiContext(String wikiId, File hibernateConfig) throws Exception
{
// Initialize the Component Manager and Environment
ComponentManager cm = org.xwiki.environment.System.initialize();
......@@ -78,8 +78,8 @@ public XWikiContext createXWikiContext(String databaseName, File hibernateConfig
throw new Exception("Failed to initialize Execution Context.", e);
}
xcontext.setWikiId(databaseName);
xcontext.setMainXWiki(databaseName);
xcontext.setWikiId(wikiId);
xcontext.setMainXWiki(wikiId);
// Use a dummy Request/Response even in daemon mode so that XWiki's initialization can create a Servlet URL
// Factory and any code requiring those objects will work.
......@@ -93,7 +93,7 @@ public XWikiContext createXWikiContext(String databaseName, File hibernateConfig
// Set a dummy Document in the context to act as the current document since when a document containing
// objects is imported it'll generate Object diff events and the algorithm to compute an object diff
// currently requires rendering object properties, which requires a current document in the context.
xcontext.setDoc(new XWikiDocument(new DocumentReference(databaseName, "dummySpace", "dummyPage")));
xcontext.setDoc(new XWikiDocument(new DocumentReference(wikiId, "dummySpace", "dummyPage")));
XWikiConfig config = new XWikiConfig();
config.put("xwiki.store.class", "com.xpn.xwiki.store.XWikiHibernateStore");
......
......@@ -55,15 +55,15 @@ public class Importer extends AbstractPackager
*
* @param sourceDirectory the directory where the package.xml file is located and where the documents to import are
* located
* @param databaseName some database name (TODO: find out what this name is really)
* @param wikiId id of the wiki into which to import the documents (e.g. {@code xwiki})
* @param hibernateConfig the Hibernate config fill containing the database definition (JDBC driver, username and
* password, etc)
* @throws Exception if the import failed for any reason
* @todo Replace the Hibernate config file with a list of parameters required for the importation
* @todo Replace the Hibernate config file with a list of parameters required for the import
*/
public void importDocuments(File sourceDirectory, String databaseName, File hibernateConfig) throws Exception
public void importDocuments(File sourceDirectory, String wikiId, File hibernateConfig) throws Exception
{
importDocuments(sourceDirectory, databaseName, hibernateConfig, null);
importDocuments(sourceDirectory, wikiId, hibernateConfig, null);
}
/**
......@@ -76,18 +76,18 @@ public void importDocuments(File sourceDirectory, String databaseName, File hibe
*
* @param sourceDirectory the directory where the package.xml file is located and where the documents to import are
* located
* @param databaseName some database name (TODO: find out what this name is really)
* @param wikiId id of the wiki into which to import the documents (e.g. {@code xwiki})
* @param hibernateConfig the Hibernate config fill containing the database definition (JDBC driver, username and
* password, etc)
* @param importUser optionally the user under which to perform the import (useful for example when importing pages
* that need to have Programming Rights and the page author is not the same as the importing user)
* @throws Exception if the import failed for any reason
* @todo Replace the Hibernate config file with a list of parameters required for the importation
* @todo Replace the Hibernate config file with a list of parameters required for the import
*/
public void importDocuments(File sourceDirectory, String databaseName, File hibernateConfig, String importUser)
public void importDocuments(File sourceDirectory, String wikiId, File hibernateConfig, String importUser)
throws Exception
{
XWikiContext xcontext = createXWikiContext(databaseName, hibernateConfig);
XWikiContext xcontext = createXWikiContext(wikiId, hibernateConfig);
Package pack = new Package();
pack.setWithVersions(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment