Author: chris.laprun(a)jboss.com
Date: 2007-12-10 21:10:11 -0500 (Mon, 10 Dec 2007)
New Revision: 9333
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd
Log:
- Use a resolver to retrieve xml.xsd instead of retrieving it over the wire.
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java 2007-12-10
16:57:16 UTC (rev 9332)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java 2007-12-11
02:10:11 UTC (rev 9333)
@@ -37,6 +37,7 @@
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.XercesXsMarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -62,10 +63,19 @@
private String configLocation;
private ProducerConfiguration configuration;
-
private File dataDir;
private File config;
+ private static DefaultSchemaResolver RESOLVER;
+
+ static
+ {
+ RESOLVER = new DefaultSchemaResolver();
+ RESOLVER.setCacheResolvedSchemas(true);
+
RESOLVER.addSchemaLocation("http://www.w3.org/XML/1998/namespace",
"xsd/xml.xsd");
+ RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_6",
"xsd/jboss-wsrp-producer_2_6.xsd");
+ }
+
public String getConfigLocation()
{
return configLocation;
@@ -99,11 +109,6 @@
reloadConfiguration();
}
- protected void stopService() throws Exception
- {
- saveConfiguration();
- }
-
public void reloadConfiguration() throws Exception
{
URL configURL = getConfigLocationURL();
@@ -179,6 +184,8 @@
// create an instance of XML Schema marshaller
XercesXsMarshaller marshaller = new XercesXsMarshaller();
+ marshaller.setSchemaResolver(RESOLVER);
+
// we need to specify what elements are top most (roots) providing namespace URI,
prefix and local name
marshaller.addRootElement("urn:jboss:portal:wsrp:producer:v2_6",
"", "producer-configuration");
@@ -187,7 +194,7 @@
// add schema location by declaring xsi namespace and adding xsi:schemaLocation
attribute
marshaller.declareNamespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
- marshaller.addAttribute("xsi", "schemaLocation",
"string", "urn:jboss:portal:wsrp:producer:v2_6
xsd/jboss-wsrp-producer_2_6.xsd");
+ marshaller.addAttribute("xsi", "schemaLocation",
"string", "urn:jboss:portal:wsrp:producer:v2_6");
// create an instance of Object Model Provider
ObjectModelProvider provider = new ProducerConfigurationProvider();
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd 2007-12-10
16:57:16 UTC (rev 9332)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd 2007-12-11
02:10:11 UTC (rev 9333)
@@ -28,7 +28,7 @@
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:wpc="urn:jboss:portal:wsrp:producer:v2_6">
- <xs:import
namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ <xs:import
namespace="http://www.w3.org/XML/1998/namespace"/>
<xs:element name="producer-configuration">
<xs:complexType>