[FELIX-56] Initial submission of mangen 1.0.1 from Ascert's inhouse mangen repository. At present mangen builds but will need further work for either "distribution" creation to be used as an external tool, and to assess if and how it can be integrated within Felix build.

git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@434371 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/mangen/src/main/resources/mangen.properties b/tools/mangen/src/main/resources/mangen.properties
new file mode 100644
index 0000000..ea7c354
--- /dev/null
+++ b/tools/mangen/src/main/resources/mangen.properties
@@ -0,0 +1,102 @@
+# ------------------------------------------------------------------

+# General mangen properties example

+# ------------------------------------------------------------------

+

+# Determines which OSGi release level to create the bundle jars against. Current

+# valid values are '3' and '4' (default is '3')

+mangen.osgi.level=3

+

+

+# Determines whether to automatically process any inner jars found, including

+# generation of a suitable "Bundle-Classpath" header. Valid values are 'true' or

+# 'false' (default is 'false').

+#TODO: not implemented yet

+#mangen.innerjar.auto=true

+

+# Default is to fail (exit code = 3) on errors, can be disabled

+#mangen.failonerror=off

+# Optionally can be made to fail (exit code = 5) if there are warnings

+#mangen.failonwarning=on

+

+#

+# The concept of rulesets is to make it easier to group whole sets of rules for

+# use e.g. here it's used to separate general rules, OSGi R3 vs. OSGi R4

+# specific rules, and an app. specific rule to ignore all Ant packages found

+# in packages. Without rulesets, the sequential numbering means that mixing

+# and matching various rules requires a lot of manual renumbering.

+#

+# Note also the use of ${var} expansion, which follows the same model as used

+# for Oscar properties (http://oscar.objectweb.org/)

+#

+mangen.rulesets=mangen-rule-initial- ,  mangen-rule-R${mangen.osgi.level}- , mangen-rule- , mangen-rule-final-

+

+# Standard JDK javax.* packages

+mangen.jdk.javax.packages=javax\\.accessibility,javax\\.crypto,javax\\.crypto\\.interfaces,javax\\.crypto\\.spec,javax\\.imageio,javax\\.imageio\\.event,javax\\.imageio\\.metadata,javax\\.imageio\\.plugins\\.jpeg,javax\\.imageio\\.spi,javax\\.imageio\\.stream,javax\\.naming,javax\\.naming\\.directory,javax\\.naming\\.event,javax\\.naming\\.ldap,javax\\.naming\\.spi,javax\\.net,javax\\.net\\.ssl,javax\\.print,javax\\.print\\.attribute,javax\\.print\\.attribute\\.standard,javax\\.print\\.event,javax\\.rmi,javax\\.rmi\\.CORBA,javax\\.security\\.auth,javax\\.security\\.auth\\.callback,javax\\.security\\.auth\\.kerberos,javax\\.security\\.auth\\.login,javax\\.security\\.auth\\.spi,javax\\.security\\.auth\\.x500,javax\\.security\\.cert,javax\\.sound\\.midi,javax\\.sound\\.midi\\.spi,javax\\.sound\\.sampled,javax\\.sound\\.sampled\\.spi,javax\\.sql,javax\\.swing,javax\\.swing\\.border,javax\\.swing\\.colorchooser,javax\\.swing\\.event,javax\\.swing\\.filechooser,javax\\.swing\\.plaf,javax\\.swing\\.plaf\\.basic,javax\\.swing\\.plaf\\.metal,javax\\.swing\\.plaf\\.multi,javax\\.swing\\.table,javax\\.swing\\.text,javax\\.swing\\.text\\.html,javax\\.swing\\.text\\.html\\.parser,javax\\.swing\\.text\\.rtf,javax\\.swing\\.tree,javax\\.swing\\.undo,javax\\.transaction,javax\\.transaction\\.xa,javax\\.xml\\.parsers,javax\\.xml\\.transform,javax\\.xml\\.transform\\.dom,javax\\.xml\\.transform\\.sax,javax\\.xml\\.transform\\.stream,org\\.ietf\\.jgss,org\\.omg\\.CORBA,org\\.omg\\.CORBA_2_3,org\\.omg\\.CORBA_2_3\\.portable,org\\.omg\\.CORBA\\.DynAnyPackage,org\\.omg\\.CORBA\\.ORBPackage,org\\.omg\\.CORBA\\.portable,org\\.omg\\.CORBA\\.TypeCodePackage,org\\.omg\\.CosNaming,org\\.omg\\.CosNaming\\.NamingContextExtPackage,org\\.omg\\.CosNaming\\.NamingContextPackage,org\\.omg\\.Dynamic,org\\.omg\\.DynamicAny,org\\.omg\\.DynamicAny\\.DynAnyFactoryPackage,org\\.omg\\.DynamicAny\\.DynAnyPackage,org\\.omg\\.IOP,org\\.omg\\.IOP\\.CodecFactoryPackage,org\\.omg\\.IOP\\.CodecPackage,org\\.omg\\.Messaging,org\\.omg\\.PortableInterceptor,org\\.omg\\.PortableInterceptor\\.ORBInitInfoPackage,org\\.omg\\.PortableServer,org\\.omg\\.PortableServer\\.CurrentPackage,org\\.omg\\.PortableServer\\.POAManagerPackage,org\\.omg\\.PortableServer\\.POAPackage,org\\.omg\\.PortableServer\\.portable,org\\.omg\\.PortableServer\\.ServantLocatorPackage,org\\.omg\\.SendingContext,org\\.omg\\.stub\\.java\\.rmi,org\\.w3c\\.dom,org\\.xml\\.sax,org\\.xml\\.sax\\.ext,org\\.xml\\.sax\\.helpers

+# R3 treats any standard JDK classes as system packages 

+mangen.R3.syspackages=java\\..*,sun\\..*,com\\.sun\\..*,${mangen.jdk.javax.packages}

+# R4 system packages are only considered to be java.*

+mangen.R4.syspackages=java\\..*

+

+# Initial rule to "process" each bundle's JAR. Without this, no class scanning 

+# will be done. Hence this will nearly always be the first rule.

+mangen-rule-initial-0=ProcessBundles

+# App specific rule to ignore Ant packages

+mangen-rule-initial-1=Ignore imports(org\\.apache\\.tools\\.ant.*)

+

+

+# R3 rule to ignore all standard JDK classes.

+#

+#   The rule contains an option, in this case imports(), which contains a comma

+#   separate list of option qualifiers, in this case a set of regex patterns to 

+#   match against package name.

+#

+#   Care needs to be taken with delimitter chars - ',' and space (' ') should

+#   not be used except as shown since the tokenizer needs them for parsing.

+#   

+mangen-rule-R3-0=Ignore imports(${mangen.R3.syspackages})

+mangen-rule-R3-1=DontImportOwnExports

+mangen-rule-R3-2=ResolveImportsToExports sys-packages(${mangen.R3.syspackages})

+

+# R4 rule is only to ignore java.* classes

+mangen-rule-R4-0=Ignore imports(${mangen.R4.syspackages})

+mangen-rule-R4-1=DontImportOwnExports

+mangen-rule-R4-2=ResolveImportsToExports sys-packages(${mangen.R4.syspackages})

+

+# General rules. These use the default rule name and will also be used if no

+# "mangen.rulesets" property is specified.

+#mangen-rule-0=Merge existing imports(.*) exports(.*)

+mangen-rule-0=Merge fixed imports(.*) exports(.*)

+

+# The AttribuetStamp rule allows atrtibutes to be supplied to be include with

+# mangen generated package names. Shown commented out here to give an example

+#

+#mangen-rule-1=AttributeStamp imports(org\\.osgi\\.framework;version="1.2.0") exports(org\\.osgi\\.service\\.cm;version="2.0.0") 

+

+# Final rules. We use these here to run a rule that will force an update to the 

+# bundle manifests. The "overwrite" option tells mangen to overwrite the bundle

+# with the new version.

+#

+mangen-rule-final-0=UpdateBundles 

+#mangen-rule-final-0=UpdateBundles overwrite 

+

+#

+# Details of which mangen reports need to be run

+#

+mangen-report-0=RuleReport 

+#mangen-report-1=BundleReport  show-local-rules show-differences

+mangen-report-1=BundleReport  show-local-rules

+

+#-----------------------------------------------------------------------------

+#

+# Properties below this section should not be changed without a good 

+# understanding of mangen's internal operation

+#

+

+# Specifies which scanner class to use.

+#mangen.scanner.class=com.ascert.openosgi.mangen.BCELScanner

+mangen.scanner.class=org.ungoverned.osgi.mangen.ASMClassScanner

+

+# Diagnostic tracing

+#mangen.trace=on

+

+

diff --git a/tools/mangen/src/main/resources/obr.properties b/tools/mangen/src/main/resources/obr.properties
new file mode 100644
index 0000000..22fed88
--- /dev/null
+++ b/tools/mangen/src/main/resources/obr.properties
@@ -0,0 +1,100 @@
+# ------------------------------------------------------------------

+# Example mangen properties for generation of OBR descriptors

+# ------------------------------------------------------------------

+

+#

+# We don't use a ProcessBundles rule, hence no imports/exports will be generated

+# Rather than assume this will always be the case, we use a "Merge" rule to 

+# merge the current imports/exports into the mangen set. This allows the

+# ObrReport to use the mangen generated set, and ensures that 

+# descriptors can be created either from existing import/exports or generated

+# imports/exports.

+#

+mangen.rulesets=mangen-rule- 

+mangen-rule-0=Merge existing imports(.*) exports(.*)

+

+#

+# Create the OBR descriptor report

+#

+mangen-report-0=ObrReport skip-jars(.*-src\\.jar)

+

+#-----------------------------------------------------------------------------

+#

+# Properties below this section should not be changed without a good 

+# understanding of mangen's internal operation

+#

+

+# Specifies which scanner class to use.

+mangen.scanner.class=com.ascert.openosgi.mangen.BCELScanner

+#mangen.scanner.class=org.ungoverned.osgi.mangen.ASMClassScanner

+

+#

+# Controls which format of OBR descriptor to create

+#

+mangen.obr.ver=1

+

+#

+# Formats for OBR 1 descriptor

+#

+mangen.obr.descr.1=\

+<bundle>\n   \

+    <bundle-name>@@hdr:Bundle-Name@@</bundle-name>\n   \

+    <bundle-description>@@hdr:Bundle-Description@@</bundle-description>\n   \

+    <bundle-updatelocation>@@hdr:Bundle-UpdateLocation@@</bundle-updatelocation>\n   \

+    <bundle-sourceurl>@@hdr:Bundle-SourceUrl@@</bundle-sourceurl>\n   \

+    <bundle-version>@@hdr:Bundle-Version@@</bundle-version>\n   \

+    <bundle-docurl>@@hdr:Bundle-DocURL@@</bundle-docurl>\n   \

+    <bundle-category>@@hdr:Bundle-Category@@</bundle-category>\n   \

+    @@imports@@\

+    @@exports@@\n\

+</bundle>

+

+mangen.obr.import.1=<import-package package="@@pkg:name@@" @@import-ver@@/>\n   

+mangen.obr.import.ver.1=specification-version="@@pkg:ver@@"

+

+mangen.obr.export.1=<export-package package="@@pkg:name@@" @@export-ver@@/>\n   

+mangen.obr.export.ver.1=specification-version="@@pkg:ver@@"

+

+#

+# Formats for OBR 2 descriptor

+#

+mangen.obr.descr.2=\

+<bundle>\n   \

+    <bundle-name>@@hdr:Bundle-Name@@</bundle-name>\n   \

+    <bundle-symbolicname>@@hdr:Bundle-SymbolicName@@</bundle-symbolicname>\n   \

+    <bundle-description>@@hdr:Bundle-Description@@</bundle-description>\n   \

+    <bundle-url>@@hdr:Bundle-URL@@</bundle-url>\n   \

+    <bundle-sourceurl>@@hdr:Bundle-SourceUrl@@</bundle-sourceurl>\n   \

+    <bundle-version>@@hdr:Bundle-Version@@</bundle-version>\n   \

+    <bundle-docurl>@@hdr:Bundle-DocURL@@</bundle-docurl>\n   \

+    <bundle-category>@@hdr:Bundle-Category@@</bundle-category>\n   \

+    @@imports@@   \

+    @@exports@@\n\

+</bundle>

+

+mangen.obr.import.2=   \

+    <requirement>\n   \

+        <![CDATA[\n      \

+            (&(type=Export-Package)\n         \

+            (name=@@pkg:name@@)\n         \

+            @@import-ver@@)\n         \

+        ]]>\n   \

+   </requirement>\n

+mangen.obr.import.ver.2=(version>=@@pkg:ver@@)

+

+mangen.obr.export.2=   \

+    <capability>\n      \

+        <property name="type"\n         \

+            type="java.lang.String"\n         \

+            value="Export-Package"/>\n      \

+        <property name="name"\n         \

+            type="java.lang.String"\n         \

+            value="@@pkg:name@@"/>\n      \

+        @@export-ver@@\

+    </capability>

+mangen.obr.export.ver.2=\

+        <property name="version"\n         \

+            type="org.ungoverned.osgi.bundle.bundlerepository.R4Version"\n         \

+            value="@@pkg:ver@@"/>\n   \

+

+