You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by rm...@apache.org on 2014/05/30 20:02:44 UTC
svn commit: r1598683 - in /geronimo/specs/trunk/geronimo-json_1.0_spec: ./
src/ src/main/ src/main/java/ src/main/java/javax/
src/main/java/javax/json/ src/main/java/javax/json/spi/
src/main/java/javax/json/stream/
Author: rmannibucau
Date: Fri May 30 18:02:42 2014
New Revision: 1598683
URL: http://svn.apache.org/r1598683
Log:
GERONIMO-6461 adding geronimo-json_1.0_spec
Added:
geronimo/specs/trunk/geronimo-json_1.0_spec/
geronimo/specs/trunk/geronimo-json_1.0_spec/LICENSE
geronimo/specs/trunk/geronimo-json_1.0_spec/NOTICE
geronimo/specs/trunk/geronimo-json_1.0_spec/pom.xml
geronimo/specs/trunk/geronimo-json_1.0_spec/src/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/Json.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArray.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArrayBuilder.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonBuilderFactory.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonException.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonNumber.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObject.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObjectBuilder.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReader.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReaderFactory.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonString.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonStructure.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonValue.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriter.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriterFactory.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/spi/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/spi/JsonProvider.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerationException.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerator.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGeneratorFactory.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonLocation.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParser.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParserFactory.java
geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParsingException.java
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/LICENSE
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/LICENSE?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/LICENSE (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/LICENSE Fri May 30 18:02:42 2014
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/NOTICE
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/NOTICE?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/NOTICE (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/NOTICE Fri May 30 18:02:42 2014
@@ -0,0 +1,6 @@
+Apache Geronimo JSR-353 JSon Spec API
+Copyright 2009-2014 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/pom.xml?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/pom.xml (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/pom.xml Fri May 30 18:02:42 2014
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.genesis</groupId>
+ <artifactId>genesis-java5-flava</artifactId>
+ <version>2.0</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-json_1.0_spec</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Geronimo JSon Spec 1.0</name>
+ <version>1.0-SNAPSHOT</version>
+
+ <description>Apache Geronimo implementation of the JSR-353</description>
+ <url>http://geronimo.apache.org/maven/${siteId}/${project.version}</url>
+
+ <distributionManagement>
+ <site>
+ <id>apache-website</id>
+ <url>${site.deploy.url}/maven/${siteId}/${project.version}</url>
+ </site>
+ </distributionManagement>
+
+ <properties>
+ <siteId>specs/${project.artifactId}</siteId>
+ </properties>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-jcache_1.0_spec/</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-jcache_1.0_spec/
+ </developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/geronimo/specs/trunk/geronimo-jcache_1.0_spec/</url>
+ </scm>
+
+ <!-- added so the build can find staged depends -->
+ <repositories>
+ <repository>
+ <id>apache.nexus.staging</id>
+ <name>Apache Staging Repository</name>
+ <layout>default</layout>
+ <url>https://repository.apache.org/content/repositories/staging/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <target>1.6</target>
+ <source>1.6</source>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ javax.json*;version=1.0
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/Json.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/Json.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/Json.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/Json.java Fri May 30 18:02:42 2014
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import javax.json.spi.JsonProvider;
+import javax.json.stream.JsonGenerator;
+import javax.json.stream.JsonGeneratorFactory;
+import javax.json.stream.JsonParser;
+import javax.json.stream.JsonParserFactory;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Map;
+
+public class Json {
+ private Json() {
+ // no-op
+ }
+
+ public static JsonParser createParser(Reader reader) {
+ return JsonProvider.provider().createParser(reader);
+ }
+
+ public static JsonParser createParser(InputStream in) {
+ return JsonProvider.provider().createParser(in);
+ }
+
+ public static JsonGenerator createGenerator(Writer writer) {
+ return JsonProvider.provider().createGenerator(writer);
+ }
+
+ public static JsonGenerator createGenerator(OutputStream out) {
+ return JsonProvider.provider().createGenerator(out);
+ }
+
+ public static JsonParserFactory createParserFactory(Map<String, ?> config) {
+ return JsonProvider.provider().createParserFactory(config);
+ }
+
+ public static JsonGeneratorFactory createGeneratorFactory(Map<String, ?> config) {
+ return JsonProvider.provider().createGeneratorFactory(config);
+ }
+
+ public static JsonWriter createWriter(Writer writer) {
+ return JsonProvider.provider().createWriter(writer);
+ }
+
+ public static JsonWriter createWriter(OutputStream out) {
+ return JsonProvider.provider().createWriter(out);
+ }
+
+ public static JsonReader createReader(Reader reader) {
+ return JsonProvider.provider().createReader(reader);
+ }
+
+ public static JsonReader createReader(InputStream in) {
+ return JsonProvider.provider().createReader(in);
+ }
+
+ public static JsonReaderFactory createReaderFactory(Map<String, ?> config) {
+ return JsonProvider.provider().createReaderFactory(config);
+ }
+
+ public static JsonWriterFactory createWriterFactory(Map<String, ?> config) {
+ return JsonProvider.provider().createWriterFactory(config);
+ }
+
+ public static JsonArrayBuilder createArrayBuilder() {
+ return JsonProvider.provider().createArrayBuilder();
+ }
+
+ public static JsonObjectBuilder createObjectBuilder() {
+ return JsonProvider.provider().createObjectBuilder();
+ }
+
+ public static JsonBuilderFactory createBuilderFactory(Map<String, ?> config) {
+ return JsonProvider.provider().createBuilderFactory(config);
+ }
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArray.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArray.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArray.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArray.java Fri May 30 18:02:42 2014
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.util.List;
+
+public interface JsonArray extends JsonStructure, List<JsonValue> {
+ JsonObject getJsonObject(int index);
+
+ JsonArray getJsonArray(int index);
+
+ JsonNumber getJsonNumber(int index);
+
+ JsonString getJsonString(int index);
+
+ <T extends JsonValue> List<T> getValuesAs(Class<T> clazz);
+
+ String getString(int index);
+
+ String getString(int index, String defaultValue);
+
+ int getInt(int index);
+
+ int getInt(int index, int defaultValue);
+
+ boolean getBoolean(int index);
+
+ boolean getBoolean(int index, boolean defaultValue);
+
+ boolean isNull(int index);
+}
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArrayBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArrayBuilder.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArrayBuilder.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonArrayBuilder.java Fri May 30 18:02:42 2014
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public interface JsonArrayBuilder {
+ JsonArrayBuilder add(JsonValue value);
+
+ JsonArrayBuilder add(String value);
+
+ JsonArrayBuilder add(BigDecimal value);
+
+ JsonArrayBuilder add(BigInteger value);
+
+ JsonArrayBuilder add(int value);
+
+ JsonArrayBuilder add(long value);
+
+ JsonArrayBuilder add(double value);
+
+ JsonArrayBuilder add(boolean value);
+
+ JsonArrayBuilder addNull();
+
+ JsonArrayBuilder add(JsonObjectBuilder builder);
+
+ JsonArrayBuilder add(JsonArrayBuilder builder);
+
+ JsonArray build();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonBuilderFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonBuilderFactory.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonBuilderFactory.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonBuilderFactory.java Fri May 30 18:02:42 2014
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.util.Map;
+
+public interface JsonBuilderFactory {
+ JsonObjectBuilder createObjectBuilder();
+
+ JsonArrayBuilder createArrayBuilder();
+
+ Map<String, ?> getConfigInUse();
+}
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonException.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonException.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonException.java Fri May 30 18:02:42 2014
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+public class JsonException extends RuntimeException {
+ public JsonException(final String message) {
+ super(message);
+ }
+
+ public JsonException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonNumber.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonNumber.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonNumber.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonNumber.java Fri May 30 18:02:42 2014
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public interface JsonNumber extends JsonValue {
+ boolean isIntegral();
+
+ int intValue();
+
+ int intValueExact();
+
+ long longValue();
+
+ long longValueExact();
+
+ BigInteger bigIntegerValue();
+
+ BigInteger bigIntegerValueExact();
+
+ double doubleValue();
+
+ BigDecimal bigDecimalValue();
+
+ @Override
+ String toString();
+
+ @Override
+ boolean equals(Object obj);
+
+ @Override
+ int hashCode();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObject.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObject.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObject.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObject.java Fri May 30 18:02:42 2014
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.util.Map;
+
+public interface JsonObject extends JsonStructure, Map<String, JsonValue> {
+ JsonArray getJsonArray(String name);
+
+ JsonObject getJsonObject(String name);
+
+ JsonNumber getJsonNumber(String name);
+
+ JsonString getJsonString(String name);
+
+ String getString(String name);
+
+ String getString(String name, String defaultValue);
+
+ int getInt(String name);
+
+ int getInt(String name, int defaultValue);
+
+ boolean getBoolean(String name);
+
+ boolean getBoolean(String name, boolean defaultValue);
+
+ boolean isNull(String name);
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObjectBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObjectBuilder.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObjectBuilder.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonObjectBuilder.java Fri May 30 18:02:42 2014
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public interface JsonObjectBuilder {
+ JsonObjectBuilder add(String name, JsonValue value);
+
+ JsonObjectBuilder add(String name, String value);
+
+ JsonObjectBuilder add(String name, BigInteger value);
+
+ JsonObjectBuilder add(String name, BigDecimal value);
+
+ JsonObjectBuilder add(String name, int value);
+
+ JsonObjectBuilder add(String name, long value);
+
+ JsonObjectBuilder add(String name, double value);
+
+ JsonObjectBuilder add(String name, boolean value);
+
+ JsonObjectBuilder addNull(String name);
+
+ JsonObjectBuilder add(String name, JsonObjectBuilder builder);
+
+ JsonObjectBuilder add(String name, JsonArrayBuilder builder);
+
+ JsonObject build();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReader.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReader.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReader.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReader.java Fri May 30 18:02:42 2014
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.io.Closeable;
+
+public interface JsonReader extends Closeable {
+ JsonStructure read();
+
+ JsonObject readObject();
+
+ JsonArray readArray();
+
+ @Override
+ void close();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReaderFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReaderFactory.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReaderFactory.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonReaderFactory.java Fri May 30 18:02:42 2014
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.util.Map;
+
+public interface JsonReaderFactory {
+ JsonReader createReader(Reader reader);
+
+ JsonReader createReader(InputStream in);
+
+ JsonReader createReader(InputStream in, Charset charset);
+
+ Map<String, ?> getConfigInUse();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonString.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonString.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonString.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonString.java Fri May 30 18:02:42 2014
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+public interface JsonString extends JsonValue {
+ String getString();
+
+ CharSequence getChars();
+
+ @Override
+ boolean equals(Object obj);
+
+ @Override
+ int hashCode();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonStructure.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonStructure.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonStructure.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonStructure.java Fri May 30 18:02:42 2014
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+public interface JsonStructure extends JsonValue {
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonValue.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonValue.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonValue.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonValue.java Fri May 30 18:02:42 2014
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+public interface JsonValue {
+ static final JsonValue NULL = new JsonValue() {
+ @Override
+ public ValueType getValueType() {
+ return ValueType.NULL;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return obj instanceof JsonValue && getValueType().equals(JsonValue.class.cast(obj).getValueType());
+ }
+
+ @Override
+ public int hashCode() {
+ return ValueType.NULL.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(null);
+ }
+ };
+ static final JsonValue TRUE = new JsonValue() {
+ @Override
+ public ValueType getValueType() {
+ return ValueType.TRUE;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return obj instanceof JsonValue && getValueType().equals(JsonValue.class.cast(obj).getValueType());
+ }
+
+ @Override
+ public int hashCode() {
+ return ValueType.TRUE.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return Boolean.TRUE.toString();
+ }
+ };
+ static final JsonValue FALSE = new JsonValue() {
+ @Override
+ public ValueType getValueType() {
+ return ValueType.FALSE;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return obj instanceof JsonValue && getValueType().equals(JsonValue.class.cast(obj).getValueType());
+ }
+
+ @Override
+ public int hashCode() {
+ return ValueType.FALSE.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return Boolean.FALSE.toString();
+ }
+ };
+
+ ValueType getValueType();
+
+ @Override
+ String toString();
+
+ enum ValueType {
+ ARRAY,
+ OBJECT, STRING, NUMBER,
+ TRUE, FALSE,
+ NULL
+ }
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriter.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriter.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriter.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriter.java Fri May 30 18:02:42 2014
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.io.Closeable;
+
+public interface JsonWriter extends Closeable {
+ void writeArray(JsonArray array);
+
+ void writeObject(JsonObject object);
+
+ void write(JsonStructure value);
+
+ @Override
+ void close();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriterFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriterFactory.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriterFactory.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/JsonWriterFactory.java Fri May 30 18:02:42 2014
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json;
+
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.Map;
+
+public interface JsonWriterFactory {
+ JsonWriter createWriter(Writer writer);
+
+ JsonWriter createWriter(OutputStream out);
+
+ JsonWriter createWriter(OutputStream out, Charset charset);
+
+ Map<String, ?> getConfigInUse();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/spi/JsonProvider.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/spi/JsonProvider.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/spi/JsonProvider.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/spi/JsonProvider.java Fri May 30 18:02:42 2014
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.spi;
+
+import javax.json.JsonArrayBuilder;
+import javax.json.JsonBuilderFactory;
+import javax.json.JsonException;
+import javax.json.JsonObjectBuilder;
+import javax.json.JsonReader;
+import javax.json.JsonReaderFactory;
+import javax.json.JsonWriter;
+import javax.json.JsonWriterFactory;
+import javax.json.stream.JsonGenerator;
+import javax.json.stream.JsonGeneratorFactory;
+import javax.json.stream.JsonParser;
+import javax.json.stream.JsonParserFactory;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+
+public abstract class JsonProvider {
+ private static final String DEFAULT_PROVIDER = "org.apache.json.JsonProviderImpl";
+
+ protected JsonProvider() {
+ // no-op
+ }
+
+ public static JsonProvider provider() {
+ if (System.getSecurityManager() != null) {
+ return AccessController.doPrivileged(new PrivilegedAction<JsonProvider>() {
+ public JsonProvider run() {
+ return doLoadProvider();
+ }
+ });
+ }
+ return doLoadProvider();
+ }
+
+ private static JsonProvider doLoadProvider() throws JsonException {
+ final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ final Class<?> clazz = Class.forName("org.apache.geronimo.osgi.locator.ProviderLocator");
+ final Method getServices = clazz.getDeclaredMethod("getServices", String.class, Class.class, ClassLoader.class);
+ final List<JsonProvider> osgiProviders = (List<JsonProvider>) getServices.invoke(null, JsonProvider.class.getName(), JsonProvider.class, tccl);
+ if (osgiProviders != null && !osgiProviders.isEmpty()) {
+ return osgiProviders.iterator().next();
+ }
+ } catch (final Throwable e) {
+ // locator not available, try normal mode
+ }
+
+ final Iterator<JsonProvider> serviceLoader = ServiceLoader.load(JsonProvider.class, tccl).iterator();
+ if (serviceLoader.hasNext()) {
+ return serviceLoader.next();
+ }
+
+ try {
+ final Class<?> clazz = Class.forName(DEFAULT_PROVIDER, true, tccl);
+ return JsonProvider.class.cast(clazz.newInstance());
+ } catch (final Throwable cnfe) {
+ throw new JsonException(DEFAULT_PROVIDER + " not found", cnfe);
+ }
+ }
+
+ public abstract JsonParser createParser(Reader reader);
+
+ public abstract JsonParser createParser(InputStream in);
+
+ public abstract JsonParserFactory createParserFactory(Map<String, ?> config);
+
+ public abstract JsonGenerator createGenerator(Writer writer);
+
+ public abstract JsonGenerator createGenerator(OutputStream out);
+
+ public abstract JsonGeneratorFactory createGeneratorFactory(Map<String, ?> config);
+
+ public abstract JsonReader createReader(Reader reader);
+
+ public abstract JsonReader createReader(InputStream in);
+
+ public abstract JsonWriter createWriter(Writer writer);
+
+ public abstract JsonWriter createWriter(OutputStream out);
+
+ public abstract JsonWriterFactory createWriterFactory(Map<String, ?> config);
+
+ public abstract JsonReaderFactory createReaderFactory(Map<String, ?> config);
+
+ public abstract JsonObjectBuilder createObjectBuilder();
+
+ public abstract JsonArrayBuilder createArrayBuilder();
+
+ public abstract JsonBuilderFactory createBuilderFactory(Map<String, ?> config);
+}
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerationException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerationException.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerationException.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerationException.java Fri May 30 18:02:42 2014
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+import javax.json.JsonException;
+
+public class JsonGenerationException extends JsonException {
+ public JsonGenerationException(final String message) {
+ super(message);
+ }
+
+ public JsonGenerationException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
+
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerator.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerator.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGenerator.java Fri May 30 18:02:42 2014
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+import javax.json.JsonValue;
+import java.io.Closeable;
+import java.io.Flushable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+public interface JsonGenerator extends Flushable, Closeable {
+ String PRETTY_PRINTING = "javax.json.stream.JsonGenerator.prettyPrinting"; // TODO: ensure it exists before releasing
+
+ JsonGenerator writeStartObject();
+
+ JsonGenerator writeStartObject(String name);
+
+ JsonGenerator writeStartArray();
+
+ JsonGenerator writeStartArray(String name);
+
+ JsonGenerator write(String name, JsonValue value);
+
+ JsonGenerator write(String name, String value);
+
+ JsonGenerator write(String name, BigInteger value);
+
+ JsonGenerator write(String name, BigDecimal value);
+
+ JsonGenerator write(String name, int value);
+
+ JsonGenerator write(String name, long value);
+
+ JsonGenerator write(String name, double value);
+
+ JsonGenerator write(String name, boolean value);
+
+ JsonGenerator writeNull(String name);
+
+ JsonGenerator writeEnd();
+
+ JsonGenerator write(JsonValue value);
+
+ JsonGenerator write(String value);
+
+ JsonGenerator write(BigDecimal value);
+
+ JsonGenerator write(BigInteger value);
+
+ JsonGenerator write(int value);
+
+ JsonGenerator write(long value);
+
+ JsonGenerator write(double value);
+
+ JsonGenerator write(boolean value);
+
+ JsonGenerator writeNull();
+
+ @Override
+ void close();
+
+ @Override
+ void flush();
+
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGeneratorFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGeneratorFactory.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGeneratorFactory.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonGeneratorFactory.java Fri May 30 18:02:42 2014
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.util.Map;
+
+public interface JsonGeneratorFactory {
+ JsonGenerator createGenerator(Writer writer);
+
+ JsonGenerator createGenerator(OutputStream out);
+
+ JsonGenerator createGenerator(OutputStream out, Charset charset);
+
+ Map<String, ?> getConfigInUse();
+}
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonLocation.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonLocation.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonLocation.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonLocation.java Fri May 30 18:02:42 2014
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+public interface JsonLocation {
+ long getLineNumber();
+
+ long getColumnNumber();
+
+ long getStreamOffset();
+}
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParser.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParser.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParser.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParser.java Fri May 30 18:02:42 2014
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+import java.io.Closeable;
+import java.math.BigDecimal;
+
+public interface JsonParser extends Closeable {
+ boolean hasNext();
+
+ Event next();
+
+ String getString();
+
+ boolean isIntegralNumber();
+
+ int getInt();
+
+ long getLong();
+
+ BigDecimal getBigDecimal();
+
+ JsonLocation getLocation();
+
+ @Override
+ void close();
+
+ enum Event {
+ START_ARRAY, START_OBJECT,
+ KEY_NAME,
+ VALUE_STRING, VALUE_NUMBER, VALUE_TRUE, VALUE_FALSE, VALUE_NULL,
+ END_OBJECT, END_ARRAY
+ }
+}
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParserFactory.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParserFactory.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParserFactory.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParserFactory.java Fri May 30 18:02:42 2014
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+import javax.json.JsonArray;
+import javax.json.JsonObject;
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.util.Map;
+
+public interface JsonParserFactory {
+ JsonParser createParser(Reader reader);
+
+ JsonParser createParser(InputStream in);
+
+ JsonParser createParser(InputStream in, Charset charset);
+
+ JsonParser createParser(JsonObject obj);
+
+ JsonParser createParser(JsonArray array);
+
+ Map<String, ?> getConfigInUse();
+}
+
Added: geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParsingException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParsingException.java?rev=1598683&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParsingException.java (added)
+++ geronimo/specs/trunk/geronimo-json_1.0_spec/src/main/java/javax/json/stream/JsonParsingException.java Fri May 30 18:02:42 2014
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.json.stream;
+
+import javax.json.JsonException;
+
+public class JsonParsingException extends JsonException {
+ private final JsonLocation location;
+
+ public JsonParsingException(String message, JsonLocation location) {
+ super(message);
+ this.location = location;
+ }
+
+ public JsonParsingException(String message, Throwable cause, JsonLocation location) {
+ super(message, cause);
+ this.location = location;
+ }
+
+ public JsonLocation getLocation() {
+ return location;
+ }
+}
+
+