Revision 886 org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.api/src/main/java/org/gvsig/topology/lib/spi/AbstractTopologyRuleFactory.java
AbstractTopologyRuleFactory.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.topology.lib.spi; |
25 | 25 |
|
26 |
import java.net.URL; |
|
26 | 27 |
import java.util.List; |
27 |
import org.gvsig.fmap.geom.Geometry; |
|
28 | 28 |
import org.gvsig.fmap.geom.GeometryLocator; |
29 | 29 |
import org.gvsig.fmap.geom.GeometryManager; |
30 |
import org.gvsig.tools.util.ListBuilder; |
|
31 | 30 |
import org.gvsig.topology.lib.api.TopologyDataSet; |
32 | 31 |
import org.gvsig.topology.lib.api.TopologyRuleFactory; |
33 | 32 |
import org.json.JSONObject; |
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
34 | 35 |
|
35 | 36 |
/** |
36 | 37 |
* |
37 | 38 |
* @author jjdelcerro |
38 | 39 |
*/ |
39 | 40 |
public abstract class AbstractTopologyRuleFactory implements TopologyRuleFactory { |
41 |
|
|
42 |
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractTopologyRuleFactory.class); |
|
43 |
|
|
40 | 44 |
private final String id; |
41 |
private String name;
|
|
42 |
private String description;
|
|
45 |
protected String name;
|
|
46 |
protected String description;
|
|
43 | 47 |
private final List<Integer> geometryTypeDataSet1; |
44 | 48 |
private final List<Integer> geometryTypeDataSet2; |
45 | 49 |
|
... | ... | |
128 | 132 |
} |
129 | 133 |
return false; |
130 | 134 |
} |
131 |
|
|
135 |
|
|
132 | 136 |
private void load_from_resource() { |
133 |
JSONObject json = RuleResourceLoaderUtils.getRule(this.id); |
|
137 |
URL url = RuleResourceLoaderUtils.getRuleURL(this.id); |
|
138 |
JSONObject json = RuleResourceLoaderUtils.getRule(url); |
|
139 |
load_from_resource(url, json); |
|
140 |
} |
|
141 |
|
|
142 |
protected void load_from_resource(URL jsonUrl, JSONObject json) { |
|
134 | 143 |
if( json == null ) { |
135 | 144 |
return; |
136 | 145 |
} |
... | ... | |
138 | 147 |
this.name = json.getString("name"); |
139 | 148 |
} |
140 | 149 |
if( json.has("description") ) { |
141 |
this.description = RuleResourceLoaderUtils.getDescription(this.id, json);
|
|
150 |
this.description = RuleResourceLoaderUtils.getDescription(jsonUrl, json);
|
|
142 | 151 |
} |
143 | 152 |
} |
144 | 153 |
} |
Also available in: Unified diff