01: package net.refractions.udig.project.internal.impl;
02:
03: import java.io.IOException;
04: import java.net.MalformedURLException;
05: import java.net.URL;
06:
07: import net.refractions.udig.catalog.IGeoResource;
08: import net.refractions.udig.catalog.IGeoResourceInfo;
09: import net.refractions.udig.catalog.IService;
10: import net.refractions.udig.project.internal.Messages;
11:
12: import org.eclipse.core.runtime.IProgressMonitor;
13: import org.geotools.geometry.jts.ReferencedEnvelope;
14: import org.opengis.referencing.crs.CoordinateReferenceSystem;
15:
16: import com.vividsolutions.jts.geom.Envelope;
17:
18: /**
19: * Indicates that no georesources were found for the layer
20: *
21: * @author Jesse
22: */
23: public class NullGeoResource extends IGeoResource {
24:
25: @Override
26: public <T> T resolve(Class<T> adaptee, IProgressMonitor monitor) {
27: return null;
28: }
29:
30: public IService service(IProgressMonitor monitor)
31: throws IOException {
32: return null; // where is NullService ?
33: }
34:
35: public <T> boolean canResolve(Class<T> adaptee) {
36: return false;
37: }
38:
39: public Status getStatus() {
40: return Status.BROKEN;
41: }
42:
43: public Throwable getMessage() {
44: return new Exception(Messages.NullGeoResource_0);
45: }
46:
47: public URL getIdentifier() {
48: try {
49: return new URL("http://NULL"); //$NON-NLS-1$
50: } catch (MalformedURLException e) {
51: // Can't happen
52: e.printStackTrace();
53: return null;
54: }
55: }
56:
57: @Override
58: public IGeoResourceInfo getInfo(IProgressMonitor monitor) {
59: // TODO Auto-generated method stub
60: return new IGeoResourceInfo() {
61: @Override
62: public ReferencedEnvelope getBounds() {
63: // TODO Auto-generated method stub
64: return new ReferencedEnvelope(new Envelope(), null);
65: }
66:
67: @Override
68: public CoordinateReferenceSystem getCRS() {
69: // TODO Auto-generated method stub
70: return null;
71: }
72:
73: };
74: }
75: }
|