Package org.hyperledger.fabric.shim
Class ChaincodeBase
- java.lang.Object
-
- org.hyperledger.fabric.shim.ChaincodeBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChaincodeBase.CCState-
Nested classes/interfaces inherited from interface org.hyperledger.fabric.shim.Chaincode
Chaincode.Response
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCORE_CHAINCODE_LOGGING_LEVELstatic java.lang.StringCORE_CHAINCODE_LOGGING_SHIMstatic java.lang.StringDEFAULT_HOSTstatic intDEFAULT_PORT
-
Constructor Summary
Constructors Constructor Description ChaincodeBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidconnectToPeer()java.util.PropertiesgetChaincodeConfig()Obtains configuration specificially for running the chaincode, and settable on a per chaincode basis, rather than taking properties from the Peers' configurationChaincodeBase.CCStategetState()abstract Chaincode.Responseinit(ChaincodeStub stub)Called during an instantiate transaction after the container has been established, allowing the chaincode to initialize its internal data.protected voidinitializeLogging()abstract Chaincode.Responseinvoke(ChaincodeStub stub)Called for every Invoke transaction.protected static Chaincode.ResponsenewErrorResponse()Deprecated.protected static Chaincode.ResponsenewErrorResponse(byte[] payload)Deprecated.protected static Chaincode.ResponsenewErrorResponse(java.lang.String message)Deprecated.protected static Chaincode.ResponsenewErrorResponse(java.lang.String message, byte[] payload)Deprecated.protected static Chaincode.ResponsenewErrorResponse(java.lang.Throwable throwable)Deprecated.protected static Chaincode.ResponsenewSuccessResponse()Deprecated.protected static Chaincode.ResponsenewSuccessResponse(byte[] payload)Deprecated.protected static Chaincode.ResponsenewSuccessResponse(java.lang.String message)Deprecated.protected static Chaincode.ResponsenewSuccessResponse(java.lang.String message, byte[] payload)Deprecated.protected voidprocessCommandLineOptions(java.lang.String[] args)protected voidprocessEnvironmentOptions()voidsetState(ChaincodeBase.CCState newState)voidstart(java.lang.String[] args)Start chaincodestatic java.lang.StringtoJsonString(org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage message)protected voidvalidateOptions()
-
-
-
Field Detail
-
CORE_CHAINCODE_LOGGING_SHIM
public static final java.lang.String CORE_CHAINCODE_LOGGING_SHIM
- See Also:
- Constant Field Values
-
CORE_CHAINCODE_LOGGING_LEVEL
public static final java.lang.String CORE_CHAINCODE_LOGGING_LEVEL
- See Also:
- Constant Field Values
-
DEFAULT_HOST
public static final java.lang.String DEFAULT_HOST
- See Also:
- Constant Field Values
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public abstract Chaincode.Response init(ChaincodeStub stub)
Description copied from interface:ChaincodeCalled during an instantiate transaction after the container has been established, allowing the chaincode to initialize its internal data.
-
invoke
public abstract Chaincode.Response invoke(ChaincodeStub stub)
Description copied from interface:ChaincodeCalled for every Invoke transaction. The chaincode may change its state variables.
-
start
public void start(java.lang.String[] args)
Start chaincode- Parameters:
args- command line arguments
-
connectToPeer
protected void connectToPeer() throws java.io.IOException- Throws:
java.io.IOException
-
initializeLogging
protected void initializeLogging()
-
validateOptions
protected void validateOptions()
-
processCommandLineOptions
protected void processCommandLineOptions(java.lang.String[] args)
-
processEnvironmentOptions
protected void processEnvironmentOptions()
-
getChaincodeConfig
public java.util.Properties getChaincodeConfig()
Obtains configuration specificially for running the chaincode, and settable on a per chaincode basis, rather than taking properties from the Peers' configuration
-
newSuccessResponse
@Deprecated protected static Chaincode.Response newSuccessResponse(java.lang.String message, byte[] payload)
Deprecated.
-
newSuccessResponse
@Deprecated protected static Chaincode.Response newSuccessResponse()
Deprecated.
-
newSuccessResponse
@Deprecated protected static Chaincode.Response newSuccessResponse(java.lang.String message)
Deprecated.
-
newSuccessResponse
@Deprecated protected static Chaincode.Response newSuccessResponse(byte[] payload)
Deprecated.
-
newErrorResponse
@Deprecated protected static Chaincode.Response newErrorResponse(java.lang.String message, byte[] payload)
Deprecated.
-
newErrorResponse
@Deprecated protected static Chaincode.Response newErrorResponse()
Deprecated.
-
newErrorResponse
@Deprecated protected static Chaincode.Response newErrorResponse(java.lang.String message)
Deprecated.
-
newErrorResponse
@Deprecated protected static Chaincode.Response newErrorResponse(byte[] payload)
Deprecated.
-
newErrorResponse
@Deprecated protected static Chaincode.Response newErrorResponse(java.lang.Throwable throwable)
Deprecated.
-
getState
public ChaincodeBase.CCState getState()
-
setState
public void setState(ChaincodeBase.CCState newState)
-
toJsonString
public static java.lang.String toJsonString(org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage message)
-
-