Package org.locationtech.udig.project

Examples of org.locationtech.udig.project.IResourceCachingInterceptor


     * @return the information requested; or null if it is unavailable
     * @throws IOException
     */
    private <T> T processResourceCachingStrategy( IProgressMonitor monitor, Class<T> requestedType )
            throws IOException {
        IResourceCachingInterceptor cachingStrategy = getCachingInterceptors();
        if (cachingStrategy == null) {
            // no caching in use; proceed as normal
            T rawResource = geoResource.resolve(requestedType, monitor);
            if (rawResource == null){               
                return null; // not available!
            }
            T resource = processPreResourceInterceptors(rawResource, requestedType);
            return resource;      
        }
        // we have a caching strategy
        //
        if (cachingStrategy.isCached(layer, geoResource, requestedType)) {
            T resource = cachingStrategy.get(layer, requestedType);
            return resource;
        } else {
            T rawResource;
            if (IGeoResourceInfo.class.isAssignableFrom(requestedType)) {
                rawResource = requestedType.cast(geoResource.getInfo(monitor));
            } else {
                rawResource = geoResource.resolve(requestedType, monitor);
            }
           
            if (rawResource == null){
                return null; // not available!
            }
            T resource = processPreResourceInterceptors(rawResource, requestedType);
            // cache for next time
            cachingStrategy.put(layer, resource, requestedType);
            return resource;
        }
    }
View Full Code Here


                    List<IConfigurationElement> list = ExtensionPointList
                            .getExtensionPointList("org.locationtech.udig.project.resourceInterceptor"); //$NON-NLS-1$
                    for( IConfigurationElement element : list ) {
                        try {
                            if (element.getName().equals("cachingStrategy")) { //$NON-NLS-1$
                                IResourceCachingInterceptor strategy = (IResourceCachingInterceptor) element
                                        .createExecutableExtension("class"); //$NON-NLS-1$
                                caching.put(element.getNamespaceIdentifier()
                                        + "." + element.getAttribute("id"), strategy); //$NON-NLS-1$ //$NON-NLS-2$
                            } else {
                                IResourceInterceptor<?> tmp = (IResourceInterceptor<?>) element
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.IResourceCachingInterceptor

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.