|
Lines 10-21
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.wst.wsi.internal.core.profile.impl; |
11 |
package org.eclipse.wst.wsi.internal.core.profile.impl; |
| 12 |
|
12 |
|
|
|
13 |
import java.io.IOException; |
| 13 |
import java.io.Reader; |
14 |
import java.io.Reader; |
|
|
15 |
import java.net.URL; |
| 14 |
import java.util.Iterator; |
16 |
import java.util.Iterator; |
| 15 |
import java.util.LinkedList; |
17 |
import java.util.LinkedList; |
| 16 |
import java.util.List; |
18 |
import java.util.List; |
| 17 |
import java.util.TreeMap; |
19 |
import java.util.TreeMap; |
| 18 |
|
20 |
|
|
|
21 |
import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver; |
| 22 |
import org.eclipse.wst.wsi.internal.WSITestToolsEclipseProperties; |
| 23 |
import org.eclipse.wst.wsi.internal.WSITestToolsProperties; |
| 19 |
import org.eclipse.wst.wsi.internal.core.WSIConstants; |
24 |
import org.eclipse.wst.wsi.internal.core.WSIConstants; |
| 20 |
import org.eclipse.wst.wsi.internal.core.WSIException; |
25 |
import org.eclipse.wst.wsi.internal.core.WSIException; |
| 21 |
import org.eclipse.wst.wsi.internal.core.profile.EntryTypeList; |
26 |
import org.eclipse.wst.wsi.internal.core.profile.EntryTypeList; |
|
Lines 27-33
Link Here
|
| 27 |
import org.eclipse.wst.wsi.internal.core.util.Utils; |
32 |
import org.eclipse.wst.wsi.internal.core.util.Utils; |
| 28 |
import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; |
33 |
import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; |
| 29 |
import org.xml.sax.Attributes; |
34 |
import org.xml.sax.Attributes; |
|
|
35 |
import org.xml.sax.EntityResolver; |
| 30 |
import org.xml.sax.InputSource; |
36 |
import org.xml.sax.InputSource; |
|
|
37 |
import org.xml.sax.SAXException; |
| 31 |
import org.xml.sax.XMLReader; |
38 |
import org.xml.sax.XMLReader; |
| 32 |
import org.xml.sax.helpers.DefaultHandler; |
39 |
import org.xml.sax.helpers.DefaultHandler; |
| 33 |
|
40 |
|
|
Lines 93-99
Link Here
|
| 93 |
|
100 |
|
| 94 |
// Set content handler to inner class |
101 |
// Set content handler to inner class |
| 95 |
reader.setContentHandler(new ProfileAssertionsHandler()); |
102 |
reader.setContentHandler(new ProfileAssertionsHandler()); |
|
|
103 |
|
| 104 |
if(WSITestToolsProperties.getEclipseContext()) |
| 105 |
{ |
| 106 |
EntityResolver resolver = new EntityResolver(){ |
| 96 |
|
107 |
|
|
|
108 |
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { |
| 109 |
URIResolver resolver = WSITestToolsEclipseProperties.getURIResolver(); |
| 110 |
String uri = resolver.resolve("", publicId, systemId); |
| 111 |
String physicalLocation = resolver.resolvePhysicalLocation("", publicId, uri); |
| 112 |
InputSource is = null; |
| 113 |
try |
| 114 |
{ |
| 115 |
URL url = new URL(physicalLocation); |
| 116 |
is = new InputSource(uri); |
| 117 |
is.setByteStream(url.openStream()); |
| 118 |
} |
| 119 |
catch(Exception e) |
| 120 |
{ |
| 121 |
// Do nothing if opening the stream fails. |
| 122 |
} |
| 123 |
return is; |
| 124 |
} |
| 125 |
|
| 126 |
}; |
| 127 |
reader.setEntityResolver(resolver); |
| 128 |
} |
| 97 |
// Parse profile definition file |
129 |
// Parse profile definition file |
| 98 |
reader.parse(inputSource); |
130 |
reader.parse(inputSource); |
| 99 |
} |
131 |
} |
|
Lines 107-121
Link Here
|
| 107 |
//Check to see if the version of test asssertion document is supported |
139 |
//Check to see if the version of test asssertion document is supported |
| 108 |
if (!Utils.isValidProfileTADVersion(profileAssertions)) |
140 |
if (!Utils.isValidProfileTADVersion(profileAssertions)) |
| 109 |
{ |
141 |
{ |
| 110 |
throw new WSIException( |
142 |
String tadVersion = profileAssertions.getTADVersion(); |
|
|
143 |
if(tadVersion != null) |
| 144 |
{ |
| 145 |
String tadName = profileAssertions.getTADName(); |
| 146 |
throw new WSIException( |
| 111 |
"\nVersion " |
147 |
"\nVersion " |
| 112 |
+ profileAssertions.getTADVersion() |
148 |
+ tadVersion |
| 113 |
+ " of the \"" |
149 |
+ " of the \"" |
| 114 |
+ profileAssertions.getTADName() |
150 |
+ tadName |
| 115 |
+ "\"\n" |
151 |
+ "\"\n" |
| 116 |
+ "document is not compatible with this version of" |
152 |
+ "document is not compatible with this version of" |
| 117 |
+ "\n" |
153 |
+ "\n" |
| 118 |
+ "the test tools."); |
154 |
+ "the test tools."); |
|
|
155 |
} |
| 156 |
else |
| 157 |
{ |
| 158 |
throw new WSIException("WS-I validation was unable to run. Unable to read the test assertion document."); |
| 159 |
} |
| 119 |
} |
160 |
} |
| 120 |
} |
161 |
} |
| 121 |
|
162 |
|