Changeset 621
- Timestamp:
- 01/10/11 09:22:50 (17 months ago)
- Location:
- modules
- Files:
-
- 37 added
- 23 modified
-
sapience-injectors-main/src/META-INF (added)
-
sapience-injectors-main/src/META-INF/MANIFEST.MF (added)
-
sapience-injectors-main/src/main/java/sapience/injectors/model/Reference.java (modified) (1 diff)
-
sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathElement.java (modified) (2 diffs)
-
sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathGenerator.java (modified) (5 diffs)
-
sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathMatcher.java (modified) (3 diffs)
-
sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathPattern.java (modified) (2 diffs)
-
sapience-injectors-main/src/main/java/sapience/injectors/stax/extract/StaxBasedExtractor.java (modified) (7 diffs)
-
sapience-injectors-main/src/main/java/sapience/injectors/stax/inject/ModelBasedStaxStreamInjector.java (modified) (11 diffs)
-
sapience-injectors-parent/pom.xml (modified) (2 diffs)
-
sapience-injectors-testclient/src/main/resources/InjectorConfig.xml (modified) (1 diff)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/TestLifeCycle.java (modified) (2 diffs)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/sos/v100/GetCapabilities/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v100 (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v100/GetCapabilities (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v100/GetCapabilities/Suite_01.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v100/GetCapabilities/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/DescribeFeature/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/Suite_01.java (modified) (4 diffs)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/Suite_02.java (modified) (1 diff)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/Suite_04.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/Test_05.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wps/v040/DescribeProcess/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wps/v040/GetCapabilities/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wps/v100/DescribeProcess/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wps/v100/GetCapabilities/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wsdl/v11/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wsdl/v11/Test_08.java (added)
-
sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wsdl/v20/TestSuite.java (added)
-
sapience-injectors-testclient/src/test/resources/samples/WSDL11/currency (added)
-
sapience-injectors-testclient/src/test/resources/samples/WSDL11/currency/annotated.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/WSDL11/currency/plain.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs100 (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs100/annotated-capabilities.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs100/not-annotated-capabilities.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/corine-capabilities (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/corine-capabilities/getCapabilities-plain.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/corine-capabilities/getCapabilities.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/corine-complex (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/corine-complex/annotated.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/corine-complex/plain.xml (added)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/wfs110-capabilities-testcases/01-serviceIdentification-annotation.xml (modified) (1 diff)
-
sapience-injectors-testclient/src/test/resources/samples/wfs110/wfs110-capabilities-testcases/02-featureType-annotation.xml (modified) (2 diffs)
-
sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v100 (added)
-
sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v100/WFS100_DescribeFeatureConfig.java (added)
-
sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v100/WFS100_GetCapabilitiesConfig.java (added)
-
sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v110/WFS110_DescribeFeatureConfig.java (modified) (1 diff)
-
sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v110/WFS110_GetCapabilitiesConfig.java (modified) (1 diff)
-
sapience-injectors-wps (modified) (1 prop)
-
sapience-injectors-wps/src/META-INF (added)
-
sapience-injectors-wps/src/META-INF/MANIFEST.MF (added)
-
sapience-injectors-wsdl (modified) (1 prop)
-
sapience-injectors-wsdl/src/META-INF (added)
-
sapience-injectors-wsdl/src/META-INF/MANIFEST.MF (added)
-
sapience-lookup-hibernate/.project (modified) (1 diff)
-
sapience-lookup-hibernate/src/main/java/sapience/lookup/hibernate/controller/ReferenceController.java (modified) (2 diffs)
-
sapience-lookup-hibernate/src/main/java/sapience/lookup/hibernate/model/HibernateReference.java (modified) (1 diff)
-
sapience-lookup-hibernate/src/main/resources/META-INF/sqlite.cfg.xml (modified) (1 diff)
-
sapience-lookup-parent/pom.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
modules/sapience-injectors-main/src/main/java/sapience/injectors/model/Reference.java
r492 r621 29 29 30 30 public abstract void setSource(Serializable source); 31 31 32 32 33 } -
modules/sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathElement.java
r541 r621 113 113 * the functions 114 114 * 115 * The following fields are a match (exact match = equals) a) 116 * elem[@attribute='value'] b) elem[@attribute='value'] 117 * 118 * (subsumption match) a) elem[@attribute] (pattern) b) 119 * elem[@attribute='value'] 120 * 121 * (subsumption match) a) elem (pattern) b) elem[@attribute='value'] 122 * d 123 * (no match) a) elem[@myAttribute] b) elem[@yourAttribute='value'] 115 * The following fields are a match 116 * 117 * (exact match = equals) 118 * a) elem[@attribute='value'] b) elem[@attribute='value'] 119 * 120 * (subsumption match) 121 * a) elem[@attribute] (pattern) b) elem[@attribute='value'] 122 * 123 * (subsumption match) 124 * a) elem (pattern) b) elem[@attribute='value'] 125 * 126 * (no match) 127 * a) elem[@myAttribute] b) elem[@yourAttribute='value'] 124 128 * 125 129 * … … 130 134 boolean result = true; 131 135 int foundAttributes = 0; 136 137 138 132 139 133 140 // same name (means, same namespace AND same localname -
modules/sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathGenerator.java
r499 r621 266 266 267 267 public XPathPattern asXPathPattern(Serializable xpath, NamespaceContext context) throws IOException { 268 StringBuilder path = new StringBuilder(xpath.toString()); 269 XPathPattern pattern = new XPathPattern(); 270 271 /* the following extensions are supported (default is attribute extension) 272 * //path1/path2/element[@attr]/child() the matching element is injected as child of element //path1/path2 273 * //path1/path2/element[@attr]/after() the matching element is injected as sibling of element //path1/path2 274 * //path1/path2/example[@attr]/attribute() the matching element is injected as attribute into the element //path1/path2/example 275 */ 276 pattern.setType(path.substring(path.lastIndexOf("/")+1)); 277 if(pattern.getType()>0) { 278 path = path.delete(path.lastIndexOf("/"), path.length()); 279 } 280 281 XPathStack p = asXPathElementStack(path,context); 282 pattern.addAll(p); 283 284 285 return pattern; 268 269 StringBuilder path = new StringBuilder(xpath.toString()); 270 XPathPattern pattern = new XPathPattern(); 271 272 // extract unique id from pattern (the pattern ends with @343214, where the number is the hashcode of the reference to inject) 273 int pos = path.lastIndexOf("~"); 274 if(pos > 0) { 275 pattern.setUniqueID(path.substring(pos+1)); 276 path = path.delete(pos, path.length()); 277 } 278 279 /* the following extensions are supported (default is attribute extension) 280 * //path1/path2/element[@attr]/child() the matching element is injected as child of element //path1/path2 281 * //path1/path2/element[@attr]/sibling() the matching element is injected as sibling of element //path1/path2 282 * //path1/path2/example[@attr]/attribute() the matching element is injected as attribute into the element //path1/path2/example 283 */ 284 pattern.setType(path.substring(path.lastIndexOf("/")+1)); 285 if(pattern.getType()>0) { 286 path = path.delete(path.lastIndexOf("/"), path.length()); 287 } 288 289 XPathStack p = asXPathElementStack(path,context); 290 pattern.addAll(p); 291 292 293 return pattern; 286 294 } 287 295 … … 448 456 StringBuilder sb = new StringBuilder(a); 449 457 458 459 450 460 451 461 /* … … 459 469 } 460 470 471 /* 472 * 473 */ 461 474 462 475 /* … … 464 477 */ 465 478 String[] array; 466 // is a URL with artefact 467 if((array = sb.toString().split("#")).length == 2) { 479 480 481 482 // is text only (for example "text()='wfs:feature') the text can contain anything 483 if(sb.toString().startsWith("text()=")) { 484 res = new XPathElement(new QName(sb.toString())); 485 486 487 // is a URL with artefact 488 } else if((array = sb.toString().split("#")).length == 2) { 468 489 res = new XPathElement(new QName(array[0], array[1])); 469 // is with prefix, e.g. prefix:value, we have to resolve the prefix from the namespace context 490 491 // is with prefix, e.g. prefix:value, we have to resolve the prefix from the namespace context 470 492 } else if((array = sb.toString().split(":")).length == 2) { 471 493 String uri = context.getNamespaceURI(array[0]); … … 584 606 String str; 585 607 if((str = ch.getData().trim()).length() == 0) return null; 586 if(str.length() > 16) str = str.substring(0, 16);608 //if(str.length() > 64) str = str.substring(0, 64); 587 609 return new StringBuilder("text()=\'").append(str).append('\'').toString(); 588 610 } -
modules/sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathMatcher.java
r541 r621 109 109 */ 110 110 public boolean matches(XPathPattern queryStack, XPathStack pathStack) throws IOException { 111 // [//, ogcwfs:WFS_Capabilities[@xsi:schemaLocation='http://www.opengis.net/wfs http://webservices.ionicsoft.com/worldData/wfs/WORLD/REQUEST/get/DATA/LPR/wfs/1.0.0/WFS-capabilities.xsd' and @version='1.0.0'], ogcwfs:FeatureTypeList, ogcwfs:FeatureType, ogcwfs:Name[@attr='22'], text()='wfs:Airport'] 112 // [//, WFS_Capabilities[@xsi:schemaLocation='http://www.opengis.net/wfs http://webservices.ionicsoft.com/worldData/wfs/WORLD/REQUEST/get/DATA/LPR/wfs/1.0.0/WFS-capabilities.xsd' and @version='1.0.0'], FeatureTypeList, FeatureType, Name[@attr='22'], text()='wfs:Airport'] 113 111 114 if( (queryStack==null) || (pathStack == null) ) return false; 112 115 return matches(queryStack, pathStack, queryStack.size()-1, pathStack.size()-1); … … 230 233 private boolean matches(XPathPattern queryStack, XPathStack pathStack, int queryPos, int pathPos) throws IOException { 231 234 try { 235 236 237 232 238 XPathElement path = pathStack.get(pathPos); 233 239 234 240 XPathElement query = queryStack.get(queryPos); 241 235 242 236 243 // break recursion … … 243 250 244 251 // we skip any text nodes (but only in the current path, and if the reference doesn't have a text node) 245 246 247 if ( (pathStack.get(pathPos).getElementName().getLocalPart().startsWith("text()")) && 248 (! (queryStack.get(queryPos).getElementName().getLocalPart().startsWith("text()")))) { 252 if ( (path.toString().startsWith("text()")) && 253 (!(query.toString().startsWith("text()")))) { 249 254 pathPos--; 250 255 } -
modules/sapience-injectors-main/src/main/java/sapience/injectors/model/xpath/XPathPattern.java
r499 r621 16 16 17 17 private int flag = 0; 18 19 20 private String id; 18 21 19 22 public boolean isAttribute() { … … 41 44 } 42 45 } 46 47 public void setUniqueID(String id) { 48 this.id = id; 49 } 43 50 44 51 -
modules/sapience-injectors-main/src/main/java/sapience/injectors/stax/extract/StaxBasedExtractor.java
r554 r621 24 24 import java.util.List; 25 25 import java.util.Map; 26 import java.util.Random; 26 27 import java.util.logging.Level; 27 28 import java.util.logging.Logger; … … 120 121 } 121 122 122 123 123 124 // System.out.println(getCurrentPath().toString()); 124 125 125 126 if ((marked = getMatcher().matches(getCurrentPath(), annotation_paths)) > -1) { … … 135 136 136 137 // build element id 137 String elementID = getCurrentPath().serialize(new StringBuilder(), getNamespaceContext()).append("/attribute()").toString();138 String elementID = this.generateElementID(getCurrentPath(), "attribute()", resultingXMLString); 138 139 String reference = nshelper.injectNamespace(new StringBuilder(resultingXMLString.toString()), elementID, getNamespaceContext()).toString(); 140 139 141 result.put(elementID, reference); 140 142 … … 177 179 178 180 // build result 179 String elementID = popper.serialize(new StringBuilder(), getNamespaceContext()).append("/child()").toString();181 String elementID = this.generateElementID(popper, "child()", resultingXMLString); 180 182 String reference = nshelper.injectNamespace(new StringBuilder(resultingXMLString.toString()), elementID, getNamespaceContext()).toString(); 181 183 result.put(elementID, reference); … … 187 189 188 190 } else if(matchingPattern.isSiblingElement()) { 189 String elementID = preceding_path.serialize(new StringBuilder(), getNamespaceContext()).append("/sibling()").toString();191 String elementID = this.generateElementID(preceding_path, "sibling()", resultingXMLString); 190 192 // declare the prefixes used in the xpath and reference to the reference as namespaces 191 193 String reference = nshelper.injectNamespace(new StringBuilder(resultingXMLString.toString()), elementID, getNamespaceContext()).toString(); … … 200 202 201 203 202 } 203 204 preceding_path = (XPathStack) getCurrentPath().clone(); 205 if(characters != null) { 206 preceding_path.push(characters); 207 } 208 204 } else { 205 // we only set the new preceding path if the current wasn't a matching pattern (otherwise we will have the problem that 206 // the key of the next line will be a reference (only the case if we have two references in a row) 207 preceding_path = (XPathStack) getCurrentPath().clone(); 208 if(characters != null) { 209 preceding_path.push(characters); 210 } 211 } 209 212 210 213 getCurrentPath().pop(); … … 247 250 return result; 248 251 252 } 253 254 255 256 257 private String generateElementID(XPathStack currentPath, String function, StringWriter reference) { 258 StringBuilder sb = currentPath.serialize(new StringBuilder(), getNamespaceContext()); 259 sb.append("/").append(function); 260 sb.append("~").append(reference.hashCode()); 261 return sb.toString(); 249 262 } 250 263 -
modules/sapience-injectors-main/src/main/java/sapience/injectors/stax/inject/ModelBasedStaxStreamInjector.java
r546 r621 89 89 public Map<XPathPattern, Reference> references; // the references from the database 90 90 91 private Reference interceptingElement= null;91 private List<Reference> interceptingElements = null; 92 92 93 93 private static final Logger logger = Logger.getLogger(ModelBasedStaxStreamInjector.class.getName()); … … 119 119 XPathElement characters = null; 120 120 int marked; 121 interceptingElements = new ArrayList<Reference>(); 121 122 122 123 try { … … 126 127 127 128 while (r.hasNext()) { 129 130 128 131 129 132 XMLEvent e = r.nextEvent(); … … 148 151 // check if the current xpath is in our list of attribute references 149 152 for(XPathPattern p : references.keySet()) { 153 if(references.get(p) == null) continue; 154 150 155 if(p.isAttribute()) { 151 156 if(getMatcher().matches(p, getCurrentPath())) { 152 157 se = this.handleAttribute(w, references.get(p), se); 153 references.remove(p); 154 break; //otherwise ConcurrentModificationException 158 references.put(p, null); // removing it would lead to concurrentmodificationexcpetion 155 159 } 156 160 } … … 164 168 165 169 // before removing from stack, we check if the current path with added characters is a match (which means we have to add a new element now) 170 XPathStack currentPath = getCurrentPath(); 171 172 173 166 174 for(XPathPattern p : references.keySet()) { 167 if(getMatcher().matches(p, getCurrentPath())) { 175 176 if(references.get(p) == null) continue; 177 178 179 if(getMatcher().matches(p, currentPath)) { 168 180 if(p.isSiblingElement()) { 169 this.interceptingElement = references.get(p); 181 // injection happens below 182 this.interceptingElements.add(references.get(p)); 183 170 184 } else if (p.isChildElement()) { 171 185 // we can add it directly … … 175 189 throw new IOException("Invalid Reference: "+p); 176 190 } 177 references.remove(p); 178 break; //otherwise ConcurrentModificationException 191 references.put(p, null); // removing it would lead to concurrentmodificationexcpetion 192 //references.remove(p); 193 //break; //otherwise ConcurrentModificationException 179 194 180 195 } … … 193 208 194 209 // if the intercepting is not null, the preceding element was a match, hence we inject some xml before writing a new element 195 if(this.interceptingElement != null) { 196 w.add(getXMLEventFactory().createSpace("\n")); 197 writeElementIntoStream(w, interceptingElement); 210 if(this.interceptingElements.size() > 0) { 211 // write all references into stream 212 for (Reference ref : this.interceptingElements) { 213 w.add(getXMLEventFactory().createSpace("\n")); 214 writeElementIntoStream(w, ref); 215 } 216 217 // reset list 218 this.interceptingElements.clear(); 198 219 } 199 220 … … 227 248 228 249 229 // test 230 // public void inject(InputStream in, OutputStream out, List<Reference> refs) throws IOException { 231 // try { 232 // XMLEventReader reader = getXMLInputFactory().createXMLEventReader(in); 233 // XMLEventWriter writer = getXMLOutputFactory().createXMLEventWriter(out); 234 // 235 // while (reader.hasNext()) { 236 // XMLEvent event = reader.nextTag(); 237 // switch(event.getEventType()) { 238 // case XMLEvent.START_ELEMENT: 239 // StartElementEvent see = new StartElementEvent((StartElement)event); 240 // for (Iterator it = see.getAttributes(); it.hasNext(); ) { 241 // Attribute att = (Attribute) it.next(); 242 // System.out.println("Path: " + getCurrentPath()); 243 // System.out.println("Attribute: " + att.getValue()); 244 // } 245 // writer.add(see); 246 // break; 247 // 248 // case XMLEvent.END_ELEMENT: 249 // 250 // break; 251 // 252 // } 253 // } 254 // } 255 // catch (XMLStreamException e) { 256 // // TODO Auto-generated catch block 257 // e.printStackTrace(); 258 // } catch (XPathExpressionException e) { 259 // // TODO Auto-generated catch block 260 // e.printStackTrace(); 261 // } 262 // finally { 263 // in.close(); 264 // } 265 // } 250 266 251 267 252 … … 276 261 createEventsForElement(w, ref); 277 262 278 // written into stream, reset interception 279 this.interceptingElement = null; 280 281 } 282 283 /** 284 * Helper method: writes the given reference into the output stream. We distinguish between injecting elements and attributes. For the former, we add the reference AFTER the element 285 * represented by the XPath expression. In the case of the attribute, we inject the reference into an existing element in the XML. 286 * 287 * @param w XMLEventWriter 288 * @param ref Reference 289 * @throws IOException 290 * @throws XMLStreamException 291 * @see ModelBasedStaxStreamInjector#handleNewElement(XMLEventWriter, Reference) 292 * @see ModelBasedStaxStreamInjector#handleAttribute(XMLEventWriter, Reference) 293 */ 294 @Deprecated 295 private void inject(XMLEventWriter w, Reference ref) throws IOException, XMLStreamException { 296 String annot = ref.getTarget().toString(); 297 // identify event type of ref 298 if(annot.getBytes()[0] == '<') { 299 this.interceptingElement = ref; 300 } else { 301 handleAttribute(w,ref, null); 302 } 303 } 263 } 264 265 304 266 305 267 … … 405 367 406 368 407 //test 408 // private StartElement handleAttribute(XMLEventWriter w, Reference ref, StartElement se) throws XMLStreamException { 409 // /* we are having attributes which are in both, the reference and the current element. We only add 410 // * a new Attribute event, if it is not already contained in the Start Element 411 // * 412 // * Example: 413 // * reference <element ns:attr1="value" reference="http://example.com"> 414 // * element <element ns:attr1="value"> 415 // */ 416 // StringBuilder referenceString = new StringBuilder(ref.getTarget().toString()); 417 // Matcher matcher = findAttributeInReference.matcher(referenceString); 418 // 419 // 420 // // copy namespaces 421 // LocalNamespaceContext lnc = new LocalNamespaceContext((BaseNsContext) se.getNamespaceContext()); 422 // while(matcher.find()) { 423 // int start = matcher.start(); 424 // int end = matcher.end(); 425 // 426 // String key = null; 427 // String prefix = null; 428 // String value = null; 429 // 430 // // [ns:attr1, "value"] 431 // String[] l = referenceString.substring(start, end).split("="); 432 // if(l.length>0) { 433 // // [ns, attr1] 434 // String[] n = l[0].split(":"); 435 // if(n.length==2) { 436 // key = n[1]; 437 // prefix = n[0]; 438 // } else { 439 // key = n[0]; 440 // } 441 // if(l.length == 2) { 442 // value = l[1].substring(1, l[1].length()-1); // remove "" 443 // 444 // } 445 // } 446 // 447 // // check if this is a namespace definition 448 // if(( prefix != null) && ("xmlns".contentEquals(prefix)) ){ 449 // lnc.put(key, value); 450 // } else { 451 // QName name = null; 452 // // create QName 453 // if(prefix != null) { 454 // name = new QName(null, key, prefix); 455 // } else { 456 // String namespaceURI = se.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX); 457 // name = new QName(namespaceURI, key); 458 // } 459 // if(name != null) { 460 // Attribute created = getXMLEventFactory().createAttribute(name, value); 461 // attributeList.add(created); 462 // } 463 // } 464 // } 465 // 466 // // remove redundant attribute from reference list 467 // Iterator<?> it = se.getAttributes(); 468 // while(it.hasNext()) { 469 // Attribute ae = (Attribute) it.next(); 470 // for(Attribute ar : attributeList) { 471 // if( (ar.getName().getLocalPart().contentEquals(ae.getName().getLocalPart())) && 472 // (ar.getValue().contentEquals(ae.getValue()))) { 473 // attributeList.remove(ar); 474 // break; 475 // } 476 // else 477 // return ar; 478 // } 479 // } 480 // 481 // // merge everything again 482 // while(it.hasNext()) { 483 // attributeList.addAll(attributeList); 484 // } 485 // 486 // // create a new element with the attribute set and return it 487 // //return StartElementEventImpl.construct(se.getLocation(), se.getName(), attributeList.iterator(), lnc.getNamespaces().iterator(), lnc); 488 // return null; 489 // } 369 490 370 491 371 … … 560 440 localElement.setElementID(path); 561 441 562 // test563 // if (path.toString().endsWith("attribute()")) {564 //565 // }566 // else if (path.toString().endsWith("sibling()")) {567 //568 // }569 // else { // child()570 //571 // }572 442 573 443 // update the reference -
modules/sapience-injectors-parent/pom.xml
r575 r621 1 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 2 <parent>3 <groupId>sapience</groupId>4 <artifactId>sapience-parent</artifactId>5 <version>1.0</version>6 7 </parent>2 <!-- <parent>--> 3 <!-- <groupId>sapience</groupId>--> 4 <!-- <artifactId>sapience-parent</artifactId>--> 5 <!-- <version>1.0</version>--> 6 <!-- --> 7 <!-- </parent>--> 8 8 9 9 <modelVersion>4.0.0</modelVersion> 10 10 11 11 <artifactId>sapience-injectors-parent</artifactId> 12 <groupId>sapience</groupId> 12 13 <packaging>pom</packaging> 13 14 <version>0.2</version> … … 32 33 33 34 <dependencies> 35 <dependency> 36 <groupId>junit</groupId> 37 <artifactId>junit</artifactId> 38 <version>4.6</version> 39 <scope>test</scope> 40 </dependency> 41 42 34 43 <!-- SPRING --> 35 44 <dependency> -
modules/sapience-injectors-testclient/src/main/resources/InjectorConfig.xml
r564 r621 14 14 <configuration id="wfs-110-capabilities" class="sapience.injectors.wfs.v110.WFS110_GetCapabilitiesConfig" /> 15 15 <configuration id="wfs-110-feature" class="sapience.injectors.wfs.v110.WFS110_DescribeFeatureConfig" /> 16 <configuration id="wfs-100-capabilities" class="sapience.injectors.wfs.v100.WFS100_GetCapabilitiesConfig" /> 17 <configuration id="wfs-100-feature" class="sapience.injectors.wfs.v100.WFS100_DescribeFeatureConfig" /> 16 18 <configuration id="sos-100-capabilities" class="sapience.injectors.sos.v100.SOS100_GetCapabilitiesConfig" /> 17 19 </configurations> -
modules/sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/TestLifeCycle.java
r609 r621 3 3 import java.io.IOException; 4 4 5 import org.junit.Before; 5 import org.springframework.beans.factory.annotation.Autowired; 6 7 import sapience.injectors.factories.ConfigurationFactory; 8 import sapience.lookup.LookupImpl; 6 9 7 10 /** … … 13 16 public abstract class TestLifeCycle extends BaseTest { 14 17 18 @Autowired ConfigurationFactory config; 15 19 16 20 public void testLifeCycle() throws IOException { 17 21 this.testExtract(); 18 22 this.testInject(); 23 24 try { 25 26 27 LookupImpl lookup = (LookupImpl) config.getLookup(); 28 29 lookup.getReferenceController().deleteAllRecords(); 30 } catch (Exception e) { 31 throw new IOException(e); 32 } 33 } 34 35 36 37 public ConfigurationFactory getConfiguration() { 38 return config; 19 39 } 20 40 -
modules/sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/Suite_01.java
r575 r621 13 13 import sapience.injectors.Configuration; 14 14 import sapience.injectors.Injector; 15 import sapience.injectors.Lookup; 15 16 import sapience.injectors.factories.ConfigurationFactory; 16 17 import sapience.injectors.model.Reference; 17 18 import sapience.injectors.testclient.TestLifeCycle; 19 import sapience.lookup.LookupImpl; 18 20 19 21 public class Suite_01 extends TestLifeCycle { 20 22 21 @Autowired ConfigurationFactory config; 23 22 24 23 25 private String sid; … … 33 35 @Override 34 36 public void testExtract() throws IOException { 35 37 sid = asHEX("http://example.com/wfs/Suite_01"); 38 39 List<Reference> check2 = getConfiguration().getLookup().check(sid); 40 assertEquals(0, check2.size()); 41 36 42 InputStream inputStream = null; 37 sid = asHEX("http://example.com/wfs/Suite_01");43 38 44 inputStream = getFileStream(annotatedFile); 39 Configuration c = config.getConfiguration(inputStream); 40 config.getLookup().put(sid, c.getExtractor().extract(sid, inputStream)); 41 List<Reference> check = config.getLookup().check(sid); 42 assertEquals(1, check.size()); 45 Configuration c = getConfiguration().getConfiguration(inputStream); 46 List<Reference> extracted = c.getExtractor().extract(sid, inputStream); 47 48 getConfiguration().getLookup().put(sid, extracted); 49 List<Reference> check = getConfiguration().getLookup().check(sid); 50 assertEquals(2, check.size()); 43 51 44 52 } … … 51 59 inputStream = getFileStream(notAnnotatedFile); 52 60 53 Configuration c = config.getConfiguration(inputStream);61 Configuration c = getConfiguration().getConfiguration(inputStream); 54 62 Injector injector = c.getInjector(); 55 63 ByteArrayOutputStream baos = new ByteArrayOutputStream(); … … 59 67 60 68 System.out.println(result); 69 70 61 71 62 72 } -
modules/sapience-injectors-testclient/src/test/java/sapience/injectors/testclient/wfs/v110/GetCapabilities/Suite_02.java
r575 r621 40 40 config.getLookup().put(sid, c.getExtractor().extract(sid, inputStream)); 41 41 List<Reference> check = config.getLookup().check(sid); 42 assertEquals( 1, check.size());42 assertEquals(2, check.size()); 43 43 44 44 } -
modules/sapience-injectors-testclient/src/test/resources/samples/wfs110/wfs110-capabilities-testcases/01-serviceIdentification-annotation.xml
r574 r621 25 25 <ows:Keyword>Framework Data Layer</ows:Keyword> 26 26 <ows:Keyword>BlueOx</ows:Keyword> 27 <ows:Type ows:codeSpace="http://core/WebServices/BlueOx">String</ows:Type> 27 <ows:Type ows:codeSpace="http://core/WebServices/BlueOx1.rdf">String</ows:Type> 28 <ows:Type ows:codeSpace="http://core/WebServices/BlueOx2.rdf">String</ows:Type> 28 29 </ows:Keywords> 29 30 <ows:ServiceType>WFS</ows:ServiceType> -
modules/sapience-injectors-testclient/src/test/resources/samples/wfs110/wfs110-capabilities-testcases/02-featureType-annotation.xml
r574 r621 244 244 <ows:Keyword>arborial</ows:Keyword> 245 245 <ows:Keyword>diversity</ows:Keyword> 246 <ows:Type ows:codeSpace="http://www.concepts.org/BlueOx">ontology</ows:Type> 246 <ows:Type ows:codeSpace="http://www.concepts.org/BlueOx.rdf">ontology</ows:Type> 247 <ows:Type ows:codeSpace="http://www.concepts.org/BlueOx.wsdl">wsdl</ows:Type> 247 248 </ows:Keywords> 248 249 <wfs:DefaultSRS>EPSG:62696405</wfs:DefaultSRS> … … 439 440 </ogc:Filter_Capabilities> 440 441 </wfs:WFS_Capabilities> 442 -
modules/sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v110/WFS110_DescribeFeatureConfig.java
r570 r621 12 12 13 13 public String[] getHeaderPattern() { 14 return new String[]{"test"}; 15 //return new String[] {"<.*schema.*",".*xmlns.*http://www.w3.org/2001/XMLSchema.*", ".*xmlns.*http://www.opengis.net/gml.*" };14 15 return new String[] {"<.*schema.*",".*xmlns.*http://www.w3.org/2001/XMLSchema.*", ".*xmlns.*http://www.opengis.net/gml.*" }; 16 16 } 17 17 -
modules/sapience-injectors-wfs/src/main/java/sapience/injectors/wfs/v110/WFS110_GetCapabilitiesConfig.java
r574 r621 12 12 13 13 public String[] getAnnotationXPathExpressions() { 14 String p1 = "//{http://www.opengis.net/ows}ServiceIdentification/{http://www.opengis.net/ows}Keywords/{http://www.opengis.net/ows}Type[@{http://www.opengis.net/ows}codeSpace]/ attribute()";14 String p1 = "//{http://www.opengis.net/ows}ServiceIdentification/{http://www.opengis.net/ows}Keywords/{http://www.opengis.net/ows}Type[@{http://www.opengis.net/ows}codeSpace]/child()"; 15 15 String p2 = "//{http://www.opengis.net/wfs}FeatureTypeList/{http://www.opengis.net/wfs}FeatureType/{http://www.opengis.net/ows}Keywords/{http://www.opengis.net/ows}Type[@{http://www.opengis.net/ows}codeSpace]/sibling()"; 16 return new String[] {p1,p2}; 16 String p3 = "//{http://www.opengis.net/wfs}FeatureTypeList/{http://www.opengis.net/wfs}FeatureType/{http://www.opengis.net/wfs}MetadataURL/sibling()"; 17 return new String[] {p1,p2,p3}; 17 18 } 18 19 -
modules/sapience-injectors-wps
- Property svn:ignore
-
old new 4 4 .classpath 5 5 *.db 6 build
-
- Property svn:ignore
-
modules/sapience-injectors-wsdl
- Property svn:ignore
-
old new 4 4 .classpath 5 5 *.db 6 build
-
- Property svn:ignore
-
modules/sapience-lookup-hibernate/.project
r612 r621 17 17 </buildCommand> 18 18 <buildCommand> 19 <name>org. maven.ide.eclipse.maven2Builder</name>19 <name>org.eclipse.wst.validation.validationbuilder</name> 20 20 <arguments> 21 21 </arguments> 22 22 </buildCommand> 23 23 <buildCommand> 24 <name>org. eclipse.wst.validation.validationbuilder</name>24 <name>org.maven.ide.eclipse.maven2Builder</name> 25 25 <arguments> 26 26 </arguments> -
modules/sapience-lookup-hibernate/src/main/java/sapience/lookup/hibernate/controller/ReferenceController.java
r513 r621 79 79 Transaction transaction = null; 80 80 try { 81 startDatabaseAccess(); 81 startDatabaseAccess(); 82 session.clear(); 83 session.flush(); 84 82 85 if(!tableExists()) throw new TableNotExistException(DbProperties.getString("Reference")); 83 86 transaction = session.beginTransaction(); 84 87 StringBuffer sb = new StringBuffer(); 85 sb.append("DELETE "); 86 sb.append("FROM "); 88 sb.append("DELETE FROM "); 87 89 sb.append(DbProperties.getString("Reference")); 88 90 Query query = session.createQuery(sb.toString()); 89 91 query.executeUpdate(); 90 92 transaction.commit(); 93 session.flush(); 91 94 if (tableIsEmpty()) { 92 95 logger.log(Level.FINE, "All records deleted!"); … … 106 109 } 107 110 111 112 108 113 /* 109 114 * (non-Javadoc) -
modules/sapience-lookup-hibernate/src/main/java/sapience/lookup/hibernate/model/HibernateReference.java
r539 r621 106 106 } 107 107 108 108 109 } -
modules/sapience-lookup-hibernate/src/main/resources/META-INF/sqlite.cfg.xml
r519 r621 43 43 <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property> 44 44 <!-- Echo all executed SQL to stdout --> 45 <property name="show_sql"> true</property>45 <property name="show_sql">false</property> 46 46 <!-- Drop and re-create the database schema on startup --> 47 <property name="hbm2ddl.auto"> none</property>47 <property name="hbm2ddl.auto">create</property> 48 48 49 49 <mapping class="sapience.lookup.hibernate.model.HibernateReference"/> -
modules/sapience-lookup-parent/pom.xml
r576 r621 1 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 2 <parent>3 <groupId>sapience</groupId>4 <artifactId>sapience-parent</artifactId>5 <version>1.0</version>6 </parent>2 <!-- <parent>--> 3 <!-- <groupId>sapience</groupId>--> 4 <!-- <artifactId>sapience-parent</artifactId>--> 5 <!-- <version>1.0</version>--> 6 <!-- </parent>--> 7 7 8 8 <modelVersion>4.0.0</modelVersion> 9 9 10 10 <artifactId>sapience-lookup-parent</artifactId> 11 <groupId>sapience</groupId> 11 12 <packaging>pom</packaging> 12 13 <version>0.1</version>