X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=hs-java.git;a=blobdiff_plain;f=Java%2FMETA%2FSpec.hs;fp=Java%2FMETA%2FSpec.hs;h=1e296fba177a36ba945bdd1eafd99d7bd1491afc;hp=82d55c1ed712e6702e9206ef62c55b12696cb378;hb=22d4ad212c27135cea11b577c62f7d133d392d4e;hpb=f70370b0813194dc47d76cd349f0d8a02616062c diff --git a/Java/META/Spec.hs b/Java/META/Spec.hs index 82d55c1..1e296fb 100644 --- a/Java/META/Spec.hs +++ b/Java/META/Spec.hs @@ -35,65 +35,3 @@ string2bool s | map toLower s == "true" = True | otherwise = False -data Manifest = Manifest { - manifestVersion :: String, - createdBy :: String, - sealed :: Bool, - signatureVersion :: Maybe String, - classPath :: [String], - mainClass :: Maybe String, - manifestEntries :: [ManifestEntry]} - deriving (Eq, Show) - -data ManifestEntry = ManifestEntry { - meName :: String, - meSealed :: Bool, - meContentType :: Maybe String, - meBean :: Bool } - deriving (Eq, Show) - -instance MetaSpec Manifest where - loadFirstSection s = Manifest { - manifestVersion = s ! "Manifest-Version", - createdBy = s ! "Created-By", - sealed = case M.lookup "Sealed" s of - Nothing -> False - Just str -> string2bool str, - signatureVersion = M.lookup "Signature-Version" s, - classPath = case M.lookup "Class-Path" s of - Nothing -> [] - Just str -> words str, - mainClass = M.lookup "Main-Class" s, - manifestEntries = []} - - loadOtherSection m s = m {manifestEntries = manifestEntries m ++ [entry]} - where - entry = ManifestEntry { - meName = s ! "Name", - meSealed = case M.lookup "Sealed" s of - Nothing -> sealed m - Just str -> string2bool str, - meContentType = M.lookup "Content-Type" s, - meBean = case M.lookup "Java-Bean" s of - Nothing -> False - Just str -> string2bool str } - - storeMeta m = first: map store (manifestEntries m) - where - first = M.fromList $ [ - ("Manifest-Version", manifestVersion m), - ("Created-By", createdBy m)] ++ - lookupList "Signature-Version" (signatureVersion m) ++ - lookupList "Main-Class" (mainClass m) ++ - case classPath m of - [] -> [] - list -> [("Class-Path", unwords list)] - - store e = M.fromList $ [ - ("Name", meName e), - ("Sealed", bool2string $ meSealed e)] ++ - lookupList "Content-Type" (meContentType e) ++ - if meBean e - then [("Java-Bean", "true")] - else [] -