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 2009/05/10 20:15:56 UTC
svn commit: r773378 -
/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
Author: jalkanen
Date: Sun May 10 18:15:56 2009
New Revision: 773378
URL: http://svn.apache.org/viewvc?rev=773378&view=rev
Log:
Minor shuffling to prepare for WikiPages *not* under the /pages/ path.
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=773378&r1=773377&r2=773378&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java Sun May 10 18:15:56 2009
@@ -1313,19 +1313,34 @@
*/
public JCRWikiPage addPage( WikiPath path, String contentType ) throws PageAlreadyExistsException, ProviderException
{
+ return addPage( path, getJCRPath(path), contentType );
+ }
+
+ /**
+ * Add new content to the repository to a particular JCR path.
+ *
+ * @param path
+ * @param jcrPath
+ * @param contentType
+ * @return
+ * @throws ProviderException
+ */
+ private JCRWikiPage addPage( WikiPath path, String jcrPath, String contentType )
+ throws ProviderException
+ {
checkValidContentType( contentType );
try
{
Session session = m_sessionManager.getSession();
- Node nd = session.getRootNode().addNode( getJCRPath(path) );
+ Node nd = session.getRootNode().addNode( jcrPath );
//nd.addMixin( "mix:versionable" );
nd.addMixin( "mix:referenceable" );
nd.setProperty( JCRWikiPage.CONTENTTYPE, contentType );
- JCRWikiPage page = new JCRWikiPage(m_engine, nd);
+ JCRWikiPage page = new JCRWikiPage(m_engine, path, nd);
return page;
}
@@ -1333,8 +1348,9 @@
{
throw new ProviderException( "Unable to add a page", e );
}
+
}
-
+
/** Throws an exception if the content type is not a fully valid content type. */
private void checkValidContentType( String type ) throws ProviderException
{
@@ -1356,7 +1372,7 @@
{
if ( path == null )
{
- throw new PageNotFoundException( "(null)" );
+ throw new PageNotFoundException( "null WikiPath given to getPage()" );
}
try
{