37
37
import java .net .MalformedURLException ;
38
38
import java .net .URL ;
39
39
import java .nio .file .Path ;
40
+ import java .sql .Array ;
40
41
import java .util .ArrayList ;
41
42
import java .util .Collection ;
42
43
import java .util .Collections ;
@@ -94,7 +95,6 @@ public BundledPluginList.BundledPlugins getBundledPlugins() {
94
95
if (bundledPluginUrl == null ) {
95
96
bundledPluginUrl = VendorConstants .getBundledPluginsUrl ();
96
97
}
97
-
98
98
if (bundledPluginUrl .contains ("{version}" )) {
99
99
String latestBundled = bundledPluginUrl .replace ("{version}" , "latest" );
100
100
if (checkUrl (latestBundled )) {
@@ -103,18 +103,26 @@ public BundledPluginList.BundledPlugins getBundledPlugins() {
103
103
String versionBundled = bundledPluginUrl .replace ("{version}" , "v" + VersionUtils .getVersion ());
104
104
if (checkUrl (versionBundled )) {
105
105
bundledPluginUrl = versionBundled ;
106
+ } else {
107
+ // todo use local stored bundled
106
108
}
107
109
}
108
110
}
109
-
110
111
try {
111
112
LOGGER .info ("Read bundled plugins '{}'" , bundledPluginUrl );
112
113
BundledPluginList bundledPluginList = new ObjectMapper ().readValue (new URL (bundledPluginUrl ), BundledPluginList .class );
113
- BundledPluginList .BundledPlugins bundledPluginsByVersion = bundledPluginList .getVersions ().get (VersionUtils .getVersion ().trim ());
114
+ String version = VersionUtils .getVersion ().trim ();
115
+ BundledPluginList .BundledPlugins bundledPluginsByVersion = bundledPluginList .getVersions ().get (version );
114
116
if (bundledPluginsByVersion == null ) {
115
- return BundledPluginList .BundledPlugins .builder ().build ();
117
+ LOGGER .warn ("No bundled plugins found for version '{}'" , version );
118
+ bundledPlugins = BundledPluginList .BundledPlugins .builder ().build ();
119
+ } else {
120
+ LOGGER .info ("Found {} bundled plugins and {} plugins to be removed for version '{}'." ,
121
+ bundledPluginsByVersion .getInstall ().size (),
122
+ bundledPluginsByVersion .getUninstall ().size (),
123
+ version );
124
+ bundledPlugins = bundledPluginsByVersion ;
116
125
}
117
- bundledPlugins = bundledPluginsByVersion ;
118
126
return bundledPluginsByVersion ;
119
127
} catch (IOException e ) {
120
128
LOGGER .warn ("Unable to load bundled plugin list from {}." , bundledPluginUrl );
@@ -183,11 +191,9 @@ public UpdateManager getUpdateManager() {
183
191
184
192
public List <? extends OutgoingMessageHook <?>> getOutgoingMessageHooks () {
185
193
List <HooksDTO .Extension > hooks = pluginConfigProvider .getOutgoingMessageHooks ();
186
-
187
- if (hooks == null ){
194
+ if (hooks == null ) {
188
195
return Collections .emptyList ();
189
196
}
190
-
191
197
return hooks
192
198
.stream ()
193
199
.map (extensionDefinition -> {
@@ -207,11 +213,9 @@ public List<? extends OutgoingMessageHook<?>> getOutgoingMessageHooks() {
207
213
208
214
public List <? extends IncomingMessageHook <?>> getIncomingMessageHooks () {
209
215
List <HooksDTO .Extension > hooks = pluginConfigProvider .getIncomingMessageHooks ();
210
-
211
- if (hooks == null ){
216
+ if (hooks == null ) {
212
217
return Collections .emptyList ();
213
218
}
214
-
215
219
return hooks
216
220
.stream ()
217
221
.map (extensionDefinition -> {
@@ -231,11 +235,9 @@ public List<? extends IncomingMessageHook<?>> getIncomingMessageHooks() {
231
235
232
236
public List <MessageValidatorHook <?>> getMessageValidators (String topic ) {
233
237
List <HooksDTO .MessageValidator > validators = pluginConfigProvider .getMessageValidators ();
234
-
235
- if (validators == null ){
238
+ if (validators == null ) {
236
239
return Collections .emptyList ();
237
240
}
238
-
239
241
return validators .stream ()
240
242
.filter (validatorDefinition -> validatorDefinition .getTopic ().equals (topic ))
241
243
.map (validatorDefinition -> validatorDefinition .getExtensions ().stream ()
0 commit comments