Author: mstruk
Date: 2011-10-03 09:32:55 -0400 (Mon, 03 Oct 2011)
New Revision: 7601
Modified:
sandbox/as7_support/exo.kernel.container/trunk/pom.xml
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_0/sample-configuration-17.xml
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_1/sample-configuration-17.xml
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_2/sample-configuration-17.xml
Log:
Merged diff between container tag 2.3.0-GA and 2.3.1-GA
Modified: sandbox/as7_support/exo.kernel.container/trunk/pom.xml
===================================================================
--- sandbox/as7_support/exo.kernel.container/trunk/pom.xml 2011-10-03 12:14:57 UTC (rev
7600)
+++ sandbox/as7_support/exo.kernel.container/trunk/pom.xml 2011-10-03 13:32:55 UTC (rev
7601)
@@ -12,10 +12,10 @@
<parent>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>kernel-parent</artifactId>
- <version>2.3.0-GA</version>
+ <version>2.3.1-GA</version>
</parent>
<artifactId>exo.kernel.container</artifactId>
- <version>2.3.0-GA-AS7</version>
+ <version>2.3.1-GA-AS7-SNAPSHOT</version>
<name>eXo Kernel :: Container</name>
<description>eXo Kernel Container</description>
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2011-10-03
12:14:57 UTC (rev 7600)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/main/java/org/exoplatform/container/configuration/ConfigurationUnmarshaller.java 2011-10-03
13:32:55 UTC (rev 7601)
@@ -21,6 +21,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.xml.Configuration;
+import org.exoplatform.container.xml.Deserializer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
@@ -29,6 +30,7 @@
import org.jibx.runtime.JiBXException;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -153,61 +155,60 @@
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
KERNEL_NAMESPACES);
factory.setNamespaceAware(true);
factory.setValidating(true);
-
- try
+ return SecurityHelper.doPrivilegedIOExceptionAction(new
PrivilegedExceptionAction<Boolean>()
{
- DocumentBuilder builder = null;
- try
+ public Boolean run() throws Exception
{
- builder = SecurityHelper.doPrivilegedExceptionAction(new
PrivilegedExceptionAction<DocumentBuilder>()
+ try
{
- public DocumentBuilder run() throws Exception
- {
- return factory.newDocumentBuilder();
- }
- });
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof ParserConfigurationException)
- {
- throw (ParserConfigurationException)cause;
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Reporter reporter = new Reporter(url);
+ builder.setErrorHandler(reporter);
+ builder.setEntityResolver(Namespaces.resolver);
+ String content =
Deserializer.resolveVariables(readStream(url.openStream()));
+ InputSource is = new InputSource(new StringReader(content));
+ builder.parse(is);
+ return reporter.valid;
}
- else if (cause instanceof RuntimeException)
+ catch (ParserConfigurationException e)
{
- throw (RuntimeException)cause;
+ log.error("Got a parser configuration exception when doing XSD
validation");
+ return false;
}
- else
+ catch (SAXException e)
{
- throw new RuntimeException(cause);
+ log.error("Got a sax exception when doing XSD validation");
+ return false;
}
}
-
- Reporter reporter = new Reporter(url);
- builder.setErrorHandler(reporter);
- builder.setEntityResolver(Namespaces.resolver);
- builder.parse(SecurityHelper.doPrivilegedIOExceptionAction(new
PrivilegedExceptionAction<InputStream>()
+ });
+ }
+
+ private String readStream(InputStream inputStream) throws IOException
+ {
+ try
+ {
+ StringBuilder out = new StringBuilder();
+ byte[] b = new byte[4096];
+ for (int n; (n = inputStream.read(b)) != -1;)
{
- public InputStream run() throws Exception
- {
- return url.openStream();
- }
- }));
- return reporter.valid;
+ out.append(new String(b, 0, n));
+ }
+ return out.toString();
}
- catch (ParserConfigurationException e)
+ finally
{
- log.error("Got a parser configuration exception when doing XSD
validation");
- return false;
+ try
+ {
+ inputStream.close();
+ }
+ catch (Exception e)
+ {
+ // ignore me
+ }
}
- catch (SAXException e)
- {
- log.error("Got a sax exception when doing XSD validation");
- return false;
- }
}
-
+
public Configuration unmarshall(final URL url) throws Exception
{
if (PropertyManager.isDevelopping())
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_0/sample-configuration-17.xml
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_0/sample-configuration-17.xml 2011-10-03
12:14:57 UTC (rev 7600)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_0/sample-configuration-17.xml 2011-10-03
13:32:55 UTC (rev 7601)
@@ -83,5 +83,18 @@
</object-param>
</init-params>
</component>
+ <component>
+ <type>org.exoplatform.container.TestExoContainer$C3</type>
+ <init-params>
+ <object-param>
+ <name>O1</name>
+ <object
type="org.exoplatform.container.TestExoContainer$O1">
+ <field
name="name"><string>IdentityCache</string></field>
+ <field
name="maxSize"><int>${cache.exo.social.IdentityCache.Capacity:200}</int></field>
+ <field
name="liveTime"><long>${cache.exo.social.IdentityCache.TimeToLive:-1}</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
</configuration>
\ No newline at end of file
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_1/sample-configuration-17.xml
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_1/sample-configuration-17.xml 2011-10-03
12:14:57 UTC (rev 7600)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_1/sample-configuration-17.xml 2011-10-03
13:32:55 UTC (rev 7601)
@@ -83,5 +83,17 @@
</object-param>
</init-params>
</component>
-
+ <component profiles="testDefaultValue">
+ <type>org.exoplatform.container.TestExoContainer$C3</type>
+ <init-params>
+ <object-param>
+ <name>O1</name>
+ <object
type="org.exoplatform.container.TestExoContainer$O1">
+ <field
name="name"><string>IdentityCache</string></field>
+ <field
name="maxSize"><int>${cache.exo.social.IdentityCache.Capacity:200}</int></field>
+ <field
name="liveTime"><long>${cache.exo.social.IdentityCache.TimeToLive:-1}</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
</configuration>
\ No newline at end of file
Modified:
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_2/sample-configuration-17.xml
===================================================================
---
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_2/sample-configuration-17.xml 2011-10-03
12:14:57 UTC (rev 7600)
+++
sandbox/as7_support/exo.kernel.container/trunk/src/test/resources/xsd_1_2/sample-configuration-17.xml 2011-10-03
13:32:55 UTC (rev 7601)
@@ -83,5 +83,17 @@
</object-param>
</init-params>
</component>
-
+ <component profiles="testDefaultValue">
+ <type>org.exoplatform.container.TestExoContainer$C3</type>
+ <init-params>
+ <object-param>
+ <name>O1</name>
+ <object
type="org.exoplatform.container.TestExoContainer$O1">
+ <field
name="name"><string>IdentityCache</string></field>
+ <field
name="maxSize"><int>${cache.exo.social.IdentityCache.Capacity:200}</int></field>
+ <field
name="liveTime"><long>${cache.exo.social.IdentityCache.TimeToLive:-1}</long></field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
</configuration>
\ No newline at end of file