├── README.md ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── licenses ├── MIT-bc.txt ├── MIT-slf4j.txt ├── README.md ├── APL-2.0.txt └── jsonp.txt ├── src ├── main │ ├── java │ │ └── com │ │ │ ├── org1 │ │ │ └── contract │ │ │ │ ├── StringBasedStateReader.java │ │ │ │ ├── StringBasedStateUpdater.java │ │ │ │ ├── DeprecatedStateUpdater.java │ │ │ │ ├── DeprecatedStateReader.java │ │ │ │ ├── StringBasedStateUpdaterReader.java │ │ │ │ ├── DeprecatedStateUpdaterReader.java │ │ │ │ ├── JsonpBasedStateUpdater.java │ │ │ │ ├── JsonpBasedStateReader.java │ │ │ │ ├── JsonpBasedStateUpdaterReader.java │ │ │ │ ├── StateUpdater.java │ │ │ │ ├── StateUpdaterReader.java │ │ │ │ ├── StateReader.java │ │ │ │ ├── JacksonBasedStateUpdater.java │ │ │ │ ├── JacksonBasedStateUpdaterReader.java │ │ │ │ └── JacksonBasedStateReader.java │ │ │ └── scalar │ │ │ └── dl │ │ │ └── client │ │ │ └── contract │ │ │ ├── DeprecatedValidateLedger.java │ │ │ └── ValidateLedger.java │ └── resources │ │ └── META-INF │ │ └── LICENSE └── test │ └── java │ └── com │ └── scalar │ └── dl │ └── client │ └── contract │ ├── ValidateLedgerTest.java │ └── DeprecatedValidateLedgerTest.java ├── docs └── README.md ├── gradlew.bat ├── conf └── client.properties ├── gradlew └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | docs/README.md -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | build/ 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scalar-labs/scalardl-java-client-sdk/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /licenses/MIT-bc.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2000 - 2018 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/StringBasedStateReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.google.common.base.Splitter; 4 | import com.scalar.dl.ledger.contract.StringBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.List; 9 | import java.util.Optional; 10 | import javax.annotation.Nullable; 11 | 12 | public class StringBasedStateReader extends StringBasedContract { 13 | 14 | @Nullable 15 | @Override 16 | public String invoke(Ledger ledger, String argument, @Nullable String properties) { 17 | // 18 | List elements = Splitter.on(',').splitToList(argument); 19 | if (elements.size() < 1) { 20 | throw new ContractContextException("invalid argument format"); 21 | } 22 | 23 | String assetId = elements.get(0); 24 | Optional> asset = ledger.get(assetId); 25 | 26 | return asset 27 | .map(value -> String.join(",", value.id(), String.valueOf(value.age()), value.data())) 28 | .orElse(null); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /licenses/MIT-slf4j.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2017 QOS.ch 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /licenses/README.md: -------------------------------------------------------------------------------- 1 | This product uses the following open source software. 2 | 3 | |Name |License |Copyright|Link | 4 | |---|---|---|---| 5 | |Gradle |[Apache License 2.0](APL-2.0.txt) | Gradle Inc | https://github.com/gradle/gradle | 6 | |Guava: Google Core Libraries for Java |[Apache License 2.0](APL-2.0.txt) |Google LLC | https://github.com/google/guava | 7 | |Guice |[Apache License 2.0](APL-2.0.txt) |Google LLC | https://github.com/google/guice | 8 | |SLF4J | [MIT](MIT-slf4j.txt) | Copyright (c) 2004-2017 QOS.ch | https://github.com/qos-ch/slf4j | 9 | |JSON-P | [CDDL 1.1 & GPL 2.0](jsonp.txt)| Copyright 2015, 2017 Oracle and/or its affiliates | https://javaee.github.io/jsonp | 10 | |gRPC-Java |[Apache License 2.0](APL-2.0.txt) | Copyright 2016 The gRPC Authors | https://github.com/grpc/grpc-java | 11 | |Bouncy Castle | [MIT](MIT-bc.txt) | Copyright (c) 2000 - 2018 The Legion of the Bouncy Castle Inc. | https://www.bouncycastle.org | 12 | |lettuce |[Apache License 2.0](APL-2.0.txt) |Copyright 2011-2019 the original author or authors | https://github.com/lettuce-io/lettuce-core | 13 | |Jackson Core |[Apache License 2.0](APL-2.0.txt) |- | https://github.com/FasterXML/jackson-core | 14 | |Jackson Databind |[Apache License 2.0](APL-2.0.txt) |- | https://github.com/FasterXML/jackson-databind | 15 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/StringBasedStateUpdater.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.google.common.base.Splitter; 4 | import com.scalar.dl.ledger.contract.StringBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.List; 9 | import java.util.Optional; 10 | import javax.annotation.Nullable; 11 | 12 | public class StringBasedStateUpdater extends StringBasedContract { 13 | 14 | @Nullable 15 | @Override 16 | public String invoke(Ledger ledger, String argument, @Nullable String properties) { 17 | // , 18 | List elements = Splitter.on(',').splitToList(argument); 19 | if (elements.size() != 2) { 20 | throw new ContractContextException("invalid argument format"); 21 | } 22 | String assetId = elements.get(0); 23 | int status = Integer.parseInt(elements.get(1)); 24 | 25 | Optional> asset = ledger.get(assetId); 26 | 27 | if (!asset.isPresent() 28 | || Integer.parseInt(Splitter.on(',').splitToList(asset.get().data()).get(1)) != status) { 29 | ledger.put(assetId, assetId + "," + status); 30 | } 31 | 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/DeprecatedStateUpdater.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.scalar.dl.ledger.asset.Asset; 4 | import com.scalar.dl.ledger.contract.Contract; 5 | import com.scalar.dl.ledger.database.Ledger; 6 | import com.scalar.dl.ledger.exception.ContractContextException; 7 | import java.util.Optional; 8 | import javax.json.Json; 9 | import javax.json.JsonObject; 10 | 11 | public class DeprecatedStateUpdater extends Contract { 12 | 13 | @Override 14 | public JsonObject invoke(Ledger ledger, JsonObject argument, Optional properties) { 15 | if (!argument.containsKey("asset_id") || !argument.containsKey("state")) { 16 | // ContractContextException is the only throwable exception in a contract and 17 | // it should be thrown when a contract faces some non-recoverable error 18 | throw new ContractContextException("please set asset_id and state in the argument"); 19 | } 20 | 21 | String assetId = argument.getString("asset_id"); 22 | int state = argument.getInt("state"); 23 | 24 | Optional asset = ledger.get(assetId); 25 | 26 | if (!asset.isPresent() || asset.get().data().getInt("state") != state) { 27 | ledger.put(assetId, Json.createObjectBuilder().add("state", state).build()); 28 | } 29 | 30 | return null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/DeprecatedStateReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.scalar.dl.ledger.asset.Asset; 4 | import com.scalar.dl.ledger.contract.Contract; 5 | import com.scalar.dl.ledger.database.Ledger; 6 | import com.scalar.dl.ledger.exception.ContractContextException; 7 | import java.util.Optional; 8 | import javax.json.Json; 9 | import javax.json.JsonObject; 10 | 11 | public class DeprecatedStateReader extends Contract { 12 | 13 | @Override 14 | public JsonObject invoke(Ledger ledger, JsonObject argument, Optional properties) { 15 | if (!argument.containsKey("asset_id")) { 16 | // ContractContextException is the only throwable exception in a contract and 17 | // it should be thrown when a contract faces some non-recoverable error 18 | throw new ContractContextException("please set asset_id in the argument"); 19 | } 20 | 21 | String assetId = argument.getString("asset_id"); 22 | Optional asset = ledger.get(assetId); 23 | 24 | return asset 25 | .map( 26 | value -> 27 | Json.createObjectBuilder() 28 | .add("id", value.id()) 29 | .add("age", value.age()) 30 | .add("output", value.data()) 31 | .build()) 32 | .orElse(null); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/StringBasedStateUpdaterReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.google.common.base.Splitter; 4 | import com.scalar.dl.ledger.contract.StringBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.List; 9 | import java.util.Optional; 10 | import javax.annotation.Nullable; 11 | 12 | public class StringBasedStateUpdaterReader extends StringBasedContract { 13 | 14 | @Nullable 15 | @Override 16 | public String invoke(Ledger ledger, String argument, @Nullable String properties) { 17 | // , 18 | List elements = Splitter.on(',').splitToList(argument); 19 | if (elements.size() != 2) { 20 | throw new ContractContextException("invalid argument format"); 21 | } 22 | String assetId = elements.get(0); 23 | int status = Integer.parseInt(elements.get(1)); 24 | 25 | Optional> asset = ledger.get(assetId); 26 | 27 | if (!asset.isPresent() 28 | || Integer.parseInt(Splitter.on(',').splitToList(asset.get().data()).get(1)) != status) { 29 | ledger.put(assetId, assetId + "," + status); 30 | } 31 | 32 | return invoke("string-state-reader", ledger, argument); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/DeprecatedStateUpdaterReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.scalar.dl.ledger.asset.Asset; 4 | import com.scalar.dl.ledger.contract.Contract; 5 | import com.scalar.dl.ledger.database.Ledger; 6 | import com.scalar.dl.ledger.exception.ContractContextException; 7 | import java.util.Optional; 8 | import javax.json.Json; 9 | import javax.json.JsonObject; 10 | 11 | public class DeprecatedStateUpdaterReader extends Contract { 12 | 13 | @Override 14 | public JsonObject invoke(Ledger ledger, JsonObject argument, Optional properties) { 15 | if (!argument.containsKey("asset_id") || !argument.containsKey("state")) { 16 | // ContractContextException is the only throwable exception in a contract and 17 | // it should be thrown when a contract faces some non-recoverable error 18 | throw new ContractContextException("please set asset_id and state in the argument"); 19 | } 20 | 21 | String assetId = argument.getString("asset_id"); 22 | int state = argument.getInt("state"); 23 | 24 | Optional asset = ledger.get(assetId); 25 | 26 | if (!asset.isPresent() || asset.get().data().getInt("state") != state) { 27 | ledger.put(assetId, Json.createObjectBuilder().add("state", state).build()); 28 | } 29 | 30 | return invoke("deprecated-state-reader", ledger, argument); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/JsonpBasedStateUpdater.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.scalar.dl.ledger.contract.JsonpBasedContract; 4 | import com.scalar.dl.ledger.exception.ContractContextException; 5 | import com.scalar.dl.ledger.statemachine.Asset; 6 | import com.scalar.dl.ledger.statemachine.Ledger; 7 | import java.util.Optional; 8 | import javax.annotation.Nullable; 9 | import javax.json.Json; 10 | import javax.json.JsonObject; 11 | 12 | public class JsonpBasedStateUpdater extends JsonpBasedContract { 13 | 14 | @Override 15 | @Nullable 16 | public JsonObject invoke( 17 | Ledger ledger, JsonObject argument, @Nullable JsonObject properties) { 18 | if (!argument.containsKey("asset_id") || !argument.containsKey("state")) { 19 | // ContractContextException is the only throwable exception in a contract and 20 | // it should be thrown when a contract faces some non-recoverable error 21 | throw new ContractContextException("please set asset_id and state in the argument"); 22 | } 23 | 24 | String assetId = argument.getString("asset_id"); 25 | int state = argument.getInt("state"); 26 | 27 | Optional> asset = ledger.get(assetId); 28 | 29 | if (!asset.isPresent() || asset.get().data().getInt("state") != state) { 30 | ledger.put(assetId, Json.createObjectBuilder().add("state", state).build()); 31 | } 32 | 33 | return null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/JsonpBasedStateReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.scalar.dl.ledger.contract.JsonpBasedContract; 4 | import com.scalar.dl.ledger.exception.ContractContextException; 5 | import com.scalar.dl.ledger.statemachine.Asset; 6 | import com.scalar.dl.ledger.statemachine.Ledger; 7 | import java.util.Optional; 8 | import javax.annotation.Nullable; 9 | import javax.json.Json; 10 | import javax.json.JsonObject; 11 | 12 | public class JsonpBasedStateReader extends JsonpBasedContract { 13 | 14 | @Override 15 | @Nullable 16 | public JsonObject invoke( 17 | Ledger ledger, JsonObject argument, @Nullable JsonObject properties) { 18 | if (!argument.containsKey("asset_id")) { 19 | // ContractContextException is the only throwable exception in a contract and 20 | // it should be thrown when a contract faces some non-recoverable error 21 | throw new ContractContextException("please set asset_id in the argument"); 22 | } 23 | 24 | String assetId = argument.getString("asset_id"); 25 | Optional> asset = ledger.get(assetId); 26 | 27 | return asset 28 | .map( 29 | value -> 30 | Json.createObjectBuilder() 31 | .add("id", value.id()) 32 | .add("age", value.age()) 33 | .add("output", value.data()) 34 | .build()) 35 | .orElse(null); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/JsonpBasedStateUpdaterReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.scalar.dl.ledger.contract.JsonpBasedContract; 4 | import com.scalar.dl.ledger.exception.ContractContextException; 5 | import com.scalar.dl.ledger.statemachine.Asset; 6 | import com.scalar.dl.ledger.statemachine.Ledger; 7 | import java.util.Optional; 8 | import javax.annotation.Nullable; 9 | import javax.json.Json; 10 | import javax.json.JsonObject; 11 | 12 | public class JsonpBasedStateUpdaterReader extends JsonpBasedContract { 13 | 14 | @Override 15 | @Nullable 16 | public JsonObject invoke( 17 | Ledger ledger, JsonObject argument, @Nullable JsonObject properties) { 18 | if (!argument.containsKey("asset_id") || !argument.containsKey("state")) { 19 | // ContractContextException is the only throwable exception in a contract and 20 | // it should be thrown when a contract faces some non-recoverable error 21 | throw new ContractContextException("please set asset_id and state in the argument"); 22 | } 23 | 24 | String assetId = argument.getString("asset_id"); 25 | int state = argument.getInt("state"); 26 | 27 | Optional> asset = ledger.get(assetId); 28 | 29 | if (!asset.isPresent() || asset.get().data().getInt("state") != state) { 30 | ledger.put(assetId, Json.createObjectBuilder().add("state", state).build()); 31 | } 32 | 33 | return invoke("jsonp-state-reader", ledger, argument); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/StateUpdater.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.Optional; 9 | import javax.annotation.Nullable; 10 | 11 | /** 12 | * It is recommended to use JacksonBasedContract for taking a good balance between development 13 | * productivity and performance. 14 | */ 15 | public class StateUpdater extends JacksonBasedContract { 16 | 17 | @Nullable 18 | @Override 19 | public JsonNode invoke( 20 | Ledger ledger, JsonNode argument, @Nullable JsonNode properties) { 21 | if (!argument.has("asset_id") || !argument.has("state")) { 22 | // ContractContextException is the only throwable exception in a contract and 23 | // it should be thrown when a contract faces some non-recoverable error 24 | throw new ContractContextException("please set asset_id and state in the argument"); 25 | } 26 | 27 | String assetId = argument.get("asset_id").asText(); 28 | int state = argument.get("state").asInt(); 29 | 30 | Optional> asset = ledger.get(assetId); 31 | 32 | if (!asset.isPresent() || asset.get().data().get("state").asInt() != state) { 33 | ledger.put(assetId, getObjectMapper().createObjectNode().put("state", state)); 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/StateUpdaterReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.Optional; 9 | import javax.annotation.Nullable; 10 | 11 | /** 12 | * It is recommended to use JacksonBasedContract for taking a good balance between development 13 | * productivity and performance. 14 | */ 15 | public class StateUpdaterReader extends JacksonBasedContract { 16 | 17 | @Nullable 18 | @Override 19 | public JsonNode invoke( 20 | Ledger ledger, JsonNode argument, @Nullable JsonNode properties) { 21 | if (!argument.has("asset_id") || !argument.has("state")) { 22 | // ContractContextException is the only throwable exception in a contract and 23 | // it should be thrown when a contract faces some non-recoverable error 24 | throw new ContractContextException("please set asset_id and state in the argument"); 25 | } 26 | 27 | String assetId = argument.get("asset_id").asText(); 28 | int state = argument.get("state").asInt(); 29 | 30 | Optional> asset = ledger.get(assetId); 31 | 32 | if (!asset.isPresent() || asset.get().data().get("state").asInt() != state) { 33 | ledger.put(assetId, getObjectMapper().createObjectNode().put("state", state)); 34 | } 35 | 36 | return invoke("state-reader", ledger, argument); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## ScalarDL Java Client SDK 2 | 3 | This is a client-side Java library to interact with [ScalarDL](https://github.com/scalar-labs/scalardl) network. 4 | 5 | ## Install 6 | The library is available on [Maven Central](https://search.maven.org/search?q=a:scalardl-java-client-sdk). You can install it in your application using your build tool such as Gradle. 7 | For example in Gradle, you can add the following dependency to your build.gradle. 8 | ``` 9 | dependencies { 10 | compile group: 'com.scalar-labs', name: 'scalardl-java-client-sdk', version: '' 11 | } 12 | ``` 13 | 14 | ## Docs 15 | * [ScalarDL Docs](https://scalardl.scalar-labs.com/) 16 | * [Javadoc](https://javadoc.io/doc/com.scalar-labs/scalardl-java-client-sdk/) 17 | 18 | ## Contributing 19 | This library is mainly maintained by the Scalar Engineering Team, but of course we appreciate any help. 20 | 21 | * For asking questions, finding answers and helping other users, please go to [stackoverflow](https://stackoverflow.com/) and use [scalardl](https://stackoverflow.com/questions/tagged/scalardl) tag. 22 | * For filing bugs, suggesting improvements, or requesting new features, help us out by opening an issue. 23 | 24 | ## License 25 | 26 | ScalarDL Java Client SDK is dual-licensed under both the Apache 2.0 License (found in the LICENSE file in the root directory) and a commercial license. You may select, at your option, one of the licenses. The commercial license includes several enterprise-grade features such as ScalarDL Auditor. For more information about the commercial license, please [contact us](https://www.scalar-labs.com/contact). 27 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/StateReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.Optional; 9 | import javax.annotation.Nullable; 10 | 11 | /** 12 | * It is recommended to use JacksonBasedContract for taking a good balance between development 13 | * productivity and performance. 14 | */ 15 | public class StateReader extends JacksonBasedContract { 16 | 17 | @Nullable 18 | @Override 19 | public JsonNode invoke( 20 | Ledger ledger, JsonNode argument, @Nullable JsonNode properties) { 21 | if (!argument.has("asset_id")) { 22 | // ContractContextException is the only throwable exception in a contract and 23 | // it should be thrown when a contract faces some non-recoverable error 24 | throw new ContractContextException("please set asset_id and state in the argument"); 25 | } 26 | 27 | String assetId = argument.get("asset_id").asText(); 28 | Optional> asset = ledger.get(assetId); 29 | 30 | return asset 31 | .map( 32 | value -> 33 | (JsonNode) 34 | getObjectMapper() 35 | .createObjectNode() 36 | .put("id", value.id()) 37 | .put("age", value.age()) 38 | .set("output", value.data())) 39 | .orElse(null); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/JacksonBasedStateUpdater.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.Optional; 9 | import javax.annotation.Nullable; 10 | 11 | /** 12 | * The contents of the contract are the same as {@link StateUpdater}. It is recommended to use 13 | * JacksonBasedContract for taking a good balance between development productivity and performance. 14 | */ 15 | public class JacksonBasedStateUpdater extends JacksonBasedContract { 16 | 17 | @Nullable 18 | @Override 19 | public JsonNode invoke( 20 | Ledger ledger, JsonNode argument, @Nullable JsonNode properties) { 21 | if (!argument.has("asset_id") || !argument.has("state")) { 22 | // ContractContextException is the only throwable exception in a contract and 23 | // it should be thrown when a contract faces some non-recoverable error 24 | throw new ContractContextException("please set asset_id and state in the argument"); 25 | } 26 | 27 | String assetId = argument.get("asset_id").asText(); 28 | int state = argument.get("state").asInt(); 29 | 30 | Optional> asset = ledger.get(assetId); 31 | 32 | if (!asset.isPresent() || asset.get().data().get("state").asInt() != state) { 33 | ledger.put(assetId, getObjectMapper().createObjectNode().put("state", state)); 34 | } 35 | 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/JacksonBasedStateUpdaterReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.Optional; 9 | import javax.annotation.Nullable; 10 | 11 | /** 12 | * The contents of the contract are the same as {@link StateUpdaterReader}. It is recommended to use 13 | * JacksonBasedContract for taking a good balance between development productivity and performance. 14 | */ 15 | public class JacksonBasedStateUpdaterReader extends JacksonBasedContract { 16 | 17 | @Nullable 18 | @Override 19 | public JsonNode invoke( 20 | Ledger ledger, JsonNode argument, @Nullable JsonNode properties) { 21 | if (!argument.has("asset_id") || !argument.has("state")) { 22 | // ContractContextException is the only throwable exception in a contract and 23 | // it should be thrown when a contract faces some non-recoverable error 24 | throw new ContractContextException("please set asset_id and state in the argument"); 25 | } 26 | 27 | String assetId = argument.get("asset_id").asText(); 28 | int state = argument.get("state").asInt(); 29 | 30 | Optional> asset = ledger.get(assetId); 31 | 32 | if (!asset.isPresent() || asset.get().data().get("state").asInt() != state) { 33 | ledger.put(assetId, getObjectMapper().createObjectNode().put("state", state)); 34 | } 35 | 36 | return invoke("jackson-state-reader", ledger, argument); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/org1/contract/JacksonBasedStateReader.java: -------------------------------------------------------------------------------- 1 | package com.org1.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 5 | import com.scalar.dl.ledger.exception.ContractContextException; 6 | import com.scalar.dl.ledger.statemachine.Asset; 7 | import com.scalar.dl.ledger.statemachine.Ledger; 8 | import java.util.Optional; 9 | import javax.annotation.Nullable; 10 | 11 | /** 12 | * The contents of the contract are the same as {@link StateReader}. It is recommended to use 13 | * JacksonBasedContract for taking a good balance between development productivity and performance. 14 | */ 15 | public class JacksonBasedStateReader extends JacksonBasedContract { 16 | 17 | @Nullable 18 | @Override 19 | public JsonNode invoke( 20 | Ledger ledger, JsonNode argument, @Nullable JsonNode properties) { 21 | if (!argument.has("asset_id")) { 22 | // ContractContextException is the only throwable exception in a contract and 23 | // it should be thrown when a contract faces some non-recoverable error 24 | throw new ContractContextException("please set asset_id and state in the argument"); 25 | } 26 | 27 | String assetId = argument.get("asset_id").asText(); 28 | Optional> asset = ledger.get(assetId); 29 | 30 | return asset 31 | .map( 32 | value -> 33 | (JsonNode) 34 | getObjectMapper() 35 | .createObjectNode() 36 | .put("id", value.id()) 37 | .put("age", value.age()) 38 | .set("output", value.data())) 39 | .orElse(null); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/scalar/dl/client/contract/DeprecatedValidateLedger.java: -------------------------------------------------------------------------------- 1 | package com.scalar.dl.client.contract; 2 | 3 | import com.scalar.dl.ledger.asset.Asset; 4 | import com.scalar.dl.ledger.contract.Contract; 5 | import com.scalar.dl.ledger.database.AssetFilter; 6 | import com.scalar.dl.ledger.database.AssetFilter.AgeOrder; 7 | import com.scalar.dl.ledger.database.Ledger; 8 | import com.scalar.dl.ledger.exception.ContractContextException; 9 | import java.util.List; 10 | import java.util.Optional; 11 | import javax.json.Json; 12 | import javax.json.JsonArrayBuilder; 13 | import javax.json.JsonObject; 14 | 15 | public class DeprecatedValidateLedger extends Contract { 16 | static final String ASSET_ID_KEY = "asset_id"; 17 | static final String AGE_KEY = "age"; 18 | static final String START_AGE_KEY = "start_age"; 19 | static final String END_AGE_KEY = "end_age"; 20 | static final String DATA_KEY = "data"; 21 | 22 | @Override 23 | public JsonObject invoke(Ledger ledger, JsonObject argument, Optional properties) { 24 | if (!argument.containsKey(ASSET_ID_KEY)) { 25 | throw new ContractContextException("please set asset_id in the argument"); 26 | } 27 | String assetId = argument.getString(ASSET_ID_KEY); 28 | 29 | int startAge = 0; 30 | int endAge = Integer.MAX_VALUE; 31 | if (argument.containsKey(AGE_KEY)) { 32 | int age = argument.getInt(AGE_KEY); 33 | startAge = age; 34 | endAge = age; 35 | } else { 36 | if (argument.containsKey(START_AGE_KEY)) { 37 | startAge = argument.getInt(START_AGE_KEY); 38 | } 39 | if (argument.containsKey(END_AGE_KEY)) { 40 | endAge = argument.getInt(END_AGE_KEY); 41 | } 42 | } 43 | 44 | AssetFilter filter = 45 | new AssetFilter(assetId) 46 | .withStartAge(startAge, true) 47 | .withEndAge(endAge, true) 48 | .withAgeOrder(AgeOrder.ASC); 49 | List assets = ledger.scan(filter); 50 | 51 | JsonArrayBuilder builder = Json.createArrayBuilder(); 52 | assets.forEach( 53 | a -> 54 | builder.add( 55 | Json.createObjectBuilder().add(AGE_KEY, a.age()).add(DATA_KEY, a.data()).build())); 56 | 57 | return Json.createObjectBuilder().add(assetId, builder.build()).build(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/scalar/dl/client/contract/ValidateLedger.java: -------------------------------------------------------------------------------- 1 | package com.scalar.dl.client.contract; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.fasterxml.jackson.databind.node.ArrayNode; 6 | import com.scalar.dl.ledger.contract.JacksonBasedContract; 7 | import com.scalar.dl.ledger.database.AssetFilter; 8 | import com.scalar.dl.ledger.database.AssetFilter.AgeOrder; 9 | import com.scalar.dl.ledger.exception.ContractContextException; 10 | import com.scalar.dl.ledger.statemachine.Asset; 11 | import com.scalar.dl.ledger.statemachine.Ledger; 12 | import java.util.List; 13 | 14 | public class ValidateLedger extends JacksonBasedContract { 15 | static final String ASSET_ID_KEY = "asset_id"; 16 | static final String AGE_KEY = "age"; 17 | static final String START_AGE_KEY = "start_age"; 18 | static final String END_AGE_KEY = "end_age"; 19 | static final String DATA_KEY = "data"; 20 | 21 | @Override 22 | public JsonNode invoke(Ledger ledger, JsonNode argument, JsonNode properties) { 23 | if (!argument.has(ASSET_ID_KEY)) { 24 | throw new ContractContextException("please set asset_id in the argument"); 25 | } 26 | 27 | String assetId = argument.get(ASSET_ID_KEY).asText(); 28 | 29 | int startAge = 0; 30 | int endAge = Integer.MAX_VALUE; 31 | if (argument.has(AGE_KEY)) { 32 | int age = argument.get(AGE_KEY).asInt(); 33 | startAge = age; 34 | endAge = age; 35 | } else { 36 | if (argument.has(START_AGE_KEY)) { 37 | startAge = argument.get(START_AGE_KEY).asInt(); 38 | } 39 | if (argument.has(END_AGE_KEY)) { 40 | endAge = argument.get(END_AGE_KEY).asInt(); 41 | } 42 | } 43 | 44 | AssetFilter filter = 45 | new AssetFilter(assetId) 46 | .withStartAge(startAge, true) 47 | .withEndAge(endAge, true) 48 | .withAgeOrder(AgeOrder.ASC); 49 | List> assets = ledger.scan(filter); 50 | 51 | ObjectMapper mapper = getObjectMapper(); 52 | ArrayNode array = mapper.createArrayNode(); 53 | 54 | assets.forEach( 55 | a -> array.add(mapper.createObjectNode().put(AGE_KEY, a.age()).set(DATA_KEY, a.data()))); 56 | 57 | return mapper.createObjectNode().set(assetId, array); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /conf/client.properties: -------------------------------------------------------------------------------- 1 | # Optional. A hostname or an IP address of the server ("localhost" by default). 2 | # It assuems that there is a single endpoint that is given by DNS or a load balancer. 3 | #scalar.dl.client.server.host=localhost 4 | 5 | # Optional. A port number of the server (50051 by default). 6 | #scalar.dl.client.server.port=50051 7 | 8 | # Optional. A port number of the server for privileged services (50052 by default). 9 | #scalar.dl.client.server.privileged_port=50052 10 | 11 | # Required. The holder ID of a certificate. 12 | # It must be configured for each private key and unique in the system. 13 | scalar.dl.client.cert_holder_id=foo 14 | 15 | # Optional. The version of the certificate (1 by default). 16 | # Use another bigger integer if you need to change your private key. 17 | #scalar.dl.client.cert_version=1 18 | 19 | # Required. The path of the certificate file in PEM format. 20 | scalar.dl.client.cert_path=/path/to/foo.pem 21 | 22 | # Required if cert_path is empty. PEM-encoded certificate data. 23 | #scalar.dl.client.cert_pem= 24 | 25 | # Required. The path of a corresponding private key file in PEM format to the certificate. 26 | scalar.dl.client.private_key_path=/path/to/foo-key.pem 27 | 28 | # Required if private_key_path is empty. PEM-encoded private key data. 29 | #scalar.dl.client.private_key_pem= 30 | 31 | # Optional. A flag to enable TLS communication for Ledger (false by default). 32 | #scalar.dl.client.tls.enabled=false 33 | 34 | # Optional. A custom CA root certificate for TLS communication for Ledger. 35 | # If the issuing certificate authority is known to the client, it can be empty. 36 | #scalar.dl.client.tls.ca_root_cert_path=/path/to/ca-root-cert 37 | #scalar.dl.client.tls.ca_root_cert_pem= 38 | 39 | # Optional. An authorization credential for Ledger. (e.g. authorization: Bearer token) 40 | # If this is given, clients will add "authorization: " http/2 header. 41 | #scalar.dl.client.authorization.credential=credential 42 | 43 | # Optional. A client mode. CLIENT OR INTERMEDIARY. CLIENT by default. 44 | # In INTERMEDIARY mode, this client recieves a signed serialized request from another client, 45 | # and sends it to a server. 46 | #scalar.dl.client.mode= 47 | 48 | # 49 | # For auditor 50 | # 51 | 52 | # Optional. A flag to enable auditor. False by default. 53 | #scalar.dl.client.auditor.enabled=false 54 | 55 | # Optional. A hostname or an IP address of the auditor. Use localhost by default if not specified. 56 | # It assuems that there is a single endpoint that is given by DNS or a load balancer. 57 | #scalar.dl.client.auditor.host=localhost 58 | 59 | # Optional. A port number of the auditor. Use 40051 by default if not specified. 60 | #scalar.dl.client.auditor.port=40051 61 | 62 | # Optional. A port number of the auditor for privileged services. Use 40052 by default if not specified. 63 | #scalar.dl.client.auditor.privileged_port=40052 64 | 65 | # Optional. A flag to enable TLS communication for Auditor. False by default. 66 | #scalar.dl.client.auditor.tls.enabled=false 67 | 68 | # Optional. A custom CA root certificate for TLS communication for Auditor. 69 | # If the issuing certificate authority is known to the client, it can be empty. 70 | #scalar.dl.client.auditor.tls.ca_root_cert_path= 71 | #scalar.dl.client.auditor.tls.ca_root_cert_pem= 72 | 73 | # Optional. An authorization credential for Auditor. (e.g. authorization: Bearer token) 74 | # If this is given, clients will add "authorization: " http/2 header. 75 | #scalar.dl.client.auditor.authorization.credential= 76 | 77 | # Optional. The ID of ValidateLedger contract. It is used for the linearizable validation. Use "validate-ledger" by deafult if not specified. 78 | #scalar.dl.client.auditor.linearizable_validation.contract_id=validate-ledger 79 | -------------------------------------------------------------------------------- /src/test/java/com/scalar/dl/client/contract/ValidateLedgerTest.java: -------------------------------------------------------------------------------- 1 | package com.scalar.dl.client.contract; 2 | 3 | import static org.assertj.core.api.AssertionsForClassTypes.assertThat; 4 | import static org.assertj.core.api.AssertionsForClassTypes.catchThrowable; 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.mock; 7 | import static org.mockito.Mockito.verify; 8 | import static org.mockito.Mockito.when; 9 | 10 | import com.fasterxml.jackson.databind.JsonNode; 11 | import com.fasterxml.jackson.databind.node.JsonNodeFactory; 12 | import com.scalar.dl.ledger.database.AssetFilter; 13 | import com.scalar.dl.ledger.database.AssetFilter.AgeOrder; 14 | import com.scalar.dl.ledger.exception.ContractContextException; 15 | import com.scalar.dl.ledger.statemachine.Asset; 16 | import com.scalar.dl.ledger.statemachine.Ledger; 17 | import java.util.List; 18 | import java.util.stream.Collectors; 19 | import java.util.stream.IntStream; 20 | import org.junit.Before; 21 | import org.junit.Test; 22 | import org.mockito.Mock; 23 | import org.mockito.MockitoAnnotations; 24 | 25 | public class ValidateLedgerTest { 26 | private static final String SOME_ASSET_ID = "some_asset_id"; 27 | private static final int SOME_AGE = 2; 28 | private static final int SOME_START_AGE = 1; 29 | private static final int SOME_END_AGE = 3; 30 | @Mock private Ledger ledger; 31 | private ValidateLedger validateLedger; 32 | 33 | @Before 34 | public void setUp() { 35 | MockitoAnnotations.initMocks(this); 36 | validateLedger = new ValidateLedger(); 37 | } 38 | 39 | private List> createMockAssets(String assetId, int startAge, int endAge) { 40 | 41 | return IntStream.range(startAge, endAge + 1) 42 | .mapToObj( 43 | i -> { 44 | @SuppressWarnings("unchecked") 45 | Asset asset = mock(Asset.class); 46 | when(asset.id()).thenReturn(assetId); 47 | when(asset.age()).thenReturn(i); 48 | when(asset.data()).thenReturn(JsonNodeFactory.instance.objectNode()); 49 | return asset; 50 | }) 51 | .collect(Collectors.toList()); 52 | } 53 | 54 | @Test 55 | public void invoke_AgeGiven_ShouldReturnOneSpecifiedAssetOnly() { 56 | JsonNode argument = 57 | JsonNodeFactory.instance 58 | .objectNode() 59 | .put(ValidateLedger.ASSET_ID_KEY, SOME_ASSET_ID) 60 | .put(ValidateLedger.AGE_KEY, SOME_AGE); 61 | JsonNode properties = JsonNodeFactory.instance.objectNode(); 62 | 63 | List> assets = createMockAssets(SOME_ASSET_ID, SOME_AGE, SOME_AGE); 64 | when(ledger.scan(any(AssetFilter.class))).thenReturn(assets); 65 | 66 | // Act 67 | JsonNode result = validateLedger.invoke(ledger, argument, properties); 68 | 69 | // Assert 70 | AssetFilter expected = 71 | new AssetFilter(SOME_ASSET_ID) 72 | .withStartAge(SOME_AGE, true) 73 | .withEndAge(SOME_AGE, true) 74 | .withAgeOrder(AgeOrder.ASC); 75 | verify(ledger).scan(expected); 76 | assertThat(result.get(SOME_ASSET_ID).size()).isEqualTo(1); 77 | assertThat(result.get(SOME_ASSET_ID).get(0).get(ValidateLedger.AGE_KEY).asInt()) 78 | .isEqualTo(assets.get(0).age()); 79 | } 80 | 81 | @Test 82 | public void invoke_StartAgeEndAgeGiven_ShouldReturnSpecifiedAssets() { 83 | // Arrange 84 | JsonNode argument = 85 | JsonNodeFactory.instance 86 | .objectNode() 87 | .put(ValidateLedger.ASSET_ID_KEY, SOME_ASSET_ID) 88 | .put(ValidateLedger.START_AGE_KEY, SOME_START_AGE) 89 | .put(ValidateLedger.END_AGE_KEY, SOME_END_AGE); 90 | JsonNode properties = JsonNodeFactory.instance.objectNode(); 91 | 92 | List> assets = createMockAssets(SOME_ASSET_ID, SOME_START_AGE, SOME_END_AGE); 93 | when(ledger.scan(any(AssetFilter.class))).thenReturn(assets); 94 | 95 | // Act 96 | JsonNode result = validateLedger.invoke(ledger, argument, properties); 97 | 98 | // Assert 99 | AssetFilter expected = 100 | new AssetFilter(SOME_ASSET_ID) 101 | .withStartAge(SOME_START_AGE, true) 102 | .withEndAge(SOME_END_AGE, true) 103 | .withAgeOrder(AgeOrder.ASC); 104 | verify(ledger).scan(expected); 105 | assertThat(result.get(SOME_ASSET_ID).size()).isEqualTo(assets.size()); 106 | for (int i = 0; i < assets.size(); i++) { 107 | assertThat(result.get(SOME_ASSET_ID).get(i).get(ValidateLedger.AGE_KEY).asInt()) 108 | .isEqualTo(assets.get(i).age()); 109 | } 110 | } 111 | 112 | @Test 113 | public void invoke_OnlyAssetIdGiven_ShouldReturnAllAssets() { 114 | // Arrange 115 | JsonNode argument = 116 | JsonNodeFactory.instance.objectNode().put(ValidateLedger.ASSET_ID_KEY, SOME_ASSET_ID); 117 | JsonNode properties = JsonNodeFactory.instance.objectNode(); 118 | 119 | // create some asset but it's not used for verification since the range is open 120 | List> assets = createMockAssets(SOME_ASSET_ID, 0, 0); 121 | when(ledger.scan(any(AssetFilter.class))).thenReturn(assets); 122 | 123 | // Act 124 | validateLedger.invoke(ledger, argument, properties); 125 | 126 | // Assert 127 | AssetFilter expected = 128 | new AssetFilter(SOME_ASSET_ID) 129 | .withStartAge(0, true) 130 | .withEndAge(Integer.MAX_VALUE, true) 131 | .withAgeOrder(AgeOrder.ASC); 132 | verify(ledger).scan(expected); 133 | } 134 | 135 | @Test 136 | public void invoke_AssetIdNotGiven_ShouldThrowContractContextException() { 137 | // Arrange 138 | JsonNode argument = JsonNodeFactory.instance.objectNode().put(ValidateLedger.AGE_KEY, SOME_AGE); 139 | JsonNode properties = JsonNodeFactory.instance.objectNode(); 140 | 141 | // Act 142 | Throwable thrown = catchThrowable(() -> validateLedger.invoke(ledger, argument, properties)); 143 | 144 | // Assert 145 | assertThat(thrown).isExactlyInstanceOf(ContractContextException.class); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/test/java/com/scalar/dl/client/contract/DeprecatedValidateLedgerTest.java: -------------------------------------------------------------------------------- 1 | package com.scalar.dl.client.contract; 2 | 3 | import static org.assertj.core.api.AssertionsForClassTypes.assertThat; 4 | import static org.assertj.core.api.AssertionsForClassTypes.catchThrowable; 5 | import static org.mockito.ArgumentMatchers.any; 6 | import static org.mockito.Mockito.mock; 7 | import static org.mockito.Mockito.verify; 8 | import static org.mockito.Mockito.when; 9 | 10 | import com.scalar.dl.ledger.asset.Asset; 11 | import com.scalar.dl.ledger.database.AssetFilter; 12 | import com.scalar.dl.ledger.database.AssetFilter.AgeOrder; 13 | import com.scalar.dl.ledger.database.Ledger; 14 | import com.scalar.dl.ledger.exception.ContractContextException; 15 | import java.util.List; 16 | import java.util.Optional; 17 | import java.util.stream.Collectors; 18 | import java.util.stream.IntStream; 19 | import javax.json.Json; 20 | import javax.json.JsonObject; 21 | import org.junit.Before; 22 | import org.junit.Test; 23 | import org.mockito.Mock; 24 | import org.mockito.MockitoAnnotations; 25 | 26 | public class DeprecatedValidateLedgerTest { 27 | private static final String SOME_ASSET_ID = "some_asset_id"; 28 | private static final int SOME_AGE = 2; 29 | private static final int SOME_START_AGE = 1; 30 | private static final int SOME_END_AGE = 3; 31 | @Mock private Ledger ledger; 32 | private DeprecatedValidateLedger validateLedger; 33 | 34 | @Before 35 | public void setUp() { 36 | MockitoAnnotations.initMocks(this); 37 | validateLedger = new DeprecatedValidateLedger(); 38 | } 39 | 40 | private List createMockAssets(String assetId, int startAge, int endAge) { 41 | return IntStream.range(startAge, endAge + 1) 42 | .mapToObj( 43 | i -> { 44 | Asset asset = mock(Asset.class); 45 | when(asset.id()).thenReturn(assetId); 46 | when(asset.age()).thenReturn(i); 47 | when(asset.data()).thenReturn(JsonObject.EMPTY_JSON_OBJECT); 48 | return asset; 49 | }) 50 | .collect(Collectors.toList()); 51 | } 52 | 53 | @Test 54 | public void invoke_AgeGiven_ShouldReturnOneSpecifiedAssetOnly() { 55 | // Arrange 56 | JsonObject argument = 57 | Json.createObjectBuilder() 58 | .add(DeprecatedValidateLedger.ASSET_ID_KEY, SOME_ASSET_ID) 59 | .add(DeprecatedValidateLedger.AGE_KEY, SOME_AGE) 60 | .build(); 61 | List assets = createMockAssets(SOME_ASSET_ID, SOME_AGE, SOME_AGE); 62 | when(ledger.scan(any(AssetFilter.class))).thenReturn(assets); 63 | 64 | // Act 65 | JsonObject result = validateLedger.invoke(ledger, argument, Optional.empty()); 66 | 67 | // Assert 68 | AssetFilter expected = 69 | new AssetFilter(SOME_ASSET_ID) 70 | .withStartAge(SOME_AGE, true) 71 | .withEndAge(SOME_AGE, true) 72 | .withAgeOrder(AgeOrder.ASC); 73 | verify(ledger).scan(expected); 74 | assertThat(result.getJsonArray(SOME_ASSET_ID).size()).isEqualTo(1); 75 | assertThat( 76 | result 77 | .getJsonArray(SOME_ASSET_ID) 78 | .get(0) 79 | .asJsonObject() 80 | .getInt(DeprecatedValidateLedger.AGE_KEY)) 81 | .isEqualTo(assets.get(0).age()); 82 | } 83 | 84 | @Test 85 | public void invoke_StartAgeEndAgeGiven_ShouldReturnSpecifiedAssets() { 86 | // Arrange 87 | JsonObject argument = 88 | Json.createObjectBuilder() 89 | .add(DeprecatedValidateLedger.ASSET_ID_KEY, SOME_ASSET_ID) 90 | .add(DeprecatedValidateLedger.START_AGE_KEY, SOME_START_AGE) 91 | .add(DeprecatedValidateLedger.END_AGE_KEY, SOME_END_AGE) 92 | .build(); 93 | List assets = createMockAssets(SOME_ASSET_ID, SOME_START_AGE, SOME_END_AGE); 94 | when(ledger.scan(any(AssetFilter.class))).thenReturn(assets); 95 | 96 | // Act 97 | JsonObject result = validateLedger.invoke(ledger, argument, Optional.empty()); 98 | 99 | // Assert 100 | AssetFilter expected = 101 | new AssetFilter(SOME_ASSET_ID) 102 | .withStartAge(SOME_START_AGE, true) 103 | .withEndAge(SOME_END_AGE, true) 104 | .withAgeOrder(AgeOrder.ASC); 105 | verify(ledger).scan(expected); 106 | assertThat(result.getJsonArray(SOME_ASSET_ID).size()).isEqualTo(assets.size()); 107 | for (int i = 0; i < assets.size(); i++) { 108 | assertThat( 109 | result 110 | .getJsonArray(SOME_ASSET_ID) 111 | .get(i) 112 | .asJsonObject() 113 | .getInt(DeprecatedValidateLedger.AGE_KEY)) 114 | .isEqualTo(assets.get(i).age()); 115 | } 116 | } 117 | 118 | @Test 119 | public void invoke_OnlyAssetIdGiven_ShouldReturnAllAssets() { 120 | // Arrange 121 | JsonObject argument = 122 | Json.createObjectBuilder() 123 | .add(DeprecatedValidateLedger.ASSET_ID_KEY, SOME_ASSET_ID) 124 | .build(); 125 | // create some asset but it's not used for verification since the range is open 126 | List assets = createMockAssets(SOME_ASSET_ID, 0, 0); 127 | when(ledger.scan(any(AssetFilter.class))).thenReturn(assets); 128 | 129 | // Act 130 | validateLedger.invoke(ledger, argument, Optional.empty()); 131 | 132 | // Assert 133 | AssetFilter expected = 134 | new AssetFilter(SOME_ASSET_ID) 135 | .withStartAge(0, true) 136 | .withEndAge(Integer.MAX_VALUE, true) 137 | .withAgeOrder(AgeOrder.ASC); 138 | verify(ledger).scan(expected); 139 | } 140 | 141 | @Test 142 | public void invoke_AssetIdNotGiven_ShouldThrowContractContextException() { 143 | // Arrange 144 | JsonObject argument = 145 | Json.createObjectBuilder().add(DeprecatedValidateLedger.AGE_KEY, SOME_AGE).build(); 146 | 147 | // Act 148 | Throwable thrown = 149 | catchThrowable(() -> validateLedger.invoke(ledger, argument, Optional.empty())); 150 | 151 | // Assert 152 | assertThat(thrown).isExactlyInstanceOf(ContractContextException.class); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /licenses/APL-2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/LICENSE: -------------------------------------------------------------------------------- 1 | This software is dual-licensed under both the AGPL and a commercial license. 2 | You can be released from the requirements of the following AGPL license by 3 | purchasing a commercial license. For more information, please contact Scalar, Inc. 4 | 5 | 6 | GNU AFFERO GENERAL PUBLIC LICENSE 7 | Version 3, 19 November 2007 8 | 9 | Copyright (C) 2007 Free Software Foundation, Inc. 10 | Everyone is permitted to copy and distribute verbatim copies 11 | of this license document, but changing it is not allowed. 12 | 13 | Preamble 14 | 15 | The GNU Affero General Public License is a free, copyleft license for 16 | software and other kinds of works, specifically designed to ensure 17 | cooperation with the community in the case of network server software. 18 | 19 | The licenses for most software and other practical works are designed 20 | to take away your freedom to share and change the works. By contrast, 21 | our General Public Licenses are intended to guarantee your freedom to 22 | share and change all versions of a program--to make sure it remains free 23 | software for all its users. 24 | 25 | When we speak of free software, we are referring to freedom, not 26 | price. Our General Public Licenses are designed to make sure that you 27 | have the freedom to distribute copies of free software (and charge for 28 | them if you wish), that you receive source code or can get it if you 29 | want it, that you can change the software or use pieces of it in new 30 | free programs, and that you know you can do these things. 31 | 32 | Developers that use our General Public Licenses protect your rights 33 | with two steps: (1) assert copyright on the software, and (2) offer 34 | you this License which gives you legal permission to copy, distribute 35 | and/or modify the software. 36 | 37 | A secondary benefit of defending all users' freedom is that 38 | improvements made in alternate versions of the program, if they 39 | receive widespread use, become available for other developers to 40 | incorporate. Many developers of free software are heartened and 41 | encouraged by the resulting cooperation. However, in the case of 42 | software used on network servers, this result may fail to come about. 43 | The GNU General Public License permits making a modified version and 44 | letting the public access it on a server without ever releasing its 45 | source code to the public. 46 | 47 | The GNU Affero General Public License is designed specifically to 48 | ensure that, in such cases, the modified source code becomes available 49 | to the community. It requires the operator of a network server to 50 | provide the source code of the modified version running there to the 51 | users of that server. Therefore, public use of a modified version, on 52 | a publicly accessible server, gives the public access to the source 53 | code of the modified version. 54 | 55 | An older license, called the Affero General Public License and 56 | published by Affero, was designed to accomplish similar goals. This is 57 | a different license, not a version of the Affero GPL, but Affero has 58 | released a new version of the Affero GPL which permits relicensing under 59 | this license. 60 | 61 | The precise terms and conditions for copying, distribution and 62 | modification follow. 63 | 64 | TERMS AND CONDITIONS 65 | 66 | 0. Definitions. 67 | 68 | "This License" refers to version 3 of the GNU Affero General Public License. 69 | 70 | "Copyright" also means copyright-like laws that apply to other kinds of 71 | works, such as semiconductor masks. 72 | 73 | "The Program" refers to any copyrightable work licensed under this 74 | License. Each licensee is addressed as "you". "Licensees" and 75 | "recipients" may be individuals or organizations. 76 | 77 | To "modify" a work means to copy from or adapt all or part of the work 78 | in a fashion requiring copyright permission, other than the making of an 79 | exact copy. The resulting work is called a "modified version" of the 80 | earlier work or a work "based on" the earlier work. 81 | 82 | A "covered work" means either the unmodified Program or a work based 83 | on the Program. 84 | 85 | To "propagate" a work means to do anything with it that, without 86 | permission, would make you directly or secondarily liable for 87 | infringement under applicable copyright law, except executing it on a 88 | computer or modifying a private copy. Propagation includes copying, 89 | distribution (with or without modification), making available to the 90 | public, and in some countries other activities as well. 91 | 92 | To "convey" a work means any kind of propagation that enables other 93 | parties to make or receive copies. Mere interaction with a user through 94 | a computer network, with no transfer of a copy, is not conveying. 95 | 96 | An interactive user interface displays "Appropriate Legal Notices" 97 | to the extent that it includes a convenient and prominently visible 98 | feature that (1) displays an appropriate copyright notice, and (2) 99 | tells the user that there is no warranty for the work (except to the 100 | extent that warranties are provided), that licensees may convey the 101 | work under this License, and how to view a copy of this License. If 102 | the interface presents a list of user commands or options, such as a 103 | menu, a prominent item in the list meets this criterion. 104 | 105 | 1. Source Code. 106 | 107 | The "source code" for a work means the preferred form of the work 108 | for making modifications to it. "Object code" means any non-source 109 | form of a work. 110 | 111 | A "Standard Interface" means an interface that either is an official 112 | standard defined by a recognized standards body, or, in the case of 113 | interfaces specified for a particular programming language, one that 114 | is widely used among developers working in that language. 115 | 116 | The "System Libraries" of an executable work include anything, other 117 | than the work as a whole, that (a) is included in the normal form of 118 | packaging a Major Component, but which is not part of that Major 119 | Component, and (b) serves only to enable use of the work with that 120 | Major Component, or to implement a Standard Interface for which an 121 | implementation is available to the public in source code form. A 122 | "Major Component", in this context, means a major essential component 123 | (kernel, window system, and so on) of the specific operating system 124 | (if any) on which the executable work runs, or a compiler used to 125 | produce the work, or an object code interpreter used to run it. 126 | 127 | The "Corresponding Source" for a work in object code form means all 128 | the source code needed to generate, install, and (for an executable 129 | work) run the object code and to modify the work, including scripts to 130 | control those activities. However, it does not include the work's 131 | System Libraries, or general-purpose tools or generally available free 132 | programs which are used unmodified in performing those activities but 133 | which are not part of the work. For example, Corresponding Source 134 | includes interface definition files associated with source files for 135 | the work, and the source code for shared libraries and dynamically 136 | linked subprograms that the work is specifically designed to require, 137 | such as by intimate data communication or control flow between those 138 | subprograms and other parts of the work. 139 | 140 | The Corresponding Source need not include anything that users 141 | can regenerate automatically from other parts of the Corresponding 142 | Source. 143 | 144 | The Corresponding Source for a work in source code form is that 145 | same work. 146 | 147 | 2. Basic Permissions. 148 | 149 | All rights granted under this License are granted for the term of 150 | copyright on the Program, and are irrevocable provided the stated 151 | conditions are met. This License explicitly affirms your unlimited 152 | permission to run the unmodified Program. The output from running a 153 | covered work is covered by this License only if the output, given its 154 | content, constitutes a covered work. This License acknowledges your 155 | rights of fair use or other equivalent, as provided by copyright law. 156 | 157 | You may make, run and propagate covered works that you do not 158 | convey, without conditions so long as your license otherwise remains 159 | in force. You may convey covered works to others for the sole purpose 160 | of having them make modifications exclusively for you, or provide you 161 | with facilities for running those works, provided that you comply with 162 | the terms of this License in conveying all material for which you do 163 | not control copyright. Those thus making or running the covered works 164 | for you must do so exclusively on your behalf, under your direction 165 | and control, on terms that prohibit them from making any copies of 166 | your copyrighted material outside their relationship with you. 167 | 168 | Conveying under any other circumstances is permitted solely under 169 | the conditions stated below. Sublicensing is not allowed; section 10 170 | makes it unnecessary. 171 | 172 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 173 | 174 | No covered work shall be deemed part of an effective technological 175 | measure under any applicable law fulfilling obligations under article 176 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 177 | similar laws prohibiting or restricting circumvention of such 178 | measures. 179 | 180 | When you convey a covered work, you waive any legal power to forbid 181 | circumvention of technological measures to the extent such circumvention 182 | is effected by exercising rights under this License with respect to 183 | the covered work, and you disclaim any intention to limit operation or 184 | modification of the work as a means of enforcing, against the work's 185 | users, your or third parties' legal rights to forbid circumvention of 186 | technological measures. 187 | 188 | 4. Conveying Verbatim Copies. 189 | 190 | You may convey verbatim copies of the Program's source code as you 191 | receive it, in any medium, provided that you conspicuously and 192 | appropriately publish on each copy an appropriate copyright notice; 193 | keep intact all notices stating that this License and any 194 | non-permissive terms added in accord with section 7 apply to the code; 195 | keep intact all notices of the absence of any warranty; and give all 196 | recipients a copy of this License along with the Program. 197 | 198 | You may charge any price or no price for each copy that you convey, 199 | and you may offer support or warranty protection for a fee. 200 | 201 | 5. Conveying Modified Source Versions. 202 | 203 | You may convey a work based on the Program, or the modifications to 204 | produce it from the Program, in the form of source code under the 205 | terms of section 4, provided that you also meet all of these conditions: 206 | 207 | a) The work must carry prominent notices stating that you modified 208 | it, and giving a relevant date. 209 | 210 | b) The work must carry prominent notices stating that it is 211 | released under this License and any conditions added under section 212 | 7. This requirement modifies the requirement in section 4 to 213 | "keep intact all notices". 214 | 215 | c) You must license the entire work, as a whole, under this 216 | License to anyone who comes into possession of a copy. This 217 | License will therefore apply, along with any applicable section 7 218 | additional terms, to the whole of the work, and all its parts, 219 | regardless of how they are packaged. This License gives no 220 | permission to license the work in any other way, but it does not 221 | invalidate such permission if you have separately received it. 222 | 223 | d) If the work has interactive user interfaces, each must display 224 | Appropriate Legal Notices; however, if the Program has interactive 225 | interfaces that do not display Appropriate Legal Notices, your 226 | work need not make them do so. 227 | 228 | A compilation of a covered work with other separate and independent 229 | works, which are not by their nature extensions of the covered work, 230 | and which are not combined with it such as to form a larger program, 231 | in or on a volume of a storage or distribution medium, is called an 232 | "aggregate" if the compilation and its resulting copyright are not 233 | used to limit the access or legal rights of the compilation's users 234 | beyond what the individual works permit. Inclusion of a covered work 235 | in an aggregate does not cause this License to apply to the other 236 | parts of the aggregate. 237 | 238 | 6. Conveying Non-Source Forms. 239 | 240 | You may convey a covered work in object code form under the terms 241 | of sections 4 and 5, provided that you also convey the 242 | machine-readable Corresponding Source under the terms of this License, 243 | in one of these ways: 244 | 245 | a) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by the 247 | Corresponding Source fixed on a durable physical medium 248 | customarily used for software interchange. 249 | 250 | b) Convey the object code in, or embodied in, a physical product 251 | (including a physical distribution medium), accompanied by a 252 | written offer, valid for at least three years and valid for as 253 | long as you offer spare parts or customer support for that product 254 | model, to give anyone who possesses the object code either (1) a 255 | copy of the Corresponding Source for all the software in the 256 | product that is covered by this License, on a durable physical 257 | medium customarily used for software interchange, for a price no 258 | more than your reasonable cost of physically performing this 259 | conveying of source, or (2) access to copy the 260 | Corresponding Source from a network server at no charge. 261 | 262 | c) Convey individual copies of the object code with a copy of the 263 | written offer to provide the Corresponding Source. This 264 | alternative is allowed only occasionally and noncommercially, and 265 | only if you received the object code with such an offer, in accord 266 | with subsection 6b. 267 | 268 | d) Convey the object code by offering access from a designated 269 | place (gratis or for a charge), and offer equivalent access to the 270 | Corresponding Source in the same way through the same place at no 271 | further charge. You need not require recipients to copy the 272 | Corresponding Source along with the object code. If the place to 273 | copy the object code is a network server, the Corresponding Source 274 | may be on a different server (operated by you or a third party) 275 | that supports equivalent copying facilities, provided you maintain 276 | clear directions next to the object code saying where to find the 277 | Corresponding Source. Regardless of what server hosts the 278 | Corresponding Source, you remain obligated to ensure that it is 279 | available for as long as needed to satisfy these requirements. 280 | 281 | e) Convey the object code using peer-to-peer transmission, provided 282 | you inform other peers where the object code and Corresponding 283 | Source of the work are being offered to the general public at no 284 | charge under subsection 6d. 285 | 286 | A separable portion of the object code, whose source code is excluded 287 | from the Corresponding Source as a System Library, need not be 288 | included in conveying the object code work. 289 | 290 | A "User Product" is either (1) a "consumer product", which means any 291 | tangible personal property which is normally used for personal, family, 292 | or household purposes, or (2) anything designed or sold for incorporation 293 | into a dwelling. In determining whether a product is a consumer product, 294 | doubtful cases shall be resolved in favor of coverage. For a particular 295 | product received by a particular user, "normally used" refers to a 296 | typical or common use of that class of product, regardless of the status 297 | of the particular user or of the way in which the particular user 298 | actually uses, or expects or is expected to use, the product. A product 299 | is a consumer product regardless of whether the product has substantial 300 | commercial, industrial or non-consumer uses, unless such uses represent 301 | the only significant mode of use of the product. 302 | 303 | "Installation Information" for a User Product means any methods, 304 | procedures, authorization keys, or other information required to install 305 | and execute modified versions of a covered work in that User Product from 306 | a modified version of its Corresponding Source. The information must 307 | suffice to ensure that the continued functioning of the modified object 308 | code is in no case prevented or interfered with solely because 309 | modification has been made. 310 | 311 | If you convey an object code work under this section in, or with, or 312 | specifically for use in, a User Product, and the conveying occurs as 313 | part of a transaction in which the right of possession and use of the 314 | User Product is transferred to the recipient in perpetuity or for a 315 | fixed term (regardless of how the transaction is characterized), the 316 | Corresponding Source conveyed under this section must be accompanied 317 | by the Installation Information. But this requirement does not apply 318 | if neither you nor any third party retains the ability to install 319 | modified object code on the User Product (for example, the work has 320 | been installed in ROM). 321 | 322 | The requirement to provide Installation Information does not include a 323 | requirement to continue to provide support service, warranty, or updates 324 | for a work that has been modified or installed by the recipient, or for 325 | the User Product in which it has been modified or installed. Access to a 326 | network may be denied when the modification itself materially and 327 | adversely affects the operation of the network or violates the rules and 328 | protocols for communication across the network. 329 | 330 | Corresponding Source conveyed, and Installation Information provided, 331 | in accord with this section must be in a format that is publicly 332 | documented (and with an implementation available to the public in 333 | source code form), and must require no special password or key for 334 | unpacking, reading or copying. 335 | 336 | 7. Additional Terms. 337 | 338 | "Additional permissions" are terms that supplement the terms of this 339 | License by making exceptions from one or more of its conditions. 340 | Additional permissions that are applicable to the entire Program shall 341 | be treated as though they were included in this License, to the extent 342 | that they are valid under applicable law. If additional permissions 343 | apply only to part of the Program, that part may be used separately 344 | under those permissions, but the entire Program remains governed by 345 | this License without regard to the additional permissions. 346 | 347 | When you convey a copy of a covered work, you may at your option 348 | remove any additional permissions from that copy, or from any part of 349 | it. (Additional permissions may be written to require their own 350 | removal in certain cases when you modify the work.) You may place 351 | additional permissions on material, added by you to a covered work, 352 | for which you have or can give appropriate copyright permission. 353 | 354 | Notwithstanding any other provision of this License, for material you 355 | add to a covered work, you may (if authorized by the copyright holders of 356 | that material) supplement the terms of this License with terms: 357 | 358 | a) Disclaiming warranty or limiting liability differently from the 359 | terms of sections 15 and 16 of this License; or 360 | 361 | b) Requiring preservation of specified reasonable legal notices or 362 | author attributions in that material or in the Appropriate Legal 363 | Notices displayed by works containing it; or 364 | 365 | c) Prohibiting misrepresentation of the origin of that material, or 366 | requiring that modified versions of such material be marked in 367 | reasonable ways as different from the original version; or 368 | 369 | d) Limiting the use for publicity purposes of names of licensors or 370 | authors of the material; or 371 | 372 | e) Declining to grant rights under trademark law for use of some 373 | trade names, trademarks, or service marks; or 374 | 375 | f) Requiring indemnification of licensors and authors of that 376 | material by anyone who conveys the material (or modified versions of 377 | it) with contractual assumptions of liability to the recipient, for 378 | any liability that these contractual assumptions directly impose on 379 | those licensors and authors. 380 | 381 | All other non-permissive additional terms are considered "further 382 | restrictions" within the meaning of section 10. If the Program as you 383 | received it, or any part of it, contains a notice stating that it is 384 | governed by this License along with a term that is a further 385 | restriction, you may remove that term. If a license document contains 386 | a further restriction but permits relicensing or conveying under this 387 | License, you may add to a covered work material governed by the terms 388 | of that license document, provided that the further restriction does 389 | not survive such relicensing or conveying. 390 | 391 | If you add terms to a covered work in accord with this section, you 392 | must place, in the relevant source files, a statement of the 393 | additional terms that apply to those files, or a notice indicating 394 | where to find the applicable terms. 395 | 396 | Additional terms, permissive or non-permissive, may be stated in the 397 | form of a separately written license, or stated as exceptions; 398 | the above requirements apply either way. 399 | 400 | 8. Termination. 401 | 402 | You may not propagate or modify a covered work except as expressly 403 | provided under this License. Any attempt otherwise to propagate or 404 | modify it is void, and will automatically terminate your rights under 405 | this License (including any patent licenses granted under the third 406 | paragraph of section 11). 407 | 408 | However, if you cease all violation of this License, then your 409 | license from a particular copyright holder is reinstated (a) 410 | provisionally, unless and until the copyright holder explicitly and 411 | finally terminates your license, and (b) permanently, if the copyright 412 | holder fails to notify you of the violation by some reasonable means 413 | prior to 60 days after the cessation. 414 | 415 | Moreover, your license from a particular copyright holder is 416 | reinstated permanently if the copyright holder notifies you of the 417 | violation by some reasonable means, this is the first time you have 418 | received notice of violation of this License (for any work) from that 419 | copyright holder, and you cure the violation prior to 30 days after 420 | your receipt of the notice. 421 | 422 | Termination of your rights under this section does not terminate the 423 | licenses of parties who have received copies or rights from you under 424 | this License. If your rights have been terminated and not permanently 425 | reinstated, you do not qualify to receive new licenses for the same 426 | material under section 10. 427 | 428 | 9. Acceptance Not Required for Having Copies. 429 | 430 | You are not required to accept this License in order to receive or 431 | run a copy of the Program. Ancillary propagation of a covered work 432 | occurring solely as a consequence of using peer-to-peer transmission 433 | to receive a copy likewise does not require acceptance. However, 434 | nothing other than this License grants you permission to propagate or 435 | modify any covered work. These actions infringe copyright if you do 436 | not accept this License. Therefore, by modifying or propagating a 437 | covered work, you indicate your acceptance of this License to do so. 438 | 439 | 10. Automatic Licensing of Downstream Recipients. 440 | 441 | Each time you convey a covered work, the recipient automatically 442 | receives a license from the original licensors, to run, modify and 443 | propagate that work, subject to this License. You are not responsible 444 | for enforcing compliance by third parties with this License. 445 | 446 | An "entity transaction" is a transaction transferring control of an 447 | organization, or substantially all assets of one, or subdividing an 448 | organization, or merging organizations. If propagation of a covered 449 | work results from an entity transaction, each party to that 450 | transaction who receives a copy of the work also receives whatever 451 | licenses to the work the party's predecessor in interest had or could 452 | give under the previous paragraph, plus a right to possession of the 453 | Corresponding Source of the work from the predecessor in interest, if 454 | the predecessor has it or can get it with reasonable efforts. 455 | 456 | You may not impose any further restrictions on the exercise of the 457 | rights granted or affirmed under this License. For example, you may 458 | not impose a license fee, royalty, or other charge for exercise of 459 | rights granted under this License, and you may not initiate litigation 460 | (including a cross-claim or counterclaim in a lawsuit) alleging that 461 | any patent claim is infringed by making, using, selling, offering for 462 | sale, or importing the Program or any portion of it. 463 | 464 | 11. Patents. 465 | 466 | A "contributor" is a copyright holder who authorizes use under this 467 | License of the Program or a work on which the Program is based. The 468 | work thus licensed is called the contributor's "contributor version". 469 | 470 | A contributor's "essential patent claims" are all patent claims 471 | owned or controlled by the contributor, whether already acquired or 472 | hereafter acquired, that would be infringed by some manner, permitted 473 | by this License, of making, using, or selling its contributor version, 474 | but do not include claims that would be infringed only as a 475 | consequence of further modification of the contributor version. For 476 | purposes of this definition, "control" includes the right to grant 477 | patent sublicenses in a manner consistent with the requirements of 478 | this License. 479 | 480 | Each contributor grants you a non-exclusive, worldwide, royalty-free 481 | patent license under the contributor's essential patent claims, to 482 | make, use, sell, offer for sale, import and otherwise run, modify and 483 | propagate the contents of its contributor version. 484 | 485 | In the following three paragraphs, a "patent license" is any express 486 | agreement or commitment, however denominated, not to enforce a patent 487 | (such as an express permission to practice a patent or covenant not to 488 | sue for patent infringement). To "grant" such a patent license to a 489 | party means to make such an agreement or commitment not to enforce a 490 | patent against the party. 491 | 492 | If you convey a covered work, knowingly relying on a patent license, 493 | and the Corresponding Source of the work is not available for anyone 494 | to copy, free of charge and under the terms of this License, through a 495 | publicly available network server or other readily accessible means, 496 | then you must either (1) cause the Corresponding Source to be so 497 | available, or (2) arrange to deprive yourself of the benefit of the 498 | patent license for this particular work, or (3) arrange, in a manner 499 | consistent with the requirements of this License, to extend the patent 500 | license to downstream recipients. "Knowingly relying" means you have 501 | actual knowledge that, but for the patent license, your conveying the 502 | covered work in a country, or your recipient's use of the covered work 503 | in a country, would infringe one or more identifiable patents in that 504 | country that you have reason to believe are valid. 505 | 506 | If, pursuant to or in connection with a single transaction or 507 | arrangement, you convey, or propagate by procuring conveyance of, a 508 | covered work, and grant a patent license to some of the parties 509 | receiving the covered work authorizing them to use, propagate, modify 510 | or convey a specific copy of the covered work, then the patent license 511 | you grant is automatically extended to all recipients of the covered 512 | work and works based on it. 513 | 514 | A patent license is "discriminatory" if it does not include within 515 | the scope of its coverage, prohibits the exercise of, or is 516 | conditioned on the non-exercise of one or more of the rights that are 517 | specifically granted under this License. You may not convey a covered 518 | work if you are a party to an arrangement with a third party that is 519 | in the business of distributing software, under which you make payment 520 | to the third party based on the extent of your activity of conveying 521 | the work, and under which the third party grants, to any of the 522 | parties who would receive the covered work from you, a discriminatory 523 | patent license (a) in connection with copies of the covered work 524 | conveyed by you (or copies made from those copies), or (b) primarily 525 | for and in connection with specific products or compilations that 526 | contain the covered work, unless you entered into that arrangement, 527 | or that patent license was granted, prior to 28 March 2007. 528 | 529 | Nothing in this License shall be construed as excluding or limiting 530 | any implied license or other defenses to infringement that may 531 | otherwise be available to you under applicable patent law. 532 | 533 | 12. No Surrender of Others' Freedom. 534 | 535 | If conditions are imposed on you (whether by court order, agreement or 536 | otherwise) that contradict the conditions of this License, they do not 537 | excuse you from the conditions of this License. If you cannot convey a 538 | covered work so as to satisfy simultaneously your obligations under this 539 | License and any other pertinent obligations, then as a consequence you may 540 | not convey it at all. For example, if you agree to terms that obligate you 541 | to collect a royalty for further conveying from those to whom you convey 542 | the Program, the only way you could satisfy both those terms and this 543 | License would be to refrain entirely from conveying the Program. 544 | 545 | 13. Remote Network Interaction; Use with the GNU General Public License. 546 | 547 | Notwithstanding any other provision of this License, if you modify the 548 | Program, your modified version must prominently offer all users 549 | interacting with it remotely through a computer network (if your version 550 | supports such interaction) an opportunity to receive the Corresponding 551 | Source of your version by providing access to the Corresponding Source 552 | from a network server at no charge, through some standard or customary 553 | means of facilitating copying of software. This Corresponding Source 554 | shall include the Corresponding Source for any work covered by version 3 555 | of the GNU General Public License that is incorporated pursuant to the 556 | following paragraph. 557 | 558 | Notwithstanding any other provision of this License, you have 559 | permission to link or combine any covered work with a work licensed 560 | under version 3 of the GNU General Public License into a single 561 | combined work, and to convey the resulting work. The terms of this 562 | License will continue to apply to the part which is the covered work, 563 | but the work with which it is combined will remain governed by version 564 | 3 of the GNU General Public License. 565 | 566 | 14. Revised Versions of this License. 567 | 568 | The Free Software Foundation may publish revised and/or new versions of 569 | the GNU Affero General Public License from time to time. Such new versions 570 | will be similar in spirit to the present version, but may differ in detail to 571 | address new problems or concerns. 572 | 573 | Each version is given a distinguishing version number. If the 574 | Program specifies that a certain numbered version of the GNU Affero General 575 | Public License "or any later version" applies to it, you have the 576 | option of following the terms and conditions either of that numbered 577 | version or of any later version published by the Free Software 578 | Foundation. If the Program does not specify a version number of the 579 | GNU Affero General Public License, you may choose any version ever published 580 | by the Free Software Foundation. 581 | 582 | If the Program specifies that a proxy can decide which future 583 | versions of the GNU Affero General Public License can be used, that proxy's 584 | public statement of acceptance of a version permanently authorizes you 585 | to choose that version for the Program. 586 | 587 | Later license versions may give you additional or different 588 | permissions. However, no additional obligations are imposed on any 589 | author or copyright holder as a result of your choosing to follow a 590 | later version. 591 | 592 | 15. Disclaimer of Warranty. 593 | 594 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 595 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 596 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 597 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 598 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 599 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 600 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 601 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 602 | 603 | 16. Limitation of Liability. 604 | 605 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 606 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 607 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 608 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 609 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 610 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 611 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 612 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 613 | SUCH DAMAGES. 614 | 615 | 17. Interpretation of Sections 15 and 16. 616 | 617 | If the disclaimer of warranty and limitation of liability provided 618 | above cannot be given local legal effect according to their terms, 619 | reviewing courts shall apply local law that most closely approximates 620 | an absolute waiver of all civil liability in connection with the 621 | Program, unless a warranty or assumption of liability accompanies a 622 | copy of the Program in return for a fee. 623 | 624 | END OF TERMS AND CONDITIONS 625 | 626 | How to Apply These Terms to Your New Programs 627 | 628 | If you develop a new program, and you want it to be of the greatest 629 | possible use to the public, the best way to achieve this is to make it 630 | free software which everyone can redistribute and change under these terms. 631 | 632 | To do so, attach the following notices to the program. It is safest 633 | to attach them to the start of each source file to most effectively 634 | state the exclusion of warranty; and each file should have at least 635 | the "copyright" line and a pointer to where the full notice is found. 636 | 637 | 638 | Copyright (C) 639 | 640 | This program is free software: you can redistribute it and/or modify 641 | it under the terms of the GNU Affero General Public License as published 642 | by the Free Software Foundation, either version 3 of the License, or 643 | (at your option) any later version. 644 | 645 | This program is distributed in the hope that it will be useful, 646 | but WITHOUT ANY WARRANTY; without even the implied warranty of 647 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 648 | GNU Affero General Public License for more details. 649 | 650 | You should have received a copy of the GNU Affero General Public License 651 | along with this program. If not, see . 652 | 653 | Also add information on how to contact you by electronic and paper mail. 654 | 655 | If your software can interact with users remotely through a computer 656 | network, you should also make sure that it provides a way for users to 657 | get its source. For example, if your program is a web application, its 658 | interface could display a "Source" link that leads users to an archive 659 | of the code. There are many ways you could offer source, and different 660 | solutions will be better for different programs; see section 13 for the 661 | specific requirements. 662 | 663 | You should also get your employer (if you work as a programmer) or school, 664 | if any, to sign a "copyright disclaimer" for the program, if necessary. 665 | For more information on this, and how to apply and follow the GNU AGPL, see 666 | . 667 | -------------------------------------------------------------------------------- /licenses/jsonp.txt: -------------------------------------------------------------------------------- 1 | COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 2 | 3 | 1. Definitions. 4 | 5 | 1.1. "Contributor" means each individual or entity that creates or 6 | contributes to the creation of Modifications. 7 | 8 | 1.2. "Contributor Version" means the combination of the Original 9 | Software, prior Modifications used by a Contributor (if any), and 10 | the Modifications made by that particular Contributor. 11 | 12 | 1.3. "Covered Software" means (a) the Original Software, or (b) 13 | Modifications, or (c) the combination of files containing Original 14 | Software with files containing Modifications, in each case including 15 | portions thereof. 16 | 17 | 1.4. "Executable" means the Covered Software in any form other than 18 | Source Code. 19 | 20 | 1.5. "Initial Developer" means the individual or entity that first 21 | makes Original Software available under this License. 22 | 23 | 1.6. "Larger Work" means a work which combines Covered Software or 24 | portions thereof with code not governed by the terms of this License. 25 | 26 | 1.7. "License" means this document. 27 | 28 | 1.8. "Licensable" means having the right to grant, to the maximum 29 | extent possible, whether at the time of the initial grant or 30 | subsequently acquired, any and all of the rights conveyed herein. 31 | 32 | 1.9. "Modifications" means the Source Code and Executable form of 33 | any of the following: 34 | 35 | A. Any file that results from an addition to, deletion from or 36 | modification of the contents of a file containing Original Software 37 | or previous Modifications; 38 | 39 | B. Any new file that contains any part of the Original Software or 40 | previous Modification; or 41 | 42 | C. Any new file that is contributed or otherwise made available 43 | under the terms of this License. 44 | 45 | 1.10. "Original Software" means the Source Code and Executable form 46 | of computer software code that is originally released under this 47 | License. 48 | 49 | 1.11. "Patent Claims" means any patent claim(s), now owned or 50 | hereafter acquired, including without limitation, method, process, 51 | and apparatus claims, in any patent Licensable by grantor. 52 | 53 | 1.12. "Source Code" means (a) the common form of computer software 54 | code in which modifications are made and (b) associated 55 | documentation included in or with such code. 56 | 57 | 1.13. "You" (or "Your") means an individual or a legal entity 58 | exercising rights under, and complying with all of the terms of, 59 | this License. For legal entities, "You" includes any entity which 60 | controls, is controlled by, or is under common control with You. For 61 | purposes of this definition, "control" means (a) the power, direct 62 | or indirect, to cause the direction or management of such entity, 63 | whether by contract or otherwise, or (b) ownership of more than 64 | fifty percent (50%) of the outstanding shares or beneficial 65 | ownership of such entity. 66 | 67 | 2. License Grants. 68 | 69 | 2.1. The Initial Developer Grant. 70 | 71 | Conditioned upon Your compliance with Section 3.1 below and subject 72 | to third party intellectual property claims, the Initial Developer 73 | hereby grants You a world-wide, royalty-free, non-exclusive license: 74 | 75 | (a) under intellectual property rights (other than patent or 76 | trademark) Licensable by Initial Developer, to use, reproduce, 77 | modify, display, perform, sublicense and distribute the Original 78 | Software (or portions thereof), with or without Modifications, 79 | and/or as part of a Larger Work; and 80 | 81 | (b) under Patent Claims infringed by the making, using or selling of 82 | Original Software, to make, have made, use, practice, sell, and 83 | offer for sale, and/or otherwise dispose of the Original Software 84 | (or portions thereof). 85 | 86 | (c) The licenses granted in Sections 2.1(a) and (b) are effective on 87 | the date Initial Developer first distributes or otherwise makes the 88 | Original Software available to a third party under the terms of this 89 | License. 90 | 91 | (d) Notwithstanding Section 2.1(b) above, no patent license is 92 | granted: (1) for code that You delete from the Original Software, or 93 | (2) for infringements caused by: (i) the modification of the 94 | Original Software, or (ii) the combination of the Original Software 95 | with other software or devices. 96 | 97 | 2.2. Contributor Grant. 98 | 99 | Conditioned upon Your compliance with Section 3.1 below and subject 100 | to third party intellectual property claims, each Contributor hereby 101 | grants You a world-wide, royalty-free, non-exclusive license: 102 | 103 | (a) under intellectual property rights (other than patent or 104 | trademark) Licensable by Contributor to use, reproduce, modify, 105 | display, perform, sublicense and distribute the Modifications 106 | created by such Contributor (or portions thereof), either on an 107 | unmodified basis, with other Modifications, as Covered Software 108 | and/or as part of a Larger Work; and 109 | 110 | (b) under Patent Claims infringed by the making, using, or selling 111 | of Modifications made by that Contributor either alone and/or in 112 | combination with its Contributor Version (or portions of such 113 | combination), to make, use, sell, offer for sale, have made, and/or 114 | otherwise dispose of: (1) Modifications made by that Contributor (or 115 | portions thereof); and (2) the combination of Modifications made by 116 | that Contributor with its Contributor Version (or portions of such 117 | combination). 118 | 119 | (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective 120 | on the date Contributor first distributes or otherwise makes the 121 | Modifications available to a third party. 122 | 123 | (d) Notwithstanding Section 2.2(b) above, no patent license is 124 | granted: (1) for any code that Contributor has deleted from the 125 | Contributor Version; (2) for infringements caused by: (i) third 126 | party modifications of Contributor Version, or (ii) the combination 127 | of Modifications made by that Contributor with other software 128 | (except as part of the Contributor Version) or other devices; or (3) 129 | under Patent Claims infringed by Covered Software in the absence of 130 | Modifications made by that Contributor. 131 | 132 | 3. Distribution Obligations. 133 | 134 | 3.1. Availability of Source Code. 135 | 136 | Any Covered Software that You distribute or otherwise make available 137 | in Executable form must also be made available in Source Code form 138 | and that Source Code form must be distributed only under the terms 139 | of this License. You must include a copy of this License with every 140 | copy of the Source Code form of the Covered Software You distribute 141 | or otherwise make available. You must inform recipients of any such 142 | Covered Software in Executable form as to how they can obtain such 143 | Covered Software in Source Code form in a reasonable manner on or 144 | through a medium customarily used for software exchange. 145 | 146 | 3.2. Modifications. 147 | 148 | The Modifications that You create or to which You contribute are 149 | governed by the terms of this License. You represent that You 150 | believe Your Modifications are Your original creation(s) and/or You 151 | have sufficient rights to grant the rights conveyed by this License. 152 | 153 | 3.3. Required Notices. 154 | 155 | You must include a notice in each of Your Modifications that 156 | identifies You as the Contributor of the Modification. You may not 157 | remove or alter any copyright, patent or trademark notices contained 158 | within the Covered Software, or any notices of licensing or any 159 | descriptive text giving attribution to any Contributor or the 160 | Initial Developer. 161 | 162 | 3.4. Application of Additional Terms. 163 | 164 | You may not offer or impose any terms on any Covered Software in 165 | Source Code form that alters or restricts the applicable version of 166 | this License or the recipients' rights hereunder. You may choose to 167 | offer, and to charge a fee for, warranty, support, indemnity or 168 | liability obligations to one or more recipients of Covered Software. 169 | However, you may do so only on Your own behalf, and not on behalf of 170 | the Initial Developer or any Contributor. You must make it 171 | absolutely clear that any such warranty, support, indemnity or 172 | liability obligation is offered by You alone, and You hereby agree 173 | to indemnify the Initial Developer and every Contributor for any 174 | liability incurred by the Initial Developer or such Contributor as a 175 | result of warranty, support, indemnity or liability terms You offer. 176 | 177 | 3.5. Distribution of Executable Versions. 178 | 179 | You may distribute the Executable form of the Covered Software under 180 | the terms of this License or under the terms of a license of Your 181 | choice, which may contain terms different from this License, 182 | provided that You are in compliance with the terms of this License 183 | and that the license for the Executable form does not attempt to 184 | limit or alter the recipient's rights in the Source Code form from 185 | the rights set forth in this License. If You distribute the Covered 186 | Software in Executable form under a different license, You must make 187 | it absolutely clear that any terms which differ from this License 188 | are offered by You alone, not by the Initial Developer or 189 | Contributor. You hereby agree to indemnify the Initial Developer and 190 | every Contributor for any liability incurred by the Initial 191 | Developer or such Contributor as a result of any such terms You offer. 192 | 193 | 3.6. Larger Works. 194 | 195 | You may create a Larger Work by combining Covered Software with 196 | other code not governed by the terms of this License and distribute 197 | the Larger Work as a single product. In such a case, You must make 198 | sure the requirements of this License are fulfilled for the Covered 199 | Software. 200 | 201 | 4. Versions of the License. 202 | 203 | 4.1. New Versions. 204 | 205 | Oracle is the initial license steward and may publish revised and/or 206 | new versions of this License from time to time. Each version will be 207 | given a distinguishing version number. Except as provided in Section 208 | 4.3, no one other than the license steward has the right to modify 209 | this License. 210 | 211 | 4.2. Effect of New Versions. 212 | 213 | You may always continue to use, distribute or otherwise make the 214 | Covered Software available under the terms of the version of the 215 | License under which You originally received the Covered Software. If 216 | the Initial Developer includes a notice in the Original Software 217 | prohibiting it from being distributed or otherwise made available 218 | under any subsequent version of the License, You must distribute and 219 | make the Covered Software available under the terms of the version 220 | of the License under which You originally received the Covered 221 | Software. Otherwise, You may also choose to use, distribute or 222 | otherwise make the Covered Software available under the terms of any 223 | subsequent version of the License published by the license steward. 224 | 225 | 4.3. Modified Versions. 226 | 227 | When You are an Initial Developer and You want to create a new 228 | license for Your Original Software, You may create and use a 229 | modified version of this License if You: (a) rename the license and 230 | remove any references to the name of the license steward (except to 231 | note that the license differs from this License); and (b) otherwise 232 | make it clear that the license contains terms which differ from this 233 | License. 234 | 235 | 5. DISCLAIMER OF WARRANTY. 236 | 237 | COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, 238 | WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 239 | INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE 240 | IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR 241 | NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF 242 | THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE 243 | DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY 244 | OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, 245 | REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN 246 | ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS 247 | AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 248 | 249 | 6. TERMINATION. 250 | 251 | 6.1. This License and the rights granted hereunder will terminate 252 | automatically if You fail to comply with terms herein and fail to 253 | cure such breach within 30 days of becoming aware of the breach. 254 | Provisions which, by their nature, must remain in effect beyond the 255 | termination of this License shall survive. 256 | 257 | 6.2. If You assert a patent infringement claim (excluding 258 | declaratory judgment actions) against Initial Developer or a 259 | Contributor (the Initial Developer or Contributor against whom You 260 | assert such claim is referred to as "Participant") alleging that the 261 | Participant Software (meaning the Contributor Version where the 262 | Participant is a Contributor or the Original Software where the 263 | Participant is the Initial Developer) directly or indirectly 264 | infringes any patent, then any and all rights granted directly or 265 | indirectly to You by such Participant, the Initial Developer (if the 266 | Initial Developer is not the Participant) and all Contributors under 267 | Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice 268 | from Participant terminate prospectively and automatically at the 269 | expiration of such 60 day notice period, unless if within such 60 270 | day period You withdraw Your claim with respect to the Participant 271 | Software against such Participant either unilaterally or pursuant to 272 | a written agreement with Participant. 273 | 274 | 6.3. If You assert a patent infringement claim against Participant 275 | alleging that the Participant Software directly or indirectly 276 | infringes any patent where such claim is resolved (such as by 277 | license or settlement) prior to the initiation of patent 278 | infringement litigation, then the reasonable value of the licenses 279 | granted by such Participant under Sections 2.1 or 2.2 shall be taken 280 | into account in determining the amount or value of any payment or 281 | license. 282 | 283 | 6.4. In the event of termination under Sections 6.1 or 6.2 above, 284 | all end user licenses that have been validly granted by You or any 285 | distributor hereunder prior to termination (excluding licenses 286 | granted to You by any distributor) shall survive termination. 287 | 288 | 7. LIMITATION OF LIABILITY. 289 | 290 | UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT 291 | (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE 292 | INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF 293 | COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE 294 | TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR 295 | CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT 296 | LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER 297 | FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR 298 | LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE 299 | POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT 300 | APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH 301 | PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH 302 | LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR 303 | LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION 304 | AND LIMITATION MAY NOT APPLY TO YOU. 305 | 306 | 8. U.S. GOVERNMENT END USERS. 307 | 308 | The Covered Software is a "commercial item," as that term is defined 309 | in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer 310 | software" (as that term is defined at 48 C.F.R. § 311 | 252.227-7014(a)(1)) and "commercial computer software documentation" 312 | as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent 313 | with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 314 | (June 1995), all U.S. Government End Users acquire Covered Software 315 | with only those rights set forth herein. This U.S. Government Rights 316 | clause is in lieu of, and supersedes, any other FAR, DFAR, or other 317 | clause or provision that addresses Government rights in computer 318 | software under this License. 319 | 320 | 9. MISCELLANEOUS. 321 | 322 | This License represents the complete agreement concerning subject 323 | matter hereof. If any provision of this License is held to be 324 | unenforceable, such provision shall be reformed only to the extent 325 | necessary to make it enforceable. This License shall be governed by 326 | the law of the jurisdiction specified in a notice contained within 327 | the Original Software (except to the extent applicable law, if any, 328 | provides otherwise), excluding such jurisdiction's conflict-of-law 329 | provisions. Any litigation relating to this License shall be subject 330 | to the jurisdiction of the courts located in the jurisdiction and 331 | venue specified in a notice contained within the Original Software, 332 | with the losing party responsible for costs, including, without 333 | limitation, court costs and reasonable attorneys' fees and expenses. 334 | The application of the United Nations Convention on Contracts for 335 | the International Sale of Goods is expressly excluded. Any law or 336 | regulation which provides that the language of a contract shall be 337 | construed against the drafter shall not apply to this License. You 338 | agree that You alone are responsible for compliance with the United 339 | States export administration regulations (and the export control 340 | laws and regulation of any other countries) when You use, distribute 341 | or otherwise make available any Covered Software. 342 | 343 | 10. RESPONSIBILITY FOR CLAIMS. 344 | 345 | As between Initial Developer and the Contributors, each party is 346 | responsible for claims and damages arising, directly or indirectly, 347 | out of its utilization of rights under this License and You agree to 348 | work with Initial Developer and Contributors to distribute such 349 | responsibility on an equitable basis. Nothing herein is intended or 350 | shall be deemed to constitute any admission of liability. 351 | 352 | ------------------------------------------------------------------------ 353 | 354 | NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION 355 | LICENSE (CDDL) 356 | 357 | The code released under the CDDL shall be governed by the laws of the 358 | State of California (excluding conflict-of-law provisions). Any 359 | litigation relating to this License shall be subject to the jurisdiction 360 | of the Federal Courts of the Northern District of California and the 361 | state courts of the State of California, with venue lying in Santa Clara 362 | County, California. 363 | 364 | 365 | 366 | The GNU General Public License (GPL) Version 2, June 1991 367 | 368 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 369 | 51 Franklin Street, Fifth Floor 370 | Boston, MA 02110-1335 371 | USA 372 | 373 | Everyone is permitted to copy and distribute verbatim copies 374 | of this license document, but changing it is not allowed. 375 | 376 | Preamble 377 | 378 | The licenses for most software are designed to take away your freedom to 379 | share and change it. By contrast, the GNU General Public License is 380 | intended to guarantee your freedom to share and change free software--to 381 | make sure the software is free for all its users. This General Public 382 | License applies to most of the Free Software Foundation's software and 383 | to any other program whose authors commit to using it. (Some other Free 384 | Software Foundation software is covered by the GNU Library General 385 | Public License instead.) You can apply it to your programs, too. 386 | 387 | When we speak of free software, we are referring to freedom, not price. 388 | Our General Public Licenses are designed to make sure that you have the 389 | freedom to distribute copies of free software (and charge for this 390 | service if you wish), that you receive source code or can get it if you 391 | want it, that you can change the software or use pieces of it in new 392 | free programs; and that you know you can do these things. 393 | 394 | To protect your rights, we need to make restrictions that forbid anyone 395 | to deny you these rights or to ask you to surrender the rights. These 396 | restrictions translate to certain responsibilities for you if you 397 | distribute copies of the software, or if you modify it. 398 | 399 | For example, if you distribute copies of such a program, whether gratis 400 | or for a fee, you must give the recipients all the rights that you have. 401 | You must make sure that they, too, receive or can get the source code. 402 | And you must show them these terms so they know their rights. 403 | 404 | We protect your rights with two steps: (1) copyright the software, and 405 | (2) offer you this license which gives you legal permission to copy, 406 | distribute and/or modify the software. 407 | 408 | Also, for each author's protection and ours, we want to make certain 409 | that everyone understands that there is no warranty for this free 410 | software. If the software is modified by someone else and passed on, we 411 | want its recipients to know that what they have is not the original, so 412 | that any problems introduced by others will not reflect on the original 413 | authors' reputations. 414 | 415 | Finally, any free program is threatened constantly by software patents. 416 | We wish to avoid the danger that redistributors of a free program will 417 | individually obtain patent licenses, in effect making the program 418 | proprietary. To prevent this, we have made it clear that any patent must 419 | be licensed for everyone's free use or not licensed at all. 420 | 421 | The precise terms and conditions for copying, distribution and 422 | modification follow. 423 | 424 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 425 | 426 | 0. This License applies to any program or other work which contains a 427 | notice placed by the copyright holder saying it may be distributed under 428 | the terms of this General Public License. The "Program", below, refers 429 | to any such program or work, and a "work based on the Program" means 430 | either the Program or any derivative work under copyright law: that is 431 | to say, a work containing the Program or a portion of it, either 432 | verbatim or with modifications and/or translated into another language. 433 | (Hereinafter, translation is included without limitation in the term 434 | "modification".) Each licensee is addressed as "you". 435 | 436 | Activities other than copying, distribution and modification are not 437 | covered by this License; they are outside its scope. The act of running 438 | the Program is not restricted, and the output from the Program is 439 | covered only if its contents constitute a work based on the Program 440 | (independent of having been made by running the Program). Whether that 441 | is true depends on what the Program does. 442 | 443 | 1. You may copy and distribute verbatim copies of the Program's source 444 | code as you receive it, in any medium, provided that you conspicuously 445 | and appropriately publish on each copy an appropriate copyright notice 446 | and disclaimer of warranty; keep intact all the notices that refer to 447 | this License and to the absence of any warranty; and give any other 448 | recipients of the Program a copy of this License along with the Program. 449 | 450 | You may charge a fee for the physical act of transferring a copy, and 451 | you may at your option offer warranty protection in exchange for a fee. 452 | 453 | 2. You may modify your copy or copies of the Program or any portion of 454 | it, thus forming a work based on the Program, and copy and distribute 455 | such modifications or work under the terms of Section 1 above, provided 456 | that you also meet all of these conditions: 457 | 458 | a) You must cause the modified files to carry prominent notices 459 | stating that you changed the files and the date of any change. 460 | 461 | b) You must cause any work that you distribute or publish, that in 462 | whole or in part contains or is derived from the Program or any part 463 | thereof, to be licensed as a whole at no charge to all third parties 464 | under the terms of this License. 465 | 466 | c) If the modified program normally reads commands interactively 467 | when run, you must cause it, when started running for such 468 | interactive use in the most ordinary way, to print or display an 469 | announcement including an appropriate copyright notice and a notice 470 | that there is no warranty (or else, saying that you provide a 471 | warranty) and that users may redistribute the program under these 472 | conditions, and telling the user how to view a copy of this License. 473 | (Exception: if the Program itself is interactive but does not 474 | normally print such an announcement, your work based on the Program 475 | is not required to print an announcement.) 476 | 477 | These requirements apply to the modified work as a whole. If 478 | identifiable sections of that work are not derived from the Program, and 479 | can be reasonably considered independent and separate works in 480 | themselves, then this License, and its terms, do not apply to those 481 | sections when you distribute them as separate works. But when you 482 | distribute the same sections as part of a whole which is a work based on 483 | the Program, the distribution of the whole must be on the terms of this 484 | License, whose permissions for other licensees extend to the entire 485 | whole, and thus to each and every part regardless of who wrote it. 486 | 487 | Thus, it is not the intent of this section to claim rights or contest 488 | your rights to work written entirely by you; rather, the intent is to 489 | exercise the right to control the distribution of derivative or 490 | collective works based on the Program. 491 | 492 | In addition, mere aggregation of another work not based on the Program 493 | with the Program (or with a work based on the Program) on a volume of a 494 | storage or distribution medium does not bring the other work under the 495 | scope of this License. 496 | 497 | 3. You may copy and distribute the Program (or a work based on it, 498 | under Section 2) in object code or executable form under the terms of 499 | Sections 1 and 2 above provided that you also do one of the following: 500 | 501 | a) Accompany it with the complete corresponding machine-readable 502 | source code, which must be distributed under the terms of Sections 1 503 | and 2 above on a medium customarily used for software interchange; or, 504 | 505 | b) Accompany it with a written offer, valid for at least three 506 | years, to give any third party, for a charge no more than your cost 507 | of physically performing source distribution, a complete 508 | machine-readable copy of the corresponding source code, to be 509 | distributed under the terms of Sections 1 and 2 above on a medium 510 | customarily used for software interchange; or, 511 | 512 | c) Accompany it with the information you received as to the offer to 513 | distribute corresponding source code. (This alternative is allowed 514 | only for noncommercial distribution and only if you received the 515 | program in object code or executable form with such an offer, in 516 | accord with Subsection b above.) 517 | 518 | The source code for a work means the preferred form of the work for 519 | making modifications to it. For an executable work, complete source code 520 | means all the source code for all modules it contains, plus any 521 | associated interface definition files, plus the scripts used to control 522 | compilation and installation of the executable. However, as a special 523 | exception, the source code distributed need not include anything that is 524 | normally distributed (in either source or binary form) with the major 525 | components (compiler, kernel, and so on) of the operating system on 526 | which the executable runs, unless that component itself accompanies the 527 | executable. 528 | 529 | If distribution of executable or object code is made by offering access 530 | to copy from a designated place, then offering equivalent access to copy 531 | the source code from the same place counts as distribution of the source 532 | code, even though third parties are not compelled to copy the source 533 | along with the object code. 534 | 535 | 4. You may not copy, modify, sublicense, or distribute the Program 536 | except as expressly provided under this License. Any attempt otherwise 537 | to copy, modify, sublicense or distribute the Program is void, and will 538 | automatically terminate your rights under this License. However, parties 539 | who have received copies, or rights, from you under this License will 540 | not have their licenses terminated so long as such parties remain in 541 | full compliance. 542 | 543 | 5. You are not required to accept this License, since you have not 544 | signed it. However, nothing else grants you permission to modify or 545 | distribute the Program or its derivative works. These actions are 546 | prohibited by law if you do not accept this License. Therefore, by 547 | modifying or distributing the Program (or any work based on the 548 | Program), you indicate your acceptance of this License to do so, and all 549 | its terms and conditions for copying, distributing or modifying the 550 | Program or works based on it. 551 | 552 | 6. Each time you redistribute the Program (or any work based on the 553 | Program), the recipient automatically receives a license from the 554 | original licensor to copy, distribute or modify the Program subject to 555 | these terms and conditions. You may not impose any further restrictions 556 | on the recipients' exercise of the rights granted herein. You are not 557 | responsible for enforcing compliance by third parties to this License. 558 | 559 | 7. If, as a consequence of a court judgment or allegation of patent 560 | infringement or for any other reason (not limited to patent issues), 561 | conditions are imposed on you (whether by court order, agreement or 562 | otherwise) that contradict the conditions of this License, they do not 563 | excuse you from the conditions of this License. If you cannot distribute 564 | so as to satisfy simultaneously your obligations under this License and 565 | any other pertinent obligations, then as a consequence you may not 566 | distribute the Program at all. For example, if a patent license would 567 | not permit royalty-free redistribution of the Program by all those who 568 | receive copies directly or indirectly through you, then the only way you 569 | could satisfy both it and this License would be to refrain entirely from 570 | distribution of the Program. 571 | 572 | If any portion of this section is held invalid or unenforceable under 573 | any particular circumstance, the balance of the section is intended to 574 | apply and the section as a whole is intended to apply in other 575 | circumstances. 576 | 577 | It is not the purpose of this section to induce you to infringe any 578 | patents or other property right claims or to contest validity of any 579 | such claims; this section has the sole purpose of protecting the 580 | integrity of the free software distribution system, which is implemented 581 | by public license practices. Many people have made generous 582 | contributions to the wide range of software distributed through that 583 | system in reliance on consistent application of that system; it is up to 584 | the author/donor to decide if he or she is willing to distribute 585 | software through any other system and a licensee cannot impose that choice. 586 | 587 | This section is intended to make thoroughly clear what is believed to be 588 | a consequence of the rest of this License. 589 | 590 | 8. If the distribution and/or use of the Program is restricted in 591 | certain countries either by patents or by copyrighted interfaces, the 592 | original copyright holder who places the Program under this License may 593 | add an explicit geographical distribution limitation excluding those 594 | countries, so that distribution is permitted only in or among countries 595 | not thus excluded. In such case, this License incorporates the 596 | limitation as if written in the body of this License. 597 | 598 | 9. The Free Software Foundation may publish revised and/or new 599 | versions of the General Public License from time to time. Such new 600 | versions will be similar in spirit to the present version, but may 601 | differ in detail to address new problems or concerns. 602 | 603 | Each version is given a distinguishing version number. If the Program 604 | specifies a version number of this License which applies to it and "any 605 | later version", you have the option of following the terms and 606 | conditions either of that version or of any later version published by 607 | the Free Software Foundation. If the Program does not specify a version 608 | number of this License, you may choose any version ever published by the 609 | Free Software Foundation. 610 | 611 | 10. If you wish to incorporate parts of the Program into other free 612 | programs whose distribution conditions are different, write to the 613 | author to ask for permission. For software which is copyrighted by the 614 | Free Software Foundation, write to the Free Software Foundation; we 615 | sometimes make exceptions for this. Our decision will be guided by the 616 | two goals of preserving the free status of all derivatives of our free 617 | software and of promoting the sharing and reuse of software generally. 618 | 619 | NO WARRANTY 620 | 621 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO 622 | WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 623 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 624 | OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, 625 | EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 626 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE 627 | ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH 628 | YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL 629 | NECESSARY SERVICING, REPAIR OR CORRECTION. 630 | 631 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 632 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 633 | AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR 634 | DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL 635 | DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM 636 | (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED 637 | INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF 638 | THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR 639 | OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 640 | 641 | END OF TERMS AND CONDITIONS 642 | 643 | How to Apply These Terms to Your New Programs 644 | 645 | If you develop a new program, and you want it to be of the greatest 646 | possible use to the public, the best way to achieve this is to make it 647 | free software which everyone can redistribute and change under these terms. 648 | 649 | To do so, attach the following notices to the program. It is safest to 650 | attach them to the start of each source file to most effectively convey 651 | the exclusion of warranty; and each file should have at least the 652 | "copyright" line and a pointer to where the full notice is found. 653 | 654 | One line to give the program's name and a brief idea of what it does. 655 | Copyright (C) 656 | 657 | This program is free software; you can redistribute it and/or modify 658 | it under the terms of the GNU General Public License as published by 659 | the Free Software Foundation; either version 2 of the License, or 660 | (at your option) any later version. 661 | 662 | This program is distributed in the hope that it will be useful, but 663 | WITHOUT ANY WARRANTY; without even the implied warranty of 664 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 665 | General Public License for more details. 666 | 667 | You should have received a copy of the GNU General Public License 668 | along with this program; if not, write to the Free Software 669 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 670 | 671 | Also add information on how to contact you by electronic and paper mail. 672 | 673 | If the program is interactive, make it output a short notice like this 674 | when it starts in an interactive mode: 675 | 676 | Gnomovision version 69, Copyright (C) year name of author 677 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type 678 | `show w'. This is free software, and you are welcome to redistribute 679 | it under certain conditions; type `show c' for details. 680 | 681 | The hypothetical commands `show w' and `show c' should show the 682 | appropriate parts of the General Public License. Of course, the commands 683 | you use may be called something other than `show w' and `show c'; they 684 | could even be mouse-clicks or menu items--whatever suits your program. 685 | 686 | You should also get your employer (if you work as a programmer) or your 687 | school, if any, to sign a "copyright disclaimer" for the program, if 688 | necessary. Here is a sample; alter the names: 689 | 690 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 691 | program `Gnomovision' (which makes passes at compilers) written by 692 | James Hacker. 693 | 694 | signature of Ty Coon, 1 April 1989 695 | Ty Coon, President of Vice 696 | 697 | This General Public License does not permit incorporating your program 698 | into proprietary programs. If your program is a subroutine library, you 699 | may consider it more useful to permit linking proprietary applications 700 | with the library. If this is what you want to do, use the GNU Library 701 | General Public License instead of this License. 702 | 703 | # 704 | 705 | Certain source files distributed by Oracle America, Inc. and/or its 706 | affiliates are subject to the following clarification and special 707 | exception to the GPLv2, based on the GNU Project exception for its 708 | Classpath libraries, known as the GNU Classpath Exception, but only 709 | where Oracle has expressly included in the particular source file's 710 | header the words "Oracle designates this particular file as subject to 711 | the "Classpath" exception as provided by Oracle in the LICENSE file 712 | that accompanied this code." 713 | 714 | You should also note that Oracle includes multiple, independent 715 | programs in this software package. Some of those programs are provided 716 | under licenses deemed incompatible with the GPLv2 by the Free Software 717 | Foundation and others. For example, the package includes programs 718 | licensed under the Apache License, Version 2.0. Such programs are 719 | licensed to you under their original licenses. 720 | 721 | Oracle facilitates your further distribution of this package by adding 722 | the Classpath Exception to the necessary parts of its GPLv2 code, which 723 | permits you to use that code in combination with other independent 724 | modules not licensed under the GPLv2. However, note that this would 725 | not permit you to commingle code under an incompatible license with 726 | Oracle's GPLv2 licensed code by, for example, cutting and pasting such 727 | code into a file also containing Oracle's GPLv2 licensed code and then 728 | distributing the result. Additionally, if you were to remove the 729 | Classpath Exception from any of the files to which it applies and 730 | distribute the result, you would likely be required to license some or 731 | all of the other code in that distribution under the GPLv2 as well, and 732 | since the GPLv2 is incompatible with the license terms of some items 733 | included in the distribution by Oracle, removing the Classpath 734 | Exception could therefore effectively compromise your ability to 735 | further distribute the package. 736 | 737 | Proceed with caution and we recommend that you obtain the advice of a 738 | lawyer skilled in open source matters before removing the Classpath 739 | Exception or making modifications to this package which may 740 | subsequently be redistributed and/or involve the use of third party 741 | software. 742 | 743 | CLASSPATH EXCEPTION 744 | Linking this library statically or dynamically with other modules is 745 | making a combined work based on this library. Thus, the terms and 746 | conditions of the GNU General Public License version 2 cover the whole 747 | combination. 748 | 749 | As a special exception, the copyright holders of this library give you 750 | permission to link this library with independent modules to produce an 751 | executable, regardless of the license terms of these independent 752 | modules, and to copy and distribute the resulting executable under 753 | terms of your choice, provided that you also meet, for each linked 754 | independent module, the terms and conditions of the license of that 755 | module. An independent module is a module which is not derived from or 756 | based on this library. If you modify this library, you may extend this 757 | exception to your version of the library, but you are not obligated to 758 | do so. If you do not wish to do so, delete this exception statement 759 | from your version. 760 | --------------------------------------------------------------------------------