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 cm...@apache.org on 2001/12/03 16:00:19 UTC
cvs commit: jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean NodeBean.java RevisionBean.java
cmlenz 01/12/03 07:00:19
Modified: src/taglib/common/org/apache/slide/taglib/bean NodeBean.java
RevisionBean.java
Log:
- Need to store a reference to the NodeRevisionDescriptors in RevisionBean
- Add method to return an InputStream of the revision's content
Revision Changes Path
1.5 +10 -9 jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/NodeBean.java
Index: NodeBean.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/NodeBean.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeBean.java 2001/09/24 16:12:09 1.4
+++ NodeBean.java 2001/12/03 15:00:18 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/NodeBean.java,v 1.4 2001/09/24 16:12:09 cmlenz Exp $
- * $Revision: 1.4 $
- * $Date: 2001/09/24 16:12:09 $
+ * $Header: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/NodeBean.java,v 1.5 2001/12/03 15:00:18 cmlenz Exp $
+ * $Revision: 1.5 $
+ * $Date: 2001/12/03 15:00:18 $
*
* ====================================================================
*
@@ -83,7 +83,7 @@
* layer technologies such as JSP or Velocity.</p>
*
* @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class NodeBean
extends AbstractBean {
@@ -364,10 +364,11 @@
try {
if (revisionDescriptors != null) {
Content content = nat.getContentHelper();
- NodeRevisionNumber nrn = revisionDescriptors.getInitialRevision();
+ NodeRevisionNumber nrn =
+ revisionDescriptors.getInitialRevision();
NodeRevisionDescriptor nrd =
content.retrieve(st, revisionDescriptors, nrn);
- bean = new RevisionBean(nat, st, nrd);
+ bean = new RevisionBean(nat, st, revisionDescriptors, nrd);
}
}
catch (SlideException e) {
@@ -398,7 +399,7 @@
revisionDescriptors.getLatestRevision();
NodeRevisionDescriptor nrd =
content.retrieve(st, revisionDescriptors, nrn);
- revision = new RevisionBean(nat, st, nrd);
+ revision = new RevisionBean(nat, st, revisionDescriptors, nrd);
}
}
catch (SlideException e) {
@@ -625,7 +626,7 @@
Content content = nat.getContentHelper();
NodeRevisionDescriptor nrd =
content.retrieve(st, revisionDescriptors, number);
- revision = new RevisionBean(nat, st, nrd);
+ revision = new RevisionBean(nat, st, revisionDescriptors, nrd);
}
}
catch (SlideException e) {
@@ -659,7 +660,7 @@
Content content = nat.getContentHelper();
NodeRevisionDescriptor nrd =
content.retrieve(st, revisionDescriptors, branch);
- revision = new RevisionBean(nat, st, nrd);
+ revision = new RevisionBean(nat, st, revisionDescriptors, nrd);
}
}
catch (SlideException e) {
1.4 +57 -4 jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/RevisionBean.java
Index: RevisionBean.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/RevisionBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RevisionBean.java 2001/09/20 13:31:08 1.3
+++ RevisionBean.java 2001/12/03 15:00:18 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/RevisionBean.java,v 1.3 2001/09/20 13:31:08 dirkv Exp $
- * $Revision: 1.3 $
- * $Date: 2001/09/20 13:31:08 $
+ * $Header: /home/cvs/jakarta-slide/src/taglib/common/org/apache/slide/taglib/bean/RevisionBean.java,v 1.4 2001/12/03 15:00:18 cmlenz Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/12/03 15:00:18 $
*
* ====================================================================
*
@@ -63,13 +63,18 @@
package org.apache.slide.taglib.bean;
+import java.io.InputStream;
+import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import org.apache.slide.common.NamespaceAccessToken;
+import org.apache.slide.common.SlideException;
import org.apache.slide.common.SlideToken;
+import org.apache.slide.content.Content;
import org.apache.slide.content.NodeProperty;
import org.apache.slide.content.NodeRevisionDescriptor;
+import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.content.NodeRevisionNumber;
/**
@@ -80,7 +85,7 @@
* layer technologies such as JSP or Velocity.</p>
*
* @author <a href="mailto:cmlenz@apache.org">Christopher Lenz</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class RevisionBean
extends AbstractBean {
@@ -95,6 +100,12 @@
private NodeRevisionDescriptor revision;
+ /**
+ * The revision-descriptors object.
+ */
+ private NodeRevisionDescriptors revisions;
+
+
// ----------------------------------------------------------- Construction
@@ -115,9 +126,11 @@
* @param revision the revision to wrap
*/
public RevisionBean(NamespaceAccessToken nat, SlideToken st,
+ NodeRevisionDescriptors revisions,
NodeRevisionDescriptor revision) {
super(nat, st);
+ setNodeRevisionDescriptors(revisions);
setNodeRevisionDescriptor(revision);
}
@@ -189,7 +202,47 @@
}
+ /**
+ * Returns the revision-descriptors this revision belongs to.
+ *
+ * @return the NodeRevisionDescriptors
+ */
+ public NodeRevisionDescriptors getNodeRevisionDescriptors() {
+
+ return revisions;
+ }
+
+
+ /**
+ * Sets the revision-descriptors this revision belongs to.
+ *
+ * @param revision the NodeRevisionDescriptors
+ */
+ public void setNodeRevisionDescriptors(NodeRevisionDescriptors revisions) {
+
+ this.revisions = revisions;
+ }
+
+
// --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Returns an InputStream of the content of the revision.
+ *
+ * @return the revision content as InputStream
+ *
+ * @throw SlideException Exception occurred when trying to access the
+ * resource through Slide.
+ * @throw IOException IO exception occurred when trying to stream the
+ * revision content
+ */
+ public InputStream getInputStream()
+ throws SlideException, IOException {
+
+ Content content = nat.getContentHelper();
+ return content.retrieve(st, revisions, revision).streamContent();
+ }
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>