Hi, sorry for the lack of clarity Manuranga. The answer is no to your question. It will only throw out a warning if it encounters a non-OSGi JAR and simply skip processing that file. The other files will continue to be processed.
Simply, all the OSGi bundles' details in the dropins directory will be updated in the bundles.info file while others will be left out. On Thu, Apr 28, 2016 at 7:20 PM, Manuranga Perera <[email protected]> wrote: > Hi, > Sorry, I was not asking about corrupted jars, asking about non-OSGi jars. > Was wondering why you said "no *other *file(s) will be written to the > bundles.info file of the particular profile, thus will not be picked up > by the Carbon server". Does this means, if I have one non-OSGi jar in > dropins some other OSGi jars will not get picked up? > > On Thu, Apr 28, 2016 at 1:13 AM, Chiranga Alwis <[email protected]> wrote: > >> Hi Manuranga, >> >> in addition to the above checks in relation with filtering out non-OSGi >> bundles, in order to access the JAR file Manifest to retrieve the required >> Manifest headers, I am using java.util.jar.JarFile >> <https://docs.oracle.com/javase/7/docs/api/java/util/jar/JarFile.html> >> class. The code fragment within the getNewBundleInfo method, for retrieving >> the Manifest information is as follows: >> >> try (JarFile jarFile = new JarFile(bundlePath.toString())) { >> Manifest manifest = jarFile.getManifest(); >> if ((manifest == null) || (manifest.getMainAttributes() == null)) { >> throw new IOException("Invalid OSGi bundle found in the " + >> Constants.DROPINS + >> " directory: " + jarFile.toString()); >> } else { >> String bundleSymbolicName = >> manifest.getMainAttributes().getValue("Bundle-SymbolicName"); >> String bundleVersion = >> manifest.getMainAttributes().getValue("Bundle-Version"); >> >> if (bundleSymbolicName == null || bundleVersion == null) { >> throw new IOException( >> "Required bundle manifest headers do not exist in " + >> jarFile.toString()); >> } else { >> if (bundleSymbolicName.contains(";")) { >> bundleSymbolicName = bundleSymbolicName.split(";")[0]; >> } >> } >> >> // checks whether this bundle is a fragment or not >> boolean isFragment = >> (manifest.getMainAttributes().getValue("Fragment-Host") != null); >> int defaultBundleStartLevel = 4; >> BundleInfo generated = new BundleInfo(bundleSymbolicName, >> bundleVersion, >> "../../" + Constants.DROPINS + "/" + fileName, >> defaultBundleStartLevel, isFragment); >> return Optional.of(generated); >> } >> } >> >> The above code fragment will be executed for every file path within the >> dropins directory, which has a .jar extension. Since we are using the above >> mentioned class, I believe that during the creation of the JarFile >> <https://docs.oracle.com/javase/7/docs/api/java/util/jar/JarFile.html> >> instance (for each file with a .jar extension) will be checked for a >> corrupted JAR. >> >> The complete implementation of the above functionality can be accessed >> from here >> <https://github.com/wso2/carbon-kernel/tree/master/launcher/src/main/java/org/wso2/carbon/launcher/extensions> >> . >> >> >> On Wed, Apr 27, 2016 at 7:45 PM, Manuranga Perera <[email protected]> wrote: >> >>> no *other *file(s) will be written to the bundles.info file of the >>>> particular profile, thus will not be picked up by the Carbon server. >>>> >>> >>> Any reason why not only faulty bundle is ignored ? >>> >>> -- >>> With regards, >>> *Manu*ranga Perera. >>> >>> phone : 071 7 70 20 50 >>> mail : [email protected] >>> >> >> >> >> -- >> Chiranga Alwis, >> Software Engineering Intern, >> +94 77 5930497 >> +94 77 6368208 >> > > > > -- > With regards, > *Manu*ranga Perera. > > phone : 071 7 70 20 50 > mail : [email protected] > -- Chiranga Alwis, Software Engineering Intern, +94 77 5930497 +94 77 6368208
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
