exo-jcr SVN: r5668 - kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-20 07:00:00 -0500 (Mon, 20 Feb 2012)
New Revision: 5668
Modified:
kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
Log:
EXOJCR-1768: Fixed wrong debug logging in PropertyConfigurator
Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2012-02-20 11:58:54 UTC (rev 5667)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2012-02-20 12:00:00 UTC (rev 5668)
@@ -88,8 +88,11 @@
ValueParam pathParam = params.getValueParam("properties.url");
if (pathParam != null)
{
- LOG.debug("Using file path " + path + " found from configuration");
path = pathParam.getValue();
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Using file path " + path + " found from configuration");
+ }
}
}
@@ -97,8 +100,11 @@
String systemPath = PropertyManager.getProperty(PropertyManager.PROPERTIES_URL);
if (systemPath != null)
{
- LOG.debug("Using file path " + path + " found from system properties");
path = systemPath;
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Using file path " + path + " found from system properties");
+ }
}
//
12 years, 4 months
exo-jcr SVN: r5667 - kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-20 06:58:54 -0500 (Mon, 20 Feb 2012)
New Revision: 5667
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
Log:
EXOJCR-1768: Fixed wrong debug logging in PropertyConfigurator
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2012-02-17 16:49:02 UTC (rev 5666)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/PropertyConfigurator.java 2012-02-20 11:58:54 UTC (rev 5667)
@@ -88,8 +88,11 @@
ValueParam pathParam = params.getValueParam("properties.url");
if (pathParam != null)
{
- LOG.debug("Using file path " + path + " found from configuration");
path = pathParam.getValue();
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Using file path " + path + " found from configuration");
+ }
}
}
@@ -97,8 +100,11 @@
String systemPath = PropertyManager.getProperty(PropertyManager.PROPERTIES_URL);
if (systemPath != null)
{
- LOG.debug("Using file path " + path + " found from system properties");
path = systemPath;
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Using file path " + path + " found from system properties");
+ }
}
//
12 years, 4 months
exo-jcr SVN: r5666 - in kernel/trunk/exo.kernel.container/src: test/java/org/exoplatform/container and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-02-17 11:49:02 -0500 (Fri, 17 Feb 2012)
New Revision: 5666
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml
Log:
EXOJCR-1774: StackOverflowError when instantiating external component plugin that has constructor dependency on its target service
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2012-02-17 13:03:02 UTC (rev 5665)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2012-02-17 16:49:02 UTC (rev 5666)
@@ -413,7 +413,7 @@
Map<Object, Object> map = depResolutionCtx.get();
if (map != null)
{
- Object result = map.get(componentType);
+ Object result = map.get(componentAdapter.getComponentKey());
if (result != null)
{
return result;
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2012-02-17 13:03:02 UTC (rev 5665)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2012-02-17 16:49:02 UTC (rev 5666)
@@ -18,6 +18,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.component.BaseComponentPlugin;
+import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.jmx.AbstractTestContainer;
import org.exoplatform.container.support.ContainerBuilder;
@@ -185,6 +186,19 @@
assertEquals(container.getComponentInstanceOfType(SOE1.class), soe2.soe1);
}
+ public void testStackOverFlow4()
+ {
+ final RootContainer container = createRootContainer("test-exo-container.xml", "testStackOverflowError");
+ MyService ms = (MyService)container.getComponentInstanceOfType(MyService.class);
+ assertNotNull(ms);
+ assertTrue(ms instanceof MyServiceImpl);
+ MyServiceImpl msi = (MyServiceImpl)ms;
+ assertNotNull(msi.componentPlugin);
+ assertTrue(msi.componentPlugin instanceof MyPlugin);
+ MyPlugin mp = (MyPlugin) msi.componentPlugin;
+ assertTrue(mp.svc == ms);
+ }
+
public void testCyclicRef()
{
final RootContainer container = createRootContainer("test-exo-container.xml", "testCyclicRef");
@@ -1005,4 +1019,44 @@
this.soe1 = (SOE1)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(SOE1.class);
}
}
+
+ public static class MyPlugin extends BaseComponentPlugin
+ {
+ MySpecialService svc;
+
+ public MyPlugin(MySpecialService svc)
+ {
+ this.svc = svc;
+ }
+ }
+
+ public static interface MyService
+ {
+ public void addPlugin(ComponentPlugin componentPlugin);
+ }
+
+ public static interface MySpecialService extends MyService
+ {
+ }
+
+ public static class MyServiceImpl implements MySpecialService, Startable
+ {
+ ComponentPlugin componentPlugin;
+ public MyServiceImpl()
+ {
+ }
+
+ public void addPlugin(ComponentPlugin componentPlugin)
+ {
+ this.componentPlugin = componentPlugin;
+ }
+
+ public void stop()
+ {
+ }
+
+ public void start()
+ {
+ }
+ }
}
Modified: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml 2012-02-17 13:03:02 UTC (rev 5665)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml 2012-02-17 16:49:02 UTC (rev 5666)
@@ -87,4 +87,18 @@
<component profiles="testStartOrder">
<type>org.exoplatform.container.TestExoContainer$C2</type>
</component>
+ <component profiles="testStackOverflowError">
+ <key>org.exoplatform.container.TestExoContainer$MyService</key>
+ <type>org.exoplatform.container.TestExoContainer$MyServiceImpl</type>
+ </component>
+
+ <external-component-plugins profiles="testStackOverflowError">
+ <target-component>org.exoplatform.container.TestExoContainer$MyService</target-component>
+ <component-plugin>
+ <name>test.plugin</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.container.TestExoContainer$MyPlugin</type>
+ <description>User - Ticket Authenticator</description>
+ </component-plugin>
+ </external-component-plugins>
</configuration>
\ No newline at end of file
12 years, 4 months
exo-jcr SVN: r5665 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype and 15 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-17 08:03:02 -0500 (Fri, 17 Feb 2012)
New Revision: 5665
Modified:
jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java
jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java
jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java
Log:
EXOJCR-1760: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
--- jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -302,7 +302,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get DetailedInfo from responce.", e);
+ throw new IllegalStateException("Can not get DetailedInfo from responce.", e);
}
if (info.getType() == DetailedInfo.COMPLETED)
@@ -380,7 +380,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
for (ShortInfo info : repositoryInfoList.getBackups())
@@ -418,7 +418,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
for (ShortInfo info : workspaceInfoList.getBackups())
@@ -686,7 +686,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get BackupServiceInfoBean from responce.", e);
+ throw new IllegalStateException("Can not get BackupServiceInfoBean from responce.", e);
}
String result =
@@ -728,7 +728,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
ShortInfoList workspaceInfoList;
@@ -738,7 +738,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
StringBuilder result = new StringBuilder("\nThe current backups information : \n");
@@ -824,7 +824,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
ShortInfoList workspaceInfoList;
@@ -910,7 +910,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get DetailedInfo from responce.", e);
+ throw new IllegalStateException("Can not get DetailedInfo from responce.", e);
}
StringBuilder result = new StringBuilder("\nThe current restores information : \n");
@@ -956,7 +956,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get DetailedInfo from responce.", e);
+ throw new IllegalStateException("Can not get DetailedInfo from responce.", e);
}
StringBuilder result = new StringBuilder("\nThe current restores information : \n");
@@ -1215,7 +1215,9 @@
wsEntry = wEntry;
if (wsEntry == null)
- throw new RuntimeException("Can not find the workspace '" + workspaceName + "' in configuration.");
+ {
+ throw new IllegalStateException("Can not find the workspace '" + workspaceName + "' in configuration.");
+ }
return wsEntry;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -31,8 +31,7 @@
public class OnParentVersionActionConversion
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.core.nodetype.OnParentVersionActionConversion");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.OnParentVersionActionConversion");
public static String serializeType(int propertyType)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -43,7 +43,7 @@
public class TransactionChangesLog implements CompositeChangesLog, Externalizable
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.jcr.dataflow.TransactionChangesLog");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.TransactionChangesLog");
private static final long serialVersionUID = 4866736965040228027L;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -37,8 +37,7 @@
*/
abstract class CaseTermQuery extends MultiTermQuery implements TransformConstants
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.CaseTermQuery");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.CaseTermQuery");
/**
* Indicates whether terms from the index should be lower-cased or
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -38,8 +38,7 @@
public class NodeTraversingQueryHits extends AbstractQueryHits
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.NodeTraversingQueryHits");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.NodeTraversingQueryHits");
/**
* The nodes to traverse.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -38,8 +38,7 @@
class WildcardTermEnum extends FilteredTermEnum implements TransformConstants
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.WildcardTermEnum");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.WildcardTermEnum");
/**
* The pattern matcher.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -31,8 +31,7 @@
public class WordNetSynonyms implements SynonymProvider
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.synonym.WordNetSynonyms");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.WordNetSynonyms");
/**
* The synonym map or <code>null</code> if an error occurred while reading the prolog file.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -37,8 +37,7 @@
public class SerializationSpoolFile extends SpoolFile
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.dataflow.serialization.SerializationSpoolFile");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.SerializationSpoolFile");
/**
* SpoolFileHolder.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -43,8 +43,7 @@
public class DB2ConnectionFactory extends GenericCQConnectionFactory
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.DB2ConnectionFactory");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.DB2ConnectionFactory");
private Boolean isReindexingSupport;
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -291,7 +291,9 @@
public int getIncrementalBackupState()
{
if (incrementalBackup == null)
- throw new RuntimeException("The incremental bacup was not configured. Only full backup.");
+ {
+ throw new IllegalStateException("The incremental bacup was not configured. Only full backup.");
+ }
return incrementalBackup.getState();
}
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -1191,7 +1191,7 @@
{
if (backupDir == null)
{
- throw new RuntimeException(BACKUP_DIR + " not specified");
+ throw new IllegalStateException(BACKUP_DIR + " not specified");
}
logsDirectory = new File(backupDir);
@@ -1202,19 +1202,19 @@
if (defIncrPeriod == null)
{
- throw new RuntimeException(DEFAULT_INCREMENTAL_JOB_PERIOD + " not specified");
+ throw new IllegalStateException(DEFAULT_INCREMENTAL_JOB_PERIOD + " not specified");
}
defaultIncrementalJobPeriod = Integer.valueOf(defIncrPeriod);
if (fullBackupType == null)
{
- throw new RuntimeException(FULL_BACKUP_TYPE + " not specified");
+ throw new IllegalStateException(FULL_BACKUP_TYPE + " not specified");
}
if (incrementalBackupType == null)
{
- throw new RuntimeException(INCREMENTAL_BACKUP_TYPE + " not specified");
+ throw new IllegalStateException(INCREMENTAL_BACKUP_TYPE + " not specified");
}
}
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -43,8 +43,7 @@
public abstract class AbstractDataDistributionType implements DataDistributionType
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.ext.distribution.impl.AbstractDataDistributionType");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ext.AbstractDataDistributionType");
/**
* The default node type to use when we create a new node
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -38,7 +38,7 @@
public class JcrURLConnection extends URLConnection
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.jcr.ext.resource.JcrURLConnection");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ext.JcrURLConnection");
private SessionProvider sessionProvider;
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -37,7 +37,7 @@
public class FtpServiceImpl implements FtpService, Startable
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpServiceImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpServiceImpl");
private CommandService commandService = null;
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -30,7 +30,7 @@
public class FtpTextUtils
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpTextUtils");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpTextUtils");
public static String getStrached(String strVal, int reqLen)
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -54,7 +54,7 @@
public class FtpClientSessionImpl implements FtpClientSession
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpClientSessionImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpClientSessionImpl");
private FtpServer ftpServer;
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -40,7 +40,7 @@
public class CmdMkd extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdMkd");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdMkd");
public CmdMkd()
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -35,7 +35,7 @@
public class CmdPort extends FtpCommandImpl
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdPort");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.ftp.CmdPort");
public CmdPort()
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -33,7 +33,7 @@
public class CmdRest extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.ftp.command.CmdRest");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.command.CmdRest");
public CmdRest()
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -39,7 +39,7 @@
public class CmdRnTo extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdRnTo");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdRnTo");
public CmdRnTo()
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -39,7 +39,7 @@
public class CmdSize extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdSize");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdSize");
public CmdSize()
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -49,7 +49,7 @@
public class CmdStor extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdStor");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdStor");
public CmdStor()
{
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -48,7 +48,7 @@
public abstract class FtpCommandImpl implements FtpCommand
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpCommandImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpCommandImpl");
protected boolean isNeedLogin = true;
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -35,7 +35,7 @@
public class FtpConfigImpl implements FtpConfig
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpConfigImpl");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.ftp.FtpConfigImpl");
/**
* "command-port".
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.ftp.data;
-import org.exoplatform.services.ftp.FtpConst;
import org.exoplatform.services.ftp.client.FtpClientSession;
import org.exoplatform.services.ftp.config.FtpConfig;
import org.exoplatform.services.log.ExoLogger;
@@ -33,7 +32,7 @@
public class FtpDataChannelManagerImpl implements FtpDataChannelManager
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpDataChannelManagerImpl");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.ftp.FtpDataChannelManagerImpl");
private FtpConfig configuration;
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -19,7 +19,6 @@
package org.exoplatform.services.ftp.data;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.services.ftp.FtpConst;
import org.exoplatform.services.ftp.client.FtpClientSession;
import org.exoplatform.services.ftp.config.FtpConfig;
import org.exoplatform.services.log.ExoLogger;
@@ -43,7 +42,7 @@
public class FtpDataTransiverImpl implements FtpDataTransiver
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpDataTransiverImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpDataTransiverImpl");
private FtpClientSession clientSession;
@@ -118,7 +117,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
@@ -130,7 +129,7 @@
}
catch (IOException ioexc)
{
- log.info("Closing socket failure.");
+ LOG.info("Closing socket failure.");
}
}
@@ -148,7 +147,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
@@ -216,7 +215,7 @@
+ configuration.getPortalContainer().getName()));
}
- protected Log acceptLog = ExoLogger.getLogger("jcr.AcceptDataConnect");
+ protected Log acceptLog = ExoLogger.getLogger("exo.jcr.component.ftp.AcceptDataConnect");
@Override
public void run()
@@ -235,7 +234,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
@@ -251,7 +250,7 @@
+ configuration.getPortalContainer().getName()));
}
- protected Log connectLog = ExoLogger.getLogger("jcr.ConnectDataPort");
+ protected Log connectLog = ExoLogger.getLogger("exo.jcr.component.ftp.ConnectDataPort");
@Override
public void run()
@@ -264,7 +263,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
Modified: jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java
===================================================================
--- jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.ftp.data;
-import org.exoplatform.services.ftp.FtpConst;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -34,7 +33,7 @@
public class FtpSlowOutputStream extends OutputStream
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpSlowOutputStream");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpSlowOutputStream");
private OutputStream nativeOutputStream;
Modified: jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java
===================================================================
--- jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -35,7 +35,7 @@
public class HelpCommand extends AbstractCliCommand
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.frameworks.jcr.cli.HelpCommand");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.framework.command.HelpCommand");
private TreeMap<String, String> map = new TreeMap<String, String>();
Modified: jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java
===================================================================
--- jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java 2012-02-17 12:34:38 UTC (rev 5664)
+++ jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java 2012-02-17 13:03:02 UTC (rev 5665)
@@ -50,12 +50,16 @@
{
Object obj = context.get(incomingNodesKey);
if (obj == null || !(obj instanceof NodeIterator))
- throw new Exception("Invalid incoming nodes iterator " + obj);
+ {
+ throw new IllegalArgumentException("Invalid incoming nodes iterator " + obj);
+ }
NodeIterator nodes = (NodeIterator)obj;
obj = context.get(typesKey);
if (obj == null || !(obj instanceof String[]))
- throw new Exception("Invalid node types object, expected String[] " + obj);
+ {
+ throw new IllegalArgumentException("Invalid node types object, expected String[] " + obj);
+ }
String[] nts = (String[])context.get(typesKey);
List nodes1 = new ArrayList();
@@ -65,7 +69,9 @@
for (int i = 0; i < nts.length; i++)
{
if (n.isNodeType(nts[i]))
+ {
nodes1.add(n);
+ }
}
}
// context.put(resultKey, new EntityCollection(nodes1));
12 years, 4 months
exo-jcr SVN: r5664 - jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-17 07:34:38 -0500 (Fri, 17 Feb 2012)
New Revision: 5664
Added:
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java
Log:
EXOJCR-1755: refactoring RepositoryCheckController
Added: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java (rev 0)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java 2012-02-17 12:34:38 UTC (rev 5664)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl;
+
+import org.exoplatform.services.jcr.core.ManageableRepository;
+
+import java.io.File;
+
+/**
+ * For testing purpose. Returns last log file to have possibility to delete.
+ *
+ * @author <a href="abazko(a)exoplatform.com">Anatoliy Bazko</a>
+ * @version $Id: TesterRepositoryCheckController.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+public class TesterRepositoryCheckController extends RepositoryCheckController
+{
+ public TesterRepositoryCheckController(ManageableRepository repository)
+ {
+ super(repository);
+ }
+
+ public File getLastLogFile()
+ {
+ return new File(lastReport.getReportPath());
+ }
+}
12 years, 4 months
exo-jcr SVN: r5663 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype and 15 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-17 07:34:21 -0500 (Fri, 17 Feb 2012)
New Revision: 5663
Modified:
jcr/branches/1.15.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java
jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java
jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java
jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java
Log:
EXOJCR-1760: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: jcr/branches/1.15.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
--- jcr/branches/1.15.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -302,7 +302,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get DetailedInfo from responce.", e);
+ throw new IllegalStateException("Can not get DetailedInfo from responce.", e);
}
if (info.getType() == DetailedInfo.COMPLETED)
@@ -380,7 +380,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
for (ShortInfo info : repositoryInfoList.getBackups())
@@ -418,7 +418,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
for (ShortInfo info : workspaceInfoList.getBackups())
@@ -686,7 +686,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get BackupServiceInfoBean from responce.", e);
+ throw new IllegalStateException("Can not get BackupServiceInfoBean from responce.", e);
}
String result =
@@ -728,7 +728,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
ShortInfoList workspaceInfoList;
@@ -738,7 +738,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
StringBuilder result = new StringBuilder("\nThe current backups information : \n");
@@ -824,7 +824,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get ShortInfoList from responce.", e);
+ throw new IllegalStateException("Can not get ShortInfoList from responce.", e);
}
ShortInfoList workspaceInfoList;
@@ -910,7 +910,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get DetailedInfo from responce.", e);
+ throw new IllegalStateException("Can not get DetailedInfo from responce.", e);
}
StringBuilder result = new StringBuilder("\nThe current restores information : \n");
@@ -956,7 +956,7 @@
}
catch (Exception e)
{
- throw new RuntimeException("Can not get DetailedInfo from responce.", e);
+ throw new IllegalStateException("Can not get DetailedInfo from responce.", e);
}
StringBuilder result = new StringBuilder("\nThe current restores information : \n");
@@ -1215,7 +1215,9 @@
wsEntry = wEntry;
if (wsEntry == null)
- throw new RuntimeException("Can not find the workspace '" + workspaceName + "' in configuration.");
+ {
+ throw new IllegalStateException("Can not find the workspace '" + workspaceName + "' in configuration.");
+ }
return wsEntry;
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/OnParentVersionActionConversion.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -31,8 +31,7 @@
public class OnParentVersionActionConversion
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.core.nodetype.OnParentVersionActionConversion");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.OnParentVersionActionConversion");
public static String serializeType(int propertyType)
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/TransactionChangesLog.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -42,7 +42,7 @@
public class TransactionChangesLog implements CompositeChangesLog, Externalizable
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.jcr.dataflow.TransactionChangesLog");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.TransactionChangesLog");
private static final long serialVersionUID = 4866736965040228027L;
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/CaseTermQuery.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -37,8 +37,7 @@
*/
abstract class CaseTermQuery extends MultiTermQuery implements TransformConstants
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.CaseTermQuery");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.CaseTermQuery");
/**
* Indicates whether terms from the index should be lower-cased or
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeTraversingQueryHits.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -38,8 +38,7 @@
public class NodeTraversingQueryHits extends AbstractQueryHits
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.NodeTraversingQueryHits");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.NodeTraversingQueryHits");
/**
* The nodes to traverse.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/WildcardTermEnum.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -38,8 +38,7 @@
class WildcardTermEnum extends FilteredTermEnum implements TransformConstants
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.WildcardTermEnum");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.WildcardTermEnum");
/**
* The pattern matcher.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/synonym/WordNetSynonyms.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -31,8 +31,7 @@
public class WordNetSynonyms implements SynonymProvider
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.core.query.lucene.synonym.WordNetSynonyms");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.WordNetSynonyms");
/**
* The synonym map or <code>null</code> if an error occurred while reading the prolog file.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/SerializationSpoolFile.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -37,8 +37,7 @@
public class SerializationSpoolFile extends SpoolFile
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.dataflow.serialization.SerializationSpoolFile");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.SerializationSpoolFile");
/**
* SpoolFileHolder.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -43,8 +43,7 @@
public class DB2ConnectionFactory extends GenericCQConnectionFactory
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.DB2ConnectionFactory");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.DB2ConnectionFactory");
private Boolean isReindexingSupport;
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupChainImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -293,7 +293,9 @@
public int getIncrementalBackupState()
{
if (incrementalBackup == null)
- throw new RuntimeException("The incremental bacup was not configured. Only full backup.");
+ {
+ throw new IllegalStateException("The incremental bacup was not configured. Only full backup.");
+ }
return incrementalBackup.getState();
}
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -1081,7 +1081,7 @@
{
if (backupDir == null)
{
- throw new RuntimeException(BACKUP_DIR + " not specified");
+ throw new IllegalStateException(BACKUP_DIR + " not specified");
}
logsDirectory = new File(backupDir);
@@ -1092,19 +1092,19 @@
if (defIncrPeriod == null)
{
- throw new RuntimeException(DEFAULT_INCREMENTAL_JOB_PERIOD + " not specified");
+ throw new IllegalStateException(DEFAULT_INCREMENTAL_JOB_PERIOD + " not specified");
}
defaultIncrementalJobPeriod = Integer.valueOf(defIncrPeriod);
if (fullBackupType == null)
{
- throw new RuntimeException(FULL_BACKUP_TYPE + " not specified");
+ throw new IllegalStateException(FULL_BACKUP_TYPE + " not specified");
}
if (incrementalBackupType == null)
{
- throw new RuntimeException(INCREMENTAL_BACKUP_TYPE + " not specified");
+ throw new IllegalStateException(INCREMENTAL_BACKUP_TYPE + " not specified");
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/distribution/impl/AbstractDataDistributionType.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -43,8 +43,7 @@
public abstract class AbstractDataDistributionType implements DataDistributionType
{
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.jcr.ext.distribution.impl.AbstractDataDistributionType");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ext.AbstractDataDistributionType");
/**
* The default node type to use when we create a new node
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/JcrURLConnection.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -38,7 +38,7 @@
public class JcrURLConnection extends URLConnection
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.jcr.ext.resource.JcrURLConnection");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ext.JcrURLConnection");
private SessionProvider sessionProvider;
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -37,7 +37,7 @@
public class FtpServiceImpl implements FtpService, Startable
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpServiceImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpServiceImpl");
private CommandService commandService = null;
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpTextUtils.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -30,7 +30,7 @@
public class FtpTextUtils
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpTextUtils");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpTextUtils");
public static String getStrached(String strVal, int reqLen)
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -54,7 +54,7 @@
public class FtpClientSessionImpl implements FtpClientSession
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpClientSessionImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpClientSessionImpl");
private FtpServer ftpServer;
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdMkd.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -40,7 +40,7 @@
public class CmdMkd extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdMkd");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdMkd");
public CmdMkd()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdPort.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -35,7 +35,7 @@
public class CmdPort extends FtpCommandImpl
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdPort");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.ftp.CmdPort");
public CmdPort()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRest.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -33,7 +33,7 @@
public class CmdRest extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.ftp.command.CmdRest");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.command.CmdRest");
public CmdRest()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -39,7 +39,7 @@
public class CmdRnTo extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdRnTo");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdRnTo");
public CmdRnTo()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdSize.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -39,7 +39,7 @@
public class CmdSize extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdSize");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdSize");
public CmdSize()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdStor.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -49,7 +49,7 @@
public class CmdStor extends FtpCommandImpl
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "CmdStor");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.CmdStor");
public CmdStor()
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -48,7 +48,7 @@
public abstract class FtpCommandImpl implements FtpCommand
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpCommandImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpCommandImpl");
protected boolean isNeedLogin = true;
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/config/FtpConfigImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -35,7 +35,7 @@
public class FtpConfigImpl implements FtpConfig
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpConfigImpl");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.ftp.FtpConfigImpl");
/**
* "command-port".
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataChannelManagerImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.ftp.data;
-import org.exoplatform.services.ftp.FtpConst;
import org.exoplatform.services.ftp.client.FtpClientSession;
import org.exoplatform.services.ftp.config.FtpConfig;
import org.exoplatform.services.log.ExoLogger;
@@ -33,7 +32,7 @@
public class FtpDataChannelManagerImpl implements FtpDataChannelManager
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpDataChannelManagerImpl");
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.ftp.FtpDataChannelManagerImpl");
private FtpConfig configuration;
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpDataTransiverImpl.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -19,7 +19,6 @@
package org.exoplatform.services.ftp.data;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.services.ftp.FtpConst;
import org.exoplatform.services.ftp.client.FtpClientSession;
import org.exoplatform.services.ftp.config.FtpConfig;
import org.exoplatform.services.log.ExoLogger;
@@ -43,7 +42,7 @@
public class FtpDataTransiverImpl implements FtpDataTransiver
{
- private static Log log = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpDataTransiverImpl");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpDataTransiverImpl");
private FtpClientSession clientSession;
@@ -118,7 +117,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
@@ -130,7 +129,7 @@
}
catch (IOException ioexc)
{
- log.info("Closing socket failure.");
+ LOG.info("Closing socket failure.");
}
}
@@ -148,7 +147,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
@@ -216,7 +215,7 @@
+ configuration.getPortalContainer().getName()));
}
- protected Log acceptLog = ExoLogger.getLogger("jcr.AcceptDataConnect");
+ protected Log acceptLog = ExoLogger.getLogger("exo.jcr.component.ftp.AcceptDataConnect");
@Override
public void run()
@@ -235,7 +234,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
@@ -251,7 +250,7 @@
+ configuration.getPortalContainer().getName()));
}
- protected Log connectLog = ExoLogger.getLogger("jcr.ConnectDataPort");
+ protected Log connectLog = ExoLogger.getLogger("exo.jcr.component.ftp.ConnectDataPort");
@Override
public void run()
@@ -264,7 +263,7 @@
}
catch (Exception exc)
{
- log.info("Unhandled exception. " + exc.getMessage(), exc);
+ LOG.info("Unhandled exception. " + exc.getMessage(), exc);
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/data/FtpSlowOutputStream.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.ftp.data;
-import org.exoplatform.services.ftp.FtpConst;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -34,7 +33,7 @@
public class FtpSlowOutputStream extends OutputStream
{
- private static final Log LOG = ExoLogger.getLogger(FtpConst.FTP_PREFIX + "FtpSlowOutputStream");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ftp.FtpSlowOutputStream");
private OutputStream nativeOutputStream;
Modified: jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/HelpCommand.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -35,7 +35,7 @@
public class HelpCommand extends AbstractCliCommand
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.frameworks.jcr.cli.HelpCommand");
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.framework.command.HelpCommand");
private TreeMap<String, String> map = new TreeMap<String, String>();
Modified: jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java 2012-02-17 12:34:07 UTC (rev 5662)
+++ jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/ext/FilterNodesByTypesCommand.java 2012-02-17 12:34:21 UTC (rev 5663)
@@ -50,12 +50,16 @@
{
Object obj = context.get(incomingNodesKey);
if (obj == null || !(obj instanceof NodeIterator))
- throw new Exception("Invalid incoming nodes iterator " + obj);
+ {
+ throw new IllegalArgumentException("Invalid incoming nodes iterator " + obj);
+ }
NodeIterator nodes = (NodeIterator)obj;
obj = context.get(typesKey);
if (obj == null || !(obj instanceof String[]))
- throw new Exception("Invalid node types object, expected String[] " + obj);
+ {
+ throw new IllegalArgumentException("Invalid node types object, expected String[] " + obj);
+ }
String[] nts = (String[])context.get(typesKey);
List nodes1 = new ArrayList();
@@ -65,7 +69,9 @@
for (int i = 0; i < nts.length; i++)
{
if (n.isNodeType(nts[i]))
+ {
nodes1.add(n);
+ }
}
}
// context.put(resultKey, new EntityCollection(nodes1));
12 years, 4 months
exo-jcr SVN: r5662 - in jcr/branches/1.15.x/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/query and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-17 07:34:07 -0500 (Fri, 17 Feb 2012)
New Revision: 5662
Added:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
Log:
EXOJCR-1755: refactoring RepositoryCheckController
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
@@ -33,7 +34,7 @@
/**
* The current repository.
*/
- private final ManageableRepository repository;
+ protected final ManageableRepository repository;
/**
* AbstractRepositorySuspender constructor.
@@ -49,12 +50,8 @@
*/
protected void suspendRepository() throws RepositoryException
{
- // Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
- }
+ SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+
repository.setState(ManageableRepository.SUSPENDED);
}
@@ -64,11 +61,8 @@
protected void resumeRepository() throws RepositoryException
{
// Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
- }
+ SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+
repository.setState(ManageableRepository.ONLINE);
}
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-import java.io.IOException;
-
-/**
- * Interface of inspection log. It provides general methods for logging consistency issues.
- *
- * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 4.10.2011 skarpenko $
- *
- */
-public interface InspectionLog
-{
- // represents broken object state
- public enum InspectionStatus {
- ERR("Error"), WARN("Warning"), REINDEX("Reindex");
- final String text;
-
- InspectionStatus(String text)
- {
- this.text = text;
- }
-
- public String toString()
- {
- return text;
- }
- }
-
- /**
- * @return true, if inconsistency was found
- */
- boolean hasInconsistency();
-
- /**
- * @return true, if inconsistency or warning was found
- */
- boolean hasWarnings();
-
- /**
- * Adds comment to log
- */
- void logComment(String message) throws IOException;
-
- /**
- * Adds description to log
- */
- void logInspectionDescription(String description) throws IOException;
-
- /**
- * Adds detailed event to log, with issue found
- */
- void logBrokenObjectInfo(String brokenObjectDesc, String comment, InspectionStatus status) throws IOException;
-
- /**
- * Adds exception with full trace to the log
- */
- void logException(String message, Exception ex) throws IOException;
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Text-based inspection log implementation. It uses any compatible Writer instance for output.
- *
- * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 6.10.2011 skarpenko $
- *
- */
-public class InspectionLogWriter implements InspectionLog
-{
- private static final String LINE_COMMENT = "//";
-
- private static final String LINE_DELIMITER = "\n";
-
- private static final String WSP = " ";
-
- private final Writer out;
-
- private final Set<InspectionStatus> statusSet = new HashSet<InspectionStatus>();
-
- public InspectionLogWriter(Writer out)
- {
- this.out = out;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasInconsistency()
- {
- return statusSet.contains(InspectionStatus.ERR) || statusSet.contains(InspectionStatus.REINDEX);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasWarnings()
- {
- return statusSet.contains(InspectionStatus.WARN);
- }
-
- /**
- * {@inheritDoc}
- */
- public void logComment(String message) throws IOException
- {
- writeLine(message);
- out.flush();
- }
-
- /**
- * {@inheritDoc}
- */
- public void logInspectionDescription(String description) throws IOException
- {
- writeLine(description);
- out.flush();
- }
-
- /**
- * {@inheritDoc}
- */
- public void logBrokenObjectInfo(String brokenObjectDesc, String comment, InspectionStatus status) throws IOException
- {
- statusSet.add(status);
-
- out.write(status.toString());
- out.write(WSP);
- out.write(brokenObjectDesc);
- out.write(WSP);
- out.write(comment);
- out.write(LINE_DELIMITER);
- out.flush();
- }
-
- public void logException(String message, Exception ex) throws IOException
- {
- statusSet.add(InspectionStatus.ERR);
-
- writeLine(message);
- writeStackTrace(ex);
- out.flush();
- }
-
- private void writeLine(String message) throws IOException
- {
- out.write(LINE_COMMENT);
- out.write(message);
- out.write(LINE_DELIMITER);
- }
-
- private void writeStackTrace(Throwable e) throws IOException
- {
- writeLine(e.getMessage());
- writeLine(e.toString());
- StackTraceElement[] trace = e.getStackTrace();
- for (int i = 0; i < trace.length; i++)
- {
- writeLine("\tat " + trace[i]);
- }
-
- Throwable ourCause = e.getCause();
- if (ourCause != null)
- {
- writeLine("Cause:");
- writeStackTrace(ourCause);
- }
- }
-}
Added: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java (rev 0)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl;
+
+import org.exoplatform.commons.utils.SecurityHelper;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.security.PrivilegedExceptionAction;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Text-based inspection log implementation.
+ *
+ * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
+ * @version $Id: InspectionReport.java 34360 6.10.2011 skarpenko $
+ */
+public class InspectionReport
+{
+ private static final String COMMENT = "//";
+
+ private static final String DELIMITER = "\n";
+
+ private static final String WHITE_SPACE = " ";
+
+ private Writer writer;
+
+ private boolean reportHasInconsistency;
+
+ private String reportPath;
+
+ /**
+ * InspectionReport constructor.
+ */
+ public InspectionReport(String forRepository) throws IOException
+ {
+ final File reportFile =
+ new File("report-" + forRepository + "-" + new SimpleDateFormat("dd-MMM-yy-HH-mm").format(new Date()) + ".txt");
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ reportPath = reportFile.getAbsolutePath();
+ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(reportFile)));
+
+ return null;
+ }
+ });
+
+ }
+
+ /**
+ * Indicates if report has inconsistency info or not.
+ */
+ public boolean hasInconsistency()
+ {
+ return reportHasInconsistency;
+ }
+
+ /**
+ * Adds comment to log.
+ */
+ public void logComment(String message) throws IOException
+ {
+ writeLine(message);
+ writer.flush();
+ }
+
+ /**
+ * Adds description to log.
+ */
+ public void logDescription(String description) throws IOException
+ {
+ writeLine(description);
+ writer.flush();
+ }
+
+ /**
+ * Adds detailed event to log.
+ */
+ public void logBrokenObjectAndSetInconsistency(String brokenObjectDesc, String comment) throws IOException
+ {
+ setInconsistency();
+
+ writer.write(brokenObjectDesc);
+ writer.write(WHITE_SPACE);
+ writer.write(comment);
+ writer.write(DELIMITER);
+ writer.flush();
+ }
+
+ /**
+ * Adds exception with full stack trace.
+ */
+ public void logExceptionAndSetInconsistency(String message, Throwable e) throws IOException
+ {
+ setInconsistency();
+
+ writeLine(message);
+ writeStackTrace(e);
+ writer.flush();
+ }
+
+ /**
+ * Closes report and frees all allocated resources.
+ */
+ public void close() throws IOException
+ {
+ writer.close();
+ }
+
+ /**
+ * Returns the absolute path to report file.
+ */
+ public String getReportPath()
+ {
+ return reportPath;
+ }
+
+ private void setInconsistency()
+ {
+ reportHasInconsistency = true;
+ }
+
+ private void writeLine(String message) throws IOException
+ {
+ writer.write(COMMENT);
+ writer.write(message);
+ writer.write(DELIMITER);
+ writer.flush();
+ }
+
+ private void writeStackTrace(Throwable e) throws IOException
+ {
+ writeLine(e.getMessage());
+ writeLine(e.toString());
+ StackTraceElement[] trace = e.getStackTrace();
+ for (int i = 0; i < trace.length; i++)
+ {
+ writeLine("\tat " + trace[i]);
+ }
+
+ Throwable ourCause = e.getCause();
+ if (ourCause != null)
+ {
+ writeLine("Cause:");
+ writeStackTrace(ourCause);
+ }
+ }
+}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
@@ -33,13 +32,7 @@
import org.exoplatform.services.log.Log;
import org.picocontainer.Startable;
-import java.io.BufferedWriter;
-import java.io.File;
import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import javax.jcr.RepositoryException;
@@ -52,7 +45,7 @@
* </ul>
*
* @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 3.10.2011 skarpenko $
+ * @version $Id: RepositoryCheckController.java 34360 3.10.2011 skarpenko $
*/
@Managed
@NameTemplate(@Property(key = "service", value = "RepositoryCheckController"))
@@ -61,20 +54,25 @@
/**
* Logger.
*/
- protected static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.RepositorySuspendController");
+ protected static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.RepositoryCheckController");
- protected static final String FILE_NAME = "report";
+ public static final String REPORT_CONSISTENT_MESSAGE = "Repository data is consistent";
+ public static final String REPORT_NOT_CONSISTENT_MESSAGE = "Repository data is NOT consistent";
+
+ public static final String EXCEPTION_DURING_CHECKING_MESSAGE = "Exception occured during consistency checking";
+
+ /**
+ * The list of available storages for checking.
+ */
protected enum DataStorage {
DB, VALUE_STORAGE, LUCENE_INDEX
};
- private File inspectionLogFile = null;
-
/**
- * The current repository.
+ * Store the results of last checking.
*/
- private final ManageableRepository repository;
+ protected InspectionReport lastReport;
/**
* RepositoryCheckController constructor.
@@ -82,7 +80,6 @@
public RepositoryCheckController(ManageableRepository repository)
{
super(repository);
- this.repository = repository;
}
/**
@@ -126,221 +123,194 @@
return checkRepositoryDataConsistency(new DataStorage[]{DataStorage.LUCENE_INDEX});
}
- protected String checkRepositoryDataConsistency(DataStorage[] checkData)
+ protected String checkRepositoryDataConsistency(DataStorage[] storages)
{
- inspectionLogFile = null;
try
{
- if (getRepositoryState() == ManageableRepository.SUSPENDED)
- {
- return "Can not check data consistency. Repository is already suspended.";
- }
+ createNewReport();
+ suspendRepository();
+
+ return doCheck(storages);
+ }
+ catch (IOException e)
+ {
+ return getExceptionDuringCheckingMessage(e);
+ }
+ catch (RepositoryException e)
+ {
+ return getExceptionDuringCheckingMessage(e);
+ }
+ finally
+ {
+ resumeRepository();
+ closeReport();
+ }
+ }
- Writer reportWriter = null;
- try
+ /**
+ * {@inheritDoc}
+ */
+ protected void resumeRepository()
+ {
+ try
+ {
+ super.resumeRepository();
+ }
+ catch (RepositoryException e)
+ {
+ LOG.error("Can not resume repository. Error: " + e.getMessage(), e);
+ }
+ }
+
+ private String doCheck(DataStorage[] storages)
+ {
+ try
+ {
+ for (DataStorage storage : storages)
{
- try
+ switch (storage)
{
- suspendRepository();
- }
- catch (RepositoryException e)
- {
- return "Can not check data consistency. Repository was not suspended. Error: " + e.getMessage();
- }
+ case DB :
+ checkDataBase();
+ break;
- // DO CHECK
- inspectionLogFile =
- new File(FILE_NAME + "-" + repository.getConfiguration().getName() + "-"
- + new SimpleDateFormat("dd-MMM-yy-HH-mm").format(new Date()) + ".txt");
- if (!PrivilegedFileHelper.exists(inspectionLogFile)
- && !PrivilegedFileHelper.createNewFile(inspectionLogFile))
- {
- LOG.error("Inspection log file was not created. "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile));
- return "Can not check data consistency. Inspection log file was not created. "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
+ case VALUE_STORAGE :
+ checkValueStorage();
+ break;
- reportWriter =
- new BufferedWriter(new OutputStreamWriter(PrivilegedFileHelper.fileOutputStream(inspectionLogFile)));
- InspectionLog report = new InspectionLogWriter(reportWriter);
- for (DataStorage cd : checkData)
- {
- switch (cd)
- {
- case DB :
- try
- {
- checkDB(report);
- }
- catch (RepositoryException e)
- {
- report.logException("RepositoryException occures during DB consistency check.", e);
- return "RepositoryException occures during DB consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- catch (IOException e)
- {
- report.logException("IOException occures during DB consistency check.", e);
- return "IOException occures during DB consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- break;
- case VALUE_STORAGE :
- try
- {
- checkVS(report);
- }
- catch (RepositoryException e)
- {
- report.logException("RepositoryException occures during ValueStorage consistency check.", e);
- return "RepositoryException occures during ValueStorage consistency check. Error: "
- + e.getMessage() + ". See log here: "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- catch (IOException e)
- {
- report.logException("IOException occures during ValueStorage consistency check.", e);
- return "IOException occures during ValueStorage consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- break;
- case LUCENE_INDEX :
- try
- {
- checkLuceneIndex(report);
- }
- catch (RepositoryException e)
- {
- report.logException("RepositoryException occures during SearchIndex consistency check.", e);
- return "RepositoryException occures during SearchIndex consistency check. Error: "
- + e.getMessage() + ". See log here: "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- catch (IOException e)
- {
- report.logException("IOException occures during SearchIndex consistency check.", e);
- return "IOException occures during SearchIndex consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- break;
- }
+ case LUCENE_INDEX :
+ checkLuceneIndex();
+ break;
}
-
- if (report.hasInconsistency())
- {
- report.logComment("Repository data is NOT consistent.");
- return "Repository data is inconsistent. See full report by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- else if (report.hasWarnings())
- {
- report.logComment("Repository data is consistent, except some warnings.");
- return "Repository data is consistent, except some warnings. See full report by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- else
- {
- report.logComment("Repository data is consistent");
- return "Repository data is consistent. See full report by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
}
- finally
- {
- if (reportWriter != null)
- {
- try
- {
- reportWriter.flush();
- reportWriter.close();
- }
- catch (IOException e)
- {
- LOG.error("Can not close file " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile), e);
- }
- }
- //resume repository
- try
- {
- resumeRepository();
- }
- catch (RepositoryException e)
- {
- LOG.error("Can not resume repository. Error: " + e.getMessage(), e);
- }
- if (getRepositoryState() != ManageableRepository.ONLINE)
- {
- LOG.error("Repository was not resumed and now it is OFFLINE");
- }
- }
+ return logAndGetCheckingResultMessage();
}
catch (Throwable e)
{
+ return logAndGetExceptionDuringCheckingMessage(e);
+ }
+ }
+
+ private String logAndGetCheckingResultMessage()
+ {
+ if (lastReport.hasInconsistency())
+ {
+ logComment(REPORT_NOT_CONSISTENT_MESSAGE);
+ return REPORT_NOT_CONSISTENT_MESSAGE + getPathToReportMessage();
+ }
+ else
+ {
+ logComment(REPORT_CONSISTENT_MESSAGE);
+ return REPORT_CONSISTENT_MESSAGE + getPathToReportMessage();
+ }
+ }
+
+ private String logAndGetExceptionDuringCheckingMessage(Throwable e)
+ {
+ logExceptionAndSetInconsistency(EXCEPTION_DURING_CHECKING_MESSAGE, e);
+ return getExceptionDuringCheckingMessage(e) + getPathToReportMessage();
+ }
+
+ private String getExceptionDuringCheckingMessage(Throwable e)
+ {
+ return EXCEPTION_DURING_CHECKING_MESSAGE + ": " + e.getMessage();
+ }
+
+ private void logComment(String message)
+ {
+ try
+ {
+ lastReport.logComment(message);
+ }
+ catch (IOException e)
+ {
LOG.error(e.getMessage(), e);
- return "Exception thrown during repository data validation: "
- + e
- + (inspectionLogFile != null ? " See log by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile) : "");
}
}
- private void checkDB(InspectionLog inspectionLog) throws RepositoryException, IOException,
+ private void logExceptionAndSetInconsistency(String message, Throwable e)
+ {
+ try
+ {
+ lastReport.logExceptionAndSetInconsistency(message, e);
+ }
+ catch (IOException e1)
+ {
+ LOG.error(e1.getMessage(), e1);
+ }
+ }
+
+ private void createNewReport() throws IOException
+ {
+ lastReport = new InspectionReport(repository.getConfiguration().getName());
+ }
+
+ private void closeReport()
+ {
+ try
+ {
+ lastReport.close();
+ }
+ catch (IOException e)
+ {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ private void checkDataBase() throws RepositoryException, IOException,
RepositoryConfigurationException
{
- String[] wsNames = repository.getWorkspaceNames();
- for (String wsName : wsNames)
+ for (String wsName : repository.getWorkspaceNames())
{
- inspectionLog.logComment("Check DB consistency. Workspace " + wsName);
+ logComment("Check DB consistency. Workspace " + wsName);
+
JDBCWorkspaceDataContainer dataContainer =
- (JDBCWorkspaceDataContainer)repository.getWorkspaceContainer(wsName).getComponent(
- JDBCWorkspaceDataContainer.class);
- JDBCWorkspaceDataContainerChecker.checkDB(dataContainer, inspectionLog);
+ (JDBCWorkspaceDataContainer)getComponent(JDBCWorkspaceDataContainer.class, wsName);
+
+ JDBCWorkspaceDataContainerChecker.checkDataBase(dataContainer, lastReport);
}
}
- private void checkVS(InspectionLog inspectionLog) throws RepositoryException, IOException
+ private void checkValueStorage() throws RepositoryException, IOException
{
- String[] wsNames = repository.getWorkspaceNames();
- for (String wsName : wsNames)
+ for (String wsName : repository.getWorkspaceNames())
{
- inspectionLog.logComment("Check ValueStorage consistency. Workspace " + wsName);
+ logComment("Check ValueStorage consistency. Workspace " + wsName);
JDBCWorkspaceDataContainer dataContainer =
- (JDBCWorkspaceDataContainer)repository.getWorkspaceContainer(wsName).getComponent(
- JDBCWorkspaceDataContainer.class);
-
+ (JDBCWorkspaceDataContainer)getComponent(JDBCWorkspaceDataContainer.class, wsName);
ValueStoragePluginProvider vsPlugin =
- (ValueStoragePluginProvider)repository.getWorkspaceContainer(wsName).getComponent(
- ValueStoragePluginProvider.class);
+ (ValueStoragePluginProvider)getComponent(ValueStoragePluginProvider.class, wsName);
- JDBCWorkspaceDataContainerChecker.checkValueStorage(dataContainer, vsPlugin, inspectionLog);
+ JDBCWorkspaceDataContainerChecker.checkValueStorage(dataContainer, vsPlugin, lastReport);
}
}
- private void checkLuceneIndex(InspectionLog inspectionLog) throws RepositoryException, IOException
+ private void checkLuceneIndex() throws RepositoryException, IOException
{
- final String[] wsNames = repository.getWorkspaceNames();
final String systemWS = repository.getConfiguration().getSystemWorkspaceName();
- for (String wsName : wsNames)
+
+ for (String wsName : repository.getWorkspaceNames())
{
- inspectionLog.logComment("Check SearchIndex consistency. Workspace " + wsName);
- SearchManager searchManager =
- (SearchManager)repository.getWorkspaceContainer(wsName).getComponent(SearchManager.class);
- searchManager.checkIndex(inspectionLog, systemWS.equals(wsName));
+ logComment("Check SearchIndex consistency. Workspace " + wsName);
+
+ SearchManager searchManager = (SearchManager)getComponent(SearchManager.class, wsName);
+
+ searchManager.checkIndex(lastReport, systemWS.equals(wsName));
}
}
- /**
- * For test purposes.
- * @return
- */
- protected File getLastLogFile()
+ private Object getComponent(Class forClass, String wsName)
{
- return inspectionLogFile;
+ return repository.getWorkspaceContainer(wsName).getComponent(forClass);
}
+ private String getPathToReportMessage()
+ {
+ return ". See full report by path " + lastReport.getReportPath();
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -20,7 +20,7 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.impl.InspectionLog;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.query.lucene.ChangesHolder;
@@ -231,10 +231,10 @@
*
* @param itemStateManager
* @param isSystem
- * @param inspectionLog
+ * @param report
* @throws RepositoryException
* @throws IOException
*/
- void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionLog inspectionLog)
+ void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionReport report)
throws RepositoryException, IOException;
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -50,7 +50,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.InspectionLog;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
@@ -401,7 +401,7 @@
* according jcr-node. If index is suspended then it will be temporary resumed, while check is running
* and suspended afterwards.
*/
- public void checkIndex(final InspectionLog inspectionLog, final boolean isSystem) throws RepositoryException,
+ public void checkIndex(final InspectionReport report, final boolean isSystem) throws RepositoryException,
IOException
{
if (isSuspended)
@@ -421,7 +421,7 @@
}
resume();
- handler.checkIndex(itemMgr, isSystem, inspectionLog);
+ handler.checkIndex(itemMgr, isSystem, report);
return null;
}
catch (ResumeException e)
@@ -467,7 +467,7 @@
else
{
// simply run checkIndex, if not suspended
- handler.checkIndex(itemMgr, isSystem, inspectionLog);
+ handler.checkIndex(itemMgr, isSystem, report);
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -52,8 +52,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.InspectionLog;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.backup.ResumeException;
import org.exoplatform.services.jcr.impl.backup.SuspendException;
import org.exoplatform.services.jcr.impl.backup.Suspendable;
@@ -859,7 +858,7 @@
/**
* {@inheritDoc}
*/
- public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, final InspectionLog inspectionLog)
+ public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, final InspectionReport report)
throws RepositoryException, IOException
{
@@ -910,12 +909,12 @@
if (docs.next())
{
//multiple entries
- inspectionLog.logBrokenObjectInfo("ID=" + uuid, "Multiple entires.", InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("ID=" + uuid, "Multiple entires.");
}
}
else
{
- inspectionLog.logBrokenObjectInfo("ID=" + uuid, "Not indexed.", InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("ID=" + uuid, "Not indexed.");
}
}
catch (IOException e)
@@ -973,8 +972,7 @@
String uuid = d.get(FieldNames.UUID);
if (!documentUUIDs.contains(uuid))
{
- inspectionLog.logBrokenObjectInfo("ID=" + uuid, "Document corresponds to removed node.",
- InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("ID=" + uuid, "Document corresponds to removed node.");
}
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
-
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -49,17 +47,11 @@
*/
public String[] fieldNames;
- /**
- * Corruption status. Is it critical - <b>ERR</b>, or not - <b>WARN</b>.
- */
- public InspectionStatus status;
-
- public InspectionQuery(String statement, String[] fieldNames, String headerMessage, InspectionStatus status)
+ public InspectionQuery(String statement, String[] fieldNames, String headerMessage)
{
this.statement = statement;
this.description = headerMessage;
this.fieldNames = fieldNames;
- this.status = status;
}
public String getStatement()
@@ -77,11 +69,6 @@
return fieldNames;
}
- public InspectionStatus getStatus()
- {
- return status;
- }
-
/**
* Creates a PreparedStatement object for sending parameterized SQL statements to the database.
*
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
-
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -34,9 +32,9 @@
/**
* {@inheritDoc}
*/
- public InspectionQueryFilteredMultivaluedProperties(String statement, String[] fieldNames, String headerMessage, InspectionStatus status)
+ public InspectionQueryFilteredMultivaluedProperties(String statement, String[] fieldNames, String headerMessage)
{
- super(statement, fieldNames, headerMessage, status);
+ super(statement, fieldNames, headerMessage);
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -20,8 +20,7 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.InspectionLog;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
@@ -61,7 +60,7 @@
* @throws RepositoryException
* @throws IOException
*/
- public static void checkDB(JDBCWorkspaceDataContainer jdbcDataContainer, InspectionLog inspectionLog)
+ public static void checkDataBase(JDBCWorkspaceDataContainer jdbcDataContainer, InspectionReport report)
throws RepositoryException, IOException
{
Set<InspectionQuery> queries = new HashSet<InspectionQuery>();
@@ -72,8 +71,8 @@
: "select * from JCR_SITEM I where I.CONTAINER_NAME='" + jdbcDataContainer.containerName
+ "' and NOT EXISTS(select * from JCR_SITEM P where P.ID = I.PARENT_ID)", new String[]{
DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_CLASS},
- "Items that do not have parent nodes", InspectionStatus.ERR));
-
+ "Items that do not have parent nodes"));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM N where N.I_CLASS=1 and NOT EXISTS "
+ "(select * from JCR_MITEM P where P.I_CLASS=2 and P.PARENT_ID=N.ID "
@@ -83,17 +82,15 @@
+ "where P.I_CLASS=2 and P.PARENT_ID=N.ID and P.NAME='[http://www.jcp.org/jcr/1.0]primaryType' "
+ "and P.CONTAINER_NAME='" + jdbcDataContainer.containerName + "')", new String[]{DBConstants.COLUMN_ID,
DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
- "Nodes that do not have at least one jcr:primaryType property", InspectionStatus.ERR));
-
- queries
- .add(new InspectionQuery(jdbcDataContainer.multiDb
- ? "select * from JCR_MVALUE V where NOT EXISTS(select * from JCR_MITEM P "
- + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)"
- : "select * from JCR_SVALUE V where NOT EXISTS(select * from JCR_SITEM P "
- + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)", new String[]{DBConstants.COLUMN_ID,
- DBConstants.COLUMN_VPROPERTY_ID}, "All value records that has not owner-property record",
- InspectionStatus.ERR));
+ "Nodes that do not have at least one jcr:primaryType property"));
+ queries.add(new InspectionQuery(jdbcDataContainer.multiDb
+ ? "select * from JCR_MVALUE V where NOT EXISTS(select * from JCR_MITEM P "
+ + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)"
+ : "select * from JCR_SVALUE V where NOT EXISTS(select * from JCR_SITEM P "
+ + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)", new String[]{DBConstants.COLUMN_ID,
+ DBConstants.COLUMN_VPROPERTY_ID}, "All value records that has not owner-property record"));
+
queries
.add(new InspectionQueryFilteredMultivaluedProperties(
jdbcDataContainer.multiDb
@@ -103,8 +100,8 @@
+ jdbcDataContainer.containerName
+ "' and P.I_CLASS=2 and P.P_MULTIVALUED=? and NOT EXISTS( select * from JCR_SVALUE V where V.PROPERTY_ID=P.ID)",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
- "All properties that have not value record.", InspectionStatus.ERR));
-
+ "All properties that have not value record."));
+
// The differences in the queries by DB dialect.
// Oracle doesn't work correct with default query because empty value stored as null value.
String statement;
@@ -121,22 +118,23 @@
else if (jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLE)
|| jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI))
{
- statement = jdbcDataContainer.multiDb
- ? "select * from JCR_MVALUE where (STORAGE_DESC is not null and DATA is not null)"
- : "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and I.CONTAINER_NAME='"
- + jdbcDataContainer.containerName
- + "' AND (STORAGE_DESC is not null and DATA is not null)";
- } else {
statement =
jdbcDataContainer.multiDb
+ ? "select * from JCR_MVALUE where (STORAGE_DESC is not null and DATA is not null)"
+ : "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and I.CONTAINER_NAME='"
+ + jdbcDataContainer.containerName + "' AND (STORAGE_DESC is not null and DATA is not null)";
+ }
+ else
+ {
+ statement =
+ jdbcDataContainer.multiDb
? "select * from JCR_MVALUE where (STORAGE_DESC is null and DATA is null) or "
+ "(STORAGE_DESC is not null and DATA is not null)"
: "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and I.CONTAINER_NAME='"
+ jdbcDataContainer.containerName
+ "' AND ((STORAGE_DESC is null and DATA is null) or (STORAGE_DESC is not null and DATA is not null))";
}
- queries.add(new InspectionQuery(statement, new String[]{DBConstants.COLUMN_ID}, "Incorrect JCR_VALUE records",
- InspectionStatus.ERR));
+ queries.add(new InspectionQuery(statement, new String[]{DBConstants.COLUMN_ID}, "Incorrect JCR_VALUE records"));
queries
.add(new InspectionQueryFilteredMultivaluedProperties(
@@ -147,15 +145,14 @@
+ jdbcDataContainer.containerName
+ "' and P.P_TYPE=9 and P.P_MULTIVALUED=? and NOT EXISTS( select * from JCR_SREF R where P.ID=R.PROPERTY_ID)",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
- "Reference properties without reference records", InspectionStatus.ERR));
+ "Reference properties without reference records"));
// an item is its own parent.
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM I where I.ID = I.PARENT_ID and I.NAME <> '" + Constants.ROOT_PARENT_NAME + "'"
: "select * from JCR_SITEM I where I.ID = I.PARENT_ID and I.CONTAINER_NAME='"
+ jdbcDataContainer.containerName + "' and I.NAME <> '" + Constants.ROOT_PARENT_NAME + "'", new String[]{
- DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "An item is its own parent.",
- InspectionStatus.ERR));
+ DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "An item is its own parent."));
// Several versions of same item
queries
@@ -164,13 +161,15 @@
? "select * from JCR_MITEM I where EXISTS (select * from JCR_MITEM J"
+ " WHERE I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ " and I.VERSION != J.VERSION)"
- : "select * from JCR_SITEM I where I.CONTAINER_NAME='" + jdbcDataContainer.containerName + "' and"
+ : "select * from JCR_SITEM I where I.CONTAINER_NAME='"
+ + jdbcDataContainer.containerName
+ + "' and"
+ " EXISTS (select * from JCR_SITEM J WHERE I.CONTAINER_NAME = J.CONTAINER_NAME and"
+ " I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ " and I.VERSION != J.VERSION)",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME,
DBConstants.COLUMN_VERSION, DBConstants.COLUMN_CLASS, DBConstants.COLUMN_INDEX},
- "Several versions of same item.", InspectionStatus.ERR));
+ "Several versions of same item."));
// using existing DataSource to get a JDBC Connection.
Connection jdbcConn = jdbcDataContainer.getConnectionFactory().getJdbcConnection();
@@ -191,7 +190,7 @@
if (resultSet.next())
{
// but if result not empty, then inconsistency takes place
- inspectionLog.logInspectionDescription(query.getDescription());
+ report.logDescription(query.getDescription());
do
{
StringBuilder record = new StringBuilder();
@@ -210,8 +209,8 @@
}
record.append(' ');
}
- // log inconsistency issue.
- inspectionLog.logBrokenObjectInfo(record.toString(), "", query.getStatus());
+
+ report.logBrokenObjectAndSetInconsistency(record.toString(), "");
}
while (resultSet.next());
}
@@ -246,8 +245,7 @@
}
catch (SQLException e)
{
- // log unexpected exceptions to log
- inspectionLog.logException("Exception during DB inspection.", e);
+ report.logExceptionAndSetInconsistency("Exception during DB inspection.", e);
}
finally
{
@@ -283,7 +281,7 @@
* @throws IOException
*/
public static void checkValueStorage(final JDBCWorkspaceDataContainer jdbcDataContainer,
- ValueStoragePluginProvider vsPlugin, InspectionLog inspectionLog) throws RepositoryException, IOException
+ ValueStoragePluginProvider vsPlugin, InspectionReport report) throws RepositoryException, IOException
{
final String valueRecordFormat = "ValueData[PROPERTY_ID=%s ORDER_NUM=%d STORAGE_DESC=%s]";
@@ -323,9 +321,8 @@
}
catch (ValueStorageNotFoundException e)
{
- inspectionLog.logBrokenObjectInfo("ValueStorage " + storageDesc + " not found. "
- + String.format(valueRecordFormat, propertyId, orderNumber, storageDesc), e.getMessage(),
- InspectionStatus.ERR);
+ report.logBrokenObjectAndSetInconsistency("ValueStorage " + storageDesc + " not found. "
+ + String.format(valueRecordFormat, propertyId, orderNumber, storageDesc), e.getMessage());
continue;
}
}
@@ -351,13 +348,13 @@
Throwable ex = e.getCause();
if (ex instanceof ValueDataNotFoundException)
{
- inspectionLog.logBrokenObjectInfo(String.format(valueRecordFormat, propertyId, orderNumber,
- storageDesc)
- + " not found.", ex.getMessage(), InspectionStatus.ERR);
+ report.logBrokenObjectAndSetInconsistency(
+ String.format(valueRecordFormat, propertyId, orderNumber, storageDesc) + " not found.",
+ ex.getMessage());
}
else if (ex instanceof IOException)
{
- inspectionLog.logException(ex.getMessage(), (IOException)ex);
+ report.logExceptionAndSetInconsistency(ex.getMessage(), ex);
}
else
{
@@ -370,8 +367,7 @@
}
catch (SQLException e)
{
- // log unexpceted exception
- inspectionLog.logException("Exception during ValueStorage inspection.", e);
+ report.logExceptionAndSetInconsistency("Exception during ValueStorage inspection.", e);
}
finally
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -19,7 +19,7 @@
import org.apache.lucene.search.Query;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.impl.InspectionLog;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.query.AbstractQueryHandler;
@@ -130,7 +130,8 @@
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#checkIndex(org.exoplatform.services.jcr.dataflow.ItemDataConsumer, boolean, InspectionLog)
*/
@Override
- public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionLog inspectionLog) throws RepositoryException,
+ public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionReport inspectionLog)
+ throws RepositoryException,
IOException
{
// do nothing
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -20,15 +20,10 @@
import junit.framework.TestCase;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
-import java.io.OutputStreamWriter;
import java.io.Reader;
-import java.io.Writer;
/**
* @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
@@ -38,31 +33,29 @@
public class TestInspectionLogFile extends TestCase
{
- private File f;
+ private InspectionReport report;
- private Writer writer;
-
public void setUp() throws Exception
{
super.setUp();
- f = File.createTempFile("testlog", "suf");
- writer = new OutputStreamWriter(PrivilegedFileHelper.fileOutputStream(f));
+
+ report = new InspectionReport("test");
}
public void tearDown() throws Exception
{
- writer.close();
- f.delete();
+ report.close();
+ getFileFromReport().delete();
+
super.tearDown();
}
public void testLogComment() throws Exception
{
- InspectionLog report = new InspectionLogWriter(writer);
report.logComment("test message");
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
br.close();
@@ -72,11 +65,10 @@
public void testLogInspectionDescription() throws Exception
{
- InspectionLog report = new InspectionLogWriter(writer);
- report.logInspectionDescription("description");
+ report.logDescription("description");
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
br.close();
@@ -86,16 +78,15 @@
public void testLogBrokenObjectInfo() throws Exception
{
- InspectionLog report = new InspectionLogWriter(writer);
- report.logBrokenObjectInfo("broken object descr", "message", InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("broken object descr", "message");
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
br.close();
- assertEquals("Reindex broken object descr message", s);
+ assertEquals("broken object descr message", s);
assertTrue(report.hasInconsistency());
}
@@ -103,11 +94,10 @@
{
Exception e = new Exception("Exception message.");
- InspectionLog report = new InspectionLogWriter(writer);
- report.logException("message", e);
+ report.logExceptionAndSetInconsistency("message", e);
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
assertEquals("//message", s);
@@ -119,4 +109,9 @@
assertTrue(report.hasInconsistency());
}
+ private File getFileFromReport()
+ {
+ return new File(report.getReportPath());
+ }
+
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-02-17 11:54:13 UTC (rev 5661)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-02-17 12:34:07 UTC (rev 5662)
@@ -62,7 +62,7 @@
public class TestRepositoryCheckController extends BaseStandaloneTest
{
- private RepositoryCheckController checkController;
+ private TesterRepositoryCheckController checkController;
private final TesterConfigurationHelper helper = TesterConfigurationHelper.getInstance();
@@ -90,19 +90,17 @@
public void testDB() throws Exception
{
- checkController =
- new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
String result = checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.DB});
assertNotNull(result);
- assertTrue("Repository data is not consistent, result: " + result, result
- .startsWith("Repository data is consistent"));
+ assertTrue("Repository data is not consistent, result: " + result,
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
public void testValueStorage() throws Exception
{
- checkController =
- new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
File f = this.createBLOBTempFile(20);
InputStream is = new FileInputStream(f);
@@ -115,8 +113,8 @@
String result = checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.VALUE_STORAGE});
assertNotNull(result);
- assertTrue("Repository data is not consistent, result: " + result, result
- .startsWith("Repository data is consistent"));
+ assertTrue("Repository data is not consistent, result: " + result,
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
finally
{
@@ -127,17 +125,17 @@
public void testSearchIndex() throws Exception
{
- checkController = new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
String result = checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.LUCENE_INDEX});
assertNotNull(result);
- assertTrue("Repository data is not consistent, result: " + result, result
- .startsWith("Repository data is consistent"));
+ assertTrue("Repository data is not consistent, result: " + result,
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
public void testAll() throws Exception
{
- checkController = new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
String result =
checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.DB, DataStorage.VALUE_STORAGE,
@@ -146,7 +144,7 @@
assertNotNull(result);
assertTrue("Repository data is not consistent, result: " + result,
- result.startsWith("Repository data is consistent"));
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
/**
@@ -155,7 +153,7 @@
public void testIndexUsecaseWrongDocumentId() throws Exception
{
ManageableRepository repository = helper.createRepository(container, false, false);
-
+
// create repository and add property
SessionImpl session =
(SessionImpl)repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName());
@@ -164,8 +162,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -185,9 +184,10 @@
conn.commit();
conn.close();
-
+
// repository is inconsistent
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -207,8 +207,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -247,7 +248,8 @@
sm.onSaveItems(log);
// repository is inconsistent
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -267,8 +269,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -307,7 +310,8 @@
sm.onSaveItems(log);
// repository is inconsistent
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -338,8 +342,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -360,7 +365,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -391,8 +397,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -427,7 +434,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -458,8 +466,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -481,7 +490,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -513,8 +523,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -532,7 +543,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -546,8 +558,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -565,7 +578,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -595,8 +609,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -617,7 +632,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -649,8 +665,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -668,7 +685,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -682,8 +700,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -717,8 +736,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -736,7 +756,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -769,8 +790,9 @@
PropertyIterator iter = node.getProperties();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -800,7 +822,8 @@
session.logout();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -815,8 +838,9 @@
PropertyIterator iter = node.getProperties();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -850,7 +874,8 @@
session.logout();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -883,8 +908,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
// remove the file from the value storage
@@ -897,7 +923,8 @@
assertTrue(vsFile.delete());
// repository is inconsistent
- assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
}
12 years, 4 months
exo-jcr SVN: r5661 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/query and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-17 06:54:13 -0500 (Fri, 17 Feb 2012)
New Revision: 5661
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
Log:
EXOJCR-1755: refactoring RepositoryCheckController
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/AbstractRepositorySuspender.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
@@ -33,7 +34,7 @@
/**
* The current repository.
*/
- private final ManageableRepository repository;
+ protected final ManageableRepository repository;
/**
* AbstractRepositorySuspender constructor.
@@ -49,12 +50,8 @@
*/
protected void suspendRepository() throws RepositoryException
{
- // Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
- }
+ SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+
repository.setState(ManageableRepository.SUSPENDED);
}
@@ -64,11 +61,8 @@
protected void resumeRepository() throws RepositoryException
{
// Need privileges to manage repository.
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
- }
+ SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+
repository.setState(ManageableRepository.ONLINE);
}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLog.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-import java.io.IOException;
-
-/**
- * Interface of inspection log. It provides general methods for logging consistency issues.
- *
- * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 4.10.2011 skarpenko $
- *
- */
-public interface InspectionLog
-{
- // represents broken object state
- public enum InspectionStatus {
- ERR("Error"), WARN("Warning"), REINDEX("Reindex");
- final String text;
-
- InspectionStatus(String text)
- {
- this.text = text;
- }
-
- public String toString()
- {
- return text;
- }
- }
-
- /**
- * @return true, if inconsistency was found
- */
- boolean hasInconsistency();
-
- /**
- * @return true, if inconsistency or warning was found
- */
- boolean hasWarnings();
-
- /**
- * Adds comment to log
- */
- void logComment(String message) throws IOException;
-
- /**
- * Adds description to log
- */
- void logInspectionDescription(String description) throws IOException;
-
- /**
- * Adds detailed event to log, with issue found
- */
- void logBrokenObjectInfo(String brokenObjectDesc, String comment, InspectionStatus status) throws IOException;
-
- /**
- * Adds exception with full trace to the log
- */
- void logException(String message, Exception ex) throws IOException;
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionLogWriter.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2011 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Text-based inspection log implementation. It uses any compatible Writer instance for output.
- *
- * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 6.10.2011 skarpenko $
- *
- */
-public class InspectionLogWriter implements InspectionLog
-{
- private static final String LINE_COMMENT = "//";
-
- private static final String LINE_DELIMITER = "\n";
-
- private static final String WSP = " ";
-
- private final Writer out;
-
- private final Set<InspectionStatus> statusSet = new HashSet<InspectionStatus>();
-
- public InspectionLogWriter(Writer out)
- {
- this.out = out;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasInconsistency()
- {
- return statusSet.contains(InspectionStatus.ERR) || statusSet.contains(InspectionStatus.REINDEX);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasWarnings()
- {
- return statusSet.contains(InspectionStatus.WARN);
- }
-
- /**
- * {@inheritDoc}
- */
- public void logComment(String message) throws IOException
- {
- writeLine(message);
- out.flush();
- }
-
- /**
- * {@inheritDoc}
- */
- public void logInspectionDescription(String description) throws IOException
- {
- writeLine(description);
- out.flush();
- }
-
- /**
- * {@inheritDoc}
- */
- public void logBrokenObjectInfo(String brokenObjectDesc, String comment, InspectionStatus status) throws IOException
- {
- statusSet.add(status);
-
- out.write(status.toString());
- out.write(WSP);
- out.write(brokenObjectDesc);
- out.write(WSP);
- out.write(comment);
- out.write(LINE_DELIMITER);
- out.flush();
- }
-
- public void logException(String message, Exception ex) throws IOException
- {
- statusSet.add(InspectionStatus.ERR);
-
- writeLine(message);
- writeStackTrace(ex);
- out.flush();
- }
-
- private void writeLine(String message) throws IOException
- {
- out.write(LINE_COMMENT);
- out.write(message);
- out.write(LINE_DELIMITER);
- }
-
- private void writeStackTrace(Throwable e) throws IOException
- {
- writeLine(e.getMessage());
- writeLine(e.toString());
- StackTraceElement[] trace = e.getStackTrace();
- for (int i = 0; i < trace.length; i++)
- {
- writeLine("\tat " + trace[i]);
- }
-
- Throwable ourCause = e.getCause();
- if (ourCause != null)
- {
- writeLine("Cause:");
- writeStackTrace(ourCause);
- }
- }
-}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/InspectionReport.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl;
+
+import org.exoplatform.commons.utils.SecurityHelper;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.security.PrivilegedExceptionAction;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Text-based inspection log implementation.
+ *
+ * @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
+ * @version $Id: InspectionReport.java 34360 6.10.2011 skarpenko $
+ */
+public class InspectionReport
+{
+ private static final String COMMENT = "//";
+
+ private static final String DELIMITER = "\n";
+
+ private static final String WHITE_SPACE = " ";
+
+ private Writer writer;
+
+ private boolean reportHasInconsistency;
+
+ private String reportPath;
+
+ /**
+ * InspectionReport constructor.
+ */
+ public InspectionReport(String forRepository) throws IOException
+ {
+ final File reportFile =
+ new File("report-" + forRepository + "-" + new SimpleDateFormat("dd-MMM-yy-HH-mm").format(new Date()) + ".txt");
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ reportPath = reportFile.getAbsolutePath();
+ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(reportFile)));
+
+ return null;
+ }
+ });
+
+ }
+
+ /**
+ * Indicates if report has inconsistency info or not.
+ */
+ public boolean hasInconsistency()
+ {
+ return reportHasInconsistency;
+ }
+
+ /**
+ * Adds comment to log.
+ */
+ public void logComment(String message) throws IOException
+ {
+ writeLine(message);
+ writer.flush();
+ }
+
+ /**
+ * Adds description to log.
+ */
+ public void logDescription(String description) throws IOException
+ {
+ writeLine(description);
+ writer.flush();
+ }
+
+ /**
+ * Adds detailed event to log.
+ */
+ public void logBrokenObjectAndSetInconsistency(String brokenObjectDesc, String comment) throws IOException
+ {
+ setInconsistency();
+
+ writer.write(brokenObjectDesc);
+ writer.write(WHITE_SPACE);
+ writer.write(comment);
+ writer.write(DELIMITER);
+ writer.flush();
+ }
+
+ /**
+ * Adds exception with full stack trace.
+ */
+ public void logExceptionAndSetInconsistency(String message, Throwable e) throws IOException
+ {
+ setInconsistency();
+
+ writeLine(message);
+ writeStackTrace(e);
+ writer.flush();
+ }
+
+ /**
+ * Closes report and frees all allocated resources.
+ */
+ public void close() throws IOException
+ {
+ writer.close();
+ }
+
+ /**
+ * Returns the absolute path to report file.
+ */
+ public String getReportPath()
+ {
+ return reportPath;
+ }
+
+ private void setInconsistency()
+ {
+ reportHasInconsistency = true;
+ }
+
+ private void writeLine(String message) throws IOException
+ {
+ writer.write(COMMENT);
+ writer.write(message);
+ writer.write(DELIMITER);
+ writer.flush();
+ }
+
+ private void writeStackTrace(Throwable e) throws IOException
+ {
+ writeLine(e.getMessage());
+ writeLine(e.toString());
+ StackTraceElement[] trace = e.getStackTrace();
+ for (int i = 0; i < trace.length; i++)
+ {
+ writeLine("\tat " + trace[i]);
+ }
+
+ Throwable ourCause = e.getCause();
+ if (ourCause != null)
+ {
+ writeLine("Cause:");
+ writeStackTrace(ourCause);
+ }
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryCheckController.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
@@ -33,13 +32,7 @@
import org.exoplatform.services.log.Log;
import org.picocontainer.Startable;
-import java.io.BufferedWriter;
-import java.io.File;
import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.text.SimpleDateFormat;
-import java.util.Date;
import javax.jcr.RepositoryException;
@@ -52,7 +45,7 @@
* </ul>
*
* @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 3.10.2011 skarpenko $
+ * @version $Id: RepositoryCheckController.java 34360 3.10.2011 skarpenko $
*/
@Managed
@NameTemplate(@Property(key = "service", value = "RepositoryCheckController"))
@@ -61,20 +54,25 @@
/**
* Logger.
*/
- protected static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.RepositorySuspendController");
+ protected static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.RepositoryCheckController");
- protected static final String FILE_NAME = "report";
+ public static final String REPORT_CONSISTENT_MESSAGE = "Repository data is consistent";
+ public static final String REPORT_NOT_CONSISTENT_MESSAGE = "Repository data is NOT consistent";
+
+ public static final String EXCEPTION_DURING_CHECKING_MESSAGE = "Exception occured during consistency checking";
+
+ /**
+ * The list of available storages for checking.
+ */
protected enum DataStorage {
DB, VALUE_STORAGE, LUCENE_INDEX
};
- private File inspectionLogFile = null;
-
/**
- * The current repository.
+ * Store the results of last checking.
*/
- private final ManageableRepository repository;
+ protected InspectionReport lastReport;
/**
* RepositoryCheckController constructor.
@@ -82,7 +80,6 @@
public RepositoryCheckController(ManageableRepository repository)
{
super(repository);
- this.repository = repository;
}
/**
@@ -126,221 +123,197 @@
return checkRepositoryDataConsistency(new DataStorage[]{DataStorage.LUCENE_INDEX});
}
- protected String checkRepositoryDataConsistency(DataStorage[] checkData)
+ protected String checkRepositoryDataConsistency(DataStorage[] storages)
{
- inspectionLogFile = null;
try
{
- if (getRepositoryState() == ManageableRepository.SUSPENDED)
- {
- return "Can not check data consistency. Repository is already suspended.";
- }
+ createNewReport();
+ }
+ catch (IOException e)
+ {
+ return getExceptionDuringCheckingMessage(e);
+ }
- Writer reportWriter = null;
- try
- {
- try
- {
- suspendRepository();
- }
- catch (RepositoryException e)
- {
- return "Can not check data consistency. Repository was not suspended. Error: " + e.getMessage();
- }
+ try
+ {
+ suspendRepository();
+
+ return doCheck(storages);
+ }
+ catch (RepositoryException e)
+ {
+ return getExceptionDuringCheckingMessage(e);
+ }
+ finally
+ {
+ resumeRepository();
+ closeReport();
+ }
+ }
- // DO CHECK
- inspectionLogFile =
- new File(FILE_NAME + "-" + repository.getConfiguration().getName() + "-"
- + new SimpleDateFormat("dd-MMM-yy-HH-mm").format(new Date()) + ".txt");
- if (!PrivilegedFileHelper.exists(inspectionLogFile)
- && !PrivilegedFileHelper.createNewFile(inspectionLogFile))
- {
- LOG.error("Inspection log file was not created. "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile));
- return "Can not check data consistency. Inspection log file was not created. "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
+ /**
+ * {@inheritDoc}
+ */
+ protected void resumeRepository()
+ {
+ try
+ {
+ super.resumeRepository();
+ }
+ catch (RepositoryException e)
+ {
+ LOG.error("Can not resume repository. Error: " + e.getMessage(), e);
+ }
+ }
- reportWriter =
- new BufferedWriter(new OutputStreamWriter(PrivilegedFileHelper.fileOutputStream(inspectionLogFile)));
- InspectionLog report = new InspectionLogWriter(reportWriter);
- for (DataStorage cd : checkData)
- {
- switch (cd)
- {
- case DB :
- try
- {
- checkDB(report);
- }
- catch (RepositoryException e)
- {
- report.logException("RepositoryException occures during DB consistency check.", e);
- return "RepositoryException occures during DB consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- catch (IOException e)
- {
- report.logException("IOException occures during DB consistency check.", e);
- return "IOException occures during DB consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- break;
- case VALUE_STORAGE :
- try
- {
- checkVS(report);
- }
- catch (RepositoryException e)
- {
- report.logException("RepositoryException occures during ValueStorage consistency check.", e);
- return "RepositoryException occures during ValueStorage consistency check. Error: "
- + e.getMessage() + ". See log here: "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- catch (IOException e)
- {
- report.logException("IOException occures during ValueStorage consistency check.", e);
- return "IOException occures during ValueStorage consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- break;
- case LUCENE_INDEX :
- try
- {
- checkLuceneIndex(report);
- }
- catch (RepositoryException e)
- {
- report.logException("RepositoryException occures during SearchIndex consistency check.", e);
- return "RepositoryException occures during SearchIndex consistency check. Error: "
- + e.getMessage() + ". See log here: "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- catch (IOException e)
- {
- report.logException("IOException occures during SearchIndex consistency check.", e);
- return "IOException occures during SearchIndex consistency check. Error: " + e.getMessage()
- + ". See log here: " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- break;
- }
- }
-
- if (report.hasInconsistency())
- {
- report.logComment("Repository data is NOT consistent.");
- return "Repository data is inconsistent. See full report by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- else if (report.hasWarnings())
- {
- report.logComment("Repository data is consistent, except some warnings.");
- return "Repository data is consistent, except some warnings. See full report by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- else
- {
- report.logComment("Repository data is consistent");
- return "Repository data is consistent. See full report by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile);
- }
- }
- finally
+ private String doCheck(DataStorage[] storages)
+ {
+ try
+ {
+ for (DataStorage storage : storages)
{
- if (reportWriter != null)
+ switch (storage)
{
- try
- {
- reportWriter.flush();
- reportWriter.close();
- }
- catch (IOException e)
- {
- LOG.error("Can not close file " + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile), e);
- }
- }
+ case DB :
+ checkDataBase();
+ break;
- //resume repository
- try
- {
- resumeRepository();
+ case VALUE_STORAGE :
+ checkValueStorage();
+ break;
+
+ case LUCENE_INDEX :
+ checkLuceneIndex();
+ break;
}
- catch (RepositoryException e)
- {
- LOG.error("Can not resume repository. Error: " + e.getMessage(), e);
- }
- if (getRepositoryState() != ManageableRepository.ONLINE)
- {
- LOG.error("Repository was not resumed and now it is OFFLINE");
- }
}
+
+ return logAndGetCheckingResultMessage();
}
catch (Throwable e)
{
+ return logAndGetExceptionDuringCheckingMessage(e);
+ }
+ }
+
+ private String logAndGetCheckingResultMessage()
+ {
+ if (lastReport.hasInconsistency())
+ {
+ logComment(REPORT_NOT_CONSISTENT_MESSAGE);
+ return REPORT_NOT_CONSISTENT_MESSAGE + getPathToReportMessage();
+ }
+ else
+ {
+ logComment(REPORT_CONSISTENT_MESSAGE);
+ return REPORT_CONSISTENT_MESSAGE + getPathToReportMessage();
+ }
+ }
+
+ private String logAndGetExceptionDuringCheckingMessage(Throwable e)
+ {
+ logExceptionAndSetInconsistency(EXCEPTION_DURING_CHECKING_MESSAGE, e);
+ return getExceptionDuringCheckingMessage(e) + getPathToReportMessage();
+ }
+
+ private String getExceptionDuringCheckingMessage(Throwable e)
+ {
+ return EXCEPTION_DURING_CHECKING_MESSAGE + ": " + e.getMessage();
+ }
+
+ private void logComment(String message)
+ {
+ try
+ {
+ lastReport.logComment(message);
+ }
+ catch (IOException e)
+ {
LOG.error(e.getMessage(), e);
- return "Exception thrown during repository data validation: "
- + e
- + (inspectionLogFile != null ? " See log by path "
- + PrivilegedFileHelper.getAbsolutePath(inspectionLogFile) : "");
}
}
- private void checkDB(InspectionLog inspectionLog) throws RepositoryException, IOException,
+ private void logExceptionAndSetInconsistency(String message, Throwable e)
+ {
+ try
+ {
+ lastReport.logExceptionAndSetInconsistency(message, e);
+ }
+ catch (IOException e1)
+ {
+ LOG.error(e1.getMessage(), e1);
+ }
+ }
+
+ private void createNewReport() throws IOException
+ {
+ lastReport = new InspectionReport(repository.getConfiguration().getName());
+ }
+
+ private void closeReport()
+ {
+ try
+ {
+ lastReport.close();
+ }
+ catch (IOException e)
+ {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ private void checkDataBase() throws RepositoryException, IOException,
RepositoryConfigurationException
{
- String[] wsNames = repository.getWorkspaceNames();
- for (String wsName : wsNames)
+ for (String wsName : repository.getWorkspaceNames())
{
- inspectionLog.logComment("Check DB consistency. Workspace " + wsName);
+ logComment("Check DB consistency. Workspace " + wsName);
+
JDBCWorkspaceDataContainer dataContainer =
- (JDBCWorkspaceDataContainer)repository.getWorkspaceContainer(wsName).getComponent(
- JDBCWorkspaceDataContainer.class);
- JDBCWorkspaceDataContainerChecker.checkDB(dataContainer, inspectionLog);
+ (JDBCWorkspaceDataContainer)getComponent(JDBCWorkspaceDataContainer.class, wsName);
+
+ JDBCWorkspaceDataContainerChecker.checkDataBase(dataContainer, lastReport);
}
}
- private void checkVS(InspectionLog inspectionLog) throws RepositoryException, IOException
+ private void checkValueStorage() throws RepositoryException, IOException
{
- String[] wsNames = repository.getWorkspaceNames();
- for (String wsName : wsNames)
+ for (String wsName : repository.getWorkspaceNames())
{
- inspectionLog.logComment("Check ValueStorage consistency. Workspace " + wsName);
+ logComment("Check ValueStorage consistency. Workspace " + wsName);
JDBCWorkspaceDataContainer dataContainer =
- (JDBCWorkspaceDataContainer)repository.getWorkspaceContainer(wsName).getComponent(
- JDBCWorkspaceDataContainer.class);
-
+ (JDBCWorkspaceDataContainer)getComponent(JDBCWorkspaceDataContainer.class, wsName);
ValueStoragePluginProvider vsPlugin =
- (ValueStoragePluginProvider)repository.getWorkspaceContainer(wsName).getComponent(
- ValueStoragePluginProvider.class);
+ (ValueStoragePluginProvider)getComponent(ValueStoragePluginProvider.class, wsName);
- JDBCWorkspaceDataContainerChecker.checkValueStorage(dataContainer, vsPlugin, inspectionLog);
+ JDBCWorkspaceDataContainerChecker.checkValueStorage(dataContainer, vsPlugin, lastReport);
}
}
- private void checkLuceneIndex(InspectionLog inspectionLog) throws RepositoryException, IOException
+ private void checkLuceneIndex() throws RepositoryException, IOException
{
- final String[] wsNames = repository.getWorkspaceNames();
final String systemWS = repository.getConfiguration().getSystemWorkspaceName();
- for (String wsName : wsNames)
+ for (String wsName : repository.getWorkspaceNames())
{
- inspectionLog.logComment("Check SearchIndex consistency. Workspace " + wsName);
- SearchManager searchManager =
- (SearchManager)repository.getWorkspaceContainer(wsName).getComponent(SearchManager.class);
- searchManager.checkIndex(inspectionLog, systemWS.equals(wsName));
+ logComment("Check SearchIndex consistency. Workspace " + wsName);
+
+ SearchManager searchManager = (SearchManager)getComponent(SearchManager.class, wsName);
+
+ searchManager.checkIndex(lastReport, systemWS.equals(wsName));
}
}
- /**
- * For test purposes.
- * @return
- */
- protected File getLastLogFile()
+ private Object getComponent(Class forClass, String wsName)
{
- return inspectionLogFile;
+ return repository.getWorkspaceContainer(wsName).getComponent(forClass);
}
+ private String getPathToReportMessage()
+ {
+ return ". See full report by path " + lastReport.getReportPath();
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/QueryHandler.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -20,7 +20,7 @@
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.impl.InspectionLog;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.query.lucene.ChangesHolder;
@@ -231,10 +231,10 @@
*
* @param itemStateManager
* @param isSystem
- * @param inspectionLog
+ * @param report
* @throws RepositoryException
* @throws IOException
*/
- void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionLog inspectionLog)
+ void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionReport report)
throws RepositoryException, IOException;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -49,7 +49,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.InspectionLog;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.Backupable;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
@@ -400,7 +400,7 @@
* according jcr-node. If index is suspended then it will be temporary resumed, while check is running
* and suspended afterwards.
*/
- public void checkIndex(final InspectionLog inspectionLog, final boolean isSystem) throws RepositoryException,
+ public void checkIndex(final InspectionReport report, final boolean isSystem) throws RepositoryException,
IOException
{
if (isSuspended)
@@ -420,7 +420,7 @@
}
resume();
- handler.checkIndex(itemMgr, isSystem, inspectionLog);
+ handler.checkIndex(itemMgr, isSystem, report);
return null;
}
catch (ResumeException e)
@@ -466,7 +466,7 @@
else
{
// simply run checkIndex, if not suspended
- handler.checkIndex(itemMgr, isSystem, inspectionLog);
+ handler.checkIndex(itemMgr, isSystem, report);
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -51,8 +51,7 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.InspectionLog;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.backup.ResumeException;
import org.exoplatform.services.jcr.impl.backup.SuspendException;
import org.exoplatform.services.jcr.impl.backup.Suspendable;
@@ -869,7 +868,7 @@
/**
* {@inheritDoc}
*/
- public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, final InspectionLog inspectionLog)
+ public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, final InspectionReport report)
throws RepositoryException, IOException
{
@@ -920,12 +919,12 @@
if (docs.next())
{
//multiple entries
- inspectionLog.logBrokenObjectInfo("ID=" + uuid, "Multiple entires.", InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("ID=" + uuid, "Multiple entires.");
}
}
else
{
- inspectionLog.logBrokenObjectInfo("ID=" + uuid, "Not indexed.", InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("ID=" + uuid, "Not indexed.");
}
}
catch (IOException e)
@@ -983,8 +982,7 @@
String uuid = d.get(FieldNames.UUID);
if (!documentUUIDs.contains(uuid))
{
- inspectionLog.logBrokenObjectInfo("ID=" + uuid, "Document corresponds to removed node.",
- InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("ID=" + uuid, "Document corresponds to removed node.");
}
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQuery.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
-
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -49,17 +47,11 @@
*/
public String[] fieldNames;
- /**
- * Corruption status. Is it critical - <b>ERR</b>, or not - <b>WARN</b>.
- */
- public InspectionStatus status;
-
- public InspectionQuery(String statement, String[] fieldNames, String headerMessage, InspectionStatus status)
+ public InspectionQuery(String statement, String[] fieldNames, String headerMessage)
{
this.statement = statement;
this.description = headerMessage;
this.fieldNames = fieldNames;
- this.status = status;
}
public String getStatement()
@@ -77,11 +69,6 @@
return fieldNames;
}
- public InspectionStatus getStatus()
- {
- return status;
- }
-
/**
* Creates a PreparedStatement object for sending parameterized SQL statements to the database.
*
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/InspectionQueryFilteredMultivaluedProperties.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
-
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -34,9 +32,9 @@
/**
* {@inheritDoc}
*/
- public InspectionQueryFilteredMultivaluedProperties(String statement, String[] fieldNames, String headerMessage, InspectionStatus status)
+ public InspectionQueryFilteredMultivaluedProperties(String statement, String[] fieldNames, String headerMessage)
{
- super(statement, fieldNames, headerMessage, status);
+ super(statement, fieldNames, headerMessage);
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainerChecker.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -20,8 +20,7 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.InspectionLog;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
@@ -61,7 +60,7 @@
* @throws RepositoryException
* @throws IOException
*/
- public static void checkDB(JDBCWorkspaceDataContainer jdbcDataContainer, InspectionLog inspectionLog)
+ public static void checkDataBase(JDBCWorkspaceDataContainer jdbcDataContainer, InspectionReport report)
throws RepositoryException, IOException
{
Set<InspectionQuery> queries = new HashSet<InspectionQuery>();
@@ -72,8 +71,8 @@
: "select * from JCR_SITEM I where I.CONTAINER_NAME='" + jdbcDataContainer.containerName
+ "' and NOT EXISTS(select * from JCR_SITEM P where P.ID = I.PARENT_ID)", new String[]{
DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_CLASS},
- "Items that do not have parent nodes", InspectionStatus.ERR));
-
+ "Items that do not have parent nodes"));
+
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM N where N.I_CLASS=1 and NOT EXISTS "
+ "(select * from JCR_MITEM P where P.I_CLASS=2 and P.PARENT_ID=N.ID "
@@ -83,17 +82,15 @@
+ "where P.I_CLASS=2 and P.PARENT_ID=N.ID and P.NAME='[http://www.jcp.org/jcr/1.0]primaryType' "
+ "and P.CONTAINER_NAME='" + jdbcDataContainer.containerName + "')", new String[]{DBConstants.COLUMN_ID,
DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
- "Nodes that do not have at least one jcr:primaryType property", InspectionStatus.ERR));
-
- queries
- .add(new InspectionQuery(jdbcDataContainer.multiDb
- ? "select * from JCR_MVALUE V where NOT EXISTS(select * from JCR_MITEM P "
- + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)"
- : "select * from JCR_SVALUE V where NOT EXISTS(select * from JCR_SITEM P "
- + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)", new String[]{DBConstants.COLUMN_ID,
- DBConstants.COLUMN_VPROPERTY_ID}, "All value records that has not owner-property record",
- InspectionStatus.ERR));
+ "Nodes that do not have at least one jcr:primaryType property"));
+ queries.add(new InspectionQuery(jdbcDataContainer.multiDb
+ ? "select * from JCR_MVALUE V where NOT EXISTS(select * from JCR_MITEM P "
+ + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)"
+ : "select * from JCR_SVALUE V where NOT EXISTS(select * from JCR_SITEM P "
+ + "where V.PROPERTY_ID = P.ID and P.I_CLASS=2)", new String[]{DBConstants.COLUMN_ID,
+ DBConstants.COLUMN_VPROPERTY_ID}, "All value records that has not owner-property record"));
+
queries
.add(new InspectionQueryFilteredMultivaluedProperties(
jdbcDataContainer.multiDb
@@ -103,8 +100,8 @@
+ jdbcDataContainer.containerName
+ "' and P.I_CLASS=2 and P.P_MULTIVALUED=? and NOT EXISTS( select * from JCR_SVALUE V where V.PROPERTY_ID=P.ID)",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
- "All properties that have not value record.", InspectionStatus.ERR));
-
+ "All properties that have not value record."));
+
// The differences in the queries by DB dialect.
// Oracle doesn't work correct with default query because empty value stored as null value.
String statement;
@@ -121,22 +118,23 @@
else if (jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLE)
|| jdbcDataContainer.dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI))
{
- statement = jdbcDataContainer.multiDb
- ? "select * from JCR_MVALUE where (STORAGE_DESC is not null and DATA is not null)"
- : "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and I.CONTAINER_NAME='"
- + jdbcDataContainer.containerName
- + "' AND (STORAGE_DESC is not null and DATA is not null)";
- } else {
statement =
jdbcDataContainer.multiDb
+ ? "select * from JCR_MVALUE where (STORAGE_DESC is not null and DATA is not null)"
+ : "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and I.CONTAINER_NAME='"
+ + jdbcDataContainer.containerName + "' AND (STORAGE_DESC is not null and DATA is not null)";
+ }
+ else
+ {
+ statement =
+ jdbcDataContainer.multiDb
? "select * from JCR_MVALUE where (STORAGE_DESC is null and DATA is null) or "
+ "(STORAGE_DESC is not null and DATA is not null)"
: "select V.* from JCR_SVALUE V, JCR_SITEM I where V.PROPERTY_ID = I.ID and I.CONTAINER_NAME='"
+ jdbcDataContainer.containerName
+ "' AND ((STORAGE_DESC is null and DATA is null) or (STORAGE_DESC is not null and DATA is not null))";
}
- queries.add(new InspectionQuery(statement, new String[]{DBConstants.COLUMN_ID}, "Incorrect JCR_VALUE records",
- InspectionStatus.ERR));
+ queries.add(new InspectionQuery(statement, new String[]{DBConstants.COLUMN_ID}, "Incorrect JCR_VALUE records"));
queries
.add(new InspectionQueryFilteredMultivaluedProperties(
@@ -147,15 +145,14 @@
+ jdbcDataContainer.containerName
+ "' and P.P_TYPE=9 and P.P_MULTIVALUED=? and NOT EXISTS( select * from JCR_SREF R where P.ID=R.PROPERTY_ID)",
new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME},
- "Reference properties without reference records", InspectionStatus.ERR));
+ "Reference properties without reference records"));
// an item is its own parent.
queries.add(new InspectionQuery(jdbcDataContainer.multiDb
? "select * from JCR_MITEM I where I.ID = I.PARENT_ID and I.NAME <> '" + Constants.ROOT_PARENT_NAME + "'"
: "select * from JCR_SITEM I where I.ID = I.PARENT_ID and I.CONTAINER_NAME='"
+ jdbcDataContainer.containerName + "' and I.NAME <> '" + Constants.ROOT_PARENT_NAME + "'", new String[]{
- DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "An item is its own parent.",
- InspectionStatus.ERR));
+ DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME}, "An item is its own parent."));
// Several versions of same item
queries
@@ -164,14 +161,15 @@
? "select * from JCR_MITEM I where EXISTS (select * from JCR_MITEM J"
+ " WHERE I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ " and I.VERSION != J.VERSION)"
- : "select * from JCR_SITEM I where I.CONTAINER_NAME='" + jdbcDataContainer.containerName + "' and"
+ : "select * from JCR_SITEM I where I.CONTAINER_NAME='"
+ + jdbcDataContainer.containerName
+ + "' and"
+ " EXISTS (select * from JCR_SITEM J WHERE I.CONTAINER_NAME = J.CONTAINER_NAME and"
+ " I.PARENT_ID = J.PARENT_ID AND I.NAME = J.NAME and I.I_INDEX = J.I_INDEX and I.I_CLASS = J.I_CLASS"
+ " and I.VERSION != J.VERSION)",
- new String[]{
- DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME, DBConstants.COLUMN_VERSION,
- DBConstants.COLUMN_CLASS, DBConstants.COLUMN_INDEX}, "Several versions of same item.",
- InspectionStatus.ERR));
+ new String[]{DBConstants.COLUMN_ID, DBConstants.COLUMN_PARENTID, DBConstants.COLUMN_NAME,
+ DBConstants.COLUMN_VERSION, DBConstants.COLUMN_CLASS, DBConstants.COLUMN_INDEX},
+ "Several versions of same item."));
// using existing DataSource to get a JDBC Connection.
Connection jdbcConn = jdbcDataContainer.getConnectionFactory().getJdbcConnection();
@@ -192,7 +190,7 @@
if (resultSet.next())
{
// but if result not empty, then inconsistency takes place
- inspectionLog.logInspectionDescription(query.getDescription());
+ report.logDescription(query.getDescription());
do
{
StringBuilder record = new StringBuilder();
@@ -211,8 +209,8 @@
}
record.append(' ');
}
- // log inconsistency issue.
- inspectionLog.logBrokenObjectInfo(record.toString(), "", query.getStatus());
+
+ report.logBrokenObjectAndSetInconsistency(record.toString(), "");
}
while (resultSet.next());
}
@@ -247,8 +245,7 @@
}
catch (SQLException e)
{
- // log unexpected exceptions to log
- inspectionLog.logException("Exception during DB inspection.", e);
+ report.logExceptionAndSetInconsistency("Exception during DB inspection.", e);
}
finally
{
@@ -284,7 +281,7 @@
* @throws IOException
*/
public static void checkValueStorage(final JDBCWorkspaceDataContainer jdbcDataContainer,
- ValueStoragePluginProvider vsPlugin, InspectionLog inspectionLog) throws RepositoryException, IOException
+ ValueStoragePluginProvider vsPlugin, InspectionReport report) throws RepositoryException, IOException
{
final String valueRecordFormat = "ValueData[PROPERTY_ID=%s ORDER_NUM=%d STORAGE_DESC=%s]";
@@ -324,9 +321,8 @@
}
catch (ValueStorageNotFoundException e)
{
- inspectionLog.logBrokenObjectInfo("ValueStorage " + storageDesc + " not found. "
- + String.format(valueRecordFormat, propertyId, orderNumber, storageDesc), e.getMessage(),
- InspectionStatus.ERR);
+ report.logBrokenObjectAndSetInconsistency("ValueStorage " + storageDesc + " not found. "
+ + String.format(valueRecordFormat, propertyId, orderNumber, storageDesc), e.getMessage());
continue;
}
}
@@ -352,13 +348,13 @@
Throwable ex = e.getCause();
if (ex instanceof ValueDataNotFoundException)
{
- inspectionLog.logBrokenObjectInfo(String.format(valueRecordFormat, propertyId, orderNumber,
- storageDesc)
- + " not found.", ex.getMessage(), InspectionStatus.ERR);
+ report.logBrokenObjectAndSetInconsistency(
+ String.format(valueRecordFormat, propertyId, orderNumber, storageDesc) + " not found.",
+ ex.getMessage());
}
else if (ex instanceof IOException)
{
- inspectionLog.logException(ex.getMessage(), (IOException)ex);
+ report.logExceptionAndSetInconsistency(ex.getMessage(), ex);
}
else
{
@@ -371,8 +367,7 @@
}
catch (SQLException e)
{
- // log unexpceted exception
- inspectionLog.logException("Exception during ValueStorage inspection.", e);
+ report.logExceptionAndSetInconsistency("Exception during ValueStorage inspection.", e);
}
finally
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/lucene/SlowQueryHandler.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -19,7 +19,7 @@
import org.apache.lucene.search.Query;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.impl.InspectionLog;
+import org.exoplatform.services.jcr.impl.InspectionReport;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.query.AbstractQueryHandler;
@@ -130,7 +130,8 @@
* @see org.exoplatform.services.jcr.impl.core.query.QueryHandler#checkIndex(org.exoplatform.services.jcr.dataflow.ItemDataConsumer, boolean, InspectionLog)
*/
@Override
- public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionLog inspectionLog) throws RepositoryException,
+ public void checkIndex(ItemDataConsumer itemStateManager, boolean isSystem, InspectionReport inspectionLog)
+ throws RepositoryException,
IOException
{
// do nothing
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestInspectionLogFile.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -20,15 +20,10 @@
import junit.framework.TestCase;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.InspectionLog.InspectionStatus;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
-import java.io.OutputStreamWriter;
import java.io.Reader;
-import java.io.Writer;
/**
* @author <a href="mailto:skarpenko@exoplatform.com">Sergiy Karpenko</a>
@@ -38,31 +33,29 @@
public class TestInspectionLogFile extends TestCase
{
- private File f;
+ private InspectionReport report;
- private Writer writer;
-
public void setUp() throws Exception
{
super.setUp();
- f = File.createTempFile("testlog", "suf");
- writer = new OutputStreamWriter(PrivilegedFileHelper.fileOutputStream(f));
+
+ report = new InspectionReport("test");
}
public void tearDown() throws Exception
{
- writer.close();
- f.delete();
+ report.close();
+ getFileFromReport().delete();
+
super.tearDown();
}
public void testLogComment() throws Exception
{
- InspectionLog report = new InspectionLogWriter(writer);
report.logComment("test message");
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
br.close();
@@ -72,11 +65,10 @@
public void testLogInspectionDescription() throws Exception
{
- InspectionLog report = new InspectionLogWriter(writer);
- report.logInspectionDescription("description");
+ report.logDescription("description");
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
br.close();
@@ -86,16 +78,15 @@
public void testLogBrokenObjectInfo() throws Exception
{
- InspectionLog report = new InspectionLogWriter(writer);
- report.logBrokenObjectInfo("broken object descr", "message", InspectionStatus.REINDEX);
+ report.logBrokenObjectAndSetInconsistency("broken object descr", "message");
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
br.close();
- assertEquals("Reindex broken object descr message", s);
+ assertEquals("broken object descr message", s);
assertTrue(report.hasInconsistency());
}
@@ -103,11 +94,10 @@
{
Exception e = new Exception("Exception message.");
- InspectionLog report = new InspectionLogWriter(writer);
- report.logException("message", e);
+ report.logExceptionAndSetInconsistency("message", e);
// read file;
- Reader reader = new FileReader(f);
+ Reader reader = new FileReader(getFileFromReport());
BufferedReader br = new BufferedReader(reader);
String s = br.readLine();
assertEquals("//message", s);
@@ -119,4 +109,9 @@
assertTrue(report.hasInconsistency());
}
+ private File getFileFromReport()
+ {
+ return new File(report.getReportPath());
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-02-17 09:35:53 UTC (rev 5660)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TestRepositoryCheckController.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -62,7 +62,7 @@
public class TestRepositoryCheckController extends BaseStandaloneTest
{
- private RepositoryCheckController checkController;
+ private TesterRepositoryCheckController checkController;
private final TesterConfigurationHelper helper = TesterConfigurationHelper.getInstance();
@@ -90,19 +90,17 @@
public void testDB() throws Exception
{
- checkController =
- new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
String result = checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.DB});
assertNotNull(result);
- assertTrue("Repository data is not consistent, result: " + result, result
- .startsWith("Repository data is consistent"));
+ assertTrue("Repository data is not consistent, result: " + result,
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
public void testValueStorage() throws Exception
{
- checkController =
- new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
File f = this.createBLOBTempFile(20);
InputStream is = new FileInputStream(f);
@@ -115,8 +113,8 @@
String result = checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.VALUE_STORAGE});
assertNotNull(result);
- assertTrue("Repository data is not consistent, result: " + result, result
- .startsWith("Repository data is consistent"));
+ assertTrue("Repository data is not consistent, result: " + result,
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
finally
{
@@ -127,17 +125,17 @@
public void testSearchIndex() throws Exception
{
- checkController = new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
String result = checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.LUCENE_INDEX});
assertNotNull(result);
- assertTrue("Repository data is not consistent, result: " + result, result
- .startsWith("Repository data is consistent"));
+ assertTrue("Repository data is not consistent, result: " + result,
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
public void testAll() throws Exception
{
- checkController = new RepositoryCheckController(repositoryService.getRepository("db1"));
+ checkController = new TesterRepositoryCheckController(repositoryService.getRepository("db1"));
String result =
checkController.checkRepositoryDataConsistency(new DataStorage[]{DataStorage.DB, DataStorage.VALUE_STORAGE,
@@ -146,7 +144,7 @@
assertNotNull(result);
assertTrue("Repository data is not consistent, result: " + result,
- result.startsWith("Repository data is consistent"));
+ result.startsWith(RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
}
/**
@@ -155,7 +153,7 @@
public void testIndexUsecaseWrongDocumentId() throws Exception
{
ManageableRepository repository = helper.createRepository(container, false, false);
-
+
// create repository and add property
SessionImpl session =
(SessionImpl)repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName());
@@ -164,8 +162,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -185,9 +184,10 @@
conn.commit();
conn.close();
-
+
// repository is inconsistent
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -206,8 +206,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -246,7 +247,8 @@
sm.onSaveItems(log);
// repository is inconsistent
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -265,8 +267,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -305,7 +308,8 @@
sm.onSaveItems(log);
// repository is inconsistent
- assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositorySearchIndexConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -336,8 +340,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -359,7 +364,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -390,8 +396,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -426,7 +433,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -457,8 +465,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -480,7 +489,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -512,8 +522,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -531,7 +542,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -545,8 +557,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -564,7 +577,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -594,8 +608,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -616,7 +631,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -648,8 +664,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -667,7 +684,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -681,8 +699,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -716,8 +735,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -735,7 +755,8 @@
conn.close();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -767,10 +788,10 @@
PropertyIterator iter = node.getProperties();
-
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -800,7 +821,8 @@
session.logout();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -815,8 +837,9 @@
PropertyIterator iter = node.getProperties();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
WorkspaceEntry wsEntry = repository.getConfiguration().getWorkspaceEntries().get(0);
@@ -850,7 +873,8 @@
session.logout();
// repository is inconsistent
- assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith("Repository data is consistent"));
+ assertTrue(checkController.checkRepositoryDataBaseConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
@@ -883,8 +907,9 @@
session.logout();
// repository is consistent
- checkController = new RepositoryCheckController(repository);
- assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith("Repository data is consistent"));
+ checkController = new TesterRepositoryCheckController(repository);
+ assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith(
+ RepositoryCheckController.REPORT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
// remove the file from the value storage
@@ -897,7 +922,8 @@
assertTrue(vsFile.delete());
// repository is inconsistent
- assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith("Repository data is inconsistent"));
+ assertTrue(checkController.checkRepositoryValueStorageConsistency().startsWith(
+ RepositoryCheckController.REPORT_NOT_CONSISTENT_MESSAGE));
checkController.getLastLogFile().delete();
}
}
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/TesterRepositoryCheckController.java 2012-02-17 11:54:13 UTC (rev 5661)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl;
+
+import org.exoplatform.services.jcr.core.ManageableRepository;
+
+import java.io.File;
+
+/**
+ * For testing purpose. Returns last log file to have possibility to delete.
+ *
+ * @author <a href="abazko(a)exoplatform.com">Anatoliy Bazko</a>
+ * @version $Id: TesterRepositoryCheckController.java 34360 2009-07-22 23:58:59Z tolusha $
+ */
+public class TesterRepositoryCheckController extends RepositoryCheckController
+{
+ public TesterRepositoryCheckController(ManageableRepository repository)
+ {
+ super(repository);
+ }
+
+ public File getLastLogFile()
+ {
+ return new File(lastReport.getReportPath());
+ }
+}
12 years, 4 months
exo-jcr SVN: r5660 - in ws/trunk: exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl and 3 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-17 04:35:53 -0500 (Fri, 17 Feb 2012)
New Revision: 5660
Modified:
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java
Log:
EXOJCR-1760: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -82,7 +82,7 @@
/**
* The logger
*/
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.DefaultAuthHandler");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.DefaultAuthHandler");
private static final byte[] NUL = new byte[0];
@@ -98,8 +98,6 @@
private static boolean prompterSet = false;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.DefaultAuthHandler");
-
/**
* For Digest authentication we need to set the uri, response and opaque
* parameters. For "Basic" and "SOCKS5" nothing is done.
@@ -114,8 +112,8 @@
else if (!info.getScheme().equalsIgnoreCase("Digest"))
throw new AuthSchemeNotImplException(info.getScheme());
- if (log.isDebugEnabled())
- log.debug("Fixing up Authorization for host " + info.getHost() + ":" + info.getPort() + "; scheme: "
+ if (LOG.isDebugEnabled())
+ LOG.debug("Fixing up Authorization for host " + info.getHost() + ":" + info.getPort() + "; scheme: "
+ info.getScheme() + "; realm: " + info.getRealm());
return digest_fixup(info, req, challenge, resp);
@@ -135,8 +133,8 @@
{
AuthorizationInfo cred;
- if (log.isDebugEnabled())
- log.debug("Requesting Authorization for host " + challenge.getHost() + ":" + challenge.getPort()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Requesting Authorization for host " + challenge.getHost() + ":" + challenge.getPort()
+ "; scheme: " + challenge.getScheme() + "; realm: " + challenge.getRealm());
// we only handle Basic, Digest and SOCKS5 authentication
@@ -201,8 +199,8 @@
// Done
- if (log.isDebugEnabled())
- log.debug("Got Authorization");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Got Authorization");
return cred;
}
@@ -753,15 +751,15 @@
if (resp.hasEntity())
{
- if (log.isDebugEnabled())
- log.debug("Pushing md5-check-stream to verify digest from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Pushing md5-check-stream to verify digest from " + hdr_name);
resp.inp_stream = new MD5InputStream(resp.inp_stream, verifier);
}
else
{
- if (log.isDebugEnabled())
- log.debug("Verifying digest from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Verifying digest from " + hdr_name);
verifier.verifyHash(MD5.digest(NUL), 0);
}
@@ -813,8 +811,8 @@
&& (qop.getValue().equalsIgnoreCase("auth") || !resp.hasEntity()
&& qop.getValue().equalsIgnoreCase("auth-int")))
{
- if (log.isDebugEnabled())
- log.debug("Verifying rspauth from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Verifying rspauth from " + hdr_name);
verifier.verifyHash(MD5.digest(NUL), 0);
}
@@ -822,8 +820,8 @@
{
// else push md5 stream and verify after body
- if (log.isDebugEnabled())
- log.debug("Pushing md5-check-stream to verify rspauth from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Pushing md5-check-stream to verify rspauth from " + hdr_name);
resp.inp_stream = new MD5InputStream(resp.inp_stream, verifier);
}
@@ -901,13 +899,13 @@
A1_hash + ":" + nonce + ":" + req.getMethod() + ":" + (dt == -1 ? "" : hdrs[dt].getValue()) + ":"
+ entity_info + ":" + entity_hash;
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Entity-Info: '" + req.getRequestURI() + ":" + (ct == -1 ? "" : hdrs[ct].getValue()) + ":"
+ LOG.debug("Entity-Info: '" + req.getRequestURI() + ":" + (ct == -1 ? "" : hdrs[ct].getValue()) + ":"
+ entity_body.length + ":" + (ce == -1 ? "" : hdrs[ce].getValue()) + ":"
+ (lm == -1 ? "" : hdrs[lm].getValue()) + ":" + (ex == -1 ? "" : hdrs[ex].getValue()) + "'");
- log.debug("Entity-Body: '" + entity_hash + "'");
- log.debug("Entity-Digest: '" + entity_digest + "'");
+ LOG.debug("Entity-Body: '" + entity_hash + "'");
+ LOG.debug("Entity-Digest: '" + entity_digest + "'");
}
return MD5.hexDigest(entity_digest);
@@ -1330,7 +1328,7 @@
class SimpleAuthPopup implements AuthorizationPrompter
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPopup");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SimpleAuthPopup");
private static BasicAuthBox inp = null;
@@ -1562,7 +1560,7 @@
class SimpleAuthPrompt implements AuthorizationPrompter
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPrompt");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SimpleAuthPrompt");
/**
* the method called by DefaultAuthHandler.
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -73,7 +73,7 @@
/**
* The logger
*/
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.IdempotentSequence");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.IdempotentSequence");
/** these are the history of previous requests */
private int[] m_history;
Modified: ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java
===================================================================
--- ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -152,60 +152,99 @@
LinkedList list = new LinkedList();
list.addToHead("One");
list.addToEnd("Last");
+
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list.remove("One");
if (!list.getFirst().equals("Last"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
list.remove("Last");
if (list.getFirst() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list = new LinkedList();
list.addToEnd("Last");
list.addToHead("One");
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
list.remove("One");
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
list.remove("Last");
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list = new LinkedList();
list.addToEnd("Last");
list.addToHead("Two");
list.addToHead("One");
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Two"))
- throw new Exception("Second element wrong");
+ {
+ throw new IllegalStateException("Second element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list.remove("Last");
list.remove("Two");
list.remove("One");
if (list.getFirst() != null)
- throw new Exception("Empty list wrong");
+ {
+ throw new IllegalStateException("Empty list wrong");
+ }
System.err.println("\n*** Tests finished successfuly"); //NOSONAR
}
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -110,7 +110,7 @@
*/
private URI baseUri;
- private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.ContainerRequest");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.ContainerRequest");
/**
* Constructs new instance of ContainerRequest.
Modified: ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
--- ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -51,7 +51,7 @@
public final class HeaderHelper
{
- private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.HeaderHelper");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.HeaderHelper");
/**
* Constructor.
Modified: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -51,8 +51,7 @@
{
private static final String DEFAULT_SOURCE_FILE_EXTENSION = ".groovy";
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoader");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.ext.DefaultGroovyResourceLoader");
public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new ConcurrentHashMap<String, Future<URL>>();
Modified: ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
===================================================================
--- ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -47,7 +47,7 @@
public class MockHttpServletResponse implements HttpServletResponse
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.test.mock.MockHttpServletResponse");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.testframework.MockHttpServletResponse");
/** The writer. */
private PrintWriter writer;
Modified: ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java
===================================================================
--- ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java 2012-02-17 09:32:20 UTC (rev 5659)
+++ ws/trunk/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java 2012-02-17 09:35:53 UTC (rev 5660)
@@ -47,7 +47,7 @@
public class MockServletContext implements ServletContext
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.MockServletContext");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.testframework.MockServletContext");
/** The name. */
private String name;
12 years, 4 months
exo-jcr SVN: r5659 - in ws/branches/2.3.x: exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl and 3 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-17 04:32:20 -0500 (Fri, 17 Feb 2012)
New Revision: 5659
Modified:
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java
Log:
EXOJCR-1760: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/DefaultAuthHandler.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -82,7 +82,7 @@
/**
* The logger
*/
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.DefaultAuthHandler");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.DefaultAuthHandler");
private static final byte[] NUL = new byte[0];
@@ -98,8 +98,6 @@
private static boolean prompterSet = false;
- private static final Log log = ExoLogger.getLogger("exo.ws.commons.DefaultAuthHandler");
-
/**
* For Digest authentication we need to set the uri, response and opaque
* parameters. For "Basic" and "SOCKS5" nothing is done.
@@ -114,8 +112,8 @@
else if (!info.getScheme().equalsIgnoreCase("Digest"))
throw new AuthSchemeNotImplException(info.getScheme());
- if (log.isDebugEnabled())
- log.debug("Fixing up Authorization for host " + info.getHost() + ":" + info.getPort() + "; scheme: "
+ if (LOG.isDebugEnabled())
+ LOG.debug("Fixing up Authorization for host " + info.getHost() + ":" + info.getPort() + "; scheme: "
+ info.getScheme() + "; realm: " + info.getRealm());
return digest_fixup(info, req, challenge, resp);
@@ -135,8 +133,8 @@
{
AuthorizationInfo cred;
- if (log.isDebugEnabled())
- log.debug("Requesting Authorization for host " + challenge.getHost() + ":" + challenge.getPort()
+ if (LOG.isDebugEnabled())
+ LOG.debug("Requesting Authorization for host " + challenge.getHost() + ":" + challenge.getPort()
+ "; scheme: " + challenge.getScheme() + "; realm: " + challenge.getRealm());
// we only handle Basic, Digest and SOCKS5 authentication
@@ -201,8 +199,8 @@
// Done
- if (log.isDebugEnabled())
- log.debug("Got Authorization");
+ if (LOG.isDebugEnabled())
+ LOG.debug("Got Authorization");
return cred;
}
@@ -753,15 +751,15 @@
if (resp.hasEntity())
{
- if (log.isDebugEnabled())
- log.debug("Pushing md5-check-stream to verify digest from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Pushing md5-check-stream to verify digest from " + hdr_name);
resp.inp_stream = new MD5InputStream(resp.inp_stream, verifier);
}
else
{
- if (log.isDebugEnabled())
- log.debug("Verifying digest from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Verifying digest from " + hdr_name);
verifier.verifyHash(MD5.digest(NUL), 0);
}
@@ -813,8 +811,8 @@
&& (qop.getValue().equalsIgnoreCase("auth") || !resp.hasEntity()
&& qop.getValue().equalsIgnoreCase("auth-int")))
{
- if (log.isDebugEnabled())
- log.debug("Verifying rspauth from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Verifying rspauth from " + hdr_name);
verifier.verifyHash(MD5.digest(NUL), 0);
}
@@ -822,8 +820,8 @@
{
// else push md5 stream and verify after body
- if (log.isDebugEnabled())
- log.debug("Pushing md5-check-stream to verify rspauth from " + hdr_name);
+ if (LOG.isDebugEnabled())
+ LOG.debug("Pushing md5-check-stream to verify rspauth from " + hdr_name);
resp.inp_stream = new MD5InputStream(resp.inp_stream, verifier);
}
@@ -901,13 +899,13 @@
A1_hash + ":" + nonce + ":" + req.getMethod() + ":" + (dt == -1 ? "" : hdrs[dt].getValue()) + ":"
+ entity_info + ":" + entity_hash;
- if (log.isDebugEnabled())
+ if (LOG.isDebugEnabled())
{
- log.debug("Entity-Info: '" + req.getRequestURI() + ":" + (ct == -1 ? "" : hdrs[ct].getValue()) + ":"
+ LOG.debug("Entity-Info: '" + req.getRequestURI() + ":" + (ct == -1 ? "" : hdrs[ct].getValue()) + ":"
+ entity_body.length + ":" + (ce == -1 ? "" : hdrs[ce].getValue()) + ":"
+ (lm == -1 ? "" : hdrs[lm].getValue()) + ":" + (ex == -1 ? "" : hdrs[ex].getValue()) + "'");
- log.debug("Entity-Body: '" + entity_hash + "'");
- log.debug("Entity-Digest: '" + entity_digest + "'");
+ LOG.debug("Entity-Body: '" + entity_hash + "'");
+ LOG.debug("Entity-Digest: '" + entity_digest + "'");
}
return MD5.hexDigest(entity_digest);
@@ -1330,7 +1328,7 @@
class SimpleAuthPopup implements AuthorizationPrompter
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPopup");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SimpleAuthPopup");
private static BasicAuthBox inp = null;
@@ -1562,7 +1560,7 @@
class SimpleAuthPrompt implements AuthorizationPrompter
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.SimpleAuthPrompt");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.SimpleAuthPrompt");
/**
* the method called by DefaultAuthHandler.
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/IdempotentSequence.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -73,7 +73,7 @@
/**
* The logger
*/
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.common.http.client.IdempotentSequence");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.commons.IdempotentSequence");
/** these are the history of previous requests */
private int[] m_history;
Modified: ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java
===================================================================
--- ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.commons/src/main/java/org/exoplatform/common/http/client/LinkedList.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -152,60 +152,99 @@
LinkedList list = new LinkedList();
list.addToHead("One");
list.addToEnd("Last");
+
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list.remove("One");
if (!list.getFirst().equals("Last"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
list.remove("Last");
if (list.getFirst() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list = new LinkedList();
list.addToEnd("Last");
list.addToHead("One");
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
list.remove("One");
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
list.remove("Last");
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list = new LinkedList();
list.addToEnd("Last");
list.addToHead("Two");
list.addToHead("One");
if (!list.getFirst().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.enumerate().equals("One"))
- throw new Exception("First element wrong");
+ {
+ throw new IllegalStateException("First element wrong");
+ }
if (!list.next().equals("Two"))
- throw new Exception("Second element wrong");
+ {
+ throw new IllegalStateException("Second element wrong");
+ }
if (!list.next().equals("Last"))
- throw new Exception("Last element wrong");
+ {
+ throw new IllegalStateException("Last element wrong");
+ }
if (list.next() != null)
- throw new Exception("End of list wrong");
+ {
+ throw new IllegalStateException("End of list wrong");
+ }
list.remove("Last");
list.remove("Two");
list.remove("One");
if (list.getFirst() != null)
- throw new Exception("Empty list wrong");
+ {
+ throw new IllegalStateException("Empty list wrong");
+ }
System.err.println("\n*** Tests finished successfuly"); //NOSONAR
}
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/ContainerRequest.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -110,7 +110,7 @@
*/
private URI baseUri;
- private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.ContainerRequest");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.ContainerRequest");
/**
* Constructs new instance of ContainerRequest.
Modified: ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/header/HeaderHelper.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -51,7 +51,7 @@
public final class HeaderHelper
{
- private static final Log LOG = ExoLogger.getLogger("org.ws.rest.core.HeaderHelper");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.core.HeaderHelper");
/**
* Constructor.
Modified: ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java
===================================================================
--- ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/groovy/DefaultGroovyResourceLoader.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -51,8 +51,7 @@
{
private static final String DEFAULT_SOURCE_FILE_EXTENSION = ".groovy";
- private static final Log LOG = ExoLogger
- .getLogger("org.exoplatform.services.rest.ext.groovy.DefaultGroovyResourceLoader");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.rest.ext.DefaultGroovyResourceLoader");
public final ConcurrentMap<String, Future<URL>> findResourceURLTasks = new ConcurrentHashMap<String, Future<URL>>();
Modified: ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java
===================================================================
--- ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockHttpServletResponse.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -47,7 +47,7 @@
public class MockHttpServletResponse implements HttpServletResponse
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.test.mock.MockHttpServletResponse");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.testframework.MockHttpServletResponse");
/** The writer. */
private PrintWriter writer;
Modified: ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java
===================================================================
--- ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java 2012-02-17 09:05:27 UTC (rev 5658)
+++ ws/branches/2.3.x/exo.ws.testframework/src/main/java/org/exoplatform/services/test/mock/MockServletContext.java 2012-02-17 09:32:20 UTC (rev 5659)
@@ -47,7 +47,7 @@
public class MockServletContext implements ServletContext
{
- private static final Log LOG = ExoLogger.getLogger("org.exoplatform.services.MockServletContext");
+ private static final Log LOG = ExoLogger.getLogger("exo.ws.testframework.MockServletContext");
/** The name. */
private String name;
12 years, 4 months