oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1483330 - in /oltu/whiteboard/simonetripodi/oltu-commons/src: main/mdo/org/apache/oltu/commons/ main/mdo/org/apache/oltu/jwt/ main/stylesheet/ test/java/org/apache/oltu/commons/
Date Thu, 16 May 2013 12:56:32 GMT
Author: simonetripodi
Date: Thu May 16 12:56:31 2013
New Revision: 1483330

URL: http://svn.apache.org/r1483330
Log:
JSON (un)marshalling operations have to be optional, not all entities need to (un)marshalled
from/to JSON format

renamed Utils to Json with (un)marshall methods

Modified:
    oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenRequest.xml
    oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenResponse.xml
    oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/ClaimsSet.xml
    oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/Header.xml
    oltu/whiteboard/simonetripodi/oltu-commons/src/main/stylesheet/commons.xsl
    oltu/whiteboard/simonetripodi/oltu-commons/src/test/java/org/apache/oltu/commons/AccessTokenResponseTestCase.java

Modified: oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenRequest.xml
URL: http://svn.apache.org/viewvc/oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenRequest.xml?rev=1483330&r1=1483329&r2=1483330&view=diff
==============================================================================
--- oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenRequest.xml
(original)
+++ oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenRequest.xml
Thu May 16 12:56:31 2013
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<class package="org.apache.oltu.commons" name="AccessTokenRequest">
+<class package="org.apache.oltu.commons" name="AccessTokenRequest" json="false">
   <description><![CDATA[Represents the Access Token Request as described in section
<a href="http://tools.ietf.org/html/rfc6749#section-4.3.2">4.3.2</a>.]]></description>
   <parameter field="grantType" type="String" name="grant_type" required="true" />
   <parameter field="username" type="String" name="username" required="true" />

Modified: oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenResponse.xml
URL: http://svn.apache.org/viewvc/oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenResponse.xml?rev=1483330&r1=1483329&r2=1483330&view=diff
==============================================================================
--- oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenResponse.xml
(original)
+++ oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/commons/AccessTokenResponse.xml
Thu May 16 12:56:31 2013
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<class package="org.apache.oltu.commons" name="AccessTokenResponse">
+<class package="org.apache.oltu.commons" name="AccessTokenResponse" json="true">
   <description><![CDATA[Represents the Access Token Response as described in section
<a href="http://tools.ietf.org/html/rfc6749#section-4.3.3">4.3.3</a>.]]></description>
   <parameter field="accessToken" type="String" name="access_token" required="true" />
   <parameter field="tokenType" type="String" name="token_type" required="true" />

Modified: oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/ClaimsSet.xml
URL: http://svn.apache.org/viewvc/oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/ClaimsSet.xml?rev=1483330&r1=1483329&r2=1483330&view=diff
==============================================================================
--- oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/ClaimsSet.xml
(original)
+++ oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/ClaimsSet.xml
Thu May 16 12:56:31 2013
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<class package="org.apache.oltu.jwt" name="ClaimsSet">
+<class package="org.apache.oltu.jwt" name="ClaimsSet" json="true">
   <description><![CDATA[Represents the Claims Set as defined in the <a href="http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06#section-6.1">6.1</a>
section of the JWT specification.]]></description>
   <parameter field="issuer" type="String" name="iss" required="true" />
   <parameter field="subject" type="String" name="sub" required="true" />

Modified: oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/Header.xml
URL: http://svn.apache.org/viewvc/oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/Header.xml?rev=1483330&r1=1483329&r2=1483330&view=diff
==============================================================================
--- oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/Header.xml
(original)
+++ oltu/whiteboard/simonetripodi/oltu-commons/src/main/mdo/org/apache/oltu/jwt/Header.xml
Thu May 16 12:56:31 2013
@@ -15,7 +15,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<class package="org.apache.oltu.jwt" name="Header">
+<class package="org.apache.oltu.jwt" name="Header" json="true">
   <description><![CDATA[Represents the Header as defined in the <a href="http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06#section-6.1">6.1</a>
section of the JWT specification.]]></description>
   <parameter field="type" type="String" name="typ" required="true" />
   <parameter field="algorithm" type="String" name="alg" required="true" />

Modified: oltu/whiteboard/simonetripodi/oltu-commons/src/main/stylesheet/commons.xsl
URL: http://svn.apache.org/viewvc/oltu/whiteboard/simonetripodi/oltu-commons/src/main/stylesheet/commons.xsl?rev=1483330&r1=1483329&r2=1483330&view=diff
==============================================================================
--- oltu/whiteboard/simonetripodi/oltu-commons/src/main/stylesheet/commons.xsl (original)
+++ oltu/whiteboard/simonetripodi/oltu-commons/src/main/stylesheet/commons.xsl Thu May 16
12:56:31 2013
@@ -117,27 +117,27 @@ public final class <xsl:value-of select=
 
     }
 
-    public static final class Utils
+    <xsl:if test="@json = 'true'">public static final class Json
     {
         <xsl:apply-templates select="parameter" mode="staticField" />
 
         /**
          * Hidden constructor, this class must not be instantiated.
          */
-        private Utils()
+        private Json()
         {
             // do nothing
         }
 
         private static final com.fasterxml.jackson.core.JsonFactory FACTORY = new com.fasterxml.jackson.core.JsonFactory();
 
-        public static <xsl:value-of select="@name" /> parseJson( String source )
+        public static <xsl:value-of select="@name" /> unmarshall( String source )
         {
             java.io.StringReader reader = new java.io.StringReader( source );
-            return parseJson( reader );
+            return unmarshall( reader );
         }
 
-        public static <xsl:value-of select="@name" /> parseJson( java.io.Reader source
)
+        public static <xsl:value-of select="@name" /> unmarshall( java.io.Reader source
)
         {
             com.fasterxml.jackson.core.JsonParser parser = null;
 
@@ -185,14 +185,14 @@ public final class <xsl:value-of select=
             }
         }
 
-        public static String toJsonString( <xsl:value-of select="@name" /> reference
)
+        public static String toStringMarshall( <xsl:value-of select="@name" /> reference
)
         {
             java.io.StringWriter target = new java.io.StringWriter();
-            toJson( reference, target );
+            marshall( reference, target );
             return target.toString();
         }
 
-        public static void toJson( <xsl:value-of select="@name" /> reference, java.io.Writer
target )
+        public static void marshall( <xsl:value-of select="@name" /> reference, java.io.Writer
target )
         {
             com.fasterxml.jackson.core.JsonGenerator writer = null;
 
@@ -235,7 +235,8 @@ public final class <xsl:value-of select=
             }
         }
 
-    }
+    }</xsl:if>
+
 }
 </xsl:template>
 

Modified: oltu/whiteboard/simonetripodi/oltu-commons/src/test/java/org/apache/oltu/commons/AccessTokenResponseTestCase.java
URL: http://svn.apache.org/viewvc/oltu/whiteboard/simonetripodi/oltu-commons/src/test/java/org/apache/oltu/commons/AccessTokenResponseTestCase.java?rev=1483330&r1=1483329&r2=1483330&view=diff
==============================================================================
--- oltu/whiteboard/simonetripodi/oltu-commons/src/test/java/org/apache/oltu/commons/AccessTokenResponseTestCase.java
(original)
+++ oltu/whiteboard/simonetripodi/oltu-commons/src/test/java/org/apache/oltu/commons/AccessTokenResponseTestCase.java
Thu May 16 12:56:31 2013
@@ -29,7 +29,7 @@ public final class AccessTokenResponseTe
     @Test
     public void fromJson()
     {
-        AccessTokenResponse response = AccessTokenResponse.Utils.parseJson( JSON );
+        AccessTokenResponse response = AccessTokenResponse.Json.unmarshall( JSON );
 
         assertEquals( "2YotnFZFEjr1zCsicMWpAA", response.getAccessToken() );
         assertEquals( "example", response.getTokenType() );
@@ -48,7 +48,7 @@ public final class AccessTokenResponseTe
                                                               .setRefreshToken( "tGzv3JOkF0XG5Qx2TlKWIA"
)
                                                               .addAuxParameter( "example_parameter",
"example_value" )
                                                               .build();
-        String actual = AccessTokenResponse.Utils.toJsonString( response );
+        String actual = AccessTokenResponse.Json.toStringMarshall( response );
         assertEquals( JSON, actual );
     }
 



Mime
View raw message