diff --git a/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextFactory.java b/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextFactory.java index e70ff569..3112b440 100644 --- a/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextFactory.java +++ b/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextFactory.java @@ -48,6 +48,7 @@ public class SliceContextFactory implements ContextFactory { * @deprecated Use method with explicit injector name * {@code ContextFactory#getServletRequestContext(String, ServletRequest, ServletResponse)} */ + @Deprecated @Override public Context getServletRequestContext(ServletRequest request, ServletResponse response) { return getServletRequestContext(COMMON_CONTEXT_NAME, request, response); diff --git a/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextScope.java b/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextScope.java index 7313d778..0faa6d0a 100644 --- a/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextScope.java +++ b/slice-core/src/main/java/com/cognifide/slice/core/internal/context/SliceContextScope.java @@ -1,9 +1,9 @@ /*- - * #%L - * Slice - Core - * %% - * Copyright (C) 2012 Cognifide Limited - * %% + * #%L + * Slice - Core + * %% + * Copyright (C) 2012 Cognifide Limited + * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License. + * limitations under the License. * #L% */ @@ -46,10 +46,12 @@ public SliceContextScope() { threadContextProvider = new ThreadLocal(); } + @Override public void setContextProvider(final ContextProvider contextProvider) { threadContextProvider.set(contextProvider); } + @Override public ContextProvider getContextProvider() { return threadContextProvider.get(); } diff --git a/slice-core/src/main/java/com/cognifide/slice/core/internal/filter/ContextRequestFilter.java b/slice-core/src/main/java/com/cognifide/slice/core/internal/filter/ContextRequestFilter.java index 4f929944..50f94944 100644 --- a/slice-core/src/main/java/com/cognifide/slice/core/internal/filter/ContextRequestFilter.java +++ b/slice-core/src/main/java/com/cognifide/slice/core/internal/filter/ContextRequestFilter.java @@ -118,10 +118,12 @@ private Context createContext(String injectorName, ServletRequest request, Servl @Override public void init(final FilterConfig filterConfig) throws ServletException { + // required by the Filter interface but no implementation is needed in this case } @Override public void destroy() { + // required by the Filter interface but no implementation is needed in this case } } diff --git a/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelClassResolver.java b/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelClassResolver.java index 626b130a..f4b879af 100644 --- a/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelClassResolver.java +++ b/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelClassResolver.java @@ -40,11 +40,15 @@ import com.cognifide.slice.api.model.ModelClassResolver; import com.cognifide.slice.api.provider.ComponentDefinitionProvider; import com.cognifide.slice.api.provider.ComponentDefinitionResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Component @Service public class SliceModelClassResolver implements ModelClassResolver { + private static final Logger LOG = LoggerFactory.getLogger(SliceModelClassResolver.class); + @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY,policyOption = ReferencePolicyOption.GREEDY) private ComponentDefinitionResolver componentDefinitionResolver; @@ -111,6 +115,10 @@ private Map getDefinition(String resourceType) { private Map getDefinitionWithResolver(String resourceType) { ResourceResolver resolver = null; try { + /* + FIXME: This method has been deprecated as of Sling 2.4 (bundle version 2.5.0) + consider replacing it with getServiceResourceResolver + */ resolver = resourceResolverFactory.getAdministrativeResourceResolver(null); final Resource componentDefinition = resolver.getResource(resourceType); if (componentDefinition != null) { @@ -121,6 +129,7 @@ private Map getDefinitionWithResolver(String resourceType) { } return null; } catch (LoginException e) { + LOG.error("Failed to load definition due to insufficient permissions.", e); return null; } finally { if (resolver != null) { diff --git a/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelProvider.java b/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelProvider.java index 6081c8f6..ac85e2ce 100644 --- a/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelProvider.java +++ b/slice-core/src/main/java/com/cognifide/slice/core/internal/provider/SliceModelProvider.java @@ -52,6 +52,8 @@ public class SliceModelProvider implements ModelProvider { private static final Logger LOG = LoggerFactory.getLogger(SliceModelProvider.class); + public static final String NEW_INSTANCE_FROM_ADAPTABLE_MESSAGE = "creating new instance of {} from {}"; + private final Injector injector; private final ContextScope contextScope; @@ -98,7 +100,7 @@ public final T get(final Class type, final String path) { * against servlet specification. */ ExecutionContextImpl executionItem = new ExecutionContextImpl(path); - LOG.debug("creating new instance of {} from {}", new Object[] { type.getName(), path }); + LOG.debug(NEW_INSTANCE_FROM_ADAPTABLE_MESSAGE, new Object[] { type.getName(), path }); return get(type, executionItem); } @@ -108,7 +110,7 @@ public final T get(final Class type, final String path) { @Override public T get(Class type, Resource resource) { ExecutionContextImpl executionItem = new ExecutionContextImpl(resource); - LOG.debug("creating new instance of {} from {}", new Object[] { type.getName(), resource }); + LOG.debug(NEW_INSTANCE_FROM_ADAPTABLE_MESSAGE, new Object[] { type.getName(), resource }); return get(type, executionItem); } @@ -118,7 +120,7 @@ public T get(Class type, Resource resource) { @Override public T get(Key key, Resource resource) { ExecutionContextImpl executionItem = new ExecutionContextImpl(resource); - LOG.debug("creating new instance of {} from {}", new Object[] { key.toString(), resource }); + LOG.debug(NEW_INSTANCE_FROM_ADAPTABLE_MESSAGE, new Object[] { key.toString(), resource }); return get(key, executionItem); } @@ -128,7 +130,7 @@ public T get(Key key, Resource resource) { @Override public T get(Key key, String path) { ExecutionContextImpl executionItem = new ExecutionContextImpl(path); - LOG.debug("creating new instance of {} from {}", new Object[] { key.toString(), path }); + LOG.debug(NEW_INSTANCE_FROM_ADAPTABLE_MESSAGE, new Object[] { key.toString(), path }); return get(key, executionItem); }