|
Lines 158-164
Link Here
|
| 158 |
try { |
158 |
try { |
| 159 |
// handle the installed featuresConfigured under featuresConfigured subdirectory |
159 |
// handle the installed featuresConfigured under featuresConfigured subdirectory |
| 160 |
dir = featureDir.list(); |
160 |
dir = featureDir.list(); |
| 161 |
for (int index = 0; index < dir.length; index++) { |
161 |
if (dir == null) { |
|
|
162 |
try { |
| 163 |
printWarning(featureDir); |
| 164 |
} |
| 165 |
catch (IOException e) { |
| 166 |
System.out.println(" * * * * * " + "Unexpected exception while handline exception: "); |
| 167 |
System.out.println(e.getMessage()); |
| 168 |
} |
| 169 |
} |
| 170 |
else { |
| 171 |
|
| 172 |
for (int index = 0; index < dir.length; index++) { |
| 162 |
|
173 |
|
| 163 |
// the URL must ends with '/' for the bundle to be resolved |
174 |
// the URL must ends with '/' for the bundle to be resolved |
| 164 |
newFilePath = dir[index] + (dir[index].endsWith("/") ? "/" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
175 |
newFilePath = dir[index] + (dir[index].endsWith("/") ? "/" : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
|
Lines 178-183
Link Here
|
| 178 |
((Site) site).addFeatureReferenceModel(featureRef); |
189 |
((Site) site).addFeatureReferenceModel(featureRef); |
| 179 |
} |
190 |
} |
| 180 |
} |
191 |
} |
|
|
192 |
} |
| 181 |
} catch (MalformedURLException e) { |
193 |
} catch (MalformedURLException e) { |
| 182 |
throw Utilities.newCoreException(NLS.bind(Messages.SiteFileFactory_UnableToCreateURLForFile, (new String[] { newFilePath })), e); |
194 |
throw Utilities.newCoreException(NLS.bind(Messages.SiteFileFactory_UnableToCreateURLForFile, (new String[] { newFilePath })), e); |
| 183 |
} |
195 |
} |
|
Lines 202-208
Link Here
|
| 202 |
try { |
214 |
try { |
| 203 |
// only list JAR files |
215 |
// only list JAR files |
| 204 |
dir = featureDir.list(FeaturePackagedContentProvider.filter); |
216 |
dir = featureDir.list(FeaturePackagedContentProvider.filter); |
| 205 |
for (int index = 0; index < dir.length; index++) { |
217 |
if (dir == null) { |
|
|
218 |
try { |
| 219 |
printWarning(featureDir); |
| 220 |
} |
| 221 |
catch (IOException e) { |
| 222 |
System.out.println(" * * * * * " + "Unexpected exception while handling unexpected exception: "); |
| 223 |
System.out.println(e.getMessage()); |
| 224 |
} |
| 225 |
} |
| 226 |
else { |
| 227 |
for (int index = 0; index < dir.length; index++) { |
| 206 |
|
228 |
|
| 207 |
// check if the JAR file contains a feature.xml |
229 |
// check if the JAR file contains a feature.xml |
| 208 |
currentFeatureFile = new File(featureDir, dir[index]); |
230 |
currentFeatureFile = new File(featureDir, dir[index]); |
|
Lines 226-237
Link Here
|
| 226 |
site.addFeatureReferenceModel(featureRef); |
248 |
site.addFeatureReferenceModel(featureRef); |
| 227 |
} |
249 |
} |
| 228 |
} |
250 |
} |
|
|
251 |
} |
| 229 |
} catch (MalformedURLException e) { |
252 |
} catch (MalformedURLException e) { |
| 230 |
throw Utilities.newCoreException(NLS.bind(Messages.SiteFileFactory_UnableToCreateURLForFile, (new String[] { newFilePath })), e); |
253 |
throw Utilities.newCoreException(NLS.bind(Messages.SiteFileFactory_UnableToCreateURLForFile, (new String[] { newFilePath })), e); |
| 231 |
} |
254 |
} |
| 232 |
} |
255 |
} |
| 233 |
} |
256 |
} |
| 234 |
|
257 |
|
|
|
258 |
private void printWarning(File directory) throws IOException { |
| 259 |
System.out.println(); |
| 260 |
System.out.println(" - - - - - " + "Unexpectedly found filtered directory was null instead of empty array: "); |
| 261 |
System.out.println(" - - - - - " + directory.getCanonicalPath()); |
| 262 |
System.out.println(" - - - - - " + " canRead: " + directory.canRead()); |
| 263 |
System.out.println(" - - - - - " + " isDirectory: " + directory.isDirectory()); |
| 264 |
System.out.println(" - - - - - " + " isHidden: " + directory.isHidden()); |
| 265 |
System.out.println(); |
| 266 |
} |
| 267 |
|
| 235 |
/** |
268 |
/** |
| 236 |
* Method parsePlugins. |
269 |
* Method parsePlugins. |
| 237 |
* |
270 |
* |
|
Lines 249-263
Link Here
|
| 249 |
return f.isDirectory(); |
282 |
return f.isDirectory(); |
| 250 |
} |
283 |
} |
| 251 |
}); |
284 |
}); |
| 252 |
DefaultPluginParser parser = new DefaultPluginParser(); |
285 |
|
| 253 |
for (int i = 0; i < dirs.length; i++) { |
286 |
if (dirs == null) { |
| 254 |
File pluginFile = new File(dirs[i], "META-INF/MANIFEST.MF"); //$NON-NLS-1$ |
|
|
| 255 |
InputStream in = null; |
| 256 |
try { |
287 |
try { |
| 257 |
BundleManifest bundleManifest = new BundleManifest(pluginFile); |
288 |
printWarning(pluginsDir); |
| 258 |
if (bundleManifest.exists()) { |
289 |
} |
| 259 |
PluginEntry entry = bundleManifest.getPluginEntry(); |
290 |
catch (IOException e) { |
| 260 |
addParsedPlugin(entry, dirs[i]); |
291 |
System.out.println(" * * * * * " + "Unexpected exception while handline exception: "); |
|
|
292 |
System.out.println(e.getMessage()); |
| 293 |
} |
| 294 |
} |
| 295 |
else { |
| 296 |
|
| 297 |
DefaultPluginParser parser = new DefaultPluginParser(); |
| 298 |
|
| 299 |
for (int i = 0; i < dirs.length; i++) { |
| 300 |
File pluginFile = new File(dirs[i], "META-INF/MANIFEST.MF"); //$NON-NLS-1$ |
| 301 |
InputStream in = null; |
| 302 |
try { |
| 303 |
BundleManifest bundleManifest = new BundleManifest(pluginFile); |
| 304 |
if (bundleManifest.exists()) { |
| 305 |
PluginEntry entry = bundleManifest.getPluginEntry(); |
| 306 |
addParsedPlugin(entry, dirs[i]); |
| 261 |
} else { |
307 |
} else { |
| 262 |
if (!(pluginFile = new File(dirs[i], "plugin.xml")) //$NON-NLS-1$ |
308 |
if (!(pluginFile = new File(dirs[i], "plugin.xml")) //$NON-NLS-1$ |
| 263 |
.exists()) { |
309 |
.exists()) { |
|
Lines 286-296
Link Here
|
| 286 |
try{ |
332 |
try{ |
| 287 |
in.close(); |
333 |
in.close(); |
| 288 |
} catch(IOException e){ |
334 |
} catch(IOException e){ |
|
|
335 |
} |
| 336 |
} |
| 289 |
} |
337 |
} |
| 290 |
} |
338 |
} |
| 291 |
} |
339 |
} |
| 292 |
} |
340 |
} |
| 293 |
} |
341 |
|
| 294 |
|
342 |
|
| 295 |
/** |
343 |
/** |
| 296 |
* tranform each Plugin and Fragment into an ArchiveReferenceModel |
344 |
* tranform each Plugin and Fragment into an ArchiveReferenceModel |
|
Lines 336-347
Link Here
|
| 336 |
return; |
384 |
return; |
| 337 |
} |
385 |
} |
| 338 |
String[] dir = pluginDir.list(FeaturePackagedContentProvider.filter); |
386 |
String[] dir = pluginDir.list(FeaturePackagedContentProvider.filter); |
| 339 |
for (int i = 0; i < dir.length; i++) { |
387 |
if (dir == null) { |
| 340 |
ContentReference ref = null; |
|
|
| 341 |
String refString = null; |
| 342 |
InputStream in = null; |
| 343 |
try { |
388 |
try { |
| 344 |
File file = new File(pluginDir, dir[i]); |
389 |
printWarning(pluginDir); |
|
|
390 |
} |
| 391 |
catch (IOException e) { |
| 392 |
System.out.println(" * * * * * " + "Unexpected exception while handline exception: "); |
| 393 |
System.out.println(e.getMessage()); |
| 394 |
} |
| 395 |
} |
| 396 |
else { |
| 397 |
for (int i = 0; i < dir.length; i++) { |
| 398 |
ContentReference ref = null; |
| 399 |
String refString = null; |
| 400 |
InputStream in = null; |
| 401 |
try { |
| 402 |
File file = new File(pluginDir, dir[i]); |
| 345 |
JarContentReference jarReference = new JarContentReference( |
403 |
JarContentReference jarReference = new JarContentReference( |
| 346 |
null, file); |
404 |
null, file); |
| 347 |
ref = jarReference.peek("META-INF/MANIFEST.MF", null, null); //$NON-NLS-1$ |
405 |
ref = jarReference.peek("META-INF/MANIFEST.MF", null, null); //$NON-NLS-1$ |
|
Lines 351-358
Link Here
|
| 351 |
if (manifest.exists()) { |
409 |
if (manifest.exists()) { |
| 352 |
addParsedPlugin(manifest.getPluginEntry(), file); |
410 |
addParsedPlugin(manifest.getPluginEntry(), file); |
| 353 |
continue; |
411 |
continue; |
|
|
412 |
} |
| 354 |
} |
413 |
} |
| 355 |
} |
414 |
|
| 356 |
ref = jarReference.peek("plugin.xml", null, null); //$NON-NLS-1$ |
415 |
ref = jarReference.peek("plugin.xml", null, null); //$NON-NLS-1$ |
| 357 |
if (ref == null) { |
416 |
if (ref == null) { |
| 358 |
ref = jarReference.peek("fragment.xml", null, null); //$NON-NLS-1$ |
417 |
ref = jarReference.peek("fragment.xml", null, null); //$NON-NLS-1$ |
|
Lines 381-391
Link Here
|
| 381 |
try{ |
440 |
try{ |
| 382 |
in.close(); |
441 |
in.close(); |
| 383 |
}catch(IOException ce){ |
442 |
}catch(IOException ce){ |
|
|
443 |
} |
| 444 |
} |
| 384 |
} |
445 |
} |
| 385 |
} |
446 |
} |
| 386 |
} |
447 |
} |
| 387 |
} |
448 |
} |
| 388 |
} |
449 |
|
| 389 |
|
450 |
|
| 390 |
/* |
451 |
/* |
| 391 |
* @see SiteModelFactory#createSiteMapModel() |
452 |
* @see SiteModelFactory#createSiteMapModel() |