You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2008/07/02 20:11:26 UTC
svn commit: r673451 - in /incubator/jspwiki/api: ./ .settings/
src/org/apache/jspwiki/api/
Author: jalkanen
Date: Wed Jul 2 11:11:26 2008
New Revision: 673451
URL: http://svn.apache.org/viewvc?rev=673451&view=rev
Log:
Added rendering and content management.
Added:
incubator/jspwiki/api/.settings/org.eclipse.jdt.ui.prefs
incubator/jspwiki/api/build.xml
incubator/jspwiki/api/src/org/apache/jspwiki/api/ModuleData.java
incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiRenderer.java
Modified:
incubator/jspwiki/api/ (props changed)
incubator/jspwiki/api/.classpath
incubator/jspwiki/api/.settings/org.eclipse.jdt.core.prefs
incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiEngine.java
incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiPage.java
Propchange: incubator/jspwiki/api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 2 11:11:26 2008
@@ -0,0 +1 @@
+docs
Modified: incubator/jspwiki/api/.classpath
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/.classpath?rev=673451&r1=673450&r2=673451&view=diff
==============================================================================
--- incubator/jspwiki/api/.classpath (original)
+++ incubator/jspwiki/api/.classpath Wed Jul 2 11:11:26 2008
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.5.0"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: incubator/jspwiki/api/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/.settings/org.eclipse.jdt.core.prefs?rev=673451&r1=673450&r2=673451&view=diff
==============================================================================
--- incubator/jspwiki/api/.settings/org.eclipse.jdt.core.prefs (original)
+++ incubator/jspwiki/api/.settings/org.eclipse.jdt.core.prefs Wed Jul 2 11:11:26 2008
@@ -1,4 +1,4 @@
-#Tue Jul 01 21:32:08 EEST 2008
+#Wed Jul 02 19:56:21 EEST 2008
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
Added: incubator/jspwiki/api/.settings/org.eclipse.jdt.ui.prefs
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/.settings/org.eclipse.jdt.ui.prefs?rev=673451&view=auto
==============================================================================
--- incubator/jspwiki/api/.settings/org.eclipse.jdt.ui.prefs (added)
+++ incubator/jspwiki/api/.settings/org.eclipse.jdt.ui.prefs Wed Jul 2 11:11:26 2008
@@ -0,0 +1,3 @@
+#Wed Jul 02 19:56:20 EEST 2008
+eclipse.preferences.version=1
+internal.default.compliance=default
Added: incubator/jspwiki/api/build.xml
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/build.xml?rev=673451&view=auto
==============================================================================
--- incubator/jspwiki/api/build.xml (added)
+++ incubator/jspwiki/api/build.xml Wed Jul 2 11:11:26 2008
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+ JSPWiki - a JSP-based WikiWiki clone.
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project name="JSPWiki-API" default="javadoc" basedir=".">
+ <property name="docs.javadoc" location="docs/api"/>
+ <property name="code.src" location="src"/>
+
+ <path id="path.base">
+ <pathelement location="bin"/>
+ </path>
+
+
+ <target name="javadoc">
+ <delete dir="${docs.javadoc}" quiet="true"/>
+ <mkdir dir="${docs.javadoc}" />
+
+ <javadoc destdir="${docs.javadoc}"
+ use="yes"
+ breakiterator="true"
+ source="1.5"
+ windowtitle="${ant.project.name}">
+ <packageset dir="${code.src}">
+ <include name="org/apache/jspwiki/**" />
+ </packageset>
+ <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
+ <link href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/>
+ <classpath refid="path.base" />
+ </javadoc>
+ </target>
+ </project>
\ No newline at end of file
Added: incubator/jspwiki/api/src/org/apache/jspwiki/api/ModuleData.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/src/org/apache/jspwiki/api/ModuleData.java?rev=673451&view=auto
==============================================================================
--- incubator/jspwiki/api/src/org/apache/jspwiki/api/ModuleData.java (added)
+++ incubator/jspwiki/api/src/org/apache/jspwiki/api/ModuleData.java Wed Jul 2 11:11:26 2008
@@ -0,0 +1,68 @@
+package org.apache.jspwiki.api;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This annotation allows you to annotate your plugin in such a way
+ * that JSPWiki can locate some extra information about it.
+ * <p>
+ * This annotation replaces the old jspwiki_modules.xml file - it
+ * is far better to be able to annotate the class file directly
+ * than to put the stuff in a separate XML file.
+ * <p>
+ * JSPWiki will use Reflection to locate all WikiPlugin classes,
+ * so the jspwiki_module.xml is not strictly speaking needed.
+ *
+ * @since 3.0
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ModuleData
+{
+ /** The author of this module. */
+ String author() default "AnonymousCoward";
+
+ /** The minimum version of JSPWiki that this module will work with. This will be
+ * checked when the module is loaded.
+ */
+ String minVersion() default "0.0";
+
+ /** The maximum version of JSPWiki that this module will work with. */
+ String maxVersion() default "1000000.0";
+
+ /** The minimum version of the JSPWiki API that this module will work with.
+ * Note the difference - you can create a dependency between either a particular
+ * JSPWiki version, or a particular JSPWiki API version.
+ * <p>
+ * Notice that there is no maxAPIVersion(), because JSPWiki API is supposed
+ * to be completely backwards compatible all the time. (Yeah right.)
+ */
+ String minAPIVersion() default "0.0";
+
+ /**
+ * Defines the style sheets which should be included whenever this module
+ * is used. For PageFilters this means almost every single request.
+ */
+ String[] stylesheets() default {};
+
+ /**
+ * Defines the Javascripts which should be included whenever this module
+ * is used.
+ */
+ String[] scripts() default {};
+
+ /**
+ * Returns the class name for the AdminBean which governs the use of this
+ * class.
+ */
+ String adminBeanClass() default "";
+
+ /**
+ * Defines the different aliases which can also be used to access this
+ * module. This allows you to define a "shorter name" for the module
+ * to be used in e.g. macros.
+ */
+ String[] aliases() default "";
+}
Modified: incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiEngine.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiEngine.java?rev=673451&r1=673450&r2=673451&view=diff
==============================================================================
--- incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiEngine.java (original)
+++ incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiEngine.java Wed Jul 2 11:11:26 2008
@@ -1,7 +1,8 @@
package org.apache.jspwiki.api;
/**
- * Provides the master interface to the content repository.
+ * Provides the master interface to the content repository and
+ * main JSPWiki functionality.
*/
public interface WikiEngine
{
@@ -22,5 +23,13 @@
// FIXME: Should we rather use WikiPage.save()?
public void savePage( WikiPage p );
+ /**
+ * Returns a Renderer object for a particular type. Allowed types
+ * are "xhtml" for XHTML renderer, or whatever might be available as plugins.
+ *
+ * @param type A string describing the destination format.
+ * @return A Renderer object.
+ */
+ public WikiRenderer getRenderer( String type );
}
Modified: incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiPage.java?rev=673451&r1=673450&r2=673451&view=diff
==============================================================================
--- incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiPage.java (original)
+++ incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiPage.java Wed Jul 2 11:11:26 2008
@@ -4,9 +4,16 @@
import java.security.acl.Acl;
import java.util.Date;
import java.util.Map;
+import java.util.Set;
+/**
+ * A WikiPage represents a Node in the repository. Unlike in
+ * JSPWiki 2.x, a WikiPage also represents an attachment - in fact,
+ * there is no difference between a WikiPage and an attachment, only
+ * that they hold different ContentTypes.
+ */
public interface WikiPage
-{
+{
/**
* Returns the name of the page.
*
@@ -24,6 +31,12 @@
public String getContentType();
/**
+ * Easy accessor to setting the wiki:contentType attribute.
+ */
+ // NEW
+ public void setContentType( String contentType );
+
+ /**
* Returns the content of the page as a stream.
*/
// NEW
@@ -31,12 +44,36 @@
/**
* Returns the content as a string, if it can be construed as a string.
- * @return
+ *
+ * @return A string.
*/
//NEW
public String getContentAsString();
/**
+ * Set the page content. This is a shortcut to setting a property "wiki:content".
+ *
+ * @param content The page content as a String.
+ */
+ // NEW
+ public void setContent( String content );
+
+ /**
+ * Set the page content from an input stream.
+ *
+ * @param in The inputstream to read from.
+ */
+ // NEW
+ public void setContent( InputStream in );
+
+ /**
+ * Returns the referrers (that is, those pages which reference this page in any form).
+ * Each String is a path to the WikiPage.
+ */
+ // NEW
+ public Set<String> getReferrers();
+
+ /**
* A WikiPage may have a number of attributes, which might or might not be
* available. Typically attributes are things that do not need to be stored
* with the wiki page to the page repository, but are generated
@@ -47,6 +84,7 @@
* @return The attribute. If the attribute has not been set, returns null.
*/
// TODO: Should this also work with the old SET -attributes?
+ // FIXME: Need to define the relationship between JCR Properties and these.
public Object getAttribute( String key );
/**
Added: incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiRenderer.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiRenderer.java?rev=673451&view=auto
==============================================================================
--- incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiRenderer.java (added)
+++ incubator/jspwiki/api/src/org/apache/jspwiki/api/WikiRenderer.java Wed Jul 2 11:11:26 2008
@@ -0,0 +1,41 @@
+package org.apache.jspwiki.api;
+
+import java.io.InputStream;
+
+/**
+ * The WikiRenderer interface provides access to the JSPWiki rendering
+ * engine. The job of the WikiRenderer is to grab content in a
+ * particular type, and shove it out in its native type.
+ * <p>
+ * Typical WikiRenderers might be:
+ * <ul>
+ * <li>XHTMLRenderer - takes in WikiMarkup and outputs XHTML</li>
+ * <li>TextRenderer - takes in WikiMarkup and produces plain text</li>
+ * <li>CleanRenderer - takes in WikiMarkup and makes it such that it can be included in HTML content.</li>
+ * <li>PDFRenderer - takes in any sort of content and turns it into PDF content.</li>
+ * </ul>
+ *
+ */
+public interface WikiRenderer
+{
+ /**
+ * Returns the MIME type for the content that this Renderer
+ * outputs. For example, a PDF renderer might be returning
+ * something like "application/pdf", and a HTML renderer might
+ * be returning "text/html".
+ *
+ * @return A MIME type describing the output of the Renderer.
+ */
+ public String getContentType();
+
+ /**
+ * Returns the rendered content.
+ */
+ public InputStream render( WikiContext context, String content );
+
+ /**
+ * Returns the rendered content as a String. This is just a simplification
+ * for those content types where it can be rendered as a String.
+ */
+ public String renderString( WikiContext context, String content );
+}