roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r755000 [1/4] - in /roller/trunk: apps/weblogger/ apps/weblogger/nbproject/ apps/weblogger/src/java/META-INF/ apps/weblogger/src/java/org/apache/roller/weblogger/business/ apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/ ap...
Date Mon, 16 Mar 2009 20:40:08 GMT
Author: snoopdave
Date: Mon Mar 16 20:40:06 2009
New Revision: 755000

URL: http://svn.apache.org/viewvc?rev=755000&view=rev
Log:
Adding OAuth support for Roller, details are here:
    https://issues.apache.org/roller/browse/ROL-1798

Added:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/OAuthManager.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAOAuthManagerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthAuthorize.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthKeys.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/oauth/
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/oauth/AccessTokenServlet.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/oauth/AuthorizationServlet.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/oauth/RequestTokenServlet.java
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/jpa/
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/jpa/JPAOAuthManagerTest.java
    roller/trunk/apps/weblogger/velocity.log.1
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/core/OAuthAuthorize.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/core/OAuthKeys.jsp
    roller/trunk/tools/lib/rome-1.0.jar   (with props)
    roller/trunk/tools/lib/rome-fetcher-1.0.jar   (with props)
    roller/trunk/tools/lib/rome-propono-1.0.jar   (with props)
    roller/trunk/tools/oauth/
    roller/trunk/tools/oauth/commons-httpclient-3.1.jar   (with props)
    roller/trunk/tools/oauth/httpclient-4.0-beta1.jar   (with props)
    roller/trunk/tools/oauth/httpcore-4.0-beta2.jar   (with props)
    roller/trunk/tools/oauth/oauth-core-20090121.jar   (with props)
Removed:
    roller/trunk/apps/weblogger/src/sql/400-to-410-migration.vm
    roller/trunk/tools/lib/rome-0.9.1-dev.jar
    roller/trunk/tools/lib/rome-fetcher-0.9.jar
    roller/trunk/tools/lib/rome-propono-0.7.jar
Modified:
    roller/trunk/apps/weblogger/build.properties
    roller/trunk/apps/weblogger/build.xml
    roller/trunk/apps/weblogger/nbproject/project.xml
    roller/trunk/apps/weblogger/properties.xmlf
    roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/URLStrategy.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/Weblogger.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/WebloggerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerModule.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/WeblogRequestMapper.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/MailUtil.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandler.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/webservices/atomprotocol/RollerAtomHandlerFactory.java
    roller/trunk/apps/weblogger/src/sql/400-to-500-migration.vm
    roller/trunk/apps/weblogger/src/sql/createdb.vm
    roller/trunk/apps/weblogger/test/java/org/apache/roller/weblogger/business/SupplementalWeblogServicesTestSuite.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
    roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/core/MainMenu.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/core/MainMenuSidebar.jsp
    roller/trunk/apps/weblogger/web/WEB-INF/tiles.xml
    roller/trunk/apps/weblogger/web/WEB-INF/web.xml

Modified: roller/trunk/apps/weblogger/build.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/build.properties?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/build.properties (original)
+++ roller/trunk/apps/weblogger/build.properties Mon Mar 16 20:40:06 2009
@@ -3,7 +3,7 @@
 basedir=.
 
 # what version is this?
-ro.version=4.1-dev
+ro.version=5.0-dev
 
 # compile time settings
 build.debug=true

Modified: roller/trunk/apps/weblogger/build.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/build.xml?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/build.xml (original)
+++ roller/trunk/apps/weblogger/build.xml Mon Mar 16 20:40:06 2009
@@ -263,6 +263,7 @@
             <fileset refid="spring.jars" /> 
             <fileset refid="jstl.jars" />
             <fileset refid="xmlrpc.jars" />
+            <fileset refid="oauth.jars" />
             
             <fileset refid="roller-core.jars" />
             <fileset refid="roller-planet.jars" />

Modified: roller/trunk/apps/weblogger/nbproject/project.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/nbproject/project.xml?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/nbproject/project.xml (original)
+++ roller/trunk/apps/weblogger/nbproject/project.xml Mon Mar 16 20:40:06 2009
@@ -4,15 +4,20 @@
     <configuration>
         <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
             <!-- Do not use Project Properties customizer when editing this file manually. -->
-            <name>roller_weblogger_trunk</name>
+            <name>workspace - roller_weblogger_trunk</name>
             <properties>
                 <property name="ant.script">build.xml</property>
             </properties>
             <folders>
                 <source-folder>
-                    <label>src/sql</label>
-                    <type>java</type>
-                    <location>src/sql</location>
+                    <label>web</label>
+                    <type>doc_root</type>
+                    <location>web</location>
+                </source-folder>
+                <source-folder>
+                    <label>WEB-INF</label>
+                    <type>web_inf</type>
+                    <location>web/WEB-INF</location>
                 </source-folder>
                 <source-folder>
                     <label>src</label>
@@ -20,6 +25,11 @@
                     <location>src/java</location>
                 </source-folder>
                 <source-folder>
+                    <label>src/sql</label>
+                    <type>java</type>
+                    <location>src/sql</location>
+                </source-folder>
+                <source-folder>
                     <label>test/java</label>
                     <type>java</type>
                     <location>test/java</location>
@@ -29,16 +39,6 @@
                     <type>java</type>
                     <location>docs/examples/plugins/pluginmodel/src</location>
                 </source-folder>
-                <source-folder>
-                    <label>web</label>
-                    <type>doc_root</type>
-                    <location>web</location>
-                </source-folder>
-                <source-folder>
-                    <label>WEB-INF</label>
-                    <type>web_inf</type>
-                    <location>web/WEB-INF</location>
-                </source-folder>
             </folders>
             <ide-actions>
                 <action name="build">
@@ -96,14 +96,14 @@
                         <location>web/WEB-INF</location>
                     </source-folder>
                     <source-folder style="packages">
-                        <label>src/sql</label>
-                        <location>src/sql</location>
-                    </source-folder>
-                    <source-folder style="packages">
                         <label>src</label>
                         <location>src/java</location>
                     </source-folder>
                     <source-folder style="packages">
+                        <label>src/sql</label>
+                        <location>src/sql</location>
+                    </source-folder>
+                    <source-folder style="packages">
                         <label>test/java</label>
                         <location>test/java</location>
                     </source-folder>
@@ -132,14 +132,13 @@
                 <package-root>src/java</package-root>
                 <package-root>test/java</package-root>
                 <package-root>docs/examples/plugins/pluginmodel/src</package-root>
-                <classpath mode="compile">../../tools/roller-core/roller-core.jar:../../tools/roller-planet/roller-planet-business.jar:../../tools/buildtime/activation.jar:../../tools/buildtime/mail.jar:../../tools/buildtime/tomcat-5.0.28/jsp-api.jar:../../tools/buildtime/tomcat-5.0.28/servlet-api.jar:../../tools/lib/commons-codec-1.3.jar:../../tools/lib/commons-collections-3.2.jar:../../tools/lib/commons-digester-1.6.jar:../../tools/lib/commons-id-0.1-SNAPSHOT.jar:../../tools/lib/commons-lang-2.1.jar:../../tools/lib/commons-logging-1.0.4.jar:../../tools/lib/concurrent-1.3.2.jar:../../tools/lib/guice-1.0.jar:../../tools/lib/jaxen-full.jar:../../tools/lib/jdom.jar:../../tools/lib/log4j-1.2.11.jar:../../tools/lib/lucene-1.4.3.jar:../../tools/lib/rome-0.9.1-dev.jar:../../tools/lib/rome-fetcher-0.9.jar:../../tools/lib/saxpath.jar:../../tools/lib/taglibs-string.jar:../../tools/lib/velocity-1.5.jar:../../tools/openjpa-0.9.7/geronimo-j2ee-connector_1.5_spec-1.0.1.jar:../../tools/op
 enjpa-0.9.7/geronimo-jpa_3.0_spec-1.0.jar:../../tools/openjpa-0.9.7/geronimo-jta_1.0.1B_spec-1.0.1.jar:../../tools/openjpa-0.9.7/openjpa-0.9.7-incubating.jar:../../tools/openjpa-0.9.7/serp-1.11.0.jar:../../tools/xmlrpc-3.0/lib/ws-commons-util-1.0.1.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-client-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-common-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-server-3.0.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/jstl.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/serializer.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/standard.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/xalan.jar:../../tools/buildtime/junit-4.1.jar:../../tools/buildtime/ant-1.7.0/ant.jar:../../tools/buildtime/derbyclient.jar:../../tools/buildtime/derby.jar:../../tools/buildtime/derbynet.jar:../../tools/buildtime/mockrunner-0.35/lib/mockrunner-servlet.jar:../../tools/buildtime/mockrunner-0.35/lib/mockrunner-struts.jar:../../tools/buildtime/mockrunner-0.35/lib/mo
 ckrunner.jar:../../tools/buildtime/mockrunner-0.35/lib/nekohtml.jar:../../tools/struts-2.0.9/lib/antlr-2.7.2.jar:../../tools/struts-2.0.9/lib/commons-beanutils-1.6.jar:../../tools/struts-2.0.9/lib/commons-chain-1.1.jar:../../tools/struts-2.0.9/lib/commons-fileupload-1.2.jar:../../tools/struts-2.0.9/lib/commons-io-1.3.1.jar:../../tools/struts-2.0.9/lib/commons-validator-1.3.0.jar:../../tools/struts-2.0.9/lib/freemarker-2.3.8.jar:../../tools/struts-2.0.9/lib/ognl-2.6.11.jar:../../tools/struts-2.0.9/lib/oro-2.0.8.jar:../../tools/struts-2.0.9/lib/struts2-core-2.0.9.jar:../../tools/struts-2.0.9/lib/struts2-spring-plugin-2.0.9.jar:../../tools/struts-2.0.9/lib/struts2-tiles-plugin-2.0.9.jar:../../tools/struts-2.0.9/lib/tiles-api-2.0.4.jar:../../tools/struts-2.0.9/lib/tiles-core-2.0.4.jar:../../tools/struts-2.0.9/lib/tiles-jsp-2.0.4.jar:../../tools/struts-2.0.9/lib/xwork-2.0.4.jar:../../tools/lib/commons-httpclient-3.0.1.jar:../../tools/lib/rome-propono-0.7.jar:../../tools/lib/dom3-
 xercesImpl.jar:../../tools/lib/nekohtml.jar:../../tools/lib/openxri-syntax.jar:../../tools/lib/apache-xml-security.jar:../../tools/lib/dom3-xml-apis.jar:../../tools/lib/openxri-client.jar:../../tools/spring-2.5/spring-2.5.4.jar:../../tools/spring-2.5/spring-security-openid-2.0.3.jar:../../tools/spring-2.5/spring-ldap-1.2.1.jar:../../tools/spring-2.5/spring-security-taglibs-2.0.3.jar:../../tools/spring-2.5/spring-security-acl-2.0.3.jar:../../tools/spring-2.5/spring-web-2.5.4.jar:../../tools/spring-2.5/spring-security-core-2.0.3.jar</classpath>
+                <classpath mode="compile">../../tools/roller-core/roller-core.jar:../../tools/roller-planet/roller-planet-business.jar:../../tools/buildtime/activation.jar:../../tools/buildtime/mail.jar:../../tools/buildtime/tomcat-5.0.28/jsp-api.jar:../../tools/buildtime/tomcat-5.0.28/servlet-api.jar:../../tools/lib/commons-codec-1.3.jar:../../tools/lib/commons-collections-3.2.jar:../../tools/lib/commons-digester-1.6.jar:../../tools/lib/commons-id-0.1-SNAPSHOT.jar:../../tools/lib/commons-lang-2.1.jar:../../tools/lib/commons-logging-1.0.4.jar:../../tools/lib/concurrent-1.3.2.jar:../../tools/lib/guice-1.0.jar:../../tools/lib/jaxen-full.jar:../../tools/lib/jdom.jar:../../tools/lib/log4j-1.2.11.jar:../../tools/lib/lucene-1.4.3.jar:../../tools/lib/rome-fetcher-0.9.jar:../../tools/lib/saxpath.jar:../../tools/lib/taglibs-string.jar:../../tools/lib/velocity-1.5.jar:../../tools/openjpa-0.9.7/geronimo-j2ee-connector_1.5_spec-1.0.1.jar:../../tools/openjpa-0.9.7/geronimo-jpa_3.0_spec-1
 .0.jar:../../tools/openjpa-0.9.7/geronimo-jta_1.0.1B_spec-1.0.1.jar:../../tools/openjpa-0.9.7/openjpa-0.9.7-incubating.jar:../../tools/openjpa-0.9.7/serp-1.11.0.jar:../../tools/xmlrpc-3.0/lib/ws-commons-util-1.0.1.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-client-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-common-3.0.jar:../../tools/xmlrpc-3.0/lib/xmlrpc-server-3.0.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/jstl.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/serializer.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/standard.jar:../../tools/jakarta-taglibs-standard-1.1.2/lib/xalan.jar:../../tools/buildtime/junit-4.1.jar:../../tools/buildtime/ant-1.7.0/ant.jar:../../tools/buildtime/derbyclient.jar:../../tools/buildtime/derby.jar:../../tools/buildtime/derbynet.jar:../../tools/buildtime/mockrunner-0.35/lib/mockrunner-servlet.jar:../../tools/buildtime/mockrunner-0.35/lib/mockrunner-struts.jar:../../tools/buildtime/mockrunner-0.35/lib/mockrunner.jar:../../tools/buildtime/
 mockrunner-0.35/lib/nekohtml.jar:../../tools/struts-2.0.9/lib/antlr-2.7.2.jar:../../tools/struts-2.0.9/lib/commons-beanutils-1.6.jar:../../tools/struts-2.0.9/lib/commons-chain-1.1.jar:../../tools/struts-2.0.9/lib/commons-fileupload-1.2.jar:../../tools/struts-2.0.9/lib/commons-io-1.3.1.jar:../../tools/struts-2.0.9/lib/commons-validator-1.3.0.jar:../../tools/struts-2.0.9/lib/freemarker-2.3.8.jar:../../tools/struts-2.0.9/lib/ognl-2.6.11.jar:../../tools/struts-2.0.9/lib/oro-2.0.8.jar:../../tools/struts-2.0.9/lib/struts2-core-2.0.9.jar:../../tools/struts-2.0.9/lib/struts2-spring-plugin-2.0.9.jar:../../tools/struts-2.0.9/lib/struts2-tiles-plugin-2.0.9.jar:../../tools/struts-2.0.9/lib/tiles-api-2.0.4.jar:../../tools/struts-2.0.9/lib/tiles-core-2.0.4.jar:../../tools/struts-2.0.9/lib/tiles-jsp-2.0.4.jar:../../tools/struts-2.0.9/lib/xwork-2.0.4.jar:../../tools/lib/commons-httpclient-3.0.1.jar:../../tools/lib/dom3-xercesImpl.jar:../../tools/lib/nekohtml.jar:../../tools/lib/openxri-synt
 ax.jar:../../tools/lib/apache-xml-security.jar:../../tools/lib/dom3-xml-apis.jar:../../tools/lib/openxri-client.jar:../../tools/spring-2.5/spring-2.5.4.jar:../../tools/spring-2.5/spring-security-openid-2.0.3.jar:../../tools/spring-2.5/spring-ldap-1.2.1.jar:../../tools/spring-2.5/spring-security-taglibs-2.0.3.jar:../../tools/spring-2.5/spring-security-acl-2.0.3.jar:../../tools/spring-2.5/spring-web-2.5.4.jar:../../tools/spring-2.5/spring-security-core-2.0.3.jar:../../tools/oauth/commons-httpclient-3.1.jar:../../tools/oauth/httpclient-4.0-beta1.jar:../../tools/oauth/httpcore-4.0-beta2.jar:../../tools/oauth/oauth-core-20090121.jar:../../tools/lib/rome-1.0.jar:../../tools/lib/rome-fetcher-1.0.jar:../../tools/lib/rome-propono-1.0.jar</classpath>
                 <source-level>1.5</source-level>
             </compilation-unit>
         </java-data>
         <web-data xmlns="http://www.netbeans.org/ns/freeform-project-web/2">
             <web-module>
                 <doc-root>web</doc-root>
-                <classpath/>
                 <context-path>/roller</context-path>
                 <j2ee-spec-level>1.5</j2ee-spec-level>
                 <web-inf>web/WEB-INF</web-inf>

Modified: roller/trunk/apps/weblogger/properties.xmlf
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/properties.xmlf?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/properties.xmlf (original)
+++ roller/trunk/apps/weblogger/properties.xmlf Mon Mar 16 20:40:06 2009
@@ -97,9 +97,9 @@
     <include name="jdom.jar"/>
     <include name="lucene-1.4.3.jar"/>
     <include name="log4j-1.2.11.jar"/>
-    <include name="rome-0.9.1-dev.jar"/>
-    <include name="rome-propono-0.7.jar"/>
-    <include name="rome-fetcher-0.9.jar"/>
+    <include name="rome-1.0.jar"/>
+    <include name="rome-propono-1.0.jar"/>
+    <include name="rome-fetcher-1.0.jar"/>
     <include name="velocity-1.5.jar"/>
     <include name="guice-1.0.jar"/>
 </fileset>
@@ -145,6 +145,10 @@
     <include name="xmlrpc-server-3.0.jar"/>
 </fileset>
 
+<fileset id="oauth.jars" dir="${ro.tools}/oauth">
+    <include name="*.jar"/>
+</fileset>
+
 <fileset id="roller-core.jars" dir="${ro.tools}/roller-core">
     <include name="*.jar"/>
 </fileset>
@@ -163,6 +167,7 @@
     <fileset refid="mail.jars"/>
     <fileset refid="roller-core.jars" />
     <fileset refid="xmlrpc.jars"/>
+    <fileset refid="oauth.jars"/>
     <fileset refid="roller-planet.jars" />
     <!-- JPA bytecode enhancement apparently wants JPA classes everywhere -->
     <fileset refid="jpa.jars" />

Modified: roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml (original)
+++ roller/trunk/apps/weblogger/src/java/META-INF/persistence.xml Mon Mar 16 20:40:06 2009
@@ -6,28 +6,30 @@
         <jta-data-source>java:comp/env/jdbc/rollerdb</jta-data-source>
         <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
         -->
-        <mapping-file>org/apache/roller/weblogger/pojos/AutoPing.orm.xml                       </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml             </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryAttribute.orm.xml           </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml           </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogHitCount.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/PingQueueEntry.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/PingTarget.orm.xml                     </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogReferrer.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/UserRole.orm.xml                       </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/RuntimeConfigProperty.orm.xml          </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/TaskLock.orm.xml                       </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/User.orm.xml                           </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml                    </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml        </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogTemplate.orm.xml                 </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/ObjectPermission.orm.xml               </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/WeblogPermission.orm.xml               </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/Weblog.orm.xml                         </mapping-file>
-        <mapping-file>org/apache/roller/weblogger/pojos/UserAttribute.orm.xml                  </mapping-file>	
+        <mapping-file>org/apache/roller/weblogger/pojos/AutoPing.orm.xml                </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogBookmark.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryComment.orm.xml      </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryAttribute.orm.xml    </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogBookmarkFolder.orm.xml    </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogHitCount.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/PingQueueEntry.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/PingTarget.orm.xml              </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogReferrer.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/UserRole.orm.xml                </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/RuntimeConfigProperty.orm.xml   </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/TaskLock.orm.xml                </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/User.orm.xml                    </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogCategory.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntry.orm.xml             </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogEntryTag.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogTemplate.orm.xml          </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/ObjectPermission.orm.xml        </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/WeblogPermission.orm.xml        </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/Weblog.orm.xml                  </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/UserAttribute.orm.xml           </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml     </mapping-file>
+        <mapping-file>org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml     </mapping-file>
     </persistence-unit> 
     
 </persistence>

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/MultiWeblogURLStrategy.java Mon Mar 16 20:40:06 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.lang.StringUtils;
+import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.util.URLUtilities;
@@ -49,25 +50,26 @@
     public String getWeblogURL(Weblog weblog,
                                             String locale,
                                             boolean absolute) {
-        
-        if(weblog == null) {
-            return null;
-        }
-        
+
         StringBuffer url = new StringBuffer();
-        
-        if(absolute) {
-            url.append(WebloggerRuntimeConfig.getAbsoluteContextURL());
+        if (absolute) {
+            String weblogAbsoluteURL =
+                WebloggerConfig.getProperty("weblog.absoluteurl." + weblog.getHandle());
+            if (weblogAbsoluteURL != null) {
+                url.append(weblogAbsoluteURL);
+            } else {
+                url.append(WebloggerRuntimeConfig.getAbsoluteContextURL());
+            }
         } else {
             url.append(WebloggerRuntimeConfig.getRelativeContextURL());
         }
-        
+
         url.append("/").append(weblog.getHandle()).append("/");
-        
+
         if(locale != null) {
             url.append(locale).append("/");
         }
-        
+
         return url.toString();
     }
     
@@ -406,6 +408,18 @@
     public String getOpenSearchWeblogURL(String weblogHandle) {
         return WebloggerRuntimeConfig.getAbsoluteContextURL() + "/roller-services/opensearch/" + weblogHandle;
     }
+
+    public String getOAuthRequestTokenURL() {
+        return WebloggerRuntimeConfig.getAbsoluteContextURL() + "/roller-services/oauth/requestToken";
+    }
+
+    public String getOAuthAuthorizationURL() {
+        return WebloggerRuntimeConfig.getAbsoluteContextURL() + "/roller-services/oauth/authorize";
+    }
+
+    public String getOAuthAccessTokenURL() {
+        return WebloggerRuntimeConfig.getAbsoluteContextURL() + "/roller-services/oauth/accessToken";
+    }
     
 }
 

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/OAuthManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/OAuthManager.java?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/OAuthManager.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/OAuthManager.java Mon Mar 16 20:40:06 2009
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2007 AOL, LLC.
+ *
+ * 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.weblogger.business;
+
+import java.io.IOException;
+
+import net.oauth.OAuthAccessor;
+import net.oauth.OAuthConsumer;
+import net.oauth.OAuthException;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.OAuthServiceProvider;
+import net.oauth.OAuthValidator;
+import org.apache.roller.weblogger.WebloggerException;
+
+
+/**
+ * Management of and access to configured and persistent OAuth objects.
+ */
+public interface OAuthManager {
+
+    /**
+     * Get validator to be used to OAuth validate messages.
+     */
+    public OAuthServiceProvider getServiceProvider();
+
+    /**
+     * Get validator to be used to OAuth validate messages.
+     */
+    public OAuthValidator getValidator();
+
+    /**
+     * Get the site-wide consumer.
+     */
+    public OAuthConsumer getConsumer()
+            throws WebloggerException;
+
+    /**
+     * Get consumer corresponding to request.
+     */
+    public OAuthConsumer getConsumerByUsername(String username)
+            throws WebloggerException;
+
+    /**
+     * Get consumer corresponding to request.
+     */
+    public OAuthConsumer getConsumer(
+            OAuthMessage requestMessage)
+            throws IOException, OAuthProblemException;
+
+    /**
+     * Add a site-wide consumer provided a key, there can only be one.
+     */
+    public OAuthConsumer addConsumer(String consumerKey)
+            throws OAuthException, WebloggerException;
+
+    /**
+     * Store a new consumer for specified user, each user can have only one.
+     */
+    public OAuthConsumer addConsumer(String username, String consumerKey)
+            throws OAuthException;
+
+    /**
+     * Get the access token and token secret for the given request.
+     * If token is provided, it better be good; otherwise exception.
+     * If consumer key is provided and no accessor exists, will return null.
+     *
+     * @param requestMessage Request with token or consumer key
+     * @return Accessor or null if consumer key does not have a token yet
+     * @throws OAuthProblemException If provided token is bad
+     * @throws java.io.IOException on IO error
+     */
+    public OAuthAccessor getAccessor(OAuthMessage requestMessage)
+            throws IOException, OAuthProblemException;
+
+    /**
+     * Set the access token 
+     */
+    public void markAsAuthorized(OAuthAccessor accessor, String userId)
+            throws OAuthException;    
+
+    /**
+     * Generate a fresh request token and secret for a consumer.
+     * 
+     * @throws OAuthException
+     */
+    public void generateRequestToken(
+            OAuthAccessor accessor)
+            throws OAuthException;
+    
+    /**
+     * Generate a fresh request token and secret for a consumer.
+     * 
+     * @throws OAuthException
+     */
+    public void generateAccessToken(OAuthAccessor accessor)
+            throws OAuthException;
+}

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/URLStrategy.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/URLStrategy.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/URLStrategy.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/URLStrategy.java Mon Mar 16 20:40:06 2009
@@ -218,5 +218,14 @@
      * Get url to JSON tags service url, optionally for a given weblog.
      */
     public String getWeblogTagsJsonURL(Weblog weblog, boolean absolute, int pageNum);
-    
+
+
+    /* Get URL for obtaining OAuth Request Token */
+    public String getOAuthRequestTokenURL();
+
+    /* Get URL authorizing an OAuth Request Token */
+    public String getOAuthAuthorizationURL();
+
+    /* Get URL for obtaining OAuth Access Token */
+    public String getOAuthAccessTokenURL();
 }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/Weblogger.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/Weblogger.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/Weblogger.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/Weblogger.java Mon Mar 16 20:40:06 2009
@@ -19,6 +19,7 @@
 package org.apache.roller.weblogger.business;
 
 import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.jpa.JPAOAuthManagerImpl;
 import org.apache.roller.weblogger.business.plugins.PluginManager;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.pings.PingQueueManager;
@@ -35,8 +36,7 @@
  * The main entry point interface of the Weblogger business tier.
  */
 public interface Weblogger {
-    
-    
+
     /**
      * 
      * Get UserManager associated with this Weblogger instance.
@@ -52,6 +52,13 @@
     
     
     /**
+     *
+     * Get OAuthManager associated with this Weblogger instance.
+     */
+    public OAuthManager getOAuthManager();
+
+
+    /**
      * 
      * Get WeblogManager associated with this Weblogger instance.
      */

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/WebloggerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/WebloggerImpl.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/WebloggerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/WebloggerImpl.java Mon Mar 16 20:40:06 2009
@@ -18,7 +18,6 @@
 
 package org.apache.roller.weblogger.business;
 
-import org.apache.roller.weblogger.business.plugins.PluginManagerImpl;
 import org.apache.roller.weblogger.business.plugins.PluginManager;
 import java.io.IOException;
 import java.util.Properties;
@@ -30,7 +29,6 @@
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
 import org.apache.roller.weblogger.business.referrers.RefererManager;
 import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
-import org.apache.roller.weblogger.business.referrers.ReferrerQueueManagerImpl;
 import org.apache.roller.weblogger.business.search.IndexManager;
 import org.apache.roller.weblogger.business.runnable.ThreadManager;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
@@ -64,6 +62,7 @@
     private final UserManager          userManager;
     private final WeblogManager        weblogManager;
     private final WeblogEntryManager   weblogEntryManager;
+    private final OAuthManager         oauthManager;
     
     // url strategy
     private final URLStrategy          urlStrategy;
@@ -91,6 +90,7 @@
         UserManager          userManager,
         WeblogManager        weblogManager,
         WeblogEntryManager   weblogEntryManager,
+        OAuthManager         oauthManager,
         URLStrategy          urlStrategy) throws WebloggerException { 
                 
         this.autoPingManager     = autoPingManager;
@@ -108,6 +108,7 @@
         this.userManager         = userManager;
         this.weblogManager       = weblogManager;
         this.weblogEntryManager  = weblogEntryManager;
+        this.oauthManager        = oauthManager;
         this.urlStrategy         = urlStrategy;
         
         Properties props = new Properties();
@@ -264,15 +265,25 @@
     
     
     /**
-     * 
-     * 
+     *
+     *
      * @see org.apache.roller.weblogger.modelWebloggerr#getPluginManager()
      */
     public PluginManager getPluginManager() {
         return pluginManager;
     }
-    
-    
+
+
+    /**
+     *
+     *
+     * @see org.apache.roller.weblogger.modelWebloggerr#getOauthManager()
+     */
+    public OAuthManager getOAuthManager() {
+        return oauthManager;
+    }
+
+
     /**
      * @inheritDoc
      */

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAOAuthManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAOAuthManagerImpl.java?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAOAuthManagerImpl.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAOAuthManagerImpl.java Mon Mar 16 20:40:06 2009
@@ -0,0 +1,405 @@
+/*
+ * 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.
+ */
+
+package org.apache.roller.weblogger.business.jpa;
+
+import java.io.IOException; 
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.UUID;
+import javax.persistence.Query;
+import net.oauth.OAuthAccessor;
+import net.oauth.OAuthConsumer;
+import net.oauth.OAuthException;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.OAuthServiceProvider;
+import net.oauth.OAuthValidator;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.OAuthManager;
+import org.apache.roller.weblogger.business.Weblogger;
+import org.apache.roller.weblogger.pojos.OAuthAccessorRecord;
+import org.apache.roller.weblogger.pojos.OAuthConsumerRecord;
+
+
+/**
+ * JPA based OAuth manager implementation.
+ */
+public class JPAOAuthManagerImpl implements OAuthManager {
+    private final Weblogger roller;
+    private final JPAPersistenceStrategy strategy;
+    private final OAuthValidator validator;
+
+    /**
+     * The logger instance for this class.
+     */
+    private static Log log = LogFactory
+            .getFactory().getInstance(JPAOAuthManagerImpl.class);
+
+
+    @com.google.inject.Inject
+    public JPAOAuthManagerImpl(
+            Weblogger roller,
+            JPAPersistenceStrategy strategy,
+            OAuthValidator validator) {
+        this.roller = roller;
+        this.strategy = strategy;
+        this.validator = validator;
+    }
+    
+    public OAuthServiceProvider getServiceProvider() {
+        return new OAuthServiceProvider(
+            roller.getUrlStrategy().getOAuthRequestTokenURL(),
+            roller.getUrlStrategy().getOAuthAuthorizationURL(),
+            roller.getUrlStrategy().getOAuthAccessTokenURL());
+    }
+
+    public OAuthValidator getValidator() {
+        return validator;
+    }
+
+    public OAuthConsumer getConsumer(
+            OAuthMessage requestMessage)
+            throws IOException, OAuthProblemException {
+
+        OAuthConsumer consumer = null;
+        // try to load from local cache if not throw exception
+        String consumer_key = requestMessage.getConsumerKey();
+
+        consumer = getConsumerByKey(consumer_key);
+
+        if(consumer == null) {
+            OAuthProblemException problem = new OAuthProblemException("token_rejected");
+            throw problem;
+        }
+
+        return consumer;
+    }
+    
+    /**
+     * Get the access token and token secret for the given oauth_token. 
+     */
+    public OAuthAccessor getAccessor(OAuthMessage requestMessage)
+            throws IOException, OAuthProblemException {
+
+        String consumerToken = requestMessage.getToken();
+        OAuthAccessor accessor = null;
+        if (StringUtils.isNotEmpty(consumerToken)) {
+            // caller provided a token, it better be good or else
+            accessor = getAccessorByToken(consumerToken);
+            if (accessor == null){
+                OAuthProblemException problem = new OAuthProblemException("token_expired");
+                throw problem;
+            }
+        }
+
+        String consumerKey = requestMessage.getConsumerKey();
+        if (accessor == null && StringUtils.isNotEmpty(consumerKey)) {
+            // caller provided contumer key, do we have an accessor yet
+            accessor = getAccessorByKey(consumerKey);
+        }
+        return accessor;
+    }
+
+    /**
+     * Set the access token 
+     */
+    public void markAsAuthorized(OAuthAccessor accessor, String userId)
+            throws OAuthException {
+        try {
+            OAuthAccessorRecord record = (OAuthAccessorRecord) strategy.load(
+                OAuthAccessorRecord.class, accessor.consumer.consumerKey);
+            record.setUserName(userId);
+            record.setAuthorized(Boolean.TRUE);
+            strategy.store(record);
+            
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR: setting authorization flag", ex);
+        }
+    }
+
+    /**
+     * Generate a fresh request token and secret for a consumer.
+     * @throws OAuthException
+     */
+    public void generateRequestToken(
+            OAuthAccessor accessor)
+            throws OAuthException {
+
+        // generate oauth_token and oauth_secret
+        String consumer_key = (String) accessor.consumer.consumerKey;
+        // generate token and secret based on consumer_key
+
+        // for now use md5 of name + current time as token
+        String token_data = consumer_key + System.nanoTime();
+        String token = DigestUtils.md5Hex(token_data);
+        // for now use md5 of name + current time + token as secret
+        String secret_data = consumer_key + System.nanoTime() + token;
+        String secret = DigestUtils.md5Hex(secret_data);
+
+        accessor.requestToken = token;
+        accessor.tokenSecret = secret;
+        accessor.accessToken = null;
+
+        // add to the local cache
+        addAccessor(accessor);
+    }
+    
+    /**
+     * Generate a fresh request token and secret for a consumer.
+     * @throws OAuthException
+     */
+    public void generateAccessToken(OAuthAccessor accessor)
+            throws OAuthException {
+
+        // generate oauth_token and oauth_secret
+        // generate token and secret based on consumer_key
+        String consumer_key = (String) accessor.consumer.consumerKey;
+
+        // unless we already have one
+        try {
+            // in that case, just return it
+            OAuthAccessorRecord record = (OAuthAccessorRecord) strategy.load(
+                OAuthAccessorRecord.class, accessor.consumer.consumerKey);
+            if (record != null) {
+                accessor.accessToken = record.getAccessToken();
+                accessor.tokenSecret = record.getTokenSecret();
+                return;
+            }
+            
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR: getting access token", ex);
+        }
+
+        // for now use md5 of name + current time as token
+        String token_data = consumer_key + System.nanoTime();
+        String token = DigestUtils.md5Hex(token_data);
+
+        try {
+            OAuthAccessorRecord record = (OAuthAccessorRecord) strategy.load(
+                OAuthAccessorRecord.class, accessor.consumer.consumerKey);
+            record.setRequestToken(null);
+            record.setAccessToken(token);
+            strategy.store(record);
+
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR: generating access token", ex);
+        }
+    }
+
+    public OAuthConsumer addConsumer(String username, String consumerKey) throws OAuthException {
+
+        OAuthConsumerRecord record = new OAuthConsumerRecord();
+        record.setConsumerKey(consumerKey);
+        record.setUserName(username);
+        record.setConsumerSecret(UUID.randomUUID().toString());
+
+        try {
+            strategy.store(record);
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR storing accessor", ex);
+        }
+        
+        OAuthConsumer consumer = new OAuthConsumer(
+            null,
+            record.getConsumerKey(),
+            record.getConsumerSecret(),
+            getServiceProvider());
+
+        return consumer;
+    }
+
+    public OAuthConsumer addConsumer(String consumerKey) 
+            throws OAuthException, WebloggerException {
+        if (getConsumer() == null) {
+            return addConsumer(null, consumerKey);
+        } else {
+            throw new OAuthException("ERROR: cannot have more than one site-wide consumer");
+        }
+    }
+
+    public OAuthConsumer getConsumer() throws WebloggerException {
+        OAuthConsumerRecord record = null;
+        try {
+            Query q = strategy.getNamedQuery("OAuthConsumerRecord.getSiteWideConsumer");
+            record = (OAuthConsumerRecord)q.getSingleResult();
+
+        } catch (Throwable ex) {
+            log.debug("ERROR fetching site-wide consumer", ex);
+        }
+        if (record != null) {
+            OAuthConsumer consumer = new OAuthConsumer(
+                null,
+                record.getConsumerKey(),
+                record.getConsumerSecret(),
+                getServiceProvider());
+            return consumer;
+        }
+        return null;
+    }
+
+    public OAuthConsumer getConsumerByUsername(String username) throws WebloggerException {
+        OAuthConsumerRecord record = null;
+        try {
+            Query q = strategy.getNamedQuery("OAuthConsumerRecord.getByUsername");
+            q.setParameter(1, username);
+            record = (OAuthConsumerRecord)q.getSingleResult();
+
+        } catch (Throwable ex) {
+            log.debug("ERROR fetching consumer", ex);
+        }
+        if (record != null) {
+            OAuthConsumer consumer = new OAuthConsumer(
+                null,
+                record.getConsumerKey(),
+                record.getConsumerSecret(),
+                getServiceProvider());
+            consumer.setProperty("userName", record.getUserName());
+            return consumer;
+        }
+        return null;
+    }
+
+    
+    //--------------------------------------------- package protected internals
+
+    OAuthConsumer consumerFromRecord(OAuthConsumerRecord record) {
+        OAuthConsumer consumer = null;
+        if (record != null) {
+            consumer = new OAuthConsumer(
+                null,
+                record.getConsumerKey(),
+                record.getConsumerSecret(),
+                getServiceProvider());
+            if (record.getUserName() != null) {
+                consumer.setProperty("userId", record.getUserName());
+            }
+        }
+        return consumer;
+    }
+
+    OAuthAccessor accessorFromRecord(OAuthAccessorRecord record) {
+        OAuthAccessor accessor = null;
+        if (record != null) {
+            accessor =
+                new OAuthAccessor(getConsumerByKey(record.getConsumerKey()));
+            accessor.accessToken = record.getAccessToken();
+            accessor.requestToken = record.getRequestToken();
+            accessor.tokenSecret = record.getTokenSecret();
+            if (record.getAuthorized() != null) {
+                accessor.setProperty("authorized", record.getAuthorized());
+            }
+            if (record.getUserName() != null) {
+                accessor.setProperty("userId", record.getUserName());
+            }
+        }
+        return accessor;
+    }
+
+    OAuthConsumer getConsumerByKey(String consumerKey) {
+        OAuthConsumerRecord record = null;
+        try {
+            Query q = strategy.getNamedQuery("OAuthConsumerRecord.getByConsumerKey");
+            q.setParameter(1, consumerKey);
+            record = (OAuthConsumerRecord)q.getSingleResult();
+
+        } catch (Throwable ex) {
+            log.debug("ERROR fetching consumer", ex);
+        }
+        return consumerFromRecord(record);
+    }
+
+    void addAccessor(OAuthAccessor accessor) throws OAuthException {
+
+        OAuthAccessorRecord record = new OAuthAccessorRecord();
+        record.setConsumerKey(accessor.consumer.consumerKey);
+        record.setRequestToken(accessor.requestToken);
+        record.setAccessToken(accessor.accessToken);
+        record.setTokenSecret(accessor.tokenSecret);
+        if (accessor.getProperty("userId") != null) {
+            record.setUserName((String)accessor.getProperty("userId"));
+        }
+
+        if (record.getCreated() != null) {
+            record.setCreated(record.getCreated());
+        } else {
+            record.setCreated(new Timestamp(new Date().getTime()));
+        }
+        
+        if (record.getUpdated() != null) {
+            record.setUpdated(record.getUpdated());
+        } else {
+            record.setUpdated(record.getCreated());
+        }
+
+        if (accessor.getProperty("authorized") != null) {
+            record.setAuthorized((Boolean)accessor.getProperty("authorized"));
+        }
+        try {
+            strategy.store(record);
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR storing accessor", ex);
+        }
+    }
+
+    OAuthAccessor getAccessorByKey(String consumerKey) {
+        OAuthAccessorRecord record = null;
+        try {
+            Query q = strategy.getNamedQuery("OAuthAccessorRecord.getByKey");
+            q.setParameter(1, consumerKey);
+            record = (OAuthAccessorRecord)q.getSingleResult();
+
+        } catch (Throwable ex) {
+            log.debug("ERROR fetching accessor", ex);
+        }
+        return accessorFromRecord(record);
+    }
+
+    OAuthAccessor getAccessorByToken(String token) {
+        OAuthAccessorRecord record = null;
+        try {
+            Query q = strategy.getNamedQuery("OAuthAccessorRecord.getByToken");
+            q.setParameter(1, token);
+            record = (OAuthAccessorRecord)q.getSingleResult();
+
+        } catch (Throwable ex) {
+            log.debug("ERROR fetching accessor", ex);
+        }
+        return accessorFromRecord(record);
+    }
+
+    void removeConsumer(OAuthConsumer consumer) throws OAuthException {
+        try {
+            strategy.remove(OAuthConsumerRecord.class, consumer.consumerKey);
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR removing consumer", ex);
+        }
+    }
+
+    void removeAccessor(OAuthAccessor accessor) throws OAuthException {
+        try {
+            strategy.remove(OAuthAccessorRecord.class, accessor.consumer.consumerKey);
+        } catch (WebloggerException ex) {
+            throw new OAuthException("ERROR removing accessor", ex);
+        }
+    }
+}

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerImpl.java Mon Mar 16 20:40:06 2009
@@ -22,6 +22,7 @@
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.FileManager;
+import org.apache.roller.weblogger.business.OAuthManager;
 import org.apache.roller.weblogger.business.PropertiesManager;
 import org.apache.roller.weblogger.business.URLStrategy;
 import org.apache.roller.weblogger.business.WebloggerImpl;
@@ -74,6 +75,7 @@
         UserManager          userManager,
         WeblogManager        weblogManager,
         WeblogEntryManager   weblogEntryManager,
+        OAuthManager         oauthManager,
         URLStrategy          urlStrategy) throws WebloggerException {
         
         super(
@@ -92,6 +94,7 @@
             userManager,
             weblogManager,
             weblogEntryManager,
+            oauthManager,
             urlStrategy);
         
         this.strategy = strategy;
@@ -117,5 +120,4 @@
         // then let parent do its thing
         super.shutdown();
     }
-    
 }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerModule.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerModule.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerModule.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/jpa/JPAWebloggerModule.java Mon Mar 16 20:40:06 2009
@@ -20,10 +20,13 @@
 
 import com.google.inject.Binder;
 import com.google.inject.Module;
+import net.oauth.OAuthValidator;
+import net.oauth.SimpleOAuthValidator;
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.FileManager;
 import org.apache.roller.weblogger.business.FileManagerImpl;
 import org.apache.roller.weblogger.business.MultiWeblogURLStrategy;
+import org.apache.roller.weblogger.business.OAuthManager;
 import org.apache.roller.weblogger.business.PropertiesManager;
 import org.apache.roller.weblogger.business.URLStrategy;
 import org.apache.roller.weblogger.business.Weblogger;
@@ -67,6 +70,9 @@
         binder.bind(UserManager.class).to(         JPAUserManagerImpl.class);   
         binder.bind(WeblogManager.class).to(       JPAWeblogManagerImpl.class);   
         binder.bind(WeblogEntryManager.class).to(  JPAWeblogEntryManagerImpl.class);   
+        binder.bind(OAuthManager.class).to(        JPAOAuthManagerImpl.class);
+
+        binder.bind(OAuthValidator.class).to(      SimpleOAuthValidator.class);
                 
         binder.bind(ReferrerQueueManager.class).to(ReferrerQueueManagerImpl.class); 
         binder.bind(FileManager.class).to(         FileManagerImpl.class);   

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/startup/DatabaseInstaller.java Mon Mar 16 20:40:06 2009
@@ -245,9 +245,9 @@
                 upgradeTo400(con, runScripts);
                 dbversion = 400;
             }
-            if(dbversion < 410) {
-                upgradeTo410(con, runScripts);
-                dbversion = 410;
+            if(dbversion < 500) {
+                upgradeTo500(con, runScripts);
+                dbversion = 500;
             }
             
             // make sure the database version is the exact version
@@ -1121,25 +1121,25 @@
     /**
      * Upgrade database for Roller 4.1.0
      */
-    private void upgradeTo410(Connection con, boolean runScripts) throws StartupException {
+    private void upgradeTo500(Connection con, boolean runScripts) throws StartupException {
         
         // first we need to run upgrade scripts 
         SQLScriptRunner runner = null;
         try {    
             if (runScripts) {
                 String handle = getDatabaseHandle(con);
-                String scriptPath = handle + "/400-to-410-migration.sql";
+                String scriptPath = handle + "/400-to-500-migration.sql";
                 successMessage("Running database upgrade script: "+scriptPath);                
                 runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                 runner.runScript(con, true);
                 messages.addAll(runner.getMessages());
             }
         } catch(Exception ex) {
-            log.error("ERROR running 410 database upgrade script", ex);
+            log.error("ERROR running 500 database upgrade script", ex);
             if (runner != null) messages.addAll(runner.getMessages());
             
-            errorMessage("Problem upgrading database to version 410", ex);
-            throw new StartupException("Problem upgrading database to version 410", ex);
+            errorMessage("Problem upgrading database to version 500", ex);
+            throw new StartupException("Problem upgrading database to version 500", ex);
         }        
     }
 

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/config/runtimeConfigDefs.xml Mon Mar 16 20:40:06 2009
@@ -80,9 +80,9 @@
          <type>boolean</type>
          <default-value>false</default-value>
       </property-def>
-      <property-def name="site.debugMode" key="configForm.debugMode">
+      <property-def name="site.allowUserWeblogCreation" key="configForm.allowUserWeblogCreation">
          <type>boolean</type>
-         <default-value>false</default-value>
+         <default-value>true</default-value>
       </property-def>
    </display-group >
 
@@ -116,6 +116,25 @@
    </display-group >
    
    
+   <display-group name="webServicesSettings" key="configForm.webServicesSettings" >
+
+      <property-def name="webservices.enableXmlRpc"  key="configForm.enableXmlRpc">
+         <type>boolean</type>
+         <default-value>false</default-value>
+      </property-def>
+
+      <property-def name="webservices.enableAtomPub"  key="configForm.enableAtomPub">
+         <type>boolean</type>
+         <default-value>false</default-value>
+      </property-def>
+
+      <property-def name="webservices.atomPubAuth"  key="configForm.AtomPubAuth">
+         <type>string</type>
+         <default-value>basic</default-value>
+      </property-def>
+
+   </display-group>
+
    <!-- Weblog Rendering Settings Group -->
    <display-group name="weblogSettings" key="configForm.weblogSettings" >
        

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.java?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.java Mon Mar 16 20:40:06 2009
@@ -0,0 +1,178 @@
+/*
+ * 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.
+ */
+
+package org.apache.roller.weblogger.pojos;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+
+/**
+ * Stores data for an OAuth accessor
+ */
+public class OAuthAccessorRecord implements Serializable {
+    private String consumerKey;
+    private String requestToken;
+    private String accessToken;
+    private String tokenSecret;
+    private Timestamp created;
+    private Timestamp updated;
+    private Boolean authorized;
+    private String userName;
+
+    public OAuthAccessorRecord() {
+    }
+
+    /**
+     * @return the consumerKey
+     */
+    public String getConsumerKey() {
+        return consumerKey;
+    }
+
+    /**
+     * @param consumerKey the consumerKey to set
+     */
+    public void setConsumerKey(String consumerKey) {
+        this.consumerKey = consumerKey;
+    }
+
+    /**
+     * @return the requestToken
+     */
+    public String getRequestToken() {
+        return requestToken;
+    }
+
+    /**
+     * @param requestToken the requestToken to set
+     */
+    public void setRequestToken(String requestToken) {
+        this.requestToken = requestToken;
+    }
+
+    /**
+     * @return the accessToken
+     */
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+    /**
+     * @param accessToken the accessToken to set
+     */
+    public void setAccessToken(String accessToken) {
+        this.accessToken = accessToken;
+    }
+
+    /**
+     * @return the tokenSecret
+     */
+    public String getTokenSecret() {
+        return tokenSecret;
+    }
+
+    /**
+     * @param tokenSecret the tokenSecret to set
+     */
+    public void setTokenSecret(String tokenSecret) {
+        this.tokenSecret = tokenSecret;
+    }
+
+    /**
+     * @return the created
+     */
+    public Timestamp getCreated() {
+        return created;
+    }
+
+    /**
+     * @param created the created to set
+     */
+    public void setCreated(Timestamp created) {
+        this.created = created;
+    }
+
+    /**
+     * @return the updated
+     */
+    public Timestamp getUpdated() {
+        return updated;
+    }
+
+    /**
+     * @param updated the updated to set
+     */
+    public void setUpdated(Timestamp updated) {
+        this.updated = updated;
+    }
+
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        buf.append("{");
+        buf.append(this.getConsumerKey());
+        buf.append("}");
+        return buf.toString();
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof OAuthAccessorRecord != true) return false;
+        OAuthAccessorRecord o = (OAuthAccessorRecord)other;
+        return new EqualsBuilder()
+            .append(getConsumerKey(), o.getConsumerKey())
+            .isEquals();
+    }
+
+    public int hashCode() {
+        return new HashCodeBuilder().append(getConsumerKey()).toHashCode();
+    }
+
+    /**
+     * @return the authorized
+     */
+    public Boolean getAuthorized() {
+        return authorized;
+    }
+
+    /**
+     * @param authorized the authorized to set
+     */
+    public void setAuthorized(Boolean authorized) {
+        this.authorized = authorized;
+    }
+
+    /**
+     * @return the userName
+     */
+    public String getUserName() {
+        return userName;
+    }
+
+    /**
+     * @param userName the userName to set
+     */
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+}

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthAccessorRecord.orm.xml Mon Mar 16 20:40:06 2009
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
+    <description>Persistence Metadata for Roller</description>
+    <persistence-unit-metadata>
+        <persistence-unit-defaults>
+            <access>PROPERTY</access>
+        </persistence-unit-defaults>
+    </persistence-unit-metadata>
+    <package>org.apache.roller.weblogger.pojos</package>
+    <entity metadata-complete="true" name="OAuthAccessorRecord"
+            class="org.apache.roller.weblogger.pojos.OAuthAccessorRecord">
+        <table name="rol_oauthaccessor"/>
+        <named-query name="OAuthAccessorRecord.getByKey">
+            <query>SELECT p FROM OAuthAccessorRecord p WHERE p.consumerKey = ?1</query>
+        </named-query>
+        <named-query name="OAuthAccessorRecord.getByToken">
+            <query>SELECT p FROM OAuthAccessorRecord p WHERE p.requestToken = ?1 OR p.accessToken = ?1</query>
+        </named-query>
+        <named-query name="OAuthAccessorRecord.getByUserName">
+            <query>SELECT p FROM OAuthAccessorRecord p WHERE p.userName = ?1</query>
+        </named-query>
+        <attributes>
+            <id name="consumerKey">
+                <column name="consumerkey"/>
+            </id>
+            <basic name="requestToken">
+                <column name="requesttoken" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="accessToken">
+                <column name="accesstoken" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="tokenSecret">
+                <column name="tokensecret" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="created">
+                <column name="created" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="updated">
+                <column name="updated" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="authorized">
+                <column name="authorized" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="userName">
+                <column name="username" insertable="true" updatable="true" unique="true"/>
+            </basic>
+        </attributes>
+    </entity>
+</entity-mappings>

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.java?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.java Mon Mar 16 20:40:06 2009
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+package org.apache.roller.weblogger.pojos;
+
+import java.io.Serializable;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+
+/**
+ * Stores data for an OAuth consumer key and secret.
+ * There can be up to one for the whole site and up to one per user.
+ */
+public class OAuthConsumerRecord implements Serializable {
+    private String consumerKey;
+    private String consumerSecret;
+    private String userName;
+
+    public OAuthConsumerRecord() {
+    }
+
+    /**
+     * @return the consumerKey
+     */
+    public String getConsumerKey() {
+        return consumerKey;
+    }
+
+    /**
+     * @param consumerKey the consumerKey to set
+     */
+    public void setConsumerKey(String consumerKey) {
+        this.consumerKey = consumerKey;
+    }
+
+    /**
+     * @return the consumerSecret
+     */
+    public String getConsumerSecret() {
+        return consumerSecret;
+    }
+
+    /**
+     * @param consumerSecret the consumerSecret to set
+     */
+    public void setConsumerSecret(String consumerSecret) {
+        this.consumerSecret = consumerSecret;
+    }
+    
+    /**
+     * @return the username
+     */
+    public String getUserName() {
+        return userName;
+    }
+
+    /**
+     * @param username the username to set
+     */
+    public void setUserName(String username) {
+        this.userName = username;
+    }
+
+    //------------------------------------------------------- Good citizenship
+
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        buf.append("{");
+        buf.append(this.getConsumerKey());
+        buf.append("}");
+        return buf.toString();
+    }
+
+    public boolean equals(Object other) {
+        if (other == this) return true;
+        if (other instanceof OAuthConsumerRecord != true) return false;
+        OAuthConsumerRecord o = (OAuthConsumerRecord)other;
+        return new EqualsBuilder()
+            .append(getConsumerKey(), o.getConsumerKey())
+            .isEquals();
+    }
+
+    public int hashCode() {
+        return new HashCodeBuilder().append(getConsumerKey()).toHashCode();
+    }
+
+}

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/OAuthConsumerRecord.orm.xml Mon Mar 16 20:40:06 2009
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
+    <description>Persistence Metadata for Roller</description>
+    <persistence-unit-metadata>
+        <persistence-unit-defaults>
+            <access>PROPERTY</access>
+        </persistence-unit-defaults>
+    </persistence-unit-metadata>
+    <package>org.apache.roller.weblogger.pojos</package>
+    <entity metadata-complete="true" name="OAuthConsumerRecord"
+            class="org.apache.roller.weblogger.pojos.OAuthConsumerRecord">
+        <table name="rol_oauthconsumer"/>
+        <named-query name="OAuthConsumerRecord.getByConsumerKey">
+            <query>SELECT p FROM OAuthConsumerRecord p WHERE p.consumerKey = ?1</query>
+        </named-query>
+        <named-query name="OAuthConsumerRecord.getByUsername">
+            <query>SELECT p FROM OAuthConsumerRecord p WHERE p.userName = ?1</query>
+        </named-query>
+        <named-query name="OAuthConsumerRecord.getSiteWideConsumer">
+            <query>SELECT p FROM OAuthConsumerRecord p WHERE p.userName IS NULL</query>
+        </named-query>
+        <attributes>
+            <id name="consumerKey">
+                <column name="consumerkey"/>
+            </id>
+            <basic name="consumerSecret">
+                <column name="consumersecret" insertable="true" updatable="true" unique="false"/>
+            </basic>
+            <basic name="userName">
+                <column name="username" insertable="true" updatable="true" unique="true"/>
+            </basic>
+        </attributes>
+    </entity>
+</entity-mappings>

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java Mon Mar 16 20:40:06 2009
@@ -45,6 +45,7 @@
 import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.util.UUIDGenerator;
 import org.apache.roller.weblogger.business.UserManager;
+import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.util.I18nUtils;
 
 
@@ -84,16 +85,16 @@
     private Date    dateCreated      = new java.util.Date();
     private Boolean defaultAllowComments = Boolean.TRUE;
     private int     defaultCommentDays = 0;
-    private Boolean moderateComments  = Boolean.FALSE;
+    private Boolean moderateComments = Boolean.FALSE;
     private int     entryDisplayCount = 15;
     private Date    lastModified     = new Date();
     private String  pageModels       = new String();
-    private boolean enableMultiLang = false;
-    private boolean showAllLangs = true;
+    private boolean enableMultiLang  = false;
+    private boolean showAllLangs     = true;
     private String  customStylesheetPath = null;
-    private String  iconPath = null;
-    private String  about = null;
-    private String  creator = null;     
+    private String  iconPath         = null;
+    private String  about            = null;
+    private String  creator          = null;
     
     // Associated objects
     private List           permissions = new ArrayList();
@@ -855,17 +856,18 @@
     }
     
     
-    /** 
+    /**
      * @roller.wrapPojoMethod type="simple"
      */
     public String getAbsoluteURL() {
-        // TODO: ATLAS reconcile entry.getPermaLink() with new URLs
-        String relPath = WebloggerRuntimeConfig.getAbsoluteContextURL();
-        return relPath + "/" + getHandle();
-        //return URLUtilities.getWeblogURL(this, null, true);
-    }
-    public void setAbsoluteURL(String url) {
-        // noop
+        String weblogAbsoluteURL =
+            WebloggerConfig.getProperty("weblog.absoluteurl." + getHandle());
+        if (weblogAbsoluteURL != null) {
+            return weblogAbsoluteURL + "/" + getHandle();
+        } else {
+            String relPath = WebloggerRuntimeConfig.getAbsoluteContextURL();
+            return relPath + "/" + getHandle();
+        }
     }
     
     
@@ -1260,5 +1262,4 @@
 
     /** No-op method to please XDoclet */
     public void setEntryCount(int ignored) {}
-    
 }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/WeblogRequestMapper.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/WeblogRequestMapper.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/WeblogRequestMapper.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/WeblogRequestMapper.java Mon Mar 16 20:40:06 2009
@@ -135,6 +135,16 @@
             log.debug("SKIPPED "+weblogHandle);
             return false;
         }
+
+        String weblogAbsoluteURL =
+            WebloggerConfig.getProperty("weblog.absoluteurl." + weblogHandle);
+        if (weblogAbsoluteURL != null) {
+            // An absolute URL is specified for this weblog, make sure request URL matches
+            if (!request.getRequestURL().toString().startsWith(weblogAbsoluteURL)) {
+                log.debug("SKIPPED "+weblogHandle);
+                return false;
+            }
+        }
         
         log.debug("WEBLOG_URL "+request.getServletPath());
         

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/URLModel.java Mon Mar 16 20:40:06 2009
@@ -27,6 +27,7 @@
 import org.apache.roller.weblogger.business.URLStrategy;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
+import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
@@ -89,7 +90,13 @@
     
     /** Absolute URL of Roller, e.g. http://localhost:8080/roller */
     public String getAbsoluteSite() {
-        return WebloggerRuntimeConfig.getAbsoluteContextURL();
+        String weblogAbsoluteURL =
+            WebloggerConfig.getProperty("weblog.absoluteurl." + weblog.getHandle());
+        if (weblogAbsoluteURL != null) {
+            return weblogAbsoluteURL;
+        } else {
+            return WebloggerRuntimeConfig.getAbsoluteContextURL();
+        }
     }
     
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java?rev=755000&r1=754999&r2=755000&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java Mon Mar 16 20:40:06 2009
@@ -244,7 +244,7 @@
             }
 
             // If request specified tags section index, then look for custom template
-        } else if ("tags".equals(pageRequest.getContext()) && pageRequest.getTags() == null) {
+        } else if ("tags".equals(pageRequest.getContext()) && pageRequest.getTags() != null) {
             try {
                 page = weblog.getTheme().getTemplateByAction(ThemeTemplate.ACTION_TAGSINDEX);
             } catch (Exception e) {

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthAuthorize.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthAuthorize.java?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthAuthorize.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthAuthorize.java Mon Mar 16 20:40:06 2009
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+package org.apache.roller.weblogger.ui.struts2.core;
+
+import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.pojos.User;
+import org.apache.roller.weblogger.ui.struts2.util.UIAction;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.apache.struts2.interceptor.validation.SkipValidation;
+
+
+/**
+ * Allow user to authorized OAuth access to his/her account.
+ */
+public class OAuthAuthorize extends UIAction implements ServletRequestAware {
+    private static Log log = LogFactory.getLog(OAuthAuthorize.class);
+    private String appDesc = null;
+    private String token = null;
+    private String callback = null;
+
+
+    public OAuthAuthorize() {
+        this.pageTitle = "oauthAuthorize.title";
+    }
+    
+    
+    // override default security, we do not require an action weblog
+    @Override
+    public boolean isWeblogRequired() {
+        return false;
+    }
+
+
+    @SkipValidation
+    @Override
+    public String execute() {
+        boolean flush = false;
+        
+        try {
+            User ud = getAuthenticatedUser();
+
+
+        } catch (Exception ex) {
+            log.error("ERROR fetching user information", ex);
+        }
+
+        return SUCCESS;
+    }
+
+    /**
+     * @return the appDesc
+     */
+    public String getAppDesc() {
+        return appDesc;
+    }
+
+    /**
+     * @return the token
+     */
+    public String getToken() {
+        return token;
+    }
+
+    /**
+     * @return the callback
+     */
+    public String getCallback() {
+        return callback;
+    }
+
+    /**
+     * @return the userName
+     */
+    public String getUserName() {
+        return getAuthenticatedUser().getUserName();
+    }
+
+    public void setServletRequest(HttpServletRequest request) {
+        this.appDesc = (String)request.getAttribute("CONS_DESC");
+        this.token = (String)request.getAttribute("TOKEN");
+        this.callback = (String)request.getAttribute("CALLBACK");
+        if (this.getCallback() == null) this.callback = "";
+    }
+}

Added: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthKeys.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthKeys.java?rev=755000&view=auto
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthKeys.java (added)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/core/OAuthKeys.java Mon Mar 16 20:40:06 2009
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+package org.apache.roller.weblogger.ui.struts2.core;
+
+import net.oauth.OAuthConsumer;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.business.OAuthManager;
+import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
+import org.apache.roller.weblogger.pojos.User;
+import org.apache.roller.weblogger.ui.struts2.util.UIAction;
+import org.apache.struts2.interceptor.validation.SkipValidation;
+
+
+/**
+ * Allows user to view his/her OAuth consumer key and secret.
+ */
+public class OAuthKeys extends UIAction {
+    private static Log log = LogFactory.getLog(OAuthKeys.class);
+    private OAuthConsumer userConsumer;
+    private OAuthConsumer siteWideConsumer;
+
+    public OAuthKeys() {
+        this.pageTitle = "oauthKeys.title";
+    }
+    
+    
+    // override default security, we do not require an action weblog
+    public boolean isWeblogRequired() {
+        return false;
+    }
+
+
+    @SkipValidation
+    public String execute() {
+        boolean flush = false;
+        
+        try {
+            User ud = getAuthenticatedUser();
+            OAuthManager omgr = WebloggerFactory.getWeblogger().getOAuthManager();
+            userConsumer = omgr.getConsumerByUsername(ud.getUserName());
+            if (userConsumer == null) {
+                String consumerKey = DigestUtils.md5Hex(ud.getUserName());
+                userConsumer = omgr.addConsumer(ud.getUserName(), consumerKey);
+                flush = true;
+            }
+
+            if (isUserIsAdmin()) {
+                siteWideConsumer = omgr.getConsumer();
+                if (siteWideConsumer == null) {
+                    String consumerKey = DigestUtils.md5Hex(
+                        WebloggerRuntimeConfig.getAbsoluteContextURL());
+                    siteWideConsumer = omgr.addConsumer(consumerKey);
+                    flush = true;
+                }
+            }
+            
+            if (flush) {
+                WebloggerFactory.getWeblogger().flush();
+            }
+
+        } catch (Exception ex) {
+            log.error("ERROR creating or retrieving your OAuth information", ex);
+        }
+
+        return SUCCESS;
+    }
+
+    /**
+     * @return the user's consumer
+     */
+    public OAuthConsumer getUserConsumer() {
+        return userConsumer;
+    }
+
+    /**
+     * @return the site's consumer
+     */
+    public OAuthConsumer getSiteWideConsumer() {
+        return siteWideConsumer;
+    }
+}



Mime
View raw message