Hi Asiri,
You shouldn't have plexus.xml and plexus.properties files in your svn
tree.
If what you want to do is create a WAR you should do as it's done in
enterprise/ or workspaces/ or watch/, etc and do an overlay of the
platform war.
That said we need to discuss the webdav integration into xwiki (see my
several emails on the topic but I think we had a problem to understand
each other...). I learnt today from Ludovic that the webdav feature
has a servlet so we need to think about how we can integrate that. The
first question is why do you need a servlet from the main one?
Thanks
-Vincent
On Aug 1, 2008, at 9:08 PM, asiri (SVN) wrote:
Author: asiri
Date: 2008-08-01 21:08:36 +0200 (Fri, 01 Aug 2008)
New Revision: 11629
Added:
sandbox/xwiki-webdav/src/main/webapp/WEB-INF/plexus.properties
sandbox/xwiki-webdav/src/main/webapp/WEB-INF/plexus.xml
Removed:
sandbox/xwiki-webdav/src/main/resources/plexus.xml
Modified:
sandbox/xwiki-webdav/database/xwiki_db.properties
sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/webdav/
XWikiDavServlet.java
sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/webdav/
resources/domain/XWikiDavPage.java
sandbox/xwiki-webdav/src/main/webapp/WEB-INF/
sandbox/xwiki-webdav/src/main/webapp/WEB-INF/web.xml
Log:
Removed plexus init code from XWikiDavServlet. Changed rename page
code (not fully complete yet).
Modified: sandbox/xwiki-webdav/database/xwiki_db.properties
===================================================================
--- sandbox/xwiki-webdav/database/xwiki_db.properties 2008-08-01
18:09:23 UTC (rev 11628)
+++ sandbox/xwiki-webdav/database/xwiki_db.properties 2008-08-01
19:08:36 UTC (rev 11629)
@@ -1,5 +1,5 @@
#HSQL Database Engine 1.8.0.5
-#Sun Jun 29 23:14:58 LKT 2008
+#Sat Aug 02 00:18:58 LKT 2008
hsqldb.script_format=0
runtime.gc_interval=0
sql.enforce_strict_size=false
Modified: sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/
webdav/XWikiDavServlet.java
===================================================================
--- sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/webdav/
XWikiDavServlet.java 2008-08-01 18:09:23 UTC (rev 11628)
+++ sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/webdav/
XWikiDavServlet.java 2008-08-01 19:08:36 UTC (rev 11629)
@@ -20,31 +20,25 @@
import org.apache.jackrabbit.webdav.WebdavRequest;
import org.apache.jackrabbit.webdav.WebdavRequestImpl;
import org.apache.jackrabbit.webdav.WebdavResponse;
-import org.apache.jackrabbit.webdav.WebdavResponseImpl;
import org.apache.jackrabbit.webdav.lock.LockManager;
import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
import org.apache.jackrabbit.webdav.server.AbstractWebdavServlet;
import org.apache.jackrabbit.webdav.simple.DavSessionProviderImpl;
import org.apache.jackrabbit.webdav.simple.LocatorFactoryImplEx;
-import org.codehaus.plexus.DefaultContainerConfiguration;
-import org.codehaus.plexus.DefaultPlexusContainer;
-import org.codehaus.plexus.PlexusContainerException;
-import
org
.codehaus
.plexus.personality.plexus.lifecycle.phase.PlexusContainerLocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xwiki.component.manager.ComponentManager;
-import org.xwiki.plexus.manager.PlexusComponentManager;
import org.xwiki.container.Container;
-import org.xwiki.container.servlet.ServletContainerInitializer;
import org.xwiki.container.servlet.ServletContainerException;
+import org.xwiki.container.servlet.ServletContainerInitializer;
import org.xwiki.context.Execution;
+import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.plugin.webdav.resources.XWikiDavResource;
import com.xpn.xwiki.plugin.webdav.utils.XWikiDavSessionProvider;
import com.xpn.xwiki.plugin.webdav.utils.XWikiResourceConfig;
import com.xpn.xwiki.plugin.webdav.utils.XWikiResourceFactory;
import com.xpn.xwiki.web.Utils;
-import com.xpn.xwiki.XWikiContext;
/**
* {@link XWikiDavServlet} implements DAV functionalities into XWiki.
@@ -276,26 +270,6 @@
this.resourceConfig = resourceConfig;
}
- /**
- * Initializes and returns the {@link ComponentManager}.
- *
- * @return a configured Component Manager (which uses the
plexus.xml file in the resources
- * directory) which can then be put in the XWiki
Context for testing.
- */
- /*
- private ComponentManager getComponentManager() throws
PlexusContainerException
- {
- if (this.componentManager == null) {
- DefaultContainerConfiguration configuration = new
DefaultContainerConfiguration();
- configuration.setContainerConfiguration("/plexus.xml");
- DefaultPlexusContainer container = new
DefaultPlexusContainer(configuration);
- PlexusContainerLocator locator = new
PlexusContainerLocator(container);
- this.componentManager = new
PlexusComponentManager(locator);
- }
- return this.componentManager;
- }
- */
-
protected void initializeContainerComponent(XWikiContext context)
throws ServletException
{
@@ -336,17 +310,7 @@
*/
public void init() throws ServletException
{
- super.init();
-
- // Initialize the componentManager (Required by XWiki).
- /* try {
-
getServletContext().setAttribute(ComponentManager.class.getName(),
- getComponentManager());
- } catch (PlexusContainerException e) {
- throw new ServletException(e);
- }
- */
-
+ super.init();
resourcePathPrefix =
getInitParameter(INIT_PARAM_RESOURCE_PATH_PREFIX);
if (resourcePathPrefix == null) {
this.resourcePathPrefix = "";
Modified: sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/
webdav/resources/domain/XWikiDavPage.java
===================================================================
--- sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/webdav/
resources/domain/XWikiDavPage.java 2008-08-01 18:09:23 UTC (rev 11628)
+++ sandbox/xwiki-webdav/src/main/java/com/xpn/xwiki/plugin/webdav/
resources/domain/XWikiDavPage.java 2008-08-01 19:08:36 UTC (rev 11629)
@@ -316,7 +316,20 @@
List<String> childDocNames =
xwikiContext.getWiki().getStore().searchDocumentsNames(sql, 0, 0,
xwikiContext);
- doc.rename(newDocName, xwikiContext);
+ // TODO : XWikiDocument.rename() seems to be
broken. This code will be soon replaced
+ // to use XWiki.renameDocument() JIRA :
http://jira.xwiki.org/jira/browse/XWIKI-2600
+ // following is a (partial) hack.
+ // 1. Extract the original content.
+ String content = doc.getContent();
+ // 2. Rename the document.
+ doc.rename(newDocName, xwikiContext);
+ // Change this instances name (not required).
+ this.name = newDocName;
+ // 3. Reload the renamed page
+ doc = xwikiContext.getWiki().getDocument(this.name,
xwikiContext);
+ // 4. Set the old content.
+ doc.setContent(content);
+ // 5. Save the new document back.
xwikiContext.getWiki().saveDocument(doc,
xwikiContext);
for (String childDocName : childDocNames) {
XWikiDocument childDoc =
Deleted: sandbox/xwiki-webdav/src/main/resources/plexus.xml
===================================================================
--- sandbox/xwiki-webdav/src/main/resources/plexus.xml 2008-08-01
18:09:23 UTC (rev 11628)
+++ sandbox/xwiki-webdav/src/main/resources/plexus.xml 2008-08-01
19:08:36 UTC (rev 11629)
@@ -1,54 +0,0 @@
-<!-- Plexus configuration for our Unit/Integation tests. This needs
to be kept in sync
- with the plexus.xml file in the Web Standard module. -->
-<plexus>
-
- <!-- Configure Plexus to use XWiki's lifecycle and XWiki's own
phases -->
- <lifecycle-handler-manager
implementation
="org.codehaus.plexus.lifecycle.DefaultLifecycleHandlerManager">
- <lifecycle-handlers>
- <lifecycle-handler
implementation="org.xwiki.plexus.lifecycle.XWikiLifecycleHandler">
- <id>xwiki</id>
- <name>XWiki Lifecycle Handler</name>
- <begin-segment>
- <!-- Let Plexus do the component injection -->
- <phase
implementation="org.xwiki.plexus.lifecycle.phase.LogEnablePhase"/>
- <phase
implementation
=
"org
.codehaus
.plexus.personality.plexus.lifecycle.phase.CompositionPhase"/>
- <phase
implementation
=
"org
.codehaus
.plexus.personality.plexus.lifecycle.phase.AutoConfigurePhase"/>
- <!-- See the comment below to understand why this is
commented out -->
- <!--phase
implementation
="org.codehaus.plexus.registry.RegistryConfigurePhase"/-->
- <phase
implementation="org.xwiki.plexus.lifecycle.phase.ComposePhase"/>
- <phase
implementation="org.xwiki.plexus.lifecycle.phase.InitializePhase"/>
- </begin-segment>
- <suspend-segment/>
- <resume-segment/>
- <end-segment/>
- </lifecycle-handler>
- </lifecycle-handlers>
- <default-lifecycle-handler-id>xwiki</default-lifecycle-handler-
id>
- </lifecycle-handler-manager>
-
- <components>
- <!-- The registry component allows using Jakarta Commons
Configuration to store configuration
- data for XWiki components, in addition to using
components.xml files. This allows storing
- configurations files in various formats (properties file,
xml files, in a database, etc).
- See Jakarta Commons Configuration for all options.
- -->
- <!-- Note: We're not using it yet. We need to ensure it works
fine before we do so. We
- haven't tested it yet. We also need to decide if we need
to implement our own solution.
- For example the current Registry implementation will not
let component access to general
- configuration data, only those configured for the
component in question.
- <component>
- <role>org.codehaus.plexus.registry.Registry</role>
-
<
implementation
org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</
implementation>
- <role-hint>commons-configuration</role-hint>
- <configuration>
- <properties>
- Q: How can we put this file in WEB-INF/
- <properties fileName="xwiki.properties" config-
at="org.xwiki"/>
- </properties>
- </configuration>
- </component-->
- </components>
-
-</plexus>
-
-
Property changes on: sandbox/xwiki-webdav/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ lib
Added: sandbox/xwiki-webdav/src/main/webapp/WEB-INF/plexus.properties
===================================================================
--- sandbox/xwiki-webdav/src/main/webapp/WEB-INF/
plexus.properties (rev 0)
+++ sandbox/xwiki-webdav/src/main/webapp/WEB-INF/plexus.properties
2008-08-01 19:08:36 UTC (rev 11629)
@@ -0,0 +1,4 @@
+# Plexus configuration file. It's required by some part of Plexus
+# that we don't use. It's a bug that Plexus makes it mandatory.
+# In the future, remove it once Plexus doesn't give a warning
+# when this file isn't present.
Added: sandbox/xwiki-webdav/src/main/webapp/WEB-INF/plexus.xml
===================================================================
--- sandbox/xwiki-webdav/src/main/webapp/WEB-INF/
plexus.xml (rev 0)
+++ sandbox/xwiki-webdav/src/main/webapp/WEB-INF/plexus.xml
2008-08-01 19:08:36 UTC (rev 11629)
@@ -0,0 +1,54 @@
+<!-- Plexus configuration for our Unit/Integation tests. This needs
to be kept in sync
+ with the plexus.xml file in the Web Standard module. -->
+<plexus>
+
+ <!-- Configure Plexus to use XWiki's lifecycle and XWiki's own
phases -->
+ <lifecycle-handler-manager
implementation
="org.codehaus.plexus.lifecycle.DefaultLifecycleHandlerManager">
+ <lifecycle-handlers>
+ <lifecycle-handler
implementation="org.xwiki.plexus.lifecycle.XWikiLifecycleHandler">
+ <id>xwiki</id>
+ <name>XWiki Lifecycle Handler</name>
+ <begin-segment>
+ <!-- Let Plexus do the component injection -->
+ <phase
implementation="org.xwiki.plexus.lifecycle.phase.LogEnablePhase"/>
+ <phase
implementation
=
"org
.codehaus
.plexus.personality.plexus.lifecycle.phase.CompositionPhase"/>
+ <phase
implementation
=
"org
.codehaus
.plexus.personality.plexus.lifecycle.phase.AutoConfigurePhase"/>
+ <!-- See the comment below to understand why this is
commented out -->
+ <!--phase
implementation
="org.codehaus.plexus.registry.RegistryConfigurePhase"/-->
+ <phase
implementation="org.xwiki.plexus.lifecycle.phase.ComposePhase"/>
+ <phase
implementation="org.xwiki.plexus.lifecycle.phase.InitializePhase"/>
+ </begin-segment>
+ <suspend-segment/>
+ <resume-segment/>
+ <end-segment/>
+ </lifecycle-handler>
+ </lifecycle-handlers>
+ <default-lifecycle-handler-id>xwiki</default-lifecycle-handler-
id>
+ </lifecycle-handler-manager>
+
+ <components>
+ <!-- The registry component allows using Jakarta Commons
Configuration to store configuration
+ data for XWiki components, in addition to using
components.xml files. This allows storing
+ configurations files in various formats (properties file,
xml files, in a database, etc).
+ See Jakarta Commons Configuration for all options.
+ -->
+ <!-- Note: We're not using it yet. We need to ensure it works
fine before we do so. We
+ haven't tested it yet. We also need to decide if we need
to implement our own solution.
+ For example the current Registry implementation will not
let component access to general
+ configuration data, only those configured for the
component in question.
+ <component>
+ <role>org.codehaus.plexus.registry.Registry</role>
+
<
implementation
org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</
implementation>
+ <role-hint>commons-configuration</role-hint>
+ <configuration>
+ <properties>
+ Q: How can we put this file in WEB-INF/
+ <properties fileName="xwiki.properties" config-
at="org.xwiki"/>
+ </properties>
+ </configuration>
+ </component-->
+ </components>
+
+</plexus>
+
+
Modified: sandbox/xwiki-webdav/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/xwiki-webdav/src/main/webapp/WEB-INF/web.xml 2008-08-01
18:09:23 UTC (rev 11628)
+++ sandbox/xwiki-webdav/src/main/webapp/WEB-INF/web.xml 2008-08-01
19:08:36 UTC (rev 11629)
@@ -1,17 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee
"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
">
- <display-name>
- xwiki-webdav-servlet
- </display-name>
+<web-app id="WebApp_ID" version="2.4"
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
">
+ <display-name>xwiki-webdav-servlet</display-name>
+ <!-- Initializes Plexus and puts a reference to the Plexus
Component Manager in the Servlet
+ Context. Also initializes the Container Manager component with
the Servlet Context. -->
+ <listener>
+ <listener-class>
+ org.xwiki.plexus.XWikiPlexusServletContextListener
+ </listener-class>
+ </listener>
<servlet>
- <description>
- </description>
- <display-name>
- DAVServlet
- </display-name>
- <servlet-name>
- DAVServlet
- </servlet-name>
+ <description></description>
+ <display-name>DAVServlet</display-name>
+ <servlet-name>DAVServlet</servlet-name>
<servlet-class>
com.xpn.xwiki.plugin.webdav.XWikiDavServlet
</servlet-class>