34
34
import org .wso2 .carbon .apimgt .api .model .Environment ;
35
35
import org .wso2 .carbon .apimgt .api .model .VHost ;
36
36
import org .wso2 .carbon .apimgt .common .gateway .configdto .HttpClientConfigurationDTO ;
37
+ import org .wso2 .carbon .apimgt .impl .ai .MarketplaceAssistantConfigurationDto ;
37
38
import org .wso2 .carbon .apimgt .common .gateway .dto .ClaimMappingDto ;
38
39
import org .wso2 .carbon .apimgt .common .gateway .dto .JWKSConfigurationDTO ;
39
40
import org .wso2 .carbon .apimgt .common .gateway .dto .TokenIssuerDto ;
@@ -107,6 +108,7 @@ public class APIManagerConfiguration {
107
108
private JSONArray applicationAttributes = new JSONArray ();
108
109
private CacheInvalidationConfiguration cacheInvalidationConfiguration ;
109
110
111
+
110
112
private HttpClientConfigurationDTO httpClientConfiguration ;
111
113
112
114
private RecommendationEnvironment recommendationEnvironment ;
@@ -116,6 +118,8 @@ public class APIManagerConfiguration {
116
118
private boolean initialized ;
117
119
private ThrottleProperties throttleProperties = new ThrottleProperties ();
118
120
private ExtendedJWTConfigurationDto jwtConfigurationDto = new ExtendedJWTConfigurationDto ();
121
+ private static MarketplaceAssistantConfigurationDto marketplaceAssistantConfigurationDto = new MarketplaceAssistantConfigurationDto ();
122
+
119
123
private WorkflowProperties workflowProperties = new WorkflowProperties ();
120
124
private Map <String , Environment > apiGatewayEnvironments = new LinkedHashMap <String , Environment >();
121
125
private static Properties realtimeNotifierProperties ;
@@ -160,6 +164,11 @@ public static boolean isTokenRevocationEnabled() {
160
164
return !tokenRevocationClassName .isEmpty ();
161
165
}
162
166
167
+ public MarketplaceAssistantConfigurationDto getMarketplaceAssistantConfigurationDto () {
168
+
169
+ return marketplaceAssistantConfigurationDto ;
170
+ }
171
+
163
172
private Set <APIStore > externalAPIStores = new HashSet <APIStore >();
164
173
private EventHubConfigurationDto eventHubConfigurationDto ;
165
174
private MonetizationConfigurationDto monetizationConfigurationDto = new MonetizationConfigurationDto ();
@@ -624,6 +633,8 @@ private void readChildElements(OMElement serverConfig,
624
633
jsonObject .put (APIConstants .CustomPropertyAttributes .REQUIRED , isRequired );
625
634
customProperties .add (jsonObject );
626
635
}
636
+ } else if (APIConstants .MARKETPLACE_ASSISTANT .equals (localName )) {
637
+ setMarketplaceAssistantConfiguration (element );
627
638
}
628
639
readChildElements (element , nameStack );
629
640
nameStack .pop ();
@@ -2326,4 +2337,46 @@ public HttpClientConfigurationDTO getHttpClientConfiguration() {
2326
2337
public void setHttpClientConfiguration (HttpClientConfigurationDTO httpClientConfiguration ) {
2327
2338
this .httpClientConfiguration = httpClientConfiguration ;
2328
2339
}
2340
+
2341
+ public void setMarketplaceAssistantConfiguration (OMElement omElement ){
2342
+ OMElement marketplaceAssistantEnableElement =
2343
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_ENABLED ));
2344
+ if (marketplaceAssistantEnableElement != null ) {
2345
+ marketplaceAssistantConfigurationDto .setEnabled (Boolean .parseBoolean (marketplaceAssistantEnableElement .getText ()));
2346
+ }
2347
+ if (marketplaceAssistantConfigurationDto .isEnabled ()) {
2348
+ OMElement marketplaceAssistantEndpoint =
2349
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_ENDPOINT ));
2350
+ if (marketplaceAssistantEndpoint != null ) {
2351
+ marketplaceAssistantConfigurationDto .setEndpoint (marketplaceAssistantEndpoint .getText ());
2352
+ }
2353
+ OMElement marketplaceAssistantToken =
2354
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_AUTH_TOKEN ));
2355
+
2356
+ if (marketplaceAssistantToken != null ) {
2357
+ String AccessToken = MiscellaneousUtil .resolve (marketplaceAssistantToken , secretResolver );
2358
+ marketplaceAssistantConfigurationDto .setAccessToken (AccessToken );
2359
+ }
2360
+ OMElement marketplaceAssistantApiCountResource =
2361
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_API_COUNT_RESOURCE ));
2362
+ if (marketplaceAssistantApiCountResource != null ) {
2363
+ marketplaceAssistantConfigurationDto .setApiCountResource (marketplaceAssistantApiCountResource .getText ());
2364
+ }
2365
+ OMElement marketplaceAssistantApiDeleteResource =
2366
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_DELETE_API_RESOURCE ));
2367
+ if (marketplaceAssistantApiDeleteResource != null ) {
2368
+ marketplaceAssistantConfigurationDto .setApiDeleteResource (marketplaceAssistantApiDeleteResource .getText ());
2369
+ }
2370
+ OMElement marketplaceAssistantApiPublishResource =
2371
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_PUBLISH_API_RESOURCE ));
2372
+ if (marketplaceAssistantApiPublishResource != null ) {
2373
+ marketplaceAssistantConfigurationDto .setApiPublishResource (marketplaceAssistantApiPublishResource .getText ());
2374
+ }
2375
+ OMElement marketplaceAssistantChatResource =
2376
+ omElement .getFirstChildWithName (new QName (APIConstants .MARKETPLACE_ASSISTANT_CHAT_RESOURCE ));
2377
+ if (marketplaceAssistantChatResource != null ) {
2378
+ marketplaceAssistantConfigurationDto .setChatResource (marketplaceAssistantChatResource .getText ());
2379
+ }
2380
+ }
2381
+ }
2329
2382
}
0 commit comments