You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@locus.apache.org on 2000/07/25 02:16:48 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/common XMLUnmarshaller.java
remm 00/07/24 17:16:46
Modified: src/share/org/apache/slide/common XMLUnmarshaller.java
Log:
- Initialize the revision descriptors of objects created at startup
- Handle the creation of properties and revisions (incomplete)
Revision Changes Path
1.7 +87 -4 jakarta-slide/src/share/org/apache/slide/common/XMLUnmarshaller.java
Index: XMLUnmarshaller.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/XMLUnmarshaller.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XMLUnmarshaller.java 2000/07/14 16:44:41 1.6
+++ XMLUnmarshaller.java 2000/07/25 00:16:45 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/XMLUnmarshaller.java,v 1.6 2000/07/14 16:44:41 remm Exp $
- * $Revision: 1.6 $
- * $Date: 2000/07/14 16:44:41 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/XMLUnmarshaller.java,v 1.7 2000/07/25 00:16:45 remm Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/07/25 00:16:45 $
*
* ====================================================================
*
@@ -84,7 +84,7 @@
* XMLUnmarshaller class.
*
* @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public final class XMLUnmarshaller {
@@ -210,6 +210,20 @@
}
+ // Retrieve the list of revisions of the object
+ Enumeration revisionDefinitions =
+ objectDefinition.getConfigurations("revision");
+
+ // We parse the revision definition list
+ while (revisionDefinitions.hasMoreElements()) {
+
+ Configuration revisionDefinition =
+ (Configuration) revisionDefinitions.nextElement();
+ loadObjectRevision(accessToken, token, uri,
+ revisionDefinition);
+
+ }
+
} catch (ObjectAlreadyExistsException e) {
// Object creation failed.
// The object probably does already exist in the data source.
@@ -234,6 +248,75 @@
Configuration childConfiguration =
(Configuration) childConfigurations.nextElement();
loadObjectNode(accessToken, token, childConfiguration);
+ }
+
+ }
+
+
+ /**
+ * Create the SlideProperties object associated with a ObjectNode.
+ *
+ * @param slideObject ObjectNode
+ * @param propertiesDef Castor object describing the properties associated
+ * with the ObjectNode
+ * @exception SlideException A data access error occured
+ */
+ private static void loadObjectRevision(NamespaceAccessToken accessToken,
+ CredentialsToken token, String uri,
+ Configuration revisionDefinition)
+ throws ServiceAccessException, ConfigurationException,
+ AccessDeniedException, ObjectNotFoundException,
+ LinkedObjectNotFoundException {
+
+ // Retrieving the list of properties
+ Enumeration propertyDefinitions =
+ revisionDefinition.getConfigurations("property");
+ // Retrieving the content element if it exists
+ Configuration contentDefinition = null;
+ try {
+ contentDefinition = revisionDefinition.getConfiguration("content");
+ } catch (ConfigurationException e) {
+ // Silent catch, since the parameter is optional
+ }
+ // Retrieving the revision number, if any
+ NodeRevisionNumber revisionNumber = null;
+
+ // TODO : Copy the contents at the specified URL to a temp file.
+ // Then, get the content length ...
+ long contentLength = 0;
+
+ // Now creating the new revision descriptor object
+ NodeRevisionDescriptor revisionDescriptor =
+ new NodeRevisionDescriptor(contentLength);
+
+ while (propertyDefinitions.hasMoreElements()) {
+ Configuration propertyDefinition =
+ (Configuration) propertyDefinitions.nextElement();
+ String propertyName = propertyDefinition.getAttribute("name");
+ String propertyValue = propertyDefinition.getValue();
+ revisionDescriptor.setProperty(propertyName, propertyValue);
+ }
+
+ NodeRevisionContent revisionContent = null;
+
+ if (contentDefinition != null) {
+ // Get an InputStream on the temporary file
+ }
+
+ // TODO : Parse predecessor list, and make the appropriate method call
+
+ try {
+ accessToken.getContentHelper().create(token, uri,
+ revisionDescriptor,
+ revisionContent);
+ } catch(ObjectLockedException e) {
+ // Should not happen
+ e.printStackTrace();
+ Domain.warn(e.getMessage());
+ } catch(RevisionAlreadyExistException e) {
+ // Should not happen
+ e.printStackTrace();
+ Domain.warn(e.getMessage());
}
}