You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2007/03/22 23:01:42 UTC
svn commit: r521490 [1/2] - in /incubator/roller/trunk: ./
sandbox/scripting/groovy/ sandbox/scripting/groovy/bin/
sandbox/scripting/groovy/examples/
sandbox/scripting/groovy/examples/adminprotocol/
sandbox/scripting/groovy/examples/adminprotocol/lib/ ...
Author: snoopdave
Date: Thu Mar 22 15:01:38 2007
New Revision: 521490
URL: http://svn.apache.org/viewvc?view=rev&rev=521490
Log:
Renaming Atom Admin Publishing Protocol to Roller Admin Protocol, also added some examples in the sandbox that show how to use the protocol from Groovy.
Added:
incubator/roller/trunk/sandbox/scripting/groovy/examples/
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/README.txt
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/createuser.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/commons-codec-1.3.jar (with props)
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/jdom.jar (with props)
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/roller-rap-sdk.jar (with props)
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listcollections.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listusers.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/rap
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/README.txt
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/checkuser.gy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/checkuser.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createblog.gy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/createblog.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createcomment.gy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/createcomment.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createentry.gy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/createentry.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createuser.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/groovy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/listusers.gy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/listusers.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/logs/
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/logs/README.txt
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/logs/README.txt
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/removeuser.gy
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/removeuser.gy
incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/roller-custom.properties
- copied unchanged from r520884, incubator/roller/trunk/sandbox/scripting/groovy/bin/roller-custom.properties
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AdminServlet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AppUrl.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/AppUrl.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Authenticator.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Authenticator.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BadRequestException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BadRequestException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BasicAuthenticator.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BasicAuthenticator.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Handler.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Handler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/HandlerException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/HandlerException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/InternalException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/InternalException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/IntrospectionHandler.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/IntrospectionHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotAllowedException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotAllowedException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotFoundException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotFoundException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerMemberHandler.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerMemberHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerUserHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerWeblogHandler.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerWeblogHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/UnauthorizedException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/UnauthorizedException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/package.html
- copied unchanged from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/package.html
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Entry.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Entry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/EntrySet.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/EntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/LocaleString.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/LocaleString.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntry.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntrySet.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Service.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Service.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UnexpectedRootElementException.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UnexpectedRootElementException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntrySet.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntry.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntrySet.java
- copied, changed from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/package.html
- copied unchanged from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/package.html
Removed:
incubator/roller/trunk/sandbox/scripting/groovy/bin/
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/AppUrl.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/AtomAdminServlet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Authenticator.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BadRequestException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BasicAuthenticator.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Handler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/HandlerException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/InternalException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/IntrospectionHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotAllowedException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotFoundException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerMemberHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerUserHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerWeblogHandler.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/UnauthorizedException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/package.html
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Entry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/EntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/LocaleString.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Service.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UnexpectedRootElementException.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntry.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntrySet.java
incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/package.html
Modified:
incubator/roller/trunk/build.xml
incubator/roller/trunk/sandbox/scripting/groovy/README.txt
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/AappTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/HandlerBaseTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/MemberHandlerTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/UserHandlerTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/WeblogHandlerTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/sdk/MemberEntryTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/sdk/UserEntryTest.java
incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/sdk/WeblogEntryTest.java
Modified: incubator/roller/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/build.xml?view=diff&rev=521490&r1=521489&r2=521490
==============================================================================
--- incubator/roller/trunk/build.xml (original)
+++ incubator/roller/trunk/build.xml Thu Mar 22 15:01:38 2007
@@ -1024,11 +1024,11 @@
</target>
- <target name="test-aapp" depends="test-aapp-sdk, test-aapp-handler"/>
+ <target name="test-rap" depends="test-rap-sdk, test-rap-handler"/>
- <target name="test-aapp-sdk">
- <mkdir dir="${build.reports}/webservices/adminapi/sdk/xml"/>
- <mkdir dir="${build.reports}/webservices/adminapi/sdk/html"/>
+ <target name="test-rap-sdk">
+ <mkdir dir="${build.reports}/webservices/adminprotocol/sdk/xml"/>
+ <mkdir dir="${build.reports}/webservices/adminprotocol/sdk/html"/>
<junit fork="true" dir="${build.tests}" printsummary="on" showOutput="true">
<syspropertyset>
@@ -1038,23 +1038,23 @@
<path refid="tests.run.path"/>
</classpath>
<formatter type="xml"/>
- <batchtest toDir="${build.reports}/webservices/adminapi/sdk/xml">
+ <batchtest toDir="${build.reports}/webservices/protocol/sdk/xml">
<fileset dir="${build.tests}/WEB-INF/classes">
- <include name="org/apache/roller/webservices/adminapi/sdk/*EntryTest.class"/>
+ <include name="org/apache/roller/webservices/protocol/sdk/*EntryTest.class"/>
</fileset>
</batchtest>
</junit>
- <junitreport todir="${build.reports}/webservices/adminapi/sdk/xml">
- <fileset dir="${build.reports}/webservices/adminapi/sdk/xml">
+ <junitreport todir="${build.reports}/webservices/protocol/sdk/xml">
+ <fileset dir="${build.reports}/webservices/protocol/sdk/xml">
<include name="TEST-*.xml"/>
</fileset>
- <report format="noframes" toDir="${build.reports}/webservices/adminapi/sdk/html"/>
+ <report format="noframes" toDir="${build.reports}/webservices/protocol/sdk/html"/>
</junitreport>
</target>
- <target name="test-aapp-handler">
- <mkdir dir="${build.reports}/webservices/adminapi/xml"/>
- <mkdir dir="${build.reports}/webservices/adminapi/html"/>
+ <target name="test-rap-handler">
+ <mkdir dir="${build.reports}/webservices/protocol/xml"/>
+ <mkdir dir="${build.reports}/webservices/protocol/html"/>
<junit fork="true" dir="${build.tests}" printsummary="on">
<syspropertyset>
@@ -1064,17 +1064,17 @@
<path refid="tests.run.path"/>
</classpath>
<formatter type="xml"/>
- <batchtest toDir="${build.reports}/webservices/adminapi/xml">
+ <batchtest toDir="${build.reports}/webservices/protocol/xml">
<fileset dir="${build.tests}/WEB-INF/classes">
- <include name="org/apache/roller/webservices/adminapi/*HandlerTest.class"/>
+ <include name="org/apache/roller/webservices/protocol/*HandlerTest.class"/>
</fileset>
</batchtest>
</junit>
- <junitreport todir="${build.reports}/webservices/adminapi/xml">
- <fileset dir="${build.reports}/webservices/adminapi/xml">
+ <junitreport todir="${build.reports}/webservices/protocol/xml">
+ <fileset dir="${build.reports}/webservices/protocol/xml">
<include name="TEST-*.xml"/>
</fileset>
- <report format="noframes" toDir="${build.reports}/webservices/adminapi/html"/>
+ <report format="noframes" toDir="${build.reports}/webservices/protocol/html"/>
</junitreport>
</target>
@@ -1178,15 +1178,15 @@
<!-- Experimental Admin API SDK -->
<!-- ********************************************************************* -->
-<!-- build standalone aapp-sdk.jar, for external consumption -->
-<target name="aapp-sdk" depends="build">
+<!-- build standalone rap-sdk.jar, for external consumption -->
+<target name="rap-sdk" depends="build">
<mkdir dir="${build.lib}"/>
- <jar destfile="${build.lib}/roller-aapp-sdk.jar">
+ <jar destfile="${build.lib}/roller-rap-sdk.jar">
<manifest>
<attribute name="Manifest-Version" value="${ro.version}"/>
</manifest>
<fileset dir="${build.compile.web}">
- <include name="org/apache/roller/webservices/adminapi/sdk/*"/>
+ <include name="org/apache/roller/webservices/adminprotocol/sdk/*"/>
</fileset>
</jar>
</target>
Modified: incubator/roller/trunk/sandbox/scripting/groovy/README.txt
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/README.txt?view=diff&rev=521490&r1=521489&r2=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/README.txt (original)
+++ incubator/roller/trunk/sandbox/scripting/groovy/README.txt Thu Mar 22 15:01:38 2007
@@ -3,14 +3,19 @@
A) Some scripts that run against the Roller API
- bin/groovy - Runs Groovy with Roller jars in path. Edit it to set paths.
- bin/roller-custom.properties - Database properties for bin/groovy
- bin/listusers.gy - Lists users and roles in Roller system
- bin/createuser.gy - Create a user
- bin/createblog.gy - Create a blog
+ examples/rollerapi/groovy - Runs Groovy with Roller jars in path. Edit it to set paths.
+ examples/rollerapi/roller-custom.properties - Database properties for bin/groovy
+ examples/rollerapi/listusers.gy - Lists users and roles in Roller system
+ examples/rollerapi/createuser.gy - Create a user
+ examples/rollerapi/createblog.gy - Create a blog
-B) A Roller GroovletRenderer that can evaluate a Roller template as Groovy code
+B) Some scripts that run against the Roller Admin Protocol
+
+ examples/adminprotocol
+
+
+C) A Roller GroovletRenderer that can evaluate a Roller template as Groovy code
with Groovlet-style "out" and "html" bindings.
The implementation:
@@ -43,7 +48,7 @@
}
}
-C) A Roller GSPRenderer that can evaluate a Roller template as a Groovy Template
+D) A Roller GSPRenderer that can evaluate a Roller template as a Groovy Template
with GSP-style "out" and "html" bindings.
The implementation:
@@ -80,7 +85,7 @@
</html>
-To use renderers (B) and (C) in Roller:
+To use renderers (C) and (D) in Roller:
1) Put roller-groovy.jar and groovy-all-1.0.jar in WEB-INF/lib
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/README.txt
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/README.txt?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/README.txt (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/README.txt Thu Mar 22 15:01:38 2007
@@ -0,0 +1,24 @@
+
+Groovy scripts that run against the Roller Admin Protocol
+-------------------------------------------------------------------------------
+
+These scripts are designed to against a remote Roller installation using the
+Roller Admin Protocol (RAP).
+
+
+1) Have Groovy 1.0 installed on your system
+
+2) Put the RAP SDK, JDOM and Commons Codec jars in your classpath.
+ For example:
+
+ $ export CLASSPATH=./lib/jdom.jar:./lib/roller-rap-sdk.jar:./lib/commons-codec-1.3.jar
+
+
+Once you've done that you can run the scripts like so:
+
+ $ groovy rap.gy <username> <password> <endpoint-url>
+
+For example:
+
+ $ groovy rap.gy admin admin http://localhost:8080/roller/roller-services/rap
+
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/createuser.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/createuser.gy?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/createuser.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/createuser.gy Thu Mar 22 15:01:38 2007
@@ -0,0 +1,86 @@
+
+import java.io.*;
+import java.net.*;
+import org.jdom.output.*;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.roller.webservices.adminprotocol.sdk.*;
+
+if (args.length < 6) {
+ println "USAGE: groovy createuser.gy <admin-username> <admin-password> <new-username> <new-password> <email> <rap-endpoint>";
+ return;
+}
+
+admin_username = args[0];
+admin_password = args[1];
+username = args[2];
+password = args[3]
+email = args[4];
+rapuri = args[5]
+
+fullName = username;
+locale = "en_US";
+timeZone = "America/New_York";
+
+
+credentials = admin_username + ":" + admin_password;
+authString = "Basic " + new String(Base64.encodeBase64(credentials.getBytes()));
+
+// get service doc
+
+url = new URL(rapuri);
+conn = url.openConnection();
+conn.setRequestProperty("Authorization", authString);
+s = new Service(conn.getInputStream());
+
+// find user collection in service
+
+userCollectionURI = null;
+baseURI = null;
+for (w in s.entries) {
+ for (c in w.entries) {
+ if (c.memberType == "user") {
+ userCollectionURI = c.href;
+ baseURI = c.href.substring(0, c.href.length() - "users".length());
+ break;
+ }
+ }
+}
+
+// create new user
+
+user = new UserEntry(username, baseURI);
+
+user.setPassword( password);
+user.setFullName( fullName);
+user.setEmailAddress(email);
+user.setLocale( locale);
+user.setTimezone( timeZone);
+user.setDateCreated( new java.util.Date());
+
+userSet = new UserEntrySet(baseURI);
+userSet.setEntries((Entry[])[user]);
+
+// post new user to user collection URI
+
+// open connection
+url = new URL(userCollectionURI);
+conn = url.openConnection();
+conn.setRequestProperty("Authorization", authString);
+conn.setDoOutput(true);
+
+// serialize XML to connection's output stream
+doc = userSet.toDocument();
+outputter = new XMLOutputter();
+outputter.output(doc, conn.getOutputStream());
+conn.getOutputStream().flush();
+conn.getOutputStream().close();
+
+println "--- Response from server ---";
+
+s = null;
+is = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+while ((s = is.readLine()) != null) {
+ println s
+}
+
+
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/commons-codec-1.3.jar
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/commons-codec-1.3.jar?view=auto&rev=521490
==============================================================================
Binary file - no diff available.
Propchange: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/commons-codec-1.3.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/jdom.jar
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/jdom.jar?view=auto&rev=521490
==============================================================================
Binary file - no diff available.
Propchange: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/jdom.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/roller-rap-sdk.jar
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/roller-rap-sdk.jar?view=auto&rev=521490
==============================================================================
Binary file - no diff available.
Propchange: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/lib/roller-rap-sdk.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listcollections.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listcollections.gy?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listcollections.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listcollections.gy Thu Mar 22 15:01:38 2007
@@ -0,0 +1,30 @@
+
+import java.io.*;
+import java.net.*;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.roller.webservices.adminprotocol.sdk.*;
+
+if (args.length < 3) {
+ println "USAGE: groovy listcollections.gy <username> <password> <rap-endpoint-uri>";
+ return;
+}
+username = args[0];
+password = args[1];
+rapuri = args[2];
+
+String credentials = username + ":" + password;
+url = new URL(rapuri);
+conn = url.openConnection();
+conn.setRequestProperty("Authorization",
+ "Basic " + new String(Base64.encodeBase64(credentials.getBytes())));
+
+
+s = new Service(conn.getInputStream());
+for (w in s.entries) {
+ println "Workspace [${w.title}]";
+ for (c in w.entries) {
+ println " Collection [${c.title}]";
+ println " URI: ${c.href}";
+ println " Member-type: ${c.memberType}";
+ }
+}
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listusers.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listusers.gy?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listusers.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/listusers.gy Thu Mar 22 15:01:38 2007
@@ -0,0 +1,46 @@
+
+import java.io.*;
+import java.net.*;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.roller.webservices.adminprotocol.sdk.*;
+
+if (args.length < 3) {
+ println "USAGE: groovy listcollections.gy <username> <password> <rap-endpoint-uri>";
+ return;
+}
+username = args[0];
+password = args[1];
+rapuri = args[2];
+
+credentials = username + ":" + password;
+authString = "Basic " + new String(Base64.encodeBase64(credentials.getBytes()));
+
+url = new URL(rapuri);
+conn = url.openConnection();
+conn.setRequestProperty("Authorization", authString);
+
+s = new Service(conn.getInputStream());
+
+// find user collection
+
+for (w in s.entries) {
+ for (c in w.entries) {
+ if (c.memberType == "user") {
+
+ url = new URL(c.href);
+ baseurl = c.href.substring(0, c.href.length() - "users".length());
+
+ conn = url.openConnection();
+ conn.setRequestProperty("Authorization", authString);
+
+ userEntrySet = new UserEntrySet(conn.getInputStream(), baseurl);
+
+ for (u in userEntrySet.entries) {
+ println u.fullName;
+ }
+
+ break;
+
+ }
+ }
+}
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/rap
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/rap?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/rap (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/adminprotocol/rap Thu Mar 22 15:01:38 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<service xmlns="http://purl.org/apache/roller/aapp#">
+ <workspace title="Workspace: Collections for administration">
+ <collection title="Collection: Weblog administration entries" href="http://localhost:8080/roller/roller-services/rap/weblogs">
+ <member-type>weblog</member-type>
+ </collection>
+ <collection title="Collection: User administration entries" href="http://localhost:8080/roller/roller-services/rap/users">
+ <member-type>user</member-type>
+ </collection>
+ <collection title="Collection: Member administration entries" href="http://localhost:8080/roller/roller-services/rap/members">
+ <member-type>member</member-type>
+ </collection>
+ </workspace>
+</service>
+
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/README.txt
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/README.txt?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/README.txt (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/README.txt Thu Mar 22 15:01:38 2007
@@ -0,0 +1,25 @@
+
+Groovy scripts that run against the Roller API
+-------------------------------------------------------------------------------
+
+These scripts are designed to the computer on which Roller is installed.
+Because they use the Roller API directly, you must run them with the provided
+"groovy" script which sets up the classpath correctly for calling into the
+Roller code base.
+
+Before you can run you must:
+
+1) Have Groovy 1.0 installed on your system
+
+2) Have Roller 4.0 or later installed and configured on yoru system
+
+3) Edit the provided groovy script to set GROOVY_HOME, WEBAPP_DIR and JARS_DIR
+
+4) Edit the provided roller-custom.properties to point to your Roller database
+
+Once you've done that you can run the scripts like so:
+
+ $ ./groovy listusers.gy
+
+
+TODO: Provide a groovy.bat file so scipts can run on Microsoft Windows
Added: incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createuser.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createuser.gy?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createuser.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/examples/rollerapi/createuser.gy Thu Mar 22 15:01:38 2007
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. 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. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+if (args.length < 3) {
+ println "USAGE: groovy createuser.gy <username> <password> <email>";
+ return;
+}
+
+username = args[0];
+password = args[1]
+email = args[2];
+
+fullName = username;
+locale = "en_US";
+timeZone = "America/New_York";
+
+user = new org.apache.roller.pojos.UserData();
+user.setUserName(username);
+user.setPassword(password);
+user.setFullName(fullName);
+user.setEmailAddress(email);
+user.setLocale(locale);
+user.setTimeZone(timeZone);
+user.setDateCreated(new java.util.Date());
+
+roller = org.apache.roller.business.RollerFactory.getRoller();
+roller.getUserManager().addUser(user);
+roller.flush();
+
+user = roller.getUserManager().getUserByUserName(username);
+println "Created user ${user.userName} with id ${user.id}";
Added: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AdminServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AdminServlet.java?view=auto&rev=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AdminServlet.java (added)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AdminServlet.java Thu Mar 22 15:01:38 2007
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005 David M Johnson (For RSS and Atom In Action)
+ *
+ * Licensed 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.
+ */
+package org.apache.roller.webservices.adminprotocol;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Writer;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Document;
+import org.jdom.output.XMLOutputter;
+import org.jdom.output.Format;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet;
+
+/**
+ * Atom Admin Servlet implements the Atom Admin endpoint.
+ * This servlet simply delegates work to a particular handler object.
+ *
+ * @author jtb
+ * @web.servlet name="AdminServlet"
+ * @web.servlet-mapping url-pattern="/roller-services/rap/*"
+ */
+public class AdminServlet extends HttpServlet {
+ private static Log logger = LogFactory.getFactory().getInstance(AdminServlet.class);
+
+ /**
+ * Handles an Atom GET by calling handler and writing results to response.
+ */
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ try {
+ Handler handler = Handler.getHandler(req);
+ String userName = handler.getUserName();
+
+ EntrySet c = handler.processGet();
+
+ res.setStatus(HttpServletResponse.SC_OK);
+ res.setContentType("application/xml; charset=utf-8");
+ String s = c.toString();
+ Writer writer = res.getWriter();
+ writer.write(s);
+ writer.close();
+ } catch (HandlerException he) {
+ res.sendError(he.getStatus(), he.getMessage());
+ he.printStackTrace(res.getWriter());
+ logger.error(he);
+ }
+ }
+
+ /**
+ * Handles an Atom POST by calling handler to identify URI, reading/parsing
+ * data, calling handler and writing results to response.
+ */
+ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ try {
+ Handler handler = Handler.getHandler(req);
+ String userName = handler.getUserName();
+
+ EntrySet c = handler.processPost(new InputStreamReader(req.getInputStream()));
+
+ res.setStatus(HttpServletResponse.SC_CREATED);
+ res.setContentType("application/xml; charset=utf-8");
+ String s = c.toString();
+ Writer writer = res.getWriter();
+ writer.write(s);
+ writer.close();
+ } catch (HandlerException he) {
+ res.sendError(he.getStatus(), he.getMessage());
+ he.printStackTrace(res.getWriter());
+ logger.error(he);
+ }
+ }
+
+ /**
+ * Handles an Atom PUT by calling handler to identify URI, reading/parsing
+ * data, calling handler and writing results to response.
+ */
+ protected void doPut(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ try {
+ Handler handler = Handler.getHandler(req);
+ String userName = handler.getUserName();
+
+ EntrySet c = handler.processPut(new InputStreamReader(req.getInputStream()));
+
+ res.setStatus(HttpServletResponse.SC_OK);
+ res.setContentType("application/xml; charset=utf-8");
+ String s = c.toString();
+ Writer writer = res.getWriter();
+ writer.write(s);
+ writer.close();
+ } catch (HandlerException he) {
+ res.sendError(he.getStatus(), he.getMessage());
+ he.printStackTrace(res.getWriter());
+ logger.error(he);
+ }
+ }
+
+ /**
+ * Handle Atom Admin DELETE by calling appropriate handler.
+ */
+ protected void doDelete(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+ try {
+ Handler handler = Handler.getHandler(req);
+ String userName = handler.getUserName();
+
+ EntrySet es = handler.processDelete();
+
+ res.setStatus(HttpServletResponse.SC_OK);
+ res.setContentType("application/xml; charset=utf-8");
+ String s = es.toString();
+ Writer writer = res.getWriter();
+ writer.write(s);
+ writer.close();
+ } catch (HandlerException he) {
+ res.sendError(he.getStatus(), he.getMessage());
+ he.printStackTrace(res.getWriter());
+ logger.error(he);
+ }
+ }
+}
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AppUrl.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/AppUrl.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AppUrl.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/AppUrl.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AppUrl.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/AppUrl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/AppUrl.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.net.MalformedURLException;
import java.net.URL;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Authenticator.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Authenticator.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Authenticator.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Authenticator.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Authenticator.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Authenticator.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Authenticator.java Thu Mar 22 15:01:38 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import javax.servlet.http.HttpServletRequest;
import org.apache.roller.RollerException;
@@ -56,7 +56,7 @@
}
if (!ud.hasRole("admin")) {
- throw new UnauthorizedException("ERROR: User must have the admin role to use the AAPP endpoint: " + userName);
+ throw new UnauthorizedException("ERROR: User must have the admin role to use the RAP endpoint: " + userName);
}
if (!ud.getEnabled().booleanValue()) {
throw new UnauthorizedException("ERROR: User is disabled: " + userName);
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BadRequestException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BadRequestException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BadRequestException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BadRequestException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BadRequestException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BadRequestException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BadRequestException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import javax.servlet.http.HttpServletResponse;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BasicAuthenticator.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BasicAuthenticator.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BasicAuthenticator.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BasicAuthenticator.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BasicAuthenticator.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/BasicAuthenticator.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/BasicAuthenticator.java Thu Mar 22 15:01:38 2007
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Handler.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Handler.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Handler.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Handler.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Handler.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/Handler.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/Handler.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.io.IOException;
import java.io.Reader;
@@ -26,7 +26,7 @@
import org.apache.roller.business.Roller;
import org.apache.roller.business.RollerFactory;
import org.apache.roller.ui.core.RollerContext;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import org.apache.roller.RollerException;
@@ -34,18 +34,18 @@
import org.apache.roller.business.UserManager;
import org.apache.roller.pojos.UserData;
import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
import org.jdom.Document;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
/**
- * This class is the abstract notion of an AAPP request handler.
+ * This class is the abstract notion of an RAP request handler.
* It processes HTTP requests for each of the four HTTP verbs:
* GET, POST, PUT, DELETE, for a given weblog resource.
*/
abstract class Handler {
- protected static final String ENDPOINT = "/aapp";
+ protected static final String ENDPOINT = "/rap";
static class URI {
private static Pattern PATHINFO_PATTERN = Pattern.compile("^/(users|weblogs|members)(?:/(.*))?$");
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/HandlerException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/HandlerException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/HandlerException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/HandlerException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/HandlerException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/HandlerException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/HandlerException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
/**
* Abstract base class for all handler exceptions.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/InternalException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/InternalException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/InternalException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/InternalException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/InternalException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/InternalException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/InternalException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import javax.servlet.http.HttpServletResponse;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/IntrospectionHandler.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/IntrospectionHandler.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/IntrospectionHandler.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/IntrospectionHandler.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/IntrospectionHandler.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/IntrospectionHandler.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/IntrospectionHandler.java Thu Mar 22 15:01:38 2007
@@ -15,21 +15,21 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
-import org.apache.roller.webservices.adminapi.sdk.Entry;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet;
-import org.apache.roller.webservices.adminapi.sdk.Service;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.Service;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
import org.jdom.Document;
/**
- * This class handles requests for the AAPP introspection document.
+ * This class handles requests for the RAP introspection document.
* It only processes HTTP GET requests.
*
* @author jtb
@@ -76,20 +76,20 @@
Service.Workspace.Collection weblogCol = new Service.Workspace.Collection();
weblogCol.setTitle("Collection: Weblog administration entries");
- weblogCol.setMemberType(org.apache.roller.webservices.adminapi.sdk.Entry.Types.WEBLOG);
- weblogCol.setHref(service.getHref() + "/" + org.apache.roller.webservices.adminapi.sdk.EntrySet.Types.WEBLOGS);
+ weblogCol.setMemberType(org.apache.roller.webservices.adminprotocol.sdk.Entry.Types.WEBLOG);
+ weblogCol.setHref(service.getHref() + "/" + org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types.WEBLOGS);
workspaceCollections.add(weblogCol);
Service.Workspace.Collection userCol = new Service.Workspace.Collection();
userCol.setTitle("Collection: User administration entries");
userCol.setMemberType("user");
- userCol.setHref(service.getHref() + "/" + org.apache.roller.webservices.adminapi.sdk.EntrySet.Types.USERS);
+ userCol.setHref(service.getHref() + "/" + org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types.USERS);
workspaceCollections.add(userCol);
Service.Workspace.Collection memberCol = new Service.Workspace.Collection();
memberCol.setTitle("Collection: Member administration entries");
memberCol.setMemberType("member");
- memberCol.setHref(service.getHref() + "/" + org.apache.roller.webservices.adminapi.sdk.EntrySet.Types.MEMBERS);
+ memberCol.setHref(service.getHref() + "/" + org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types.MEMBERS);
workspaceCollections.add(memberCol);
workspace.setEntries((Entry[])workspaceCollections.toArray(new Entry[0]));
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotAllowedException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotAllowedException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotAllowedException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotAllowedException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotAllowedException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotAllowedException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotAllowedException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import javax.servlet.http.HttpServletResponse;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotFoundException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotFoundException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotFoundException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotFoundException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotFoundException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/NotFoundException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/NotFoundException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import javax.servlet.http.HttpServletResponse;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerMemberHandler.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerMemberHandler.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerMemberHandler.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerMemberHandler.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerMemberHandler.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerMemberHandler.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerMemberHandler.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.io.IOException;
import java.io.Reader;
@@ -32,11 +32,11 @@
import org.apache.roller.pojos.UserData;
import org.apache.roller.pojos.WebsiteData;
import org.apache.roller.util.cache.CacheManager;
-import org.apache.roller.webservices.adminapi.sdk.Entry;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntry;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntrySet;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
/**
* This class handles requests concerning Roller weblog membership (groups).
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerUserHandler.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerUserHandler.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerUserHandler.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerUserHandler.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.io.IOException;
import java.io.Reader;
@@ -29,11 +29,11 @@
import org.apache.roller.business.UserManager;
import org.apache.roller.pojos.UserData;
import org.apache.roller.util.cache.CacheManager;
-import org.apache.roller.webservices.adminapi.sdk.Entry;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
-import org.apache.roller.webservices.adminapi.sdk.UserEntry;
-import org.apache.roller.webservices.adminapi.sdk.UserEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.UserEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.UserEntrySet;
/**
* This class handles request concerning Roller users.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerWeblogHandler.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerWeblogHandler.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerWeblogHandler.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerWeblogHandler.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerWeblogHandler.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/RollerWeblogHandler.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/RollerWeblogHandler.java Thu Mar 22 15:01:38 2007
@@ -16,7 +16,7 @@
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import java.io.Reader;
import java.net.MalformedURLException;
@@ -38,11 +38,11 @@
import org.apache.roller.pojos.WebsiteData;
import org.apache.roller.util.cache.CacheManager;
import org.apache.roller.util.Utilities;
-import org.apache.roller.webservices.adminapi.sdk.Entry;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
-import org.apache.roller.webservices.adminapi.sdk.WeblogEntry;
-import org.apache.roller.webservices.adminapi.sdk.WeblogEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.WeblogEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.WeblogEntrySet;
/**
* This class handles requests concerning Roller weblog resources.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/UnauthorizedException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/UnauthorizedException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/UnauthorizedException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/UnauthorizedException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/UnauthorizedException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/UnauthorizedException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/UnauthorizedException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi;
+package org.apache.roller.webservices.adminprotocol;
import javax.servlet.http.HttpServletResponse;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Entry.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Entry.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Entry.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Entry.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Entry.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Entry.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Entry.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.io.IOException;
import java.io.StringWriter;
@@ -31,7 +31,7 @@
* Weblog resources are represented by sets of entries.
*/
public abstract class Entry {
- protected static final Namespace NAMESPACE = Namespace.getNamespace("http://purl.org/apache/roller/aapp#");
+ protected static final Namespace NAMESPACE = Namespace.getNamespace("http://purl.org/apache/roller/rap#");
/** Entry types. */
public static interface Types {
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/EntrySet.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/EntrySet.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/EntrySet.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/EntrySet.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/EntrySet.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/EntrySet.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/EntrySet.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.util.Arrays;
import java.util.List;
@@ -52,7 +52,7 @@
* Set of workspace entries.
* This type, along with WORKSPACE and COLLECTION, define
* the element that describe the introspection document
- * for the AAPP service.
+ * for the RAP service.
* <p>
* A service is a set of workspaces, and a workspace is a set of
* collections.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/LocaleString.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/LocaleString.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/LocaleString.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/LocaleString.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/LocaleString.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/LocaleString.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/LocaleString.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.util.Locale;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntry.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntry.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntry.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntry.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntry.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntry.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntry.java Thu Mar 22 15:01:38 2007
@@ -16,7 +16,7 @@
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.io.InputStream;
import java.io.IOException;
@@ -25,8 +25,8 @@
import org.jdom.Text;
import org.jdom.input.SAXBuilder;
import org.jdom.JDOMException;
-import org.apache.roller.webservices.adminapi.sdk.Entry.Attributes;
-import org.apache.roller.webservices.adminapi.sdk.Entry.Types;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry.Attributes;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry.Types;
/**
* This class describes a member entry.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntrySet.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntrySet.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntrySet.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntrySet.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntrySet.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/MemberEntrySet.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/MemberEntrySet.java Thu Mar 22 15:01:38 2007
@@ -21,7 +21,7 @@
* Created on January 17, 2006, 12:44 PM
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.io.InputStream;
import java.io.IOException;
@@ -32,7 +32,7 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet.Types;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types;
/**
* This class describes a set of member entries.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Service.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Service.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Service.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Service.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Service.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/Service.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/Service.java Thu Mar 22 15:01:38 2007
@@ -20,19 +20,22 @@
*
* Created on January 17, 2006, 12:44 PM
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types;
import org.jdom.Document;
import org.jdom.Element;
-import org.jdom.Namespace;
-import org.jdom.filter.Filter;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
/**
- * This class describes an AAPP service (introspection document).
+ * This class describes an RAP service (introspection document).
* A Service is a set of workspaces, which is a set of
* collections.
*
@@ -40,10 +43,109 @@
*/
public class Service extends EntrySet {
+
+ public Service(String href) {
+ setHref(href);
+ }
+
+ public Service(Document d) throws UnexpectedRootElementException {
+ populate(d);
+ }
+
+ public Service(InputStream stream) throws JDOMException, IOException, UnexpectedRootElementException {
+ SAXBuilder sb = new SAXBuilder();
+ Document d = sb.build(stream);
+ populate(d);
+ }
+
+ public String getType() {
+ return Types.SERVICE;
+ }
+
+ public Document toDocument() {
+ Document doc = new Document();
+ Element root = new Element(Types.SERVICE, NAMESPACE);
+ doc.setRootElement(root);
+
+ for (int i = 0; i < getEntries().length; i++) {
+ Entry entry = getEntries()[i];
+ root.addContent(entry.toDocument().detachRootElement());
+ }
+
+ return doc;
+ }
+
+ public void populate(Document doc) {
+ Element root = doc.getRootElement();
+ List workspaces = new ArrayList();
+ List spaces = root.getChildren("workspace", NAMESPACE);
+ Iterator iter = spaces.iterator();
+ while (iter.hasNext()) {
+ Element e = (Element) iter.next();
+ Workspace ws = new Workspace();
+ ws.populate(e);
+ workspaces.add(ws);
+ }
+ setEntries((Entry[])workspaces.toArray(new Workspace[0]));
+ }
+
/** This class describes a service workspace. */
- public static class Workspace extends EntrySet {
+ public static class Workspace extends EntrySet {
+
+ private static interface Attributes {
+ public static final String TITLE = "title";
+ }
+
+ private String title = null;
+
+ public Workspace() {
+ }
+
+ public String getType() {
+ return Types.WORKSPACE;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+
+ public Document toDocument() {
+ Document doc = new Document();
+ Element element = new Element(EntrySet.Types.WORKSPACE, NAMESPACE);
+ doc.setRootElement(element);
+
+ element.setAttribute(Attributes.TITLE, getTitle());
+ for (int i = 0; i < getEntries().length; i++) {
+ Entry entry = getEntries()[i];
+ element.addContent(entry.toDocument().detachRootElement());
+ }
+
+ return doc;
+ }
+
+ public void populate(Element elem) {
+ setTitle(elem.getAttributeValue(Attributes.TITLE)); //, NAMESPACE));
+ List collections = new ArrayList();
+ List spaces = elem.getChildren("collection", NAMESPACE);
+ Iterator iter = spaces.iterator();
+ while (iter.hasNext()) {
+ Element e = (Element) iter.next();
+ Collection col = new Collection();
+ col.populate(e);
+ collections.add(col);
+ }
+ Workspace.this.setEntries((Entry[])collections.toArray(new Collection[0]));
+ }
+
+
/** This class describes a workspace collection. */
public static class Collection extends Entry {
+
private static interface Tags {
public static final String MEMBER_TYPE = "member-type";
}
@@ -87,6 +189,14 @@
return doc;
}
+
+ public void populate(Element elem) {
+ setTitle(elem.getAttributeValue(Attributes.TITLE)); //, NAMESPACE));
+ setHref(elem.getAttributeValue(Entry.Attributes.HREF)); //, NAMESPACE));
+ Element typeElem = elem.getChild(Tags.MEMBER_TYPE, NAMESPACE);
+ setMemberType(typeElem.getText());
+ }
+
public String getMemberType() {
return memberType;
}
@@ -97,61 +207,6 @@
}
- private static interface Attributes {
- public static final String TITLE = "title";
- }
-
- private String title = null;
-
- public Workspace() {
- }
-
- public String getType() {
- return Types.WORKSPACE;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
-
- public Document toDocument() {
- Document doc = new Document();
- Element element = new Element(EntrySet.Types.WORKSPACE, NAMESPACE);
- doc.setRootElement(element);
-
- element.setAttribute(Attributes.TITLE, getTitle());
- for (int i = 0; i < getEntries().length; i++) {
- Entry entry = getEntries()[i];
- element.addContent(entry.toDocument().detachRootElement());
- }
-
- return doc;
- }
- }
-
- public Service(String href) {
- setHref(href);
}
- public String getType() {
- return Types.SERVICE;
- }
-
- public Document toDocument() {
- Document doc = new Document();
- Element root = new Element(Types.SERVICE, NAMESPACE);
- doc.setRootElement(root);
-
- for (int i = 0; i < getEntries().length; i++) {
- Entry entry = getEntries()[i];
- root.addContent(entry.toDocument().detachRootElement());
- }
-
- return doc;
- }
}
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UnexpectedRootElementException.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UnexpectedRootElementException.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UnexpectedRootElementException.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UnexpectedRootElementException.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UnexpectedRootElementException.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UnexpectedRootElementException.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UnexpectedRootElementException.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
public class UnexpectedRootElementException extends Exception {
private String expected;
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntry.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntry.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntry.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntry.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.io.IOException;
import java.io.InputStream;
@@ -27,8 +27,8 @@
import org.jdom.JDOMException;
import org.jdom.Text;
import org.jdom.input.SAXBuilder;
-import org.apache.roller.webservices.adminapi.sdk.Entry.Attributes;
-import org.apache.roller.webservices.adminapi.sdk.Entry.Types;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry.Attributes;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry.Types;
/**
* This class describes a user entry; a user weblog resource.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntrySet.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntrySet.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntrySet.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntrySet.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntrySet.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/UserEntrySet.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/UserEntrySet.java Thu Mar 22 15:01:38 2007
@@ -21,7 +21,7 @@
* Created on January 17, 2006, 12:44 PM
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.io.IOException;
import java.io.InputStream;
@@ -32,7 +32,7 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet.Types;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types;
/**
* This class describes a set of user entries.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntry.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntry.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntry.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntry.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntry.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntry.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntry.java Thu Mar 22 15:01:38 2007
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
/*
* WeblogEntry.java
*
@@ -32,8 +32,8 @@
import org.jdom.JDOMException;
import org.jdom.Text;
import org.jdom.input.SAXBuilder;
-import org.apache.roller.webservices.adminapi.sdk.Entry.Attributes;
-import org.apache.roller.webservices.adminapi.sdk.Entry.Types;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry.Attributes;
+import org.apache.roller.webservices.adminprotocol.sdk.Entry.Types;
/**
* This class describes a weblog entry.
Copied: incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntrySet.java (from r520884, incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntrySet.java)
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntrySet.java?view=diff&rev=521490&p1=incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntrySet.java&r1=520884&p2=incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntrySet.java&r2=521490
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/adminapi/sdk/WeblogEntrySet.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/adminprotocol/sdk/WeblogEntrySet.java Thu Mar 22 15:01:38 2007
@@ -21,7 +21,7 @@
* Created on January 17, 2006, 12:44 PM
*/
-package org.apache.roller.webservices.adminapi.sdk;
+package org.apache.roller.webservices.adminprotocol.sdk;
import java.io.IOException;
import java.io.InputStream;
@@ -32,7 +32,7 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
-import org.apache.roller.webservices.adminapi.sdk.EntrySet.Types;
+import org.apache.roller.webservices.adminprotocol.sdk.EntrySet.Types;
/**
* This class describes a set of weblog entries.
Modified: incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/AappTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/AappTest.java?view=diff&rev=521490&r1=521489&r2=521490
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/AappTest.java (original)
+++ incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/AappTest.java Thu Mar 22 15:01:38 2007
@@ -21,12 +21,12 @@
import java.util.Locale;
import java.util.TimeZone;
import junit.framework.TestCase;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntry;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntrySet;
-import org.apache.roller.webservices.adminapi.sdk.UserEntry;
-import org.apache.roller.webservices.adminapi.sdk.UserEntrySet;
-import org.apache.roller.webservices.adminapi.sdk.WeblogEntry;
-import org.apache.roller.webservices.adminapi.sdk.WeblogEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.UserEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.UserEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.WeblogEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.WeblogEntrySet;
public abstract class AappTest extends TestCase {
private static final Date sampleDate = new Date();
Modified: incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/HandlerBaseTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/HandlerBaseTest.java?view=diff&rev=521490&r1=521489&r2=521490
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/HandlerBaseTest.java (original)
+++ incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/HandlerBaseTest.java Thu Mar 22 15:01:38 2007
@@ -27,13 +27,13 @@
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.util.Base64;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntry;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntrySet;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
-import org.apache.roller.webservices.adminapi.sdk.UserEntry;
-import org.apache.roller.webservices.adminapi.sdk.UserEntrySet;
-import org.apache.roller.webservices.adminapi.sdk.WeblogEntry;
-import org.apache.roller.webservices.adminapi.sdk.WeblogEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.UserEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.UserEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.WeblogEntry;
+import org.apache.roller.webservices.adminprotocol.sdk.WeblogEntrySet;
import org.jdom.JDOMException;
public abstract class HandlerBaseTest extends AappTest {
Modified: incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/MemberHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/MemberHandlerTest.java?view=diff&rev=521490&r1=521489&r2=521490
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/MemberHandlerTest.java (original)
+++ incubator/roller/trunk/tests/org/apache/roller/webservices/adminapi/MemberHandlerTest.java Thu Mar 22 15:01:38 2007
@@ -18,8 +18,8 @@
package org.apache.roller.webservices.adminapi;
import java.io.IOException;
-import org.apache.roller.webservices.adminapi.sdk.MemberEntrySet;
-import org.apache.roller.webservices.adminapi.sdk.UnexpectedRootElementException;
+import org.apache.roller.webservices.adminprotocol.sdk.MemberEntrySet;
+import org.apache.roller.webservices.adminprotocol.sdk.UnexpectedRootElementException;
import org.jdom.JDOMException;
public class MemberHandlerTest extends HandlerBaseTest {