|
20 | 20 | import java.util.Collections; |
21 | 21 | import java.util.Deque; |
22 | 22 | import java.util.Map; |
| 23 | +import java.util.concurrent.ConcurrentHashMap; |
23 | 24 | import java.util.zip.ZipInputStream; |
24 | 25 |
|
25 | 26 | import org.apache.logging.log4j.LogManager; |
@@ -62,6 +63,8 @@ public class DirectLinkingResourceStorageLoadable extends ResourceStorageLoadabl |
62 | 63 |
|
63 | 64 | private static final Logger LOG = LogManager.getLogger(DirectLinkingResourceStorageLoadable.class); |
64 | 65 |
|
| 66 | + private static final Map<String, URI> resourceUriMap = new ConcurrentHashMap<>(100_000); |
| 67 | + private static final Map<String, URI> fragmentUriMap = new ConcurrentHashMap<>(500_000); |
65 | 68 | private static final int SOURCE_BUFFER_CAPACITY = 0x10000; // 64 KiB |
66 | 69 |
|
67 | 70 | private final boolean loadNodeModel; |
@@ -314,6 +317,29 @@ public InternalEObject loadEObject() throws IOException { |
314 | 317 | return result; |
315 | 318 | } |
316 | 319 |
|
| 320 | + @Override |
| 321 | + public URI readURI() throws IOException { |
| 322 | + int id = readCompressedInt(); |
| 323 | + if (id == -1) { |
| 324 | + return null; |
| 325 | + } else { |
| 326 | + URI uri; |
| 327 | + if (uriList.size() <= id) { |
| 328 | + String value = readSegmentedString(); |
| 329 | + uri = resolve(resourceUriMap.computeIfAbsent(value, key -> new DirectLinkingURI(key))); |
| 330 | + uriList.add(uri); |
| 331 | + } else { |
| 332 | + uri = uriList.get(id); |
| 333 | + } |
| 334 | + String fragment = readSegmentedString(); |
| 335 | + if (fragment != null) { |
| 336 | + uri = fragmentUriMap.computeIfAbsent(uri.toString() + '#' + fragment, key -> new DirectLinkingURI(key)); |
| 337 | + // uri = uri.appendFragment(fragment); |
| 338 | + } |
| 339 | + return uri; |
| 340 | + } |
| 341 | + } |
| 342 | + |
317 | 343 | @Override |
318 | 344 | protected void loadFeatureValue(final InternalEObject internalEObject, final EStructuralFeatureData eStructuralFeatureData) throws IOException { |
319 | 345 | try { |
|
0 commit comments