Package org.hyperledger.fabric.sdk
Class LifecycleChaincodePackage
java.lang.Object
org.hyperledger.fabric.sdk.LifecycleChaincodePackage
A wrapper for the Hyperledger Fabric Policy object
-
Method Summary
Modifier and TypeMethodDescriptionstatic LifecycleChaincodePackagefromBytes(byte[] packageBytes) Sets the LifecycleChaincodePackage from a byte arraystatic LifecycleChaincodePackageconstructs a ChaincodeEndorsementPolicy object with the actual policy gotten from the file systemstatic LifecycleChaincodePackagefromSource(String label, Path chaincodeSource, TransactionRequest.Type chaincodeType, String chaincodePath, Path chaincodeMetaInfLocation) static LifecycleChaincodePackagefromStream(InputStream inputStream) Construct a LifecycleChaincodePackage from a stream.byte[]Lifecycle chaincode package as bytesbyte[]getLabel()javax.json.JsonObjectgetPath()getType()voidtoFile(Path path, OpenOption... options) Write Lifecycle chaincode package bytes to file.
-
Method Details
-
fromFile
public static LifecycleChaincodePackage fromFile(File policyFile) throws IOException, InvalidArgumentException constructs a ChaincodeEndorsementPolicy object with the actual policy gotten from the file system- Parameters:
policyFile- The file containing the policy- Throws:
IOExceptionInvalidArgumentException
-
fromStream
public static LifecycleChaincodePackage fromStream(InputStream inputStream) throws IOException, InvalidArgumentException Construct a LifecycleChaincodePackage from a stream.- Parameters:
inputStream- The stream containing the lifecycle chaincode package. This stream is NOT closed.- Throws:
IOExceptionInvalidArgumentException
-
fromBytes
public static LifecycleChaincodePackage fromBytes(byte[] packageBytes) throws InvalidArgumentException Sets the LifecycleChaincodePackage from a byte array- Parameters:
packageBytes- the byte array containing the serialized policy- Throws:
InvalidArgumentException
-
getAsBytes
public byte[] getAsBytes()Lifecycle chaincode package as bytes- Returns:
- Lifecycle chaincode package as bytes.
-
toFile
Write Lifecycle chaincode package bytes to file.- Parameters:
path- of the file to write to.options- Options on creating file.- Throws:
IOException
-
fromSource
public static LifecycleChaincodePackage fromSource(String label, Path chaincodeSource, TransactionRequest.Type chaincodeType, String chaincodePath, Path chaincodeMetaInfLocation) throws IOException, InvalidArgumentException - Parameters:
label- Any name you like to identify this package.chaincodeSource- Chaincode source directory.chaincodeType- Chaincode type GO, JAVA.chaincodePath- Only valid for GO LANG chaincode. Otherwise, null.chaincodeMetaInfLocation- MetaInf location. Can be null.- Returns:
- Throws:
IOExceptionInvalidArgumentException
-
getMetaInfJson
- Throws:
IOException
-
getChaincodePayloadBytes
- Throws:
IOException
-
getType
- Throws:
IOException
-
getLabel
- Throws:
IOException
-
getPath
- Throws:
IOException
-