3 (module Java.META.Types,
4 module Java.META.Parser,
9 import Java.META.Parser
12 data Manifest = Manifest {
13 manifestVersion :: String,
16 signatureVersion :: Maybe String,
17 classPath :: [String],
18 mainClass :: Maybe String,
19 manifestEntries :: [ManifestEntry]}
22 data ManifestEntry = ManifestEntry {
25 meContentType :: Maybe String,
29 instance MetaSpec Manifest where
30 loadFirstSection s = Manifest {
31 manifestVersion = s ! "Manifest-Version",
32 createdBy = s ! "Created-By",
33 sealed = case M.lookup "Sealed" s of
35 Just str -> string2bool str,
36 signatureVersion = M.lookup "Signature-Version" s,
37 classPath = case M.lookup "Class-Path" s of
39 Just str -> words str,
40 mainClass = M.lookup "Main-Class" s,
43 loadOtherSection m s = m {manifestEntries = manifestEntries m ++ [entry]}
45 entry = ManifestEntry {
47 meSealed = case M.lookup "Sealed" s of
49 Just str -> string2bool str,
50 meContentType = M.lookup "Content-Type" s,
51 meBean = case M.lookup "Java-Bean" s of
53 Just str -> string2bool str }
55 storeMeta m = first: map store (manifestEntries m)
57 first = M.fromList $ [
58 ("Manifest-Version", manifestVersion m),
59 ("Created-By", createdBy m)] ++
60 lookupList "Signature-Version" (signatureVersion m) ++
61 lookupList "Main-Class" (mainClass m) ++
64 list -> [("Class-Path", unwords list)]
66 store e = M.fromList $ [
68 ("Sealed", bool2string $ meSealed e)] ++
69 lookupList "Content-Type" (meContentType e) ++
71 then [("Java-Bean", "true")]