@@ -33,29 +33,21 @@ func NewSessionClientFactory() *SessionClientFactory {
3333 return & f
3434}
3535
36- /*
37- // NewSystemClient returns a new FabricClient.
38- // TODO: duplicate of core factory method or rename?
39- func (f *SessionClientFactory) NewSystemClient(sdk apisdk.SDK, session apisdk.Session, config apiconfig.Config) (fab.FabricClient, error) {
40- return sdk.FabricProvider().NewClient(session.Identity())
41- }
42- */
43-
4436// NewChannelMgmtClient returns a client that manages channels (create/join channel)
45- func (f * SessionClientFactory ) NewChannelMgmtClient (sdk apisdk.SDK , session apisdk.Session , config apiconfig.Config ) (chmgmt.ChannelMgmtClient , error ) {
37+ func (f * SessionClientFactory ) NewChannelMgmtClient (sdk apisdk.Providers , session apisdk.Session , config apiconfig.Config ) (chmgmt.ChannelMgmtClient , error ) {
4638 // For now settings are the same as for system client
47- client , err := sdk .FabricProvider ().NewClient (session .Identity ())
39+ client , err := sdk .FabricProvider ().NewResourceClient (session .Identity ())
4840 if err != nil {
4941 return nil , err
5042 }
5143 return chmgmtImpl .NewChannelMgmtClient (client , config )
5244}
5345
5446// NewResourceMgmtClient returns a client that manages resources
55- func (f * SessionClientFactory ) NewResourceMgmtClient (sdk apisdk.SDK , session apisdk.Session , config apiconfig.Config , filter resmgmt.TargetFilter ) (resmgmt.ResourceMgmtClient , error ) {
47+ func (f * SessionClientFactory ) NewResourceMgmtClient (sdk apisdk.Providers , session apisdk.Session , config apiconfig.Config , filter resmgmt.TargetFilter ) (resmgmt.ResourceMgmtClient , error ) {
5648
5749 // For now settings are the same as for system client
58- client , err := sdk .FabricProvider ().NewClient (session .Identity ())
50+ client , err := sdk .FabricProvider ().NewResourceClient (session .Identity ())
5951 if err != nil {
6052 return nil , err
6153 }
@@ -70,13 +62,13 @@ func (f *SessionClientFactory) NewResourceMgmtClient(sdk apisdk.SDK, session api
7062
7163// NewChannelClient returns a client that can execute transactions on specified channel
7264// TODO - better refactoring for testing and/or extract getChannelImpl to another package
73- func (f * SessionClientFactory ) NewChannelClient (sdk apisdk.SDK , session apisdk.Session , config apiconfig.Config , channelID string ) (apitxn.ChannelClient , error ) {
65+ func (f * SessionClientFactory ) NewChannelClient (sdk apisdk.Providers , session apisdk.Session , config apiconfig.Config , channelID string ) (apitxn.ChannelClient , error ) {
7466 // TODO: Add capablity to override sdk's selection and discovery provider
7567
7668 client := clientImpl .NewClient (sdk .ConfigProvider ())
7769 client .SetCryptoSuite (sdk .CryptoSuiteProvider ())
7870 client .SetStateStore (sdk .StateStoreProvider ())
79- client .SetUserContext (session .Identity ())
71+ client .SetIdentityContext (session .Identity ())
8072 client .SetSigningManager (sdk .SigningManager ())
8173
8274 channel , err := getChannel (client , channelID )
@@ -103,7 +95,7 @@ func (f *SessionClientFactory) NewChannelClient(sdk apisdk.SDK, session apisdk.S
10395}
10496
10597// getChannel is helper method to initializes and returns a channel based on config
106- func getChannel (client fab.FabricClient , channelID string ) (fab.Channel , error ) {
98+ func getChannel (client fab.Resource , channelID string ) (fab.Channel , error ) {
10799
108100 channel , err := client .NewChannel (channelID )
109101 if err != nil {
@@ -135,7 +127,7 @@ func getChannel(client fab.FabricClient, channelID string) (fab.Channel, error)
135127 return channel , nil
136128}
137129
138- func getEventHub (client fab.FabricClient , channelID string , session apisdk.Session ) (* events.EventHub , error ) {
130+ func getEventHub (client fab.Resource , channelID string , session apisdk.Session ) (* events.EventHub , error ) {
139131
140132 peerConfig , err := client .Config ().ChannelPeers (channelID )
141133 if err != nil {
0 commit comments