Author: sdumitriu
Date: 2008-01-02 17:59:09 +0100 (Wed, 02 Jan 2008)
New Revision: 6598
Added:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/XmlSerializable.java
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/LogicalTime.java
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Operation.java
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Originator.java
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Patch.java
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchId.java
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchSet.java
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Position.java
Log:
XWIKI-1977: Create a patchservice data model
Move the common toXml and fromXml methods to a common interface
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/LogicalTime.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/LogicalTime.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/LogicalTime.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -1,13 +1,12 @@
package org.xwiki.platform.patchservice.api;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.xpn.xwiki.XWikiException;
-
-public interface LogicalTime extends Comparable
+/**
+ * A logical time represents a kind of timestamp that can be used in a p2p
environment, where a
+ * simple host time isn't enough for event ordering. The actual implementation
is hidden, as all we
+ * need to do is compare two logical timestamps.
+ *
+ * @version $Id: $
+ */
+public interface LogicalTime extends Comparable, XmlSerializable
{
- Element toXml(Document doc) throws XWikiException;
-
- void fromXml(Element e) throws XWikiException;
}
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Operation.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Operation.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Operation.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -1,8 +1,5 @@
package org.xwiki.platform.patchservice.api;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
import com.xpn.xwiki.XWikiException;
import com.xpn.xwiki.doc.XWikiDocument;
@@ -32,7 +29,7 @@
* @see RWOperation
* @version $Id: $
*/
-public interface Operation
+public interface Operation extends XmlSerializable
{
/* Operation type flags */
/**
@@ -119,26 +116,6 @@
/* Actions */
/**
- * Serialize this operation as a DOM Element that can be inserted in the
given DOM Document.
- *
- * @param doc A DOM Document used for generating a compatible Element. The
document is not
- * changed, as the constructed Element is just returned, not
inserted in the
- * document.
- * @return The operation exported as a DOM Element.
- * @throws XWikiException If the Operation is not well defined.
- */
- Element toXml(Document doc) throws XWikiException;
-
- /**
- * Load the operation from an XML.
- *
- * @param e A DOM Element defining the Operation.
- * @throws XWikiException If the provided element is not a valid (or
compatible) exported
- * Operation.
- */
- void fromXml(Element e) throws XWikiException;
-
- /**
* Apply this operation on a document.
*
* @param doc The document being patched.
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Originator.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Originator.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Originator.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -1,19 +1,10 @@
package org.xwiki.platform.patchservice.api;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.xpn.xwiki.XWikiException;
-
-public interface Originator
+public interface Originator extends XmlSerializable
{
String getAuthor();
String getHostId();
String getWikiId();
-
- Element toXml(Document doc) throws XWikiException;
-
- void fromXml(Element e) throws XWikiException;
}
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Patch.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Patch.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Patch.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -2,13 +2,12 @@
import java.util.List;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import com.xpn.xwiki.XWikiException;
import com.xpn.xwiki.doc.XWikiDocument;
-public interface Patch
+public interface Patch extends XmlSerializable
{
String getSpecVersion();
@@ -33,10 +32,6 @@
// boolean checkSignature();
Element toXml() throws XWikiException;
- Element toXml(Document doc) throws XWikiException;
-
- void fromXml(Element e) throws XWikiException;
-
/**
* Apply this patch on a document.
*
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchId.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchId.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchId.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -2,12 +2,7 @@
import java.util.Date;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.xpn.xwiki.XWikiException;
-
-public interface PatchId
+public interface PatchId extends XmlSerializable
{
String getHostId();
@@ -16,8 +11,4 @@
Date getTime();
String getDocumentId();
-
- Element toXml(Document doc) throws XWikiException;
-
- void fromXml(Element e) throws XWikiException;
}
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchSet.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchSet.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/PatchSet.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -2,21 +2,15 @@
import java.util.List;
-import org.w3c.dom.Element;
-
import com.xpn.xwiki.XWikiException;
import com.xpn.xwiki.doc.XWikiDocument;
-public interface PatchSet
+public interface PatchSet extends XmlSerializable
{
List getVersionRange();
List getPatches();
- Element toXml() throws XWikiException;
-
- void fromXml(Element e) throws XWikiException;
-
/**
* Apply this patch set on a document.
*
Modified:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Position.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Position.java
2008-01-02 16:39:44 UTC (rev 6597)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/Position.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -1,11 +1,6 @@
package org.xwiki.platform.patchservice.api;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.xpn.xwiki.XWikiException;
-
-public interface Position
+public interface Position extends XmlSerializable
{
/**
* Checks if the position is still valid for the given text.
@@ -34,24 +29,4 @@
* valid.
*/
String getTextAfterPosition(String text);
-
- /**
- * Serialize this position as a DOM Element that can be inserted in the
given DOM Document.
- *
- * @param doc A DOM Document used for generating a compatible Element. The
document is not
- * changed, as the constructed Element is just returned, not
inserted in the
- * document.
- * @return The operation exported as a DOM Element.
- * @throws XWikiException If the Operation is not well defined.
- */
- Element toXml(Document doc) throws XWikiException;
-
- /**
- * Load the operation from an XML.
- *
- * @param e A DOM Element defining the Operation.
- * @throws XWikiException If the provided element is not a valid (or
compatible) exported
- * Operation.
- */
- void fromXml(Element e) throws XWikiException;
}
Added:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/XmlSerializable.java
===================================================================
---
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/XmlSerializable.java
(rev 0)
+++
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/XmlSerializable.java
2008-01-02 16:59:09 UTC (rev 6598)
@@ -0,0 +1,29 @@
+package org.xwiki.platform.patchservice.api;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.xpn.xwiki.XWikiException;
+
+public interface XmlSerializable
+{
+ /**
+ * Serialize this object as a DOM Element that can be inserted in the
given DOM Document.
+ *
+ * @param doc A DOM Document used for generating a compatible Element. The
document is not
+ * changed, as the constructed Element is just returned, not
inserted in the
+ * document.
+ * @return The object exported as a DOM Element.
+ * @throws XWikiException If the object is not well defined.
+ */
+ Element toXml(Document doc) throws XWikiException;
+
+ /**
+ * Load the object from an XML.
+ *
+ * @param e A DOM Element defining the object.
+ * @throws XWikiException If the provided element is not a valid (or
compatible) exported
+ * object.
+ */
+ void fromXml(Element e) throws XWikiException;
+}
Property changes on:
xwiki-platform/core/trunk/xwiki-patchservice/src/main/java/org/xwiki/platform/patchservice/api/XmlSerializable.java
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications