-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-3066] sync java/go chaincode interface
ChaincodeBase: - removed run() method - implemented new Chaincode interface - added init(stub) method - added invoke(stub) method ChaincodeStub: - added chaincode args to stub (like golang version) Handler: - ChaincodeStub initialized with args - invoke calls Chaincode.invoke() - initialize call Chaincode.init() Other: - edited chaincode docs - fixed example Java chaincodes Change-Id: I04906052317c382b78884c00a85b80a12ed1bd9d Signed-off-by: Luis Sanchez <sanchezl@us.ibm.com>
- Loading branch information
Luis Sanchez
committed
Apr 14, 2017
1 parent
8eb16dc
commit 8026601
Showing
10 changed files
with
257 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
protos | ||
src/main/proto | ||
.classpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/chaincode/shim/java/src/main/java/org/hyperledger/java/shim/Chaincode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright IBM 2017 All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package org.hyperledger.java.shim; | ||
|
||
import org.hyperledger.fabric.protos.peer.ProposalResponsePackage.Response; | ||
|
||
/** | ||
* Defines methods that all chaincodes must implement. | ||
*/ | ||
public interface Chaincode { | ||
/** | ||
* Called during an instantiate transaction after the container | ||
* has been established, allowing the chaincode to initialize | ||
* its internal data. | ||
*/ | ||
public Response init(ChaincodeStub stub); | ||
/** | ||
* Called for every Invoke transaction. The chaincode may change | ||
* its state variables. | ||
*/ | ||
public Response invoke(ChaincodeStub stub); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.