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

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


            ResourceDownloadError, XMLStreamException,
            BELDataMissingPropertyException, BELDataConversionException {
        if (instance == null) {
            instance = new Namespaces();

            final CacheableResourceService c = new DefaultCacheableResourceService();
            final NamespaceHeaderParser p = new NamespaceHeaderParser();

            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);
                }
View Full Code Here


    private DefaultParameterEquivalencer() throws IOException,
            ResourceDownloadError, XMLStreamException {
        openEquivalences =
                new ConcurrentHashMap<String, JDBMEquivalenceLookup>();
        cacheService = new DefaultCacheableResourceService();
        eqIndexer = new EquivalenceIndexerServiceImpl();

        if (!ResourceIndex.INSTANCE.isLoaded()) {
            // Load resource index defined by the BELFramework instance
            final SystemConfiguration sysConfig = getSystemConfiguration();
View Full Code Here

        this.resourceCache = resourceCache;
        this.cacheLookupService = cacheLookupService;
    }

    public CacheableAnnotationDefinitionServiceImpl() {
        this.resourceCache = new DefaultCacheableResourceService();
        this.cacheLookupService = new DefaultCacheLookupService();
    }
View Full Code Here

    @Override
    public void setup() {
        super.setup();

        CacheableResourceService cacheService =
                new DefaultCacheableResourceService();
        CacheLookupService cacheLookup = new DefaultCacheLookupService();
        annotationDefService = new DefaultAnnotationDefinitionService(
                cacheService, cacheLookup);
    }
View Full Code Here

        final CacheLookupService cacheLookup = new DefaultCacheLookupService();
        final NamespaceIndexerService nsindexer =
                new NamespaceIndexerServiceImpl();
        final CacheableResourceService cacheService =
                new DefaultCacheableResourceService();
        namespaceService = new DefaultNamespaceService(
                cacheService, cacheLookup, nsindexer);
    }
View Full Code Here

     * {@link SystemConfiguration system config} settings.</li>
     * </ul>
     */
    @BeforeClass
    public static void createProtoNetwork() {
        final CacheableResourceService crs = new DefaultCacheableResourceService();
        final CacheLookupService cls = new DefaultCacheLookupService();
        final NamespaceService nss = new DefaultNamespaceService( crs, cls,
                new NamespaceIndexerServiceImpl());

        final DefaultPhaseOne p1;
        try {
            p1 = new PhaseOneImpl(
                    new XBELValidatorServiceImpl(),
                    new XBELConverterServiceImpl(),
                    new BELValidatorServiceImpl(),
                    new BELConverterServiceImpl(),
                    nss,
                    new SemanticServiceImpl(nss), new ExpansionServiceImpl(),
                    new ProtoNetworkServiceImpl(),
                    new DefaultAnnotationService(),
                    new DefaultAnnotationDefinitionService(crs, cls));
        } catch (Exception e) {
            e.printStackTrace();
            fail("failed to create Phase One due to exception");
            return;
        }

        // read in BEL document and compile to proto network
        final File doc = new File(DOC_PATH);
        assertThat("test BEL document cannot be read", doc.canRead(), is(true));
        Stage1Output p1s1 = p1.stage1BELValidation(doc);
        final ProtoNetworkBuilder bldr = new ProtoNetworkBuilder(p1s1.getDocument());
        pn = bldr.buildProtoNetwork();

        // Create system configuration, BELFRAMEWORK_HOME must be set.
        try {
            createSystemConfiguration();
        } catch (IOException e) {
            e.printStackTrace();
            fail("failed to load system configuration, set BELFRAMEWORK_HOME");
        }

        // 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) {
View Full Code Here

     */
    @Test
    public void testEquivalence() {
        // load equivalences using PhaseTwo
        final DefaultPhaseTwo p2 = new PhaseTwoImpl(
                new DefaultCacheableResourceService(),
                new EquivalenceIndexerServiceImpl(),
                new ProtoNetworkServiceImpl());

        assertThat("test protonetwork is null", pn, notNullValue());

View Full Code Here

     */
    public PhaseThreeApplication(String[] args) {
        super(args);

        sysconfig = getSystemConfiguration();
        cache = new DefaultCacheableResourceService();

        final ProtoNetworkService protonetService =
                new ProtoNetworkServiceImpl();
        final EquivalenceIndexerService indexer =
                new EquivalenceIndexerServiceImpl();
View Full Code Here

        final BELValidatorService belValidator = new BELValidatorServiceImpl();
        final BELConverterService belConverter = new BELConverterServiceImpl();
        final NamespaceIndexerService nsindexer =
                new NamespaceIndexerServiceImpl();
        final CacheableResourceService cache =
                new DefaultCacheableResourceService();
        final CacheLookupService cacheLookup = new DefaultCacheLookupService();
        final NamespaceService nsService = new DefaultNamespaceService(
                cache, cacheLookup, nsindexer);
        final ProtoNetworkService protonetService =
                new ProtoNetworkServiceImpl();
View Full Code Here

        initializeSystemConfiguration();

        config = getSystemConfiguration();
        cacheLookupService = new DefaultCacheLookupService();
        cacheService = new DefaultCacheableResourceService();
        final NamespaceIndexerService nsindexer =
                new NamespaceIndexerServiceImpl();
        final NamespaceService namespace = new DefaultNamespaceService(
                cacheService, cacheLookupService, nsindexer);
        cacheMgrService = new DefaultCacheManagerService(
View Full Code Here

TOP

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

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.