[exo-jcr-commits] exo-jcr SVN: r5547 - in jcr/trunk: exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jan 31 12:57:21 EST 2012
Author: nfilotto
Date: 2012-01-31 12:57:20 -0500 (Tue, 31 Jan 2012)
New Revision: 5547
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryServiceConfiguration.java
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
Log:
EXOJCR-1737: Gives a way to get the configuration of the repositories/workspaces at Runtime
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryServiceConfiguration.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryServiceConfiguration.java 2012-01-31 15:59:04 UTC (rev 5546)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/RepositoryServiceConfiguration.java 2012-01-31 17:57:20 UTC (rev 5547)
@@ -19,12 +19,21 @@
package org.exoplatform.services.jcr.config;
import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
+import org.jibx.runtime.IMarshallingContext;
import org.jibx.runtime.IUnmarshallingContext;
import org.jibx.runtime.JiBXException;
+import java.io.IOException;
import java.io.InputStream;
+import java.io.StringWriter;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.LinkedHashMap;
@@ -40,9 +49,11 @@
* @author <a href="mailto:gennady.azarenkov at exoplatform.com">Gennady Azarenkov </a>
* @version $Id: RepositoryServiceConfiguration.java 2038 2005-10-05 16:50:11Z geaz $
*/
-
+ at Managed
+ at NameTemplate(@Property(key = "service", value = "RepositoryServiceConfiguration"))
public class RepositoryServiceConfiguration extends AbstractRepositoryServiceConfiguration
{
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.RepositoryServiceConfiguration"); //NOSONAR
public RepositoryServiceConfiguration()
{
@@ -180,4 +191,37 @@
{
}
+ @Managed
+ @ManagedDescription("The configuration of all the repositories in XML format.")
+ public String getConfigurationXML()
+ {
+ StringWriter sw = new StringWriter();
+ try
+ {
+ IBindingFactory bfact = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ IMarshallingContext mctx = bfact.createMarshallingContext();
+ mctx.setIndent(2);
+ mctx.marshalDocument(this, "UTF-8", null, sw);
+ }
+ catch (Exception e)
+ {
+ LOG.warn("Cannot convert the configuration to XML format", e);
+ return null;
+ }
+ finally
+ {
+ try
+ {
+ sw.close();
+ }
+ catch (IOException ignore)
+ {
+ if (LOG.isTraceEnabled())
+ {
+ LOG.trace("An exception occurred: " + ignore.getMessage());
+ }
+ }
+ }
+ return sw.toString();
+ }
}
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2012-01-31 15:59:04 UTC (rev 5546)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2012-01-31 17:57:20 UTC (rev 5547)
@@ -275,7 +275,7 @@
<entry>acl-bloomfilter-false-positive-probability</entry>
<entry>ACL Bloom-filter desired false positive probability. Range
- [0..1]. Default value 0.1d. (See the note below) </entry>
+ [0..1]. Default value 0.1d. (See the note below)</entry>
</row>
<row>
@@ -514,4 +514,18 @@
</listitem>
</orderedlist>
</section>
+
+ <section>
+ <title>Getting the effective configuration at Runtime of all the
+ repositories</title>
+
+ <para>The effective configuration of all the repositories and their
+ workspaces can be known thanks to the method
+ <emphasis>getConfigurationXML</emphasis>() that is exposed through JMX at
+ the <emphasis>RepositoryServiceConfiguration</emphasis> level. This method
+ will give you the effective configuration in XML format that has been
+ really interpreted by the the JCR core. This could be helpful to
+ understand how your repositories/workspaces are configured especially if
+ you would like to overwrite the configuration for some reasons.</para>
+ </section>
</chapter>
More information about the exo-jcr-commits
mailing list