@@ -150,6 +150,42 @@ public final File getBundleFolder(String bundleName) {
150
150
return new File (getTelosysToolsCfg ().getTemplatesFolderAbsolutePath (bundleName ));
151
151
}
152
152
153
+ /**
154
+ * Returns all the bundles folders for the current project
155
+ * @return
156
+ * @since 4.1.0
157
+ */
158
+ public final List <File > getBundles () {
159
+ BundlesManager bundlesManager = new BundlesManager ( getTelosysToolsCfg () );
160
+ return bundlesManager .getBundles ();
161
+ }
162
+
163
+ /**
164
+ * Returns all the names of existing bunles for the current project
165
+ * @return
166
+ * @since 4.1.0
167
+ */
168
+ public final List <String > getBundleNames () {
169
+ BundlesManager bundlesManager = new BundlesManager ( getTelosysToolsCfg () );
170
+ List <String > bundleNames = new LinkedList <>();
171
+ for (File file : bundlesManager .getBundles () ) {
172
+ bundleNames .add (file .getName ());
173
+ }
174
+ return bundleNames ;
175
+ }
176
+
177
+ /**
178
+ * Returns true if the bundle folder exists for the given bundle name
179
+ * @param bundleName
180
+ * @return
181
+ * @since 4.1.0
182
+ */
183
+ public final boolean bundleFolderExists (String bundleName ) {
184
+ checkArgumentNotNull (bundleName , "bundleName" );
185
+ File file = getBundleFolder (bundleName );
186
+ return file .exists () && file .isDirectory ();
187
+ }
188
+
153
189
/**
154
190
* Returns a list of bundles available on the given user's name (on GitHub)
155
191
* @param userName the GitHub user name (e.g. "telosys-tools")
@@ -193,34 +229,44 @@ public BundleStatus downloadAndInstallBundle(String userName, String bundleName)
193
229
return bm .downloadAndInstallBundle (userName , bundleName );
194
230
}
195
231
232
+ // /**
233
+ // * Returns a list containing all the bundles installed for the current project
234
+ // * @return
235
+ // * @throws TelosysToolsException
236
+ // */
237
+ // public List<String> getInstalledBundles() throws TelosysToolsException {
238
+ // BundlesManager bundlesManager = new BundlesManager( getTelosysToolsCfg() );
239
+ // return bundlesManager.getProjectBundlesList();
240
+ // }
241
+
196
242
/**
197
- * Returns a list containing all the bundles installed for the current project
243
+ * Returns the 'templates.cfg' file for the given bundle name <br>
244
+ * There's no guarantee the returned file exists
245
+ * @param bundleName
198
246
* @return
199
- * @throws TelosysToolsException
200
247
*/
201
- public List < String > getInstalledBundles () throws TelosysToolsException {
202
- BundlesManager bundlesManager = new BundlesManager ( getTelosysToolsCfg () );
203
- return bundlesManager . getProjectBundlesList ( );
248
+ public File getBundleConfigFile ( String bundleName ) {
249
+ BundlesManager bm = new BundlesManager ( getTelosysToolsCfg () );
250
+ return bm . getBundleConfigFile ( bundleName );
204
251
}
205
252
206
253
/**
207
- * Returns the 'templates.cfg' File object for the given bundle name <br>
254
+ * Returns the 'templates.cfg' file for the given bundle folder <br>
208
255
* There's no guarantee the returned file exists
209
- * @param bundleName
256
+ * @param bundleFolder
210
257
* @return
211
258
*/
212
- public File getBundleConfigFile (String bundleName ) {
259
+ public File getBundleConfigFile (File bundleFolder ) {
213
260
BundlesManager bm = new BundlesManager ( getTelosysToolsCfg () );
214
- return bm .getBundleConfigFile (bundleName );
261
+ return bm .getBundleConfigFile (bundleFolder );
215
262
}
216
263
217
264
/**
218
265
* Deletes the given bundle
219
266
* @param bundleName
220
267
* @return true if found and deleted, false if not found
221
- * @throws TelosysToolsException
222
268
*/
223
- public boolean deleteBundle (String bundleName ) throws TelosysToolsException {
269
+ public boolean deleteBundle (String bundleName ) {
224
270
BundlesManager bm = new BundlesManager ( getTelosysToolsCfg () );
225
271
return bm .deleteBundle (bundleName );
226
272
}
@@ -393,6 +439,21 @@ public final List<File> getModels() {
393
439
return DslModelUtil .getModelsInFolder (getModelsFolder ());
394
440
}
395
441
442
+ /**
443
+ * Returns all the names of existing models for the current project
444
+ * @return
445
+ * @since 4.1.0
446
+ * @return
447
+ */
448
+ public final List <String > getModelNames () {
449
+ List <String > modelNames = new LinkedList <>();
450
+ // Convert files to file names (strings)
451
+ for ( File f : getModels () ) {
452
+ modelNames .add (f .getName ());
453
+ }
454
+ return modelNames ;
455
+ }
456
+
396
457
/**
397
458
* Returns the model info file for the given model name
398
459
* @param modelName
0 commit comments