Search in sources :

Example 1 with IResourceInfo

use of org.polymap.core.catalog.resolve.IResourceInfo in project polymap4-core by Polymap4.

the class MetadataContentProvider method updateMetadata.

/**
 * @param elm
 * @param currentChildCount
 */
protected void updateMetadata(IMetadata elm, int currentChildCount) {
    updateChildrenLoading(elm);
    UIJob job = new UIJob("Resolve service") {

        @Override
        protected void runWithException(IProgressMonitor monitor) throws Exception {
            IMetadata metadata = (IMetadata) elm;
            if (resolver.canResolve(metadata)) {
                try {
                    IServiceInfo service = (IServiceInfo) resolver.resolve(metadata, monitor);
                    // skip service as it has not more info than metadata record
                    IResourceInfo[] children = Iterables.toArray(service.getResources(monitor), IResourceInfo.class);
                    updateChildren(elm, children, currentChildCount);
                } catch (Exception e) {
                    // FIXME handle exceptions
                    log.warn("", e);
                    throw new RuntimeException(e);
                }
            } else {
                updateChildren(elm, new Object[] { "Unable to resolve the service." }, currentChildCount);
            }
        }
    };
    job.scheduleWithUIUpdate();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IMetadata(org.polymap.core.catalog.IMetadata) IServiceInfo(org.polymap.core.catalog.resolve.IServiceInfo) UIJob(org.polymap.core.runtime.UIJob) IResourceInfo(org.polymap.core.catalog.resolve.IResourceInfo)

Example 2 with IResourceInfo

use of org.polymap.core.catalog.resolve.IResourceInfo in project polymap4-core by Polymap4.

the class WfsServiceInfo method getResources.

@Override
public Iterable<IResourceInfo> getResources(IProgressMonitor monitor) throws Exception {
    List<IResourceInfo> result = new ArrayList();
    for (Name name : ds.getNames()) {
        ResourceInfo info = ds.getFeatureSource(name).getInfo();
        result.add(new WfsResourceInfo(this, info));
    }
    return result;
}
Also used : DefaultResourceInfo(org.polymap.core.catalog.resolve.DefaultResourceInfo) IResourceInfo(org.polymap.core.catalog.resolve.IResourceInfo) ResourceInfo(org.geotools.data.ResourceInfo) ArrayList(java.util.ArrayList) IResourceInfo(org.polymap.core.catalog.resolve.IResourceInfo) Name(org.opengis.feature.type.Name)

Aggregations

IResourceInfo (org.polymap.core.catalog.resolve.IResourceInfo)2 ArrayList (java.util.ArrayList)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ResourceInfo (org.geotools.data.ResourceInfo)1 Name (org.opengis.feature.type.Name)1 IMetadata (org.polymap.core.catalog.IMetadata)1 DefaultResourceInfo (org.polymap.core.catalog.resolve.DefaultResourceInfo)1 IServiceInfo (org.polymap.core.catalog.resolve.IServiceInfo)1 UIJob (org.polymap.core.runtime.UIJob)1