Index: modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/Projection.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/Projection.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/Projection.java Mon Feb 08 12:51:00 CET 2010 @@ -62,12 +62,14 @@ */ private static final long serialVersionUID = 1L; protected static final List parserMethods; + private static final Logger LOGGER = Logger.getLogger(Projection.class); + static { parserMethods = new CopyOnWriteArrayList(); try { parserMethods.add(Projection.class.getDeclaredMethod("parsePathRule", String.class, ExecutionContext.class)); } catch (Throwable err) { - Logger.getLogger(Projection.class).error(err, GraphI18n.errorAddingProjectionRuleParseMethod); + LOGGER.error(err, GraphI18n.errorAddingProjectionRuleParseMethod); } } Index: modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/ProjectionParser.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/ProjectionParser.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/ProjectionParser.java Mon Feb 08 12:52:09 CET 2010 @@ -23,11 +23,6 @@ */ package org.modeshape.graph.connector.federation; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; import net.jcip.annotations.ThreadSafe; import org.modeshape.common.text.TextEncoder; import org.modeshape.common.util.CheckArg; @@ -38,6 +33,12 @@ import org.modeshape.graph.connector.federation.Projection.Rule; import org.modeshape.graph.property.NamespaceRegistry; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + /** * A parser library for {@link Projection projections} and {@link Projection.Rule projection rules}. */ @@ -45,13 +46,15 @@ public class ProjectionParser { private static final ProjectionParser INSTANCE; + private static final Logger LOGGER = Logger.getLogger(Projection.class); + static { INSTANCE = new ProjectionParser(); try { INSTANCE.addRuleParser(Projection.class, "parsePathRule"); assert INSTANCE.parserMethods.size() == 1; } catch (Throwable err) { - Logger.getLogger(Projection.class).error(err, GraphI18n.errorAddingProjectionRuleParseMethod); + LOGGER.error(err, GraphI18n.errorAddingProjectionRuleParseMethod); } } Index: extensions/modeshape-connector-jdbc-metadata/src/main/java/org/modeshape/connector/meta/jdbc/JdbcMetadataRepository.java =================================================================== --- extensions/modeshape-connector-jdbc-metadata/src/main/java/org/modeshape/connector/meta/jdbc/JdbcMetadataRepository.java (revision 1596) +++ extensions/modeshape-connector-jdbc-metadata/src/main/java/org/modeshape/connector/meta/jdbc/JdbcMetadataRepository.java Mon Feb 08 12:48:56 CET 2010 @@ -67,7 +67,7 @@ public final static String TABLES_SEGMENT_NAME = "tables"; public final static String PROCEDURES_SEGMENT_NAME = "procedures"; - private final Logger log = Logger.getLogger(JdbcMetadataRepository.class); + private static final Logger LOGGER = Logger.getLogger(JdbcMetadataRepository.class); private final JdbcMetadataSource source; private Map rootNodeProperties; private String databaseProductName; @@ -140,7 +140,7 @@ try { connection.close(); } catch (SQLException se) { - log.error(se, JdbcMetadataI18n.errorClosingConnection); + LOGGER.error(se, JdbcMetadataI18n.errorClosingConnection); } } Index: web/modeshape-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/json/JsonRestClient.java =================================================================== --- web/modeshape-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/json/JsonRestClient.java (revision 1596) +++ web/modeshape-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/json/JsonRestClient.java Thu Feb 25 13:15:59 CET 2010 @@ -23,10 +23,6 @@ */ package org.modeshape.web.jcr.rest.client.json; -import java.io.File; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.Collection; import org.modeshape.common.util.CheckArg; import org.modeshape.common.util.Logger; import org.modeshape.web.jcr.rest.client.IRestClient; @@ -39,6 +35,11 @@ import org.modeshape.web.jcr.rest.client.http.HttpClientConnection; import org.modeshape.web.jcr.rest.client.json.IJsonConstants.RequestMethod; +import java.io.File; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Collection; + /** * The JsonRestClient class is an implementation of IRestClient that works with the ModeShape REST server that * uses JSON as its interface protocol. @@ -50,9 +51,9 @@ // =========================================================================================================================== /** - * The logger. + * The LOGGER. */ - private final Logger logger = Logger.getLogger(JsonRestClient.class); + private static final Logger LOGGER = Logger.getLogger(JsonRestClient.class); // =========================================================================================================================== // Methods @@ -68,7 +69,7 @@ private HttpClientConnection connect( Server server, URL url, RequestMethod method ) throws Exception { - this.logger.trace("connect: url={0}, method={1}", url, method); + LOGGER.trace("connect: url={0}, method={1}", url, method); return new HttpClientConnection(server, url, method); } @@ -83,12 +84,12 @@ private void createFileNode( Workspace workspace, String path, File file ) throws Exception { - this.logger.trace("createFileNode: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); + LOGGER.trace("createFileNode: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); FileNode fileNode = new FileNode(workspace, path, file); HttpClientConnection connection = connect(workspace.getServer(), fileNode.getUrl(), RequestMethod.POST); try { - this.logger.trace("createFileNode: create node={0}", fileNode); + LOGGER.trace("createFileNode: create node={0}", fileNode); connection.write(fileNode.getContent()); // make sure node was created @@ -96,13 +97,13 @@ if (responseCode != HttpURLConnection.HTTP_CREATED) { // node was not created - this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "createFileNode"); + LOGGER.error(RestClientI18n.connectionErrorMsg, responseCode, "createFileNode"); String msg = RestClientI18n.createFileFailedMsg.text(file.getName(), path, workspace.getName(), responseCode); throw new RuntimeException(msg); } } finally { if (connection != null) { - this.logger.trace("createFileNode: leaving"); + LOGGER.trace("createFileNode: leaving"); connection.disconnect(); } } @@ -117,26 +118,26 @@ */ private void createFolderNode( Workspace workspace, String path ) throws Exception { - this.logger.trace("createFolderNode: workspace={0}, path={1}", workspace.getName(), path); + LOGGER.trace("createFolderNode: workspace={0}, path={1}", workspace.getName(), path); FolderNode folderNode = new FolderNode(workspace, path); HttpClientConnection connection = connect(workspace.getServer(), folderNode.getUrl(), RequestMethod.POST); try { - this.logger.trace("createFolderNode: create node={0}", folderNode); + LOGGER.trace("createFolderNode: create node={0}", folderNode); - connection.write(folderNode.getContent()); + connection.write(folderNode.getContent()); // make sure node was created int responseCode = connection.getResponseCode(); if (responseCode != HttpURLConnection.HTTP_CREATED) { // node was not created - this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "createFolderNode"); + LOGGER.error(RestClientI18n.connectionErrorMsg, responseCode, "createFolderNode"); String msg = RestClientI18n.createFolderFailedMsg.text(path, workspace.getName(), responseCode); throw new RuntimeException(msg); } } finally { if (connection != null) { - this.logger.trace("createFolderNode: leaving"); + LOGGER.trace("createFolderNode: leaving"); connection.disconnect(); } } @@ -151,7 +152,7 @@ */ private void ensureFolderExists( Workspace workspace, String folderPath ) throws Exception { - this.logger.trace("ensureFolderExists: workspace={0}, path={1}", workspace.getName(), folderPath); + LOGGER.trace("ensureFolderExists: workspace={0}, path={1}", workspace.getName(), folderPath); FolderNode folderNode = new FolderNode(workspace, folderPath); if (!pathExists(workspace.getServer(), folderNode.getUrl())) { @@ -190,7 +191,7 @@ */ public Collection getRepositories( Server server ) throws Exception { CheckArg.isNotNull(server, "server"); - this.logger.trace("getRepositories: server={0}", server); + LOGGER.trace("getRepositories: server={0}", server); ServerNode serverNode = new ServerNode(server); HttpClientConnection connection = connect(server, serverNode.getFindRepositoriesUrl(), RequestMethod.GET); @@ -203,12 +204,12 @@ } // not a good response code - this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "getRepositories"); + LOGGER.error(RestClientI18n.connectionErrorMsg, responseCode, "getRepositories"); String msg = RestClientI18n.getRepositoriesFailedMsg.text(server.getName(), responseCode); throw new RuntimeException(msg); } finally { if (connection != null) { - this.logger.trace("getRepositories: leaving"); + LOGGER.trace("getRepositories: leaving"); connection.disconnect(); } } @@ -242,7 +243,7 @@ */ public Collection getWorkspaces( Repository repository ) throws Exception { CheckArg.isNotNull(repository, "repository"); - this.logger.trace("getWorkspaces: repository={0}", repository); + LOGGER.trace("getWorkspaces: repository={0}", repository); RepositoryNode repositoryNode = new RepositoryNode(repository); HttpClientConnection connection = connect(repository.getServer(), repositoryNode.getUrl(), RequestMethod.GET); @@ -255,14 +256,14 @@ } // not a good response code - this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "getWorkspaces"); + LOGGER.error(RestClientI18n.connectionErrorMsg, responseCode, "getWorkspaces"); String msg = RestClientI18n.getWorkspacesFailedMsg.text(repository.getName(), repository.getServer().getName(), responseCode); throw new RuntimeException(msg); } finally { if (connection != null) { - this.logger.trace("getWorkspaces: leaving"); + LOGGER.trace("getWorkspaces: leaving"); connection.disconnect(); } } @@ -300,16 +301,16 @@ */ private boolean pathExists( Server server, URL url ) throws Exception { - this.logger.trace("pathExists: url={0}", url); + LOGGER.trace("pathExists: url={0}", url); HttpClientConnection connection = connect(server, url, RequestMethod.GET); try { int responseCode = connection.getResponseCode(); - this.logger.trace("pathExists: responseCode={0}", responseCode); + LOGGER.trace("pathExists: responseCode={0}", responseCode); return (responseCode == HttpURLConnection.HTTP_OK); } finally { if (connection != null) { - this.logger.trace("pathExists: leaving"); + LOGGER.trace("pathExists: leaving"); connection.disconnect(); } } @@ -341,7 +342,7 @@ CheckArg.isNotNull(workspace, "workspace"); CheckArg.isNotNull(path, "path"); CheckArg.isNotNull(file, "file"); - this.logger.trace("publish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); + LOGGER.trace("publish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); try { // first delete if file exists at that path @@ -374,7 +375,7 @@ CheckArg.isNotNull(workspace, "workspace"); CheckArg.isNotNull(path, "path"); CheckArg.isNotNull(file, "file"); - this.logger.trace("unpublish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); + LOGGER.trace("unpublish: workspace={0}, path={1}, file={2}", workspace.getName(), path, file.getAbsolutePath()); HttpClientConnection connection = null; @@ -382,7 +383,7 @@ FileNode fileNode = new FileNode(workspace, path, file); connection = connect(workspace.getServer(), fileNode.getUrl(), RequestMethod.DELETE); int responseCode = connection.getResponseCode(); - this.logger.trace("responseCode={0}", responseCode); + LOGGER.trace("responseCode={0}", responseCode); if (responseCode != HttpURLConnection.HTTP_NO_CONTENT) { // check to see if the file was never published @@ -392,7 +393,7 @@ } // unexpected result - this.logger.error(RestClientI18n.connectionErrorMsg, responseCode, "unpublish"); + LOGGER.error(RestClientI18n.connectionErrorMsg, responseCode, "unpublish"); String msg = RestClientI18n.unpublishFailedMsg.text(file.getName(), workspace.getName(), path); throw new RuntimeException(msg); } @@ -403,7 +404,7 @@ return new Status(Severity.ERROR, msg, e); } finally { if (connection != null) { - this.logger.trace("unpublish: leaving"); + LOGGER.trace("unpublish: leaving"); connection.disconnect(); } } Index: modeshape-repository/src/main/java/org/modeshape/repository/RepositoryService.java =================================================================== --- modeshape-repository/src/main/java/org/modeshape/repository/RepositoryService.java (revision 1628) +++ modeshape-repository/src/main/java/org/modeshape/repository/RepositoryService.java Thu Feb 25 13:19:06 CET 2010 @@ -23,11 +23,6 @@ */ package org.modeshape.repository; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import net.jcip.annotations.ThreadSafe; import org.modeshape.common.collection.Problems; import org.modeshape.common.collection.SimpleProblems; @@ -57,6 +52,12 @@ import org.modeshape.repository.service.AdministeredService; import org.modeshape.repository.service.ServiceAdministrator; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + /** * A service that manages the {@link RepositorySource}es defined within a configuration repository. */ Index: modeshape-graph/src/main/java/org/modeshape/graph/observe/ChangeObserver.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/observe/ChangeObserver.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/observe/ChangeObserver.java Mon Feb 08 12:44:24 CET 2010 @@ -23,11 +23,12 @@ */ package org.modeshape.graph.observe; -import java.lang.ref.WeakReference; -import java.util.concurrent.CopyOnWriteArraySet; import net.jcip.annotations.ThreadSafe; import org.modeshape.common.util.Logger; +import java.lang.ref.WeakReference; +import java.util.concurrent.CopyOnWriteArraySet; + /** * Abstract class that is used to signal that a change set has occurred. This class is typically subclassed by those that wish to * observe changes in content, and {@link Observable#register(Observer) registered} with a {@link Observable}. Index: modeshape-graph/src/main/java/org/modeshape/graph/observe/ObservationBus.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/observe/ObservationBus.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/observe/ObservationBus.java Mon Feb 08 12:54:48 CET 2010 @@ -34,7 +34,7 @@ @ThreadSafe public class ObservationBus implements Observable, Observer { private final ChangeObservers observers = new ChangeObservers(); - private final Logger logger = Logger.getLogger(getClass()); + private static final Logger LOGGER = Logger.getLogger(ObservationBus.class); public ObservationBus() { } @@ -69,7 +69,7 @@ try { observers.broadcast(changes); } catch (RuntimeException t) { - logger.error(t, GraphI18n.errorNotifyingObserver, t.getLocalizedMessage()); + LOGGER.error(t, GraphI18n.errorNotifyingObserver, t.getLocalizedMessage()); } } } Index: modeshape-repository/src/main/java/org/modeshape/repository/ModeShapeEngine.java =================================================================== --- modeshape-repository/src/main/java/org/modeshape/repository/ModeShapeEngine.java (revision 1596) +++ modeshape-repository/src/main/java/org/modeshape/repository/ModeShapeEngine.java Mon Feb 08 13:05:35 CET 2010 @@ -21,16 +21,6 @@ */ package org.modeshape.repository; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; import net.jcip.annotations.Immutable; import org.modeshape.common.collection.Problem; import org.modeshape.common.collection.Problems; @@ -63,6 +53,17 @@ import org.modeshape.repository.sequencer.SequencerConfig; import org.modeshape.repository.sequencer.SequencingService; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; + /** * A single instance of the ModeShape services, which is obtained after setting up the {@link ModeShapeConfiguration#build() configuration}. * @@ -82,6 +83,7 @@ private final SequencingService sequencingService; private final ExecutorService executorService; private final MimeTypeDetectors detectors; + private static final Logger LOGGER = Logger.getLogger(ModeShapeEngine.class); protected ModeShapeEngine( ExecutionContext context, ModeShapeConfiguration.ConfigurationDefinition configuration ) { @@ -261,10 +263,9 @@ public void start() { if (getProblems().hasErrors()) { // First log the messages ... - Logger log = Logger.getLogger(getClass()); - log.error(RepositoryI18n.errorsPreventStarting); + LOGGER.error(RepositoryI18n.errorsPreventStarting); for (Problem problem : getProblems()) { - log.error(problem.getMessage(), problem.getParameters()); + LOGGER.error(problem.getMessage(), problem.getParameters()); } // Then throw an exception ... throw new IllegalStateException(RepositoryI18n.errorsPreventStarting.text()); Index: modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/FederatedRepositoryConnection.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/FederatedRepositoryConnection.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/connector/federation/FederatedRepositoryConnection.java Mon Feb 08 12:50:48 CET 2010 @@ -23,14 +23,6 @@ */ package org.modeshape.graph.connector.federation; -import java.util.LinkedList; -import java.util.Queue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import javax.transaction.xa.XAResource; import org.modeshape.common.statistic.Stopwatch; import org.modeshape.common.util.Logger; import org.modeshape.graph.ExecutionContext; @@ -43,6 +35,15 @@ import org.modeshape.graph.request.Request; import org.modeshape.graph.request.processor.RequestProcessor; +import javax.transaction.xa.XAResource; +import java.util.LinkedList; +import java.util.Queue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.TimeUnit; + /** * This {@link RepositoryConnection} implementation executes {@link Request requests} against the federated repository by * projecting them into requests against the underlying sources that are being federated. @@ -76,14 +77,13 @@ private final FederatedRepository repository; private final Stopwatch stopwatch; - private final Logger logger; private final Observer observer; + private static final Logger LOGGER = Logger.getLogger(FederatedRepositoryConnection.class); FederatedRepositoryConnection( FederatedRepository repository, Observer observer ) { this.repository = repository; - this.logger = Logger.getLogger(getClass()); - this.stopwatch = logger.isTraceEnabled() ? new Stopwatch() : null; + this.stopwatch = LOGGER.isTraceEnabled() ? new Stopwatch() : null; this.observer = observer; } @@ -279,7 +279,7 @@ */ public void close() { if (stopwatch != null) { - logger.trace("Processing federated requests:\n" + stopwatch.getDetailedStatistics()); + LOGGER.trace("Processing federated requests:\n" + stopwatch.getDetailedStatistics()); } // do nothing else, since we don't currently hold any state } Index: web/modeshape-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/json/ServerNode.java =================================================================== --- web/modeshape-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/json/ServerNode.java (revision 1596) +++ web/modeshape-web-jcr-rest-client/src/main/java/org/modeshape/web/jcr/rest/client/json/ServerNode.java Thu Feb 25 13:20:14 CET 2010 @@ -23,16 +23,17 @@ */ package org.modeshape.web.jcr.rest.client.json; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; import org.codehaus.jettison.json.JSONObject; import org.modeshape.common.util.CheckArg; import org.modeshape.common.util.Logger; import org.modeshape.web.jcr.rest.client.domain.Repository; import org.modeshape.web.jcr.rest.client.domain.Server; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + /** * The ServerNode class is responsible for knowing how to create a URL for a server, create a URL to obtain a * server's repositories, and parse a JSON response into {@link Repository repository} objects. @@ -44,9 +45,9 @@ // =========================================================================================================================== /** - * The logger. + * The LOGGER. */ - private final Logger logger = Logger.getLogger(ServerNode.class); + private static final Logger LOGGER = Logger.getLogger(ServerNode.class); /** * The server containing ModeShape repositories. @@ -108,7 +109,7 @@ public Collection getRepositories( String jsonResponse ) throws Exception { CheckArg.isNotNull(jsonResponse, "jsonResponse"); Collection repositories = new ArrayList(); - this.logger.trace("getRepositories:jsonResponse={0}", jsonResponse); + LOGGER.trace("getRepositories:jsonResponse={0}", jsonResponse); JSONObject jsonObj = new JSONObject(jsonResponse); // keys are the repository names @@ -116,7 +117,7 @@ String name = JsonUtils.decode(itr.next()); Repository repository = new Repository(name, this.server); repositories.add(repository); - this.logger.trace("getRepositories: adding repository={0}", repository); + LOGGER.trace("getRepositories: adding repository={0}", repository); } return repositories; Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrRepository.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrRepository.java (revision 1662) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrRepository.java Mon Mar 01 16:11:41 CET 2010 @@ -51,7 +51,6 @@ import javax.jcr.Session; import javax.jcr.SimpleCredentials; import javax.jcr.query.Query; -import javax.jcr.query.QueryManager; import javax.security.auth.Subject; import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; @@ -122,7 +121,6 @@ @ThreadSafe public class JcrRepository implements Repository { - private static final Logger log = Logger.getLogger(JcrRepository.class); /** * A flag that controls whether the repository uses a shared repository (or workspace) for the "/jcr:system" content in all of @@ -141,6 +139,7 @@ * @see Option#ANONYMOUS_USER_ROLES */ static final String ANONYMOUS_USER_NAME = ""; + private static final Logger LOGGER = Logger.getLogger(JcrRepository.class); /** * The available options for the {@code JcrRepository}. @@ -490,18 +489,18 @@ } } else { I18n msg = JcrI18n.systemSourceNameOptionValueDoesNotReferenceExistingSource; - Logger.getLogger(getClass()).warn(msg, systemSourceNameValue, systemSourceName); + LOGGER.warn(msg, systemSourceNameValue, systemSourceName); } } catch (InvalidWorkspaceException e) { // Bad workspace name ... systemSourceName = null; I18n msg = JcrI18n.systemSourceNameOptionValueDoesNotReferenceValidWorkspace; - Logger.getLogger(getClass()).warn(msg, systemSourceNameValue, systemSourceName); + LOGGER.warn(msg, systemSourceNameValue, systemSourceName); } catch (IllegalArgumentException e) { // Invalid format ... systemSourceName = null; I18n msg = JcrI18n.systemSourceNameOptionValueIsNotFormattedCorrectly; - Logger.getLogger(getClass()).warn(msg, systemSourceNameValue); + LOGGER.warn(msg, systemSourceNameValue); } } if (systemSourceName == null) { @@ -1041,8 +1040,8 @@ * by a session that is no longer active. */ void cleanUpLocks() { - if (log.isTraceEnabled()) { - log.trace(JcrI18n.cleaningUpLocks.text()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace(JcrI18n.cleaningUpLocks.text()); } Set activeSessions = activeSessions(); @@ -1095,8 +1094,8 @@ } } - if (log.isTraceEnabled()) { - log.trace(JcrI18n.cleanedUpLocks.text()); + if (LOGGER.isTraceEnabled()) { + LOGGER.trace(JcrI18n.cleanedUpLocks.text()); } } Index: extensions/modeshape-classloader-maven/src/main/java/org/modeshape/maven/MavenRepository.java =================================================================== --- extensions/modeshape-classloader-maven/src/main/java/org/modeshape/maven/MavenRepository.java (revision 1596) +++ extensions/modeshape-classloader-maven/src/main/java/org/modeshape/maven/MavenRepository.java Mon Mar 01 16:51:02 CET 2010 @@ -23,27 +23,6 @@ */ package org.modeshape.maven; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import javax.jcr.Repository; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; import org.modeshape.common.component.ClassLoaderFactory; import org.modeshape.common.util.CheckArg; import org.modeshape.common.util.Logger; @@ -54,6 +33,18 @@ import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import javax.jcr.Repository; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.*; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.util.*; + /** * A Maven 2 repository that can be used to store and access artifacts like JARs and source archives within a running application. * This class understands Maven 2 Project Object Model (POM) files, and thus is able to analyze dependencies and provide a @@ -71,14 +62,13 @@ private final MavenUrlProvider urlProvider; private final MavenClassLoaders classLoaders; - private final Logger logger; + private static final Logger LOGGER = Logger.getLogger(MavenRepository.class); public MavenRepository( final MavenUrlProvider urlProvider ) { CheckArg.isNotNull(urlProvider, "urlProvider"); this.urlProvider = urlProvider; this.classLoaders = new MavenClassLoaders(this); - this.logger = Logger.getLogger(this.getClass()); - assert this.logger != null; + assert LOGGER != null; assert this.urlProvider != null; } @@ -282,7 +272,7 @@ // Extract the Maven dependency ... if (depGroupId == null || depArtifactId == null || depVersion == null) { - this.logger.trace("Skipping dependency of {1} due to missing groupId, artifactId or version: {2}", + LOGGER.trace("Skipping dependency of {1} due to missing groupId, artifactId or version: {2}", mavenId, dependencyNode); continue; // not enough information, so skip @@ -303,7 +293,7 @@ String excludedArtifactId = (String)artifactIdExpression.evaluate(exclusionNode, XPathConstants.STRING); if (excludedGroupId == null || excludedArtifactId == null) { - this.logger.trace("Skipping exclusion in dependency of {1} due to missing exclusion groupId or artifactId: {2} ", + LOGGER.trace("Skipping exclusion in dependency of {1} due to missing exclusion groupId or artifactId: {2} ", mavenId, exclusionNode); continue; // not enough information, so skip @@ -324,7 +314,7 @@ try { pomStream.close(); } catch (IOException e) { - this.logger.error(e, MavenI18n.errorClosingUrlStreamToPom, mavenId); + LOGGER.error(e, MavenI18n.errorClosingUrlStreamToPom, mavenId); } } return results; Index: extensions/modeshape-classloader-maven/src/main/java/org/modeshape/maven/spi/JcrMavenUrlProvider.java =================================================================== --- extensions/modeshape-classloader-maven/src/main/java/org/modeshape/maven/spi/JcrMavenUrlProvider.java (revision 1596) +++ extensions/modeshape-classloader-maven/src/main/java/org/modeshape/maven/spi/JcrMavenUrlProvider.java Mon Feb 08 12:59:22 CET 2010 @@ -23,6 +23,32 @@ */ package org.modeshape.maven.spi; +import org.modeshape.common.text.TextDecoder; +import org.modeshape.common.text.TextEncoder; +import org.modeshape.common.text.UrlEncoder; +import org.modeshape.common.util.Logger; +import org.modeshape.maven.ArtifactType; +import org.modeshape.maven.MavenI18n; +import org.modeshape.maven.MavenId; +import org.modeshape.maven.MavenRepositoryException; +import org.modeshape.maven.MavenUrl; +import org.modeshape.maven.SignatureType; + +import javax.jcr.Credentials; +import javax.jcr.ItemExistsException; +import javax.jcr.LoginException; +import javax.jcr.NoSuchWorkspaceException; +import javax.jcr.Node; +import javax.jcr.PathNotFoundException; +import javax.jcr.Property; +import javax.jcr.Repository; +import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.SimpleCredentials; +import javax.jcr.lock.LockException; +import javax.jcr.nodetype.ConstraintViolationException; +import javax.jcr.nodetype.NoSuchNodeTypeException; +import javax.jcr.version.VersionException; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; @@ -39,31 +65,6 @@ import java.net.URLStreamHandler; import java.util.Calendar; import java.util.Properties; -import javax.jcr.Credentials; -import javax.jcr.ItemExistsException; -import javax.jcr.LoginException; -import javax.jcr.NoSuchWorkspaceException; -import javax.jcr.Node; -import javax.jcr.PathNotFoundException; -import javax.jcr.Property; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import javax.jcr.SimpleCredentials; -import javax.jcr.lock.LockException; -import javax.jcr.nodetype.ConstraintViolationException; -import javax.jcr.nodetype.NoSuchNodeTypeException; -import javax.jcr.version.VersionException; -import org.modeshape.common.text.TextDecoder; -import org.modeshape.common.text.TextEncoder; -import org.modeshape.common.text.UrlEncoder; -import org.modeshape.common.util.Logger; -import org.modeshape.maven.ArtifactType; -import org.modeshape.maven.MavenI18n; -import org.modeshape.maven.MavenId; -import org.modeshape.maven.MavenRepositoryException; -import org.modeshape.maven.MavenUrl; -import org.modeshape.maven.SignatureType; /** * Base class for providers that work against a JCR repository. This class implements all functionality except for creating the @@ -103,7 +104,7 @@ private String workspaceName; private Credentials credentials; private String pathToTopOfRepository = DEFAULT_PATH_TO_TOP_OF_MAVEN_REPOSITORY; - private final Logger logger = Logger.getLogger(JcrMavenUrlProvider.class); + private static final Logger LOGGER = Logger.getLogger(JcrMavenUrlProvider.class); /** * @@ -233,7 +234,7 @@ } } session.save(); - this.logger.trace("Created Maven repository node for {0}", mavenUrl); + LOGGER.trace("Created Maven repository node for {0}", mavenUrl); } catch (LoginException err) { throw new MavenRepositoryException( MavenI18n.unableToOpenSessiontoRepositoryWhenCreatingNode.text(mavenUrl, @@ -273,7 +274,7 @@ } } if (created) { - this.logger.debug("Created Maven repository folders {0}", current.getPath()); + LOGGER.debug("Created Maven repository folders {0}", current.getPath()); } return current; } @@ -482,6 +483,7 @@ private OutputStream stream; private final File file; private final MavenUrl mavenUrl; + private final Logger LOGGER = Logger.getLogger(MavenOutputStream.class); protected MavenOutputStream( final MavenUrl mavenUrl, final File file ) throws FileNotFoundException { @@ -540,7 +542,7 @@ try { inputStream.close(); } catch (IOException ioe) { - Logger.getLogger(this.getClass()).error(ioe, + LOGGER.error(ioe, MavenI18n.errorClosingTempFileStreamAfterWritingContent, mavenUrl, ioe.getMessage()); Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrObservationManager.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrObservationManager.java (revision 1596) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrObservationManager.java Mon Feb 08 13:04:42 CET 2010 @@ -23,22 +23,6 @@ */ package org.modeshape.jcr; -import static org.modeshape.graph.JcrLexicon.MIXIN_TYPES; -import static org.modeshape.graph.JcrLexicon.PRIMARY_TYPE; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import javax.jcr.RangeIterator; -import javax.jcr.RepositoryException; -import javax.jcr.observation.Event; -import javax.jcr.observation.EventIterator; -import javax.jcr.observation.EventListener; -import javax.jcr.observation.EventListenerIterator; -import javax.jcr.observation.ObservationManager; import net.jcip.annotations.NotThreadSafe; import org.modeshape.common.util.CheckArg; import org.modeshape.common.util.Logger; @@ -59,6 +43,24 @@ import org.modeshape.graph.request.ChangeRequest; import org.modeshape.graph.session.InvalidStateException; +import javax.jcr.RangeIterator; +import javax.jcr.RepositoryException; +import javax.jcr.observation.Event; +import javax.jcr.observation.EventIterator; +import javax.jcr.observation.EventListener; +import javax.jcr.observation.EventListenerIterator; +import javax.jcr.observation.ObservationManager; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import static org.modeshape.graph.JcrLexicon.MIXIN_TYPES; +import static org.modeshape.graph.JcrLexicon.PRIMARY_TYPE; + /** * The implementation of JCR {@link ObservationManager}. */ Index: modeshape-graph/src/main/java/org/modeshape/graph/request/processor/LoggingRequestProcessor.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/request/processor/LoggingRequestProcessor.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/request/processor/LoggingRequestProcessor.java Mon Feb 08 12:56:19 CET 2010 @@ -65,12 +65,12 @@ public class LoggingRequestProcessor extends RequestProcessor { private final RequestProcessor delegate; - private final Logger logger; + private static final Logger LOGGER = Logger.getLogger(LoggingRequestProcessor.class); private final Logger.Level level; /** * @param delegate the processor to which this processor delegates - * @param logger the logger that should be used + * @param logger the LOGGER that should be used * @param level the level of the log messages; defaults to {@link Logger.Level#TRACE} */ public LoggingRequestProcessor( RequestProcessor delegate, @@ -79,7 +79,6 @@ super(delegate.getSourceName(), delegate.getExecutionContext(), null); CheckArg.isNotNull(logger, "logger"); this.delegate = delegate; - this.logger = logger; this.level = level != null ? level : Logger.Level.TRACE; } @@ -90,9 +89,9 @@ */ @Override public void process( VerifyWorkspaceRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - // logger.log(level, GraphI18n.executedRequest, request); + // LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -102,9 +101,9 @@ */ @Override public void process( GetWorkspacesRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -114,9 +113,9 @@ */ @Override public void process( CreateWorkspaceRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -126,9 +125,9 @@ */ @Override public void process( CloneBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -138,9 +137,9 @@ */ @Override public void process( CloneWorkspaceRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -150,9 +149,9 @@ */ @Override public void process( DestroyWorkspaceRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -162,9 +161,9 @@ */ @Override public void process( CopyBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -174,9 +173,9 @@ */ @Override public void process( CreateNodeRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -186,9 +185,9 @@ */ @Override public void process( DeleteBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -198,9 +197,9 @@ */ @Override public void process( DeleteChildrenRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -210,9 +209,9 @@ */ @Override public void process( MoveBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -222,9 +221,9 @@ */ @Override public void process( VerifyNodeExistsRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -234,9 +233,9 @@ */ @Override public void process( ReadAllChildrenRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -246,9 +245,9 @@ */ @Override public void process( ReadAllPropertiesRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -258,9 +257,9 @@ */ @Override public void process( UpdatePropertiesRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -270,9 +269,9 @@ */ @Override public void process( UpdateValuesRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -282,9 +281,9 @@ */ @Override public void process( CompositeRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -294,9 +293,9 @@ */ @Override public void process( ReadBlockOfChildrenRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -306,9 +305,9 @@ */ @Override public void process( ReadNextBlockOfChildrenRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -318,9 +317,9 @@ */ @Override public void process( ReadBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -330,9 +329,9 @@ */ @Override public void process( ReadNodeRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -342,9 +341,9 @@ */ @Override public void process( ReadPropertyRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -354,9 +353,9 @@ */ @Override public void process( SetPropertyRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -366,9 +365,9 @@ */ @Override public void process( RemovePropertyRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -378,9 +377,9 @@ */ @Override public void process( RenameNodeRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -390,9 +389,9 @@ */ @Override public void process( LockBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -402,9 +401,9 @@ */ @Override public void process( UnlockBranchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -414,9 +413,9 @@ */ @Override public void process( AccessQueryRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -426,9 +425,9 @@ */ @Override public void process( FullTextSearchRequest request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -438,9 +437,9 @@ */ @Override public void process( Request request ) { - logger.log(level, GraphI18n.executingRequest, request); + LOGGER.log(level, GraphI18n.executingRequest, request); delegate.process(request); - logger.log(level, GraphI18n.executedRequest, request); + LOGGER.log(level, GraphI18n.executedRequest, request); } /** @@ -450,9 +449,9 @@ */ @Override public void close() { - logger.log(level, GraphI18n.closingRequestProcessor); + LOGGER.log(level, GraphI18n.closingRequestProcessor); delegate.close(); - logger.log(level, GraphI18n.closedRequestProcessor); + LOGGER.log(level, GraphI18n.closedRequestProcessor); } } Index: extensions/modeshape-search-lucene/src/main/java/org/modeshape/search/lucene/LuceneSearchProcessor.java =================================================================== --- extensions/modeshape-search-lucene/src/main/java/org/modeshape/search/lucene/LuceneSearchProcessor.java (revision 1638) +++ extensions/modeshape-search-lucene/src/main/java/org/modeshape/search/lucene/LuceneSearchProcessor.java Mon Feb 08 20:23:07 CET 2010 @@ -23,12 +23,6 @@ */ package org.modeshape.search.lucene; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; import net.jcip.annotations.NotThreadSafe; import org.apache.lucene.queryParser.ParseException; import org.apache.lucene.search.Query; @@ -41,26 +35,18 @@ import org.modeshape.graph.query.QueryResults.Columns; import org.modeshape.graph.query.QueryResults.Statistics; import org.modeshape.graph.query.process.FullTextSearchResultColumns; -import org.modeshape.graph.request.CloneBranchRequest; -import org.modeshape.graph.request.CloneWorkspaceRequest; -import org.modeshape.graph.request.CopyBranchRequest; -import org.modeshape.graph.request.CreateNodeRequest; -import org.modeshape.graph.request.CreateWorkspaceRequest; -import org.modeshape.graph.request.DeleteBranchRequest; -import org.modeshape.graph.request.DestroyWorkspaceRequest; -import org.modeshape.graph.request.FullTextSearchRequest; -import org.modeshape.graph.request.GetWorkspacesRequest; -import org.modeshape.graph.request.LockBranchRequest; -import org.modeshape.graph.request.MoveBranchRequest; -import org.modeshape.graph.request.ReadAllChildrenRequest; -import org.modeshape.graph.request.ReadAllPropertiesRequest; -import org.modeshape.graph.request.UnlockBranchRequest; -import org.modeshape.graph.request.UpdatePropertiesRequest; -import org.modeshape.graph.request.VerifyWorkspaceRequest; -import org.modeshape.graph.search.SearchEngineProcessor; +import org.modeshape.graph.request.*; import org.modeshape.graph.search.AbstractSearchEngine.Workspaces; +import org.modeshape.graph.search.SearchEngineProcessor; import org.modeshape.search.lucene.AbstractLuceneSearchEngine.AbstractLuceneProcessor; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + /** * Abstract {@link SearchEngineProcessor} implementation for the {@link LuceneSearchEngine}. */ @@ -68,7 +54,7 @@ public class LuceneSearchProcessor extends AbstractLuceneProcessor { protected static final Columns FULL_TEXT_RESULT_COLUMNS = new FullTextSearchResultColumns(); - private final Logger logger = Logger.getLogger(getClass()); + private static final Logger logger = Logger.getLogger(LuceneSearchProcessor.class); protected LuceneSearchProcessor( String sourceName, ExecutionContext context, Index: modeshape-graph/src/main/java/org/modeshape/graph/connector/RepositoryConnectionPool.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/connector/RepositoryConnectionPool.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/connector/RepositoryConnectionPool.java Mon Feb 08 12:53:36 CET 2010 @@ -23,6 +23,16 @@ */ package org.modeshape.graph.connector; +import net.jcip.annotations.GuardedBy; +import net.jcip.annotations.ThreadSafe; +import org.modeshape.common.util.CheckArg; +import org.modeshape.common.util.Logger; +import org.modeshape.graph.ExecutionContext; +import org.modeshape.graph.GraphI18n; +import org.modeshape.graph.cache.CachePolicy; +import org.modeshape.graph.request.Request; + +import javax.transaction.xa.XAResource; import java.util.Collection; import java.util.HashSet; import java.util.LinkedList; @@ -35,15 +45,6 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; -import javax.transaction.xa.XAResource; -import net.jcip.annotations.GuardedBy; -import net.jcip.annotations.ThreadSafe; -import org.modeshape.common.util.CheckArg; -import org.modeshape.common.util.Logger; -import org.modeshape.graph.ExecutionContext; -import org.modeshape.graph.GraphI18n; -import org.modeshape.graph.cache.CachePolicy; -import org.modeshape.graph.request.Request; /** * A reusable implementation of a managed pool of connections that is optimized for safe concurrent operations. @@ -158,7 +159,7 @@ private final AtomicLong totalConnectionsUsed = new AtomicLong(0); - private final Logger logger = Logger.getLogger(this.getClass()); + private static final Logger LOGGER = Logger.getLogger(RepositoryConnectionPool.class); /** * Create the pool to use the supplied connection factory, which is typically a {@link RepositorySource}. This constructor @@ -485,7 +486,7 @@ SecurityManager security = System.getSecurityManager(); if (security != null) java.security.AccessController.checkPermission(shutdownPerm); - this.logger.debug("Shutting down repository connection pool for {0}", getSourceName()); + LOGGER.debug("Shutting down repository connection pool for {0}", getSourceName()); boolean fullyTerminated = false; final ReentrantLock mainLock = this.mainLock; try { @@ -507,10 +508,10 @@ // If there are no connections being used, trigger full termination now ... if (this.inUseConnections.isEmpty()) { fullyTerminated = true; - this.logger.trace("Signalling termination of repository connection pool for {0}", getSourceName()); + LOGGER.trace("Signalling termination of repository connection pool for {0}", getSourceName()); runState = TERMINATED; termination.signalAll(); - this.logger.debug("Terminated repository connection pool for {0}", getSourceName()); + LOGGER.debug("Terminated repository connection pool for {0}", getSourceName()); } // Otherwise the last connection that is closed will transition the runState to TERMINATED ... } finally { @@ -533,7 +534,7 @@ SecurityManager security = System.getSecurityManager(); if (security != null) java.security.AccessController.checkPermission(shutdownPerm); - this.logger.debug("Shutting down (immediately) repository connection pool for {0}", getSourceName()); + LOGGER.debug("Shutting down (immediately) repository connection pool for {0}", getSourceName()); boolean fullyTerminated = false; final ReentrantLock mainLock = this.mainLock; try { @@ -555,7 +556,7 @@ // If there are connections being used, close them now ... if (!this.inUseConnections.isEmpty()) { for (ConnectionWrapper connectionInUse : this.inUseConnections) { - this.logger.trace("Closing repository connection to {0}", getSourceName()); + LOGGER.trace("Closing repository connection to {0}", getSourceName()); connectionInUse.getOriginal().close(); } this.poolSize -= this.inUseConnections.size(); @@ -563,10 +564,10 @@ } else { // There are no connections in use, so trigger full termination now ... fullyTerminated = true; - this.logger.trace("Signalling termination of repository connection pool for {0}", getSourceName()); + LOGGER.trace("Signalling termination of repository connection pool for {0}", getSourceName()); runState = TERMINATED; termination.signalAll(); - this.logger.debug("Terminated repository connection pool for {0}", getSourceName()); + LOGGER.debug("Terminated repository connection pool for {0}", getSourceName()); } } finally { @@ -638,22 +639,22 @@ */ public boolean awaitTermination( long timeout, TimeUnit unit ) throws InterruptedException { - this.logger.trace("Awaiting termination"); + LOGGER.trace("Awaiting termination"); long nanos = unit.toNanos(timeout); final ReentrantLock mainLock = this.mainLock; try { mainLock.lock(); for (;;) { - // this.logger.trace("---> Run state = {0}; condition = {1}, {2} open", runState, termination, poolSize); + // LOGGER.trace("---> Run state = {0}; condition = {1}, {2} open", runState, termination, poolSize); if (runState == TERMINATED) return true; if (nanos <= 0) return false; nanos = termination.awaitNanos(nanos); - // this.logger.trace("---> Done waiting: run state = {0}; condition = {1}, {2} open",runState,termination,poolSize) + // LOGGER.trace("---> Done waiting: run state = {0}; condition = {1}, {2} open",runState,termination,poolSize) // ; } } finally { mainLock.unlock(); - this.logger.trace("Finished awaiting termination"); + LOGGER.trace("Finished awaiting termination"); } } @@ -710,7 +711,7 @@ try { connection = this.availableConnections.take(); } catch (InterruptedException e) { - this.logger.trace("Cancelled obtaining a repository connection from pool {0}", getSourceName()); + LOGGER.trace("Cancelled obtaining a repository connection from pool {0}", getSourceName()); Thread.interrupted(); throw new RepositorySourceException(getSourceName(), e); } @@ -728,11 +729,11 @@ } if (connection == null) { // There are not enough connections, so wait in line for the next available connection ... - this.logger.trace("Waiting for a repository connection from pool {0}", getSourceName()); + LOGGER.trace("Waiting for a repository connection from pool {0}", getSourceName()); try { connection = this.availableConnections.take(); } catch (InterruptedException e) { - this.logger.trace("Cancelled obtaining a repository connection from pool {0}", getSourceName()); + LOGGER.trace("Cancelled obtaining a repository connection from pool {0}", getSourceName()); Thread.interrupted(); throw new RepositorySourceException(getSourceName(), e); } @@ -745,13 +746,13 @@ } finally { mainLock.unlock(); } - this.logger.trace("Recieved a repository connection from pool {0}", getSourceName()); + LOGGER.trace("Recieved a repository connection from pool {0}", getSourceName()); } if (connection != null && this.validateConnectionBeforeUse.get()) { try { connection = validateConnection(connection); } catch (InterruptedException e) { - this.logger.trace("Cancelled validating a repository connection obtained from pool {0}", getSourceName()); + LOGGER.trace("Cancelled validating a repository connection obtained from pool {0}", getSourceName()); returnConnection(connection); Thread.interrupted(); throw new RepositorySourceException(getSourceName(), e); @@ -863,7 +864,7 @@ RepositoryConnection original = wrapper.getOriginal(); assert original != null; try { - this.logger.debug("Closing repository connection to {0} ({1} open connections remain)", getSourceName(), poolSize); + LOGGER.debug("Closing repository connection to {0} ({1} open connections remain)", getSourceName(), poolSize); original.close(); } finally { final ReentrantLock mainLock = this.mainLock; @@ -874,10 +875,10 @@ // And if shutting down and this was the last connection being used... if ((runState == SHUTDOWN || runState == STOP) && this.poolSize <= 0) { // then signal anybody that has called "awaitTermination(...)" - this.logger.trace("Signalling termination of repository connection pool for {0}", getSourceName()); + LOGGER.trace("Signalling termination of repository connection pool for {0}", getSourceName()); this.runState = TERMINATED; this.termination.signalAll(); - this.logger.trace("Terminated repository connection pool for {0}", getSourceName()); + LOGGER.trace("Terminated repository connection pool for {0}", getSourceName()); // fall through to call terminate() outside of lock. } @@ -890,17 +891,17 @@ @GuardedBy( "mainLock" ) protected int drainUnusedConnections( int count ) { if (count <= 0) return 0; - this.logger.trace("Draining up to {0} unused repository connections to {1}", count, getSourceName()); + LOGGER.trace("Draining up to {0} unused repository connections to {1}", count, getSourceName()); // Drain the extra connections from those available ... Collection extraConnections = new LinkedList(); this.availableConnections.drainTo(extraConnections, count); for (ConnectionWrapper connection : extraConnections) { - this.logger.trace("Closing repository connection to {0}", getSourceName()); + LOGGER.trace("Closing repository connection to {0}", getSourceName()); connection.getOriginal().close(); } int numClosed = extraConnections.size(); this.poolSize -= numClosed; - this.logger.trace("Drained {0} unused connections ({1} open connections remain)", numClosed, poolSize); + LOGGER.trace("Drained {0} unused connections ({1} open connections remain)", numClosed, poolSize); return numClosed; } @@ -909,7 +910,7 @@ // Add connection ... if (this.poolSize < this.corePoolSize) { this.availableConnections.offer(newWrappedConnection()); - this.logger.trace("Added connection to {0} in undersized pool", getSourceName()); + LOGGER.trace("Added connection to {0} in undersized pool", getSourceName()); return true; } return false; @@ -923,7 +924,7 @@ this.availableConnections.offer(newWrappedConnection()); ++n; } - this.logger.trace("Added {0} connection(s) to {1} in undersized pool", n, getSourceName()); + LOGGER.trace("Added {0} connection(s) to {1} in undersized pool", n, getSourceName()); return n; } Index: modeshape-graph/src/main/java/org/modeshape/graph/JaasSecurityContext.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/JaasSecurityContext.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/JaasSecurityContext.java Mon Feb 08 12:56:35 CET 2010 @@ -1,25 +1,21 @@ package org.modeshape.graph; +import net.jcip.annotations.NotThreadSafe; +import org.modeshape.common.util.CheckArg; +import org.modeshape.common.util.Logger; +import org.modeshape.common.util.Reflection; + +import javax.security.auth.Subject; +import javax.security.auth.callback.*; +import javax.security.auth.login.Configuration; +import javax.security.auth.login.LoginContext; +import javax.security.auth.login.LoginException; import java.io.IOException; import java.security.Principal; import java.security.acl.Group; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; -import javax.security.auth.Subject; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.TextOutputCallback; -import javax.security.auth.callback.UnsupportedCallbackException; -import javax.security.auth.login.Configuration; -import javax.security.auth.login.LoginContext; -import javax.security.auth.login.LoginException; -import net.jcip.annotations.NotThreadSafe; -import org.modeshape.common.util.CheckArg; -import org.modeshape.common.util.Logger; -import org.modeshape.common.util.Reflection; /** * JAAS-based {@link SecurityContext security context} that provides authentication and authorization through the JAAS @@ -28,7 +24,7 @@ @NotThreadSafe public final class JaasSecurityContext implements SecurityContext { - private final Logger log = Logger.getLogger(getClass()); + private static final Logger LOGGER = Logger.getLogger(JaasSecurityContext.class); private final LoginContext loginContext; private final String userName; @@ -146,7 +142,7 @@ } } else { userName = principal.getName(); - log.debug("Adding principal user name: " + userName); + LOGGER.debug("Adding principal user name: " + userName); } } } @@ -182,7 +178,7 @@ loggedIn = false; if (loginContext != null) loginContext.logout(); } catch (LoginException le) { - log.info(le, null); + LOGGER.info(le, null); } } Index: modeshape-jcr/src/main/java/org/modeshape/jcr/SessionCache.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/SessionCache.java (revision 1630) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/SessionCache.java Mon Mar 01 16:53:59 CET 2010 @@ -2069,6 +2069,8 @@ @Immutable final class JcrNodeOperations extends GraphSession.NodeOperations { + private final Logger LOGGER = Logger.getLogger(JcrNodeOperations.class); + /** * {@inheritDoc} * @@ -2514,7 +2516,7 @@ multiValuedPropertyNames.add(nameFactory.create(value)); } catch (ValueFormatException e) { String msg = "{0} value \"{1}\" on {2} in \"{3}\" workspace is not a valid name and is being ignored"; - Logger.getLogger(getClass()).trace(e, + LOGGER.trace(e, msg, readable(ModeShapeIntLexicon.MULTI_VALUED_PROPERTIES), value, Index: extensions/modeshape-sequencer-msoffice/src/main/java/org/modeshape/sequencer/msoffice/MSOfficeMetadata.java =================================================================== --- extensions/modeshape-sequencer-msoffice/src/main/java/org/modeshape/sequencer/msoffice/MSOfficeMetadata.java (revision 1596) +++ extensions/modeshape-sequencer-msoffice/src/main/java/org/modeshape/sequencer/msoffice/MSOfficeMetadata.java Mon Mar 01 16:54:24 CET 2010 @@ -23,13 +23,14 @@ */ package org.modeshape.sequencer.msoffice; -import java.util.Date; import org.apache.poi.hpsf.PropertySetFactory; import org.apache.poi.hpsf.SummaryInformation; import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener; import org.modeshape.common.util.Logger; +import java.util.Date; + /** * Metadata about an Microsoft Office file. */ @@ -52,6 +53,7 @@ private int characters; private String creatingApplication; private byte[] thumbnail; + private static final Logger LOGGER = Logger.getLogger(MSOfficeMetadata.class); public void processPOIFSReaderEvent( POIFSReaderEvent event ) { try { @@ -74,7 +76,7 @@ creatingApplication = si.getApplicationName(); thumbnail = si.getThumbnail(); } catch (Exception ex) { - Logger.getLogger(this.getClass()).debug(ex, "Error processing the metadata for the MS Office document"); + LOGGER.debug(ex, "Error processing the metadata for the MS Office document"); } } Index: extensions/modeshape-connector-jdbc-metadata/src/main/java/org/modeshape/connector/meta/jdbc/JdbcMetadataSource.java =================================================================== --- extensions/modeshape-connector-jdbc-metadata/src/main/java/org/modeshape/connector/meta/jdbc/JdbcMetadataSource.java (revision 1596) +++ extensions/modeshape-connector-jdbc-metadata/src/main/java/org/modeshape/connector/meta/jdbc/JdbcMetadataSource.java Mon Feb 08 12:49:17 CET 2010 @@ -48,7 +48,7 @@ private static final long serialVersionUID = 1L; - private final Logger log = Logger.getLogger(JdbcMetadataSource.class); + private static final Logger LOGGER = Logger.getLogger(JdbcMetadataSource.class); protected static final String SOURCE_NAME = "sourceName"; protected static final String ROOT_NODE_UUID = "rootNodeUuid"; @@ -186,7 +186,7 @@ Context context = new InitialContext(); dataSource = (DataSource)context.lookup(this.dataSourceJndiName); } catch (Throwable t) { - log.error(t, JdbcMetadataI18n.errorFindingDataSourceInJndi, name, dataSourceJndiName); + LOGGER.error(t, JdbcMetadataI18n.errorFindingDataSourceInJndi, name, dataSourceJndiName); } } @@ -201,7 +201,7 @@ } } catch (Throwable t) { I18n msg = JdbcMetadataI18n.errorSettingContextClassLoader; - log.error(t, msg, name, driverClassloaderName); + LOGGER.error(t, msg, name, driverClassloaderName); } } Index: modeshape-graph/src/main/java/org/modeshape/graph/query/optimize/RuleBasedOptimizer.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/query/optimize/RuleBasedOptimizer.java (revision 1596) +++ modeshape-graph/src/main/java/org/modeshape/graph/query/optimize/RuleBasedOptimizer.java Mon Feb 08 12:55:05 CET 2010 @@ -39,7 +39,7 @@ @Immutable public class RuleBasedOptimizer implements Optimizer { - private final Logger logger = Logger.getLogger(getClass()); + private static final Logger LOGGER = Logger.getLogger(RuleBasedOptimizer.class); /** * {@inheritDoc} @@ -54,7 +54,7 @@ Problems problems = context.getProblems(); while (rules.peek() != null && !problems.hasErrors()) { OptimizerRule nextRule = rules.poll(); - logger.debug("Running query optimizer rule {0}", nextRule); + LOGGER.debug("Running query optimizer rule {0}", nextRule); plan = nextRule.execute(context, plan, rules); } Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrEngine.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrEngine.java (revision 1655) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrEngine.java Thu Feb 25 12:56:50 CET 2010 @@ -71,7 +71,7 @@ final static int LOCK_SWEEP_INTERVAL_IN_MILLIS = 30000; final static int LOCK_EXTENSION_INTERVAL_IN_MILLIS = LOCK_SWEEP_INTERVAL_IN_MILLIS * 2; - private final Logger log = Logger.getLogger(ModeShapeEngine.class); + private static final Logger log = Logger.getLogger(ModeShapeEngine.class); private final Map repositories; private final Lock repositoriesLock; Index: modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryQueryManager.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryQueryManager.java (revision 1662) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryQueryManager.java Mon Mar 01 16:11:41 CET 2010 @@ -23,14 +23,6 @@ */ package org.modeshape.jcr; -import java.io.File; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import javax.jcr.RepositoryException; -import javax.jcr.query.InvalidQueryException; import org.apache.lucene.analysis.snowball.SnowballAnalyzer; import org.apache.lucene.util.Version; import org.modeshape.common.collection.Problems; @@ -76,6 +68,15 @@ import org.modeshape.search.lucene.LuceneConfigurations; import org.modeshape.search.lucene.LuceneSearchEngine; +import javax.jcr.RepositoryException; +import javax.jcr.query.InvalidQueryException; +import java.io.File; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + /** * */