src/share/classes/org/openjdk/jigsaw/PublishedRepository.java

Print this page

        

@@ -171,12 +171,12 @@
         if (e == null)
             throw new IllegalArgumentException(mid + ": No such module");
         return jms.parseModuleInfo(e.mibs);
     }
 
-    private ModuleType getModuleType(Path modp) {
-        for (ModuleType type: ModuleType.values()) {
+    private ModuleFileType getModuleFileType(Path modp) {
+        for (ModuleFileType type: ModuleFileType.values()) {
             if (modp.getFileName().toString().endsWith(type.getFileNameSuffix())) {
                 return type;
             }
         }   
 

@@ -186,34 +186,34 @@
     
     private Path getModulePath(ModuleId mid, String ext) throws IOException {
         return path.resolve(mid.toString() + ext);
     }
     
-    private Path getModulePath(ModuleId mid, ModuleType type) throws IOException {
+    private Path getModulePath(ModuleId mid, ModuleFileType type) throws IOException {
         return getModulePath(mid, type.getFileNameSuffix());
     }
 
     private Path getModulePath(ModuleId mid) throws IOException {
-        for (ModuleType type: ModuleType.values()) {
+        for (ModuleFileType type: ModuleFileType.values()) {
             Path file = getModulePath(mid, type);
             if (Files.exists(file)) {
                 return file;
             }
         }
         throw new IllegalArgumentException(mid + ": No such module file");
     }
 
     private Entry readModuleInfo(Path modp) throws IOException {
-        return readModuleInfo(modp, getModuleType(modp));
+        return readModuleInfo(modp, getModuleFileType(modp));
     }
       
     private Entry getModuleInfo(ModuleId mid) throws IOException {
         return readModuleInfo(getModulePath(mid));
     }
     
-    private Entry readModuleInfo(Path modp, ModuleType type) throws IOException {
-        switch(getModuleType(modp)) {
+    private Entry readModuleInfo(Path modp, ModuleFileType type) throws IOException {
+        switch(getModuleFileType(modp)) {
             case JAR: 
                 return readModuleInfoFromModularJarFile(modp);
             case JMOD: 
                 return readModuleInfoFromJmodFile(modp);
             default:

@@ -230,11 +230,12 @@
             ModuleFileHeader mfh = parser.fileHeader();
             
             // Move to the module info section
             parser.next();
             
-            return new Entry(ModuleType.JMOD, 
+            return new Entry(ModuleFileType.JMOD,
+                             mfh.getArchitecture(),
                              toByteArray(parser.getContentStream()), 
                              mfh.getCSize(), 
                              mfh.getUSize(), 
                              mfh.getHashType(), 
                              mfh.getHash());

@@ -256,11 +257,12 @@
                 }
                 
                 usize += je.getSize();
             }
                         
-            return new Entry(ModuleType.JAR, 
+            return new Entry(ModuleFileType.JAR,
+                            ModuleArchitecture.ANY,
                             toByteArray(j, moduleInfo),
                             jf.length(), 
                             usize, 
                             HashType.SHA256,
                             digest(jf));   

@@ -334,16 +336,16 @@
             throw new IllegalArgumentException(mid + ": No such module");
         return Files.newInputStream(getModulePath(mid, e.type));
     }
 
     @Override
-    public ModuleMetaData fetchMetaData(ModuleId mid) throws IOException {
+    public ModuleFileMetaData fetchMetaData(ModuleId mid) throws IOException {
         RepositoryCatalog cat = loadCatalog();
         Entry e = cat.get(mid);
         if (e == null)
             throw new IllegalArgumentException(mid + ": No such module");
-        return new ModuleMetaData(e.type, e.csize, e.usize);
+        return new ModuleFileMetaData(e.type, e.modArch, e.csize, e.usize);
     }
 
     public boolean remove(ModuleId mid) throws IOException {
         try (FileChannel lc = FileChannel.open(lockp, READ, WRITE)) {
             lc.lock();

@@ -373,20 +375,20 @@
     {
         // ## Change to use String joiner when lamda is merged into JDK8
         StringBuilder sb = new StringBuilder();
         sb.append("*.{");
         int l = sb.length();
-        for (ModuleType type: ModuleType.values()) {
+        for (ModuleFileType type: ModuleFileType.values()) {
             if (sb.length() > l) {
                 sb.append(",");
             }
             sb.append(type.getFileNameExtension());
         }
         sb.append("}");
         try (DirectoryStream<Path> ds = Files.newDirectoryStream(path, sb.toString())) { 
             for (Path modp : ds) {
-                ModuleType type = getModuleType(modp);
+                ModuleFileType type = getModuleFileType(modp);
                 String fn = modp.getFileName().toString();
                 ModuleId mid
                     = jms.parseModuleId(fn.substring(0, fn.length() - type.getFileNameSuffix().length()));
                 mids.add(mid);
             }