Package org.openbel.framework.core.df.cache

Examples of org.openbel.framework.core.df.cache.ResolvedResource


            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = c.resolveResource(
                        ResourceType.RESOURCE_INDEX, resourceIndexURL);
                indexFile = resolvedResource.getCacheResourceCopy();
            }

            final ResourceIndex ri = ResourceIndex.INSTANCE;
            ri.loadIndex(indexFile);
            final Index index = ri.getIndex();


            final List<ResourceLocation> nsr = index.getNamespaceResources();
            final Map<String, NamespaceHeader> hvals;
            if (hasItems(nsr)) {
                hvals = new LinkedHashMap<String, NamespaceHeader>(index
                        .getNamespaceResources().size());
                for (ResourceLocation rl : index.getNamespaceResources()) {
                    String loc = rl.getResourceLocation();
                    ResolvedResource nsResource = c.resolveResource(
                            ResourceType.NAMESPACES, loc);
                    NamespaceHeader header = p.parseNamespace(loc,
                            nsResource.getCacheResourceCopy());
                    hvals.put(loc, header);
                }
            } else {
                hvals = new LinkedHashMap<String, NamespaceHeader>();
            }
View Full Code Here


            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = cacheService
                        .resolveResource(ResourceType.RESOURCE_INDEX,
                                resourceIndexURL);
                indexFile = resolvedResource.getCacheResourceCopy();
            }

            ResourceIndex.INSTANCE.loadIndex(indexFile);
        }
        resourceIndex = ResourceIndex.INSTANCE.getIndex();
View Full Code Here

    private void openEquivalence(final Equivalence equivalence)
            throws ResourceDownloadError, IndexingFailure, IOException {

        synchronized (equivalence.getResourceLocation()) {

            ResolvedResource resolved =
                    cacheService.resolveResource(ResourceType.EQUIVALENCES,
                            equivalence.getResourceLocation());

            final DataFileIndex equivalenceIndex =
                    eqIndexer.indexEquivalence(
                            equivalence.getResourceLocation(),
                            resolved.getCacheResourceCopy());

            final EquivalenceDataIndex dataIndex = new EquivalenceDataIndex(
                    equivalence.getNamespaceResourceLocation()
                            .getResourceLocation(), equivalenceIndex);
View Full Code Here

     */
    @Override
    public AnnotationDefinition resolveAnnotationDefinition(
            String resourceLocation)
            throws AnnotationDefinitionResolutionException {
        ResolvedResource resolveResource;
        try {
            resolveResource = resourceCache.resolveResource(
                    ANNOTATIONS, resourceLocation);
        } catch (ResourceDownloadError e) {
            throw new AnnotationDefinitionResolutionException(resourceLocation,
                    e.getMessage());
        }
        File annotationCacheCopy = resolveResource.getCacheResourceCopy();

        CachedResource cacheResource = cacheLookupService.findInCache(
                ANNOTATIONS, resourceLocation);

        AnnotationHeaderProcessor annotationHeaderProcessor =
View Full Code Here

        this.headers = new HashMap<String, NamespaceHeader>(resourceIndex
                .getNamespaceResources().size());

        for (ResourceLocation rl : resourceIndex.getNamespaceResources()) {
            String loc = rl.getResourceLocation();
            ResolvedResource nsResource = cacheableResourceService
                    .resolveResource(ResourceType.NAMESPACES, loc);
            NamespaceHeader header = parser.parseNamespace(loc,
                    nsResource.getCacheResourceCopy());
            headers.put(loc, header);
        }
        logger.debug("Finished loading BEL namespaces");
    }
View Full Code Here

            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = cacheService
                        .resolveResource(ResourceType.RESOURCE_INDEX,
                                resourceIndexURL);
                indexFile = resolvedResource.getCacheResourceCopy();
            }

            ResourceIndex.INSTANCE.loadIndex(indexFile);
        }
        return ResourceIndex.INSTANCE.getIndex();
View Full Code Here

     * @throws ResourceDownloadError Thrown if an error occurred downloading
     * resource
     */
    private String doCompile(String resourceLocation) throws IndexingFailure,
            ResourceDownloadError {
        final ResolvedResource resolved =
                resourceCache.resolveResource(NAMESPACES, resourceLocation);
        final File resourceCopy = resolved.getCacheResourceCopy();
        namespaceIndexerService.indexNamespace(
                resourceLocation, resolved.getCacheResourceCopy());

        final String indexPath = asPath(resourceCopy.getParent(),
                NAMESPACE_ROOT_DIRECTORY_NAME, NS_INDEX_FILE_NAME);
        return indexPath;
    }
View Full Code Here

        // Load resource index from system configuration settings.
        final CacheableResourceService cache = new DefaultCacheableResourceService();
        String resourceIndexURL = getSystemConfiguration().getResourceIndexURL();
        try {
            final ResolvedResource resource = cache.resolveResource(
                    ResourceType.RESOURCE_INDEX, resourceIndexURL);
            ResourceIndex.INSTANCE.loadIndex(resource.getCacheResourceCopy());
        } catch (ResourceDownloadError e) {
            fail("failed to load resource index, download error");
        } catch (FileNotFoundException e) {
            fail("failed to load resource index, not found");
        } catch (XMLStreamException e) {
View Full Code Here

        }

        // load the resource index for phase III use.
        String resourceIndexURL = sysconfig.getResourceIndexURL();
        try {
            final ResolvedResource resource = cache.resolveResource(
                    ResourceType.RESOURCE_INDEX, resourceIndexURL);
            ResourceIndex.INSTANCE.loadIndex(resource.getCacheResourceCopy());
        } catch (ResourceDownloadError e) {
            failIndex(phasecfg, e.getUserFacingMessage());
        } catch (FileNotFoundException e) {
            failIndex(phasecfg, e.getMessage());
        } catch (XMLStreamException e) {
View Full Code Here

        String pfLocation = pfResource.getResourceLocation();
        File pfamResource = null;
        final ResourceType pfamType = fromLocation(pfLocation);
        try {
            ResolvedResource resolvedResource =
                    cache.resolveResource(pfamType, pfLocation);
            pfamResource = resolvedResource.getCacheResourceCopy();
        } catch (ResourceDownloadError e) {
            return failProteinFamilies(pn, bldr, pfLocation,
                    e.getUserFacingMessage());
        }
View Full Code Here

TOP

Related Classes of org.openbel.framework.core.df.cache.ResolvedResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.