Skip to content

Commit

Permalink
FAB-7872 Java SDK v1.1-alpha
Browse files Browse the repository at this point in the history
Change-Id: I885f79b14aa240ac44cd9c64e52c31f890b352b1
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Jan 29, 2018
1 parent 09f386c commit 9b87b73
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 26 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,39 @@ SDK's `Enrollment` interface.

* TCerts are not supported: JIRA FAB-1401
* HSM not supported. JIRA FAB-3137
* Single Crypto strength 256 JIRA FAB-2564



<p &nbsp; />
<p &nbsp; />

`*************************************************`
## *v1.0.1*
## *v1.1.0-alpha*

## v1.1 release notes
Please review the [v1.1 release notes](./docs/release_v1.1.0_notes.md) to familarize yourself with changes since v1.0 sdk release

### Git v1.0.1
### Git v1.1.0-alpha

There is a git tagged v1.0.1 release of the SDK where there is no
There is a git tagged v1.1.0-alpha release of the SDK where there is no
need to build the Hyperledger Fabric and Hyperledger Fabric CA described below.
The provided docker-compose.yaml for the integration tests should pull v1.0.1 tagged images from Docker hub.
The provided docker-compose.yaml for the integration tests should pull v1.1.0-alpha tagged images from Docker hub.

The v1.0.1 version of the Hyperledger Fabric Java SDK is published to Maven so you can directly use in your application's pom.xml.
The v1.1.0-alpha version of the Hyperledger Fabric Java SDK is published to Maven so you can directly use in your application's pom.xml.

[Maven Repository Hyperledger Fabric Java SDK](https://mvnrepository.com/artifact/org.hyperledger.fabric-sdk-java/fabric-sdk-java)

_Make sure you're using docker images at the level of the Fabric that matches the level of the SDK you're using in your application._

### Using the SDK in your application

Add below code in your `pom.xml` to download fabric-sdk-java-1.0.1
Add below code in your `pom.xml` to download fabric-sdk-java-1.1.0-alpha

```xml

<dependencies>
<dependency>
<groupId>org.hyperledger.fabric-sdk-java</groupId>
<artifactId>fabric-sdk-java</artifactId>
<version>1.0.1</version>
<version>1.1.0-alpha</version>
</dependency>
</dependencies>
```
Expand Down Expand Up @@ -182,7 +182,7 @@ Alternatively, <code> mvn dependency:analyze-report </code> will produce a repor
## Using the SDK
The SDK's test cases uses chaincode in the SDK's source tree: `/src/test/fixture`

The SDK's JAR is in `target/fabric-sdk-java-1.1.0-SNAPSHOT.jar` and you will need the additional dependencies listed above.
The SDK's JAR is in `target/fabric-sdk-java-1.1.0-alpha.jar` and you will need the additional dependencies listed above.


### Compiling
Expand Down
103 changes: 103 additions & 0 deletions docs/release_v1.1.0_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Java SDK for Hyperledger Fabric 1.1 release notes.

The JSDK 1.1 has features added since the 1.0 based release to match those added to the Fabric 1.1 release.

## Fabric v1.0 considerations
The SDK is mostly backward compatible with the v1.0 based Fabric with the following considerations
- The new peer eventing service is the default for the SDK however, in v1.0 Fabric peer eventing service is not supported. To address in applications that are
connecting to Fabric 1.0 you must when adding or joining a peer to a channel provide a PeerRole option.
A role with `PeerRole.NO_EVENT_SOURCE` has been defined that has the equivalent functionality of a v1.0 Peer.
You can see an example of this
in [End2endIT.java#L732](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L732)
and in [End2endAndBackAgainIT.java#L597](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L597)


## v1.1 Fabric features

### [FAB-6066 JSDK Channel service for events](https://jira.hyperledger.org/browse/FAB-6066)
The Fabric Peer now implements eventing services on the same endpoint as proposal endorsements and it is no longer necessary to have an EventHub service. Using Peer
eventing is the preferred means for receiving events. Future releases of Fabric may not support Eventhubs. When joining or adding Peers to a channel the default is
to have the peer provide the eventing service. Whether a peer is an eventing or non-eventing is controlled by the peer options when adding or joining
a channel.You can see an example of this in [End2endIT.java#L732](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L732)
and in [End2endAndBackAgainIT.java#L597](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L597)

Peers may be added to a channel with specific roles to help with distributing the workload. PeerRoles are defined in [Peer.java#L328](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/main/java/org/hyperledger/fabric/sdk/Peer.java#L328)
The default is for Peers to have all roles.


The new Peer eventing services will by default just return the last block on the blockchain. Note this is *not* the **next** block that gets
added to the chain. The application can now specifiy both the starting and ending block number to be sent. Applications set these
options when adding or joining peers to the channel with the PeerOption methods *startEvents*, *stopEvents* and *startEventsNewest* which
is the default. [End2endAndBackAgainIT.java#L234-L257](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L234-L257)
calls the method [`testPeerServiceEventingReplay`](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L719-L881) which restarts the channel with different start and stop values.



### [FAB-7652 JSDK filterblock enablement](https://jira.hyperledger.org/browse/FAB-7652)

Fabric supports on the new Peer eventing service limits to what the events return thourgh ACLs. The block event may contain the full Block or a FilteredBlock.
Applications requesting for a full Block without authority will get a permission failure. Application by default will get the full block. To request
request a FiltedBlock when adding or joining peers applications can add via PeerOptions.registerEventsForFilteredBlocks. An example of this is seen in
[End2endAndBackAgainIT.java#L592-595](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L592-L595)

Application's that register block listeners need to be written to check for *isFiltered()" to know if the block is full or filtered.

Filtered blocks are limited to the following methods.

FilteredBlocks
- isFiltered should return true
- getChannelId the channel name
- getFilteredBlock the raw filtered block
- getBlockNumber blocknumber
- getEnvelopeCount number of envelopes
- getEnvelopeInfo index into envelopes.
- getEnvelopeInfos interator on envelopes

EnvelopeInfo
- getChannelId channel name
- getTransactionID the transaction id
- isValid was the transaction valid.
- getType the type of envelope

TransactionEnvelopeInfo all the methods on EnvelopeInfo
- getTransactionActionInfoCount number transactions
- getTransactionActionInfos an integrater over all the TransactionAction

TransactionActionInfo
- getEvent chaincode events


### [FAB-6603 Java SDK CryptoPrimitives should perform Signature operations using standard JCA/JCE](https://jira.hyperledger.org/browse/FAB-6603)
Changes made to make the Java SDK crypto primitives to use more JCA/JCE compliant methods. These changes are internal and not
directly apparant to the application. This allows specifying other JCA/JCE provider.

### [FAB-5632 Implement "Connection Profile" for java-sdk](https://jira.hyperledger.org/browse/FAB-5632)
Allow creating channels from a yaml or json specified document. Examples of this can be found in [NetworkConfigIT.java#L65](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/NetworkConfigIT.java#L65)

### [FAB-5387 Provide listener for custom chaincode events.](https://jira.hyperledger.org/browse/FAB-5387)
Allow application to register for specific events triggered by chaincode. Example of this can be found in
[End2endIT.java#L303](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L303)

The registerChaincodeEventListener method on the channel registers a call back that matches via a Java pattern on both the event name and the
chaincodeId. When ledger block with an event that matches that criteria specified is found by event hub or new peer event service the
callback is called to handle the event.

### [FAB-6200 Java serialize channels.](https://jira.hyperledger.org/browse/FAB-6200)
Channels can be Java serialized and deserialized. Examples of this can be found throughout the integration tests. Example of serialization
in [End2endIT.java#L257](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L257)
where the sample store stores channel bar. Later in [End2endAndBackAgainIT.java#L562](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L562-L565)
it's restored.
*Applications using this serialziation means will be tasked with any migrating future changes. The SDK will not do this.*
It's advised to use a different persistene means for saving and restoring channel.s

## v1.1 Fabric/CA features

### [FAB-7383 Implement the Fabric-CA identities and affiliations API](https://jira.hyperledger.org/browse/FAB-7383)
Fabric CA API added APIs for managing identies and affiliations. Examples how this can be done with Java SDK on how to
create, modify, read and delete are in [HFCAClientIT.java#L514-L658](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java#L514-L658)
for identies and [HFCAClientIT#L704](https://github.com/hyperledger/fabric-sdk-java/blob/09f386c340e157e2a4f3f5cdde85e340f4586923/src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java#L704-L1015)
for affiliations.

### [FAB-6411 Add Java SDK support for gencrl endpoint](https://jira.hyperledger.org/browse/FAB-6411)
Support for getting certificate revocation list from Fabric-ca was added to the HFCAClient's **generateCRL** method.
Examples of this are in the integration tests that call [HFCAClientIT.java getRevokes method](https://github.com/hyperledger/fabric-sdk-java/blob/224f569d9d1f1f77e5d22e8e0c78f3d4e298b3fc/src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java#L496-L500)
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.hyperledger.fabric-sdk-java</groupId>
<artifactId>fabric-sdk-java</artifactId>
<packaging>jar</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.0-alpha</version>
<name>fabric-java-sdk</name>
<description>Java SDK for Hyperledger fabric project</description>
<url>https://www.hyperledger.org/community/projects</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

package org.hyperledger.fabric_ca.sdk;

import java.io.PrintWriter;
import java.io.StringWriter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -28,15 +25,13 @@
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import javax.json.JsonWriter;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hyperledger.fabric.sdk.User;
import org.hyperledger.fabric.sdk.helper.Utils;
import org.hyperledger.fabric_ca.sdk.exception.AffiliationException;
import org.hyperledger.fabric_ca.sdk.exception.HTTPException;
import org.hyperledger.fabric_ca.sdk.exception.IdentityException;
import org.hyperledger.fabric_ca.sdk.exception.InvalidArgumentException;

import static java.lang.String.format;
Expand Down Expand Up @@ -521,7 +516,7 @@ private JsonObject affToJsonObject() {
/**
* Validate affiliation name for proper formatting
*
* @param url the string to test.
* @param name the string to test.
* @throws InvalidArgumentException
*/
void validateAffiliationNames(String name) throws InvalidArgumentException {
Expand All @@ -542,7 +537,7 @@ void validateAffiliationNames(String name) throws InvalidArgumentException {
/**
* Validate affiliation name for proper formatting
*
* @param url the string to test.
* @param name the string to test.
* @throws InvalidArgumentException
*/
void validateSingleAffiliationName(String name) throws InvalidArgumentException {
Expand Down
9 changes: 7 additions & 2 deletions src/test/cirun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ export IMAGE_TAG_FABRIC=:x86_64-1.0.0
export IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0
else
export ORG_HYPERLEDGER_FABRIC_SDKTEST_ITSUITE=""
export IMAGE_TAG_FABRIC=:latest
export IMAGE_TAG_FABRIC_CA=:latest
#unset to use what's in docker's .env file.
unset IMAGE_TAG_FABRIC
unset IMAGE_TAG_FABRIC_CA
fi

echo "environment:--------------------"
env
echo "environment:--------------------"

cd $WD/src/test/fixture/sdkintegration
./fabric.sh restart >dockerlogfile.log 2>&1 &
sleep 5; #give it this much to start.
Expand Down
8 changes: 3 additions & 5 deletions src/test/fixture/sdkintegration/.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
#TLS:
#ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=true
#ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS=--tls.enabled
#ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=false
ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=false
ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS=
#
#Image tags:
#IMAGE_TAG_FABRIC=:x86_64-1.0.1
#IMAGE_TAG_FABRIC_CA=:x86_64-1.0.1
IMAGE_TAG_FABRIC=
IMAGE_TAG_FABRIC_CA=
IMAGE_TAG_FABRIC=:x86_64-1.1.0-alpha
IMAGE_TAG_FABRIC_CA=:x86_64-1.1.0-alpha
V11_IDENTITIES_ALLOWREMOVE=--cfg.identities.allowremove
V11_AFFILIATIONS_ALLOWREMOVE=--cfg.affiliations.allowremove

0 comments on commit 9b87b73

Please sign in to comment.