Skip to content

Commit b5c4e39

Browse files
committed
Removed dependency on GlassFish maven repo - replaced commons-logging with rewrite-logging
1 parent 45d3168 commit b5c4e39

32 files changed

Lines changed: 445 additions & 692 deletions

‎core/src/main/java/com/ocpsoft/pretty/PrettyContext.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,24 @@
2323
import javax.servlet.http.HttpServletRequest;
2424
import javax.servlet.http.HttpServletResponse;
2525

26-
import org.apache.commons.logging.Log;
27-
import org.apache.commons.logging.LogFactory;
28-
2926
import com.ocpsoft.pretty.faces.config.PrettyConfig;
3027
import com.ocpsoft.pretty.faces.config.PrettyConfigurator;
3128
import com.ocpsoft.pretty.faces.config.mapping.UrlMapping;
3229
import com.ocpsoft.pretty.faces.url.QueryString;
3330
import com.ocpsoft.pretty.faces.url.URL;
3431
import com.ocpsoft.pretty.faces.util.Assert;
32+
import com.ocpsoft.rewrite.logging.Logger;
3533

3634
/**
3735
* @author Lincoln Baxter, III <lincoln@ocpsoft.com>
3836
*/
3937
public class PrettyContext implements Serializable
4038
{
39+
private static final Logger log = Logger.getLogger(PrettyContext.class);
4140

4241
private static final String DEFAULT_ENCODING = "UTF-8";
4342
public static final String CONFIG_KEY = "com.ocpsoft.pretty.CONFIG_FILES";
4443

45-
private static final Log log = LogFactory.getLog(PrettyContext.class);
4644
private static final long serialVersionUID = -4593906924975844541L;
4745

4846
public static final String PRETTY_PREFIX = "pretty:";

‎core/src/main/java/com/ocpsoft/pretty/faces/application/PrettyRedirector.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,21 @@
2222
import javax.faces.context.FacesContext;
2323
import javax.servlet.http.HttpServletResponse;
2424

25-
import org.apache.commons.logging.Log;
26-
import org.apache.commons.logging.LogFactory;
27-
2825
import com.ocpsoft.pretty.PrettyContext;
2926
import com.ocpsoft.pretty.PrettyException;
3027
import com.ocpsoft.pretty.faces.beans.ExtractedValuesURLBuilder;
3128
import com.ocpsoft.pretty.faces.config.PrettyConfig;
3229
import com.ocpsoft.pretty.faces.config.mapping.UrlMapping;
3330
import com.ocpsoft.pretty.faces.url.QueryString;
3431
import com.ocpsoft.pretty.faces.url.URL;
32+
import com.ocpsoft.rewrite.logging.Logger;
3533

3634
/**
3735
* @author Lincoln Baxter, III <lincoln@ocpsoft.com>
3836
*/
3937
public class PrettyRedirector
4038
{
41-
private static final Log log = LogFactory.getLog(PrettyRedirector.class);
39+
private static final Logger log = Logger.getLogger(PrettyRedirector.class);
4240
private final ExtractedValuesURLBuilder builder = new ExtractedValuesURLBuilder();
4341

4442
public static PrettyRedirector getInstance()
@@ -103,7 +101,7 @@ public void send404(final FacesContext facesContext)
103101
}
104102
}
105103

106-
private boolean isPrettyNavigationCase(PrettyContext prettyContext, final String action)
104+
private boolean isPrettyNavigationCase(final PrettyContext prettyContext, final String action)
107105
{
108106
PrettyConfig config = prettyContext.getConfig();
109107
return (action != null) && config.isMappingId(action) && action.trim().startsWith(PrettyContext.PRETTY_PREFIX);

‎core/src/main/java/com/ocpsoft/pretty/faces/beans/ActionExecutor.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
import javax.faces.context.FacesContext;
2222
import javax.faces.event.PhaseId;
2323

24-
import org.apache.commons.logging.Log;
25-
import org.apache.commons.logging.LogFactory;
26-
2724
import com.ocpsoft.pretty.PrettyContext;
2825
import com.ocpsoft.pretty.PrettyException;
2926
import com.ocpsoft.pretty.faces.config.mapping.UrlAction;
@@ -32,13 +29,14 @@
3229
import com.ocpsoft.pretty.faces.util.FacesMessagesUtils;
3330
import com.ocpsoft.pretty.faces.util.FacesStateUtils;
3431
import com.ocpsoft.pretty.faces.util.PhaseIdComparator;
32+
import com.ocpsoft.rewrite.logging.Logger;
3533

3634
/**
3735
* @author Lincoln Baxter, III <lincoln@ocpsoft.com>
3836
*/
3937
public class ActionExecutor
4038
{
41-
private static final Log log = LogFactory.getLog(ActionExecutor.class);
39+
private static final Logger log = Logger.getLogger(ActionExecutor.class);
4240
private static final FacesElUtils elUtils = new FacesElUtils();
4341
private final FacesMessagesUtils mu = new FacesMessagesUtils();
4442

‎core/src/main/java/com/ocpsoft/pretty/faces/beans/ParameterInjector.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
import javax.faces.context.FacesContext;
2121
import javax.faces.convert.Converter;
2222

23-
import org.apache.commons.logging.Log;
24-
import org.apache.commons.logging.LogFactory;
25-
2623
import com.ocpsoft.pretty.PrettyContext;
2724
import com.ocpsoft.pretty.PrettyException;
2825
import com.ocpsoft.pretty.faces.config.mapping.PathParameter;
@@ -33,13 +30,14 @@
3330
import com.ocpsoft.pretty.faces.util.FacesElUtils;
3431
import com.ocpsoft.pretty.faces.util.FacesStateUtils;
3532
import com.ocpsoft.pretty.faces.util.NullComponent;
33+
import com.ocpsoft.rewrite.logging.Logger;
3634

3735
/**
3836
* @author Lincoln Baxter, III <lincoln@ocpsoft.com>
3937
*/
4038
public class ParameterInjector
4139
{
42-
private static final Log log = LogFactory.getLog(ParameterInjector.class);
40+
private static final Logger log = Logger.getLogger(ParameterInjector.class);
4341
private static final FacesElUtils elUtils = new FacesElUtils();
4442

4543
public void injectParameters(final FacesContext context)

‎core/src/main/java/com/ocpsoft/pretty/faces/beans/ParameterValidator.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
import javax.faces.validator.ValidatorException;
2828
import javax.servlet.http.HttpServletResponse;
2929

30-
import org.apache.commons.logging.Log;
31-
import org.apache.commons.logging.LogFactory;
32-
3330
import com.ocpsoft.pretty.PrettyContext;
3431
import com.ocpsoft.pretty.PrettyException;
3532
import com.ocpsoft.pretty.faces.config.mapping.PathParameter;
@@ -39,13 +36,14 @@
3936
import com.ocpsoft.pretty.faces.url.URL;
4037
import com.ocpsoft.pretty.faces.util.FacesElUtils;
4138
import com.ocpsoft.pretty.faces.util.NullComponent;
39+
import com.ocpsoft.rewrite.logging.Logger;
4240

4341
/**
4442
* @author Lincoln Baxter, III <lincoln@ocpsoft.com>
4543
*/
4644
public class ParameterValidator
4745
{
48-
private static final Log log = LogFactory.getLog(ParameterInjector.class);
46+
private static final Logger log = Logger.getLogger(ParameterInjector.class);
4947
private static final FacesElUtils elUtils = new FacesElUtils();
5048

5149
public void validateParameters(final FacesContext context)
@@ -77,7 +75,7 @@ private void validatePathParams(final FacesContext context, final URL url, final
7775

7876
List<PathValidator> validators = mapping.getValidatorsForPathParam(param);
7977

80-
if (validators != null && validators.size() > 0)
78+
if ((validators != null) && (validators.size() > 0))
8179
{
8280
String value = param.getValue();
8381
Object coerced = elUtils.coerceToType(context, param.getExpression().getELExpression(), value);

‎core/src/main/java/com/ocpsoft/pretty/faces/config/PrettyConfigurator.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
import javax.servlet.ServletContext;
1919

20-
import org.apache.commons.logging.Log;
21-
import org.apache.commons.logging.LogFactory;
22-
2320
import com.ocpsoft.pretty.PrettyContext;
2421
import com.ocpsoft.pretty.PrettyException;
2522
import com.ocpsoft.pretty.faces.config.dynaview.DynaviewEngine;
@@ -29,6 +26,7 @@
2926
import com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor;
3027
import com.ocpsoft.pretty.faces.spi.ConfigurationProvider;
3128
import com.ocpsoft.pretty.faces.util.ServiceLoader;
29+
import com.ocpsoft.rewrite.logging.Logger;
3230

3331
/**
3432
* @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
@@ -37,7 +35,7 @@
3735
public class PrettyConfigurator
3836
{
3937

40-
private static final Log log = LogFactory.getLog(PrettyConfigurator.class);
38+
private static final Logger log = Logger.getLogger(PrettyConfigurator.class);
4139

4240
private final ServletContext servletContext;
4341

‎core/src/main/java/com/ocpsoft/pretty/faces/config/annotation/AbstractClassFinder.java‎

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
import javax.servlet.ServletContext;
2323

24-
import org.apache.commons.logging.Log;
25-
import org.apache.commons.logging.LogFactory;
24+
import com.ocpsoft.rewrite.logging.Logger;
2625

2726
/**
2827
* Base class for implementations of the {@link ClassFinder} interface.
@@ -36,7 +35,7 @@ public abstract class AbstractClassFinder implements ClassFinder
3635
/**
3736
* Common logger for all implementations
3837
*/
39-
protected final Log log = LogFactory.getLog(this.getClass());
38+
protected final Logger log = Logger.getLogger(this.getClass());
4039

4140
/**
4241
* The {@link ServletContext}
@@ -52,7 +51,7 @@ public abstract class AbstractClassFinder implements ClassFinder
5251
* The filter for checking which classes to process
5352
*/
5453
protected final PackageFilter packageFilter;
55-
54+
5655
/**
5756
* The filter to check bytecode for interesting annotations
5857
*/
@@ -61,15 +60,12 @@ public abstract class AbstractClassFinder implements ClassFinder
6160
/**
6261
* Initialization procedure
6362
*
64-
* @param servletContext
65-
* The {@link ServletContext} of the web application.
66-
* @param classLoader
67-
* The {@link ClassLoader} to use for loading classes
68-
* @param packageFilter
69-
* The {@link PackageFilter} used to check if a package has to be
70-
* scanned.
63+
* @param servletContext The {@link ServletContext} of the web application.
64+
* @param classLoader The {@link ClassLoader} to use for loading classes
65+
* @param packageFilter The {@link PackageFilter} used to check if a package has to be scanned.
7166
*/
72-
public AbstractClassFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter)
67+
public AbstractClassFinder(final ServletContext servletContext, final ClassLoader classLoader,
68+
final PackageFilter packageFilter)
7369
{
7470
this.servletContext = servletContext;
7571
this.classLoader = classLoader;
@@ -80,14 +76,11 @@ public AbstractClassFinder(ServletContext servletContext, ClassLoader classLoade
8076
/**
8177
* Strip everything up to and including a given prefix from a string.
8278
*
83-
* @param str
84-
* The string to process
85-
* @param prefix
86-
* The prefix
87-
* @return the stripped string or <code>null</code> if the prefix has not
88-
* been found
79+
* @param str The string to process
80+
* @param prefix The prefix
81+
* @return the stripped string or <code>null</code> if the prefix has not been found
8982
*/
90-
protected String stripKnownPrefix(String str, String prefix)
83+
protected String stripKnownPrefix(final String str, final String prefix)
9184
{
9285

9386
int startIndex = str.lastIndexOf(prefix);
@@ -98,18 +91,16 @@ protected String stripKnownPrefix(String str, String prefix)
9891

9992
return null;
10093
}
101-
94+
10295
/**
10396
* <p>
104-
* Creates a FQCN from an {@link URL} representing a <code>.class</code>
105-
* file.
97+
* Creates a FQCN from an {@link URL} representing a <code>.class</code> file.
10698
* </p>
107-
*
108-
* @param url
109-
* The path of the class file
99+
*
100+
* @param url The path of the class file
110101
* @return the FQCN of the class
111102
*/
112-
protected static String getClassName(String filename)
103+
protected static String getClassName(final String filename)
113104
{
114105

115106
// end index is just before ".class"
@@ -123,15 +114,12 @@ protected static String getClassName(String filename)
123114
}
124115

125116
/**
126-
* Checks if a supplied class has to be processed by checking the package
127-
* name against the {@link PackageFilter}.
117+
* Checks if a supplied class has to be processed by checking the package name against the {@link PackageFilter}.
128118
*
129-
* @param className
130-
* FQCN of the class
131-
* @return <code>true</code> for classes to process, <code>false</code> for
132-
* classes to ignore
119+
* @param className FQCN of the class
120+
* @return <code>true</code> for classes to process, <code>false</code> for classes to ignore
133121
*/
134-
protected boolean mustProcessClass(String className)
122+
protected boolean mustProcessClass(final String className)
135123
{
136124

137125
// the default package
@@ -151,36 +139,31 @@ protected boolean mustProcessClass(String className)
151139

152140
/**
153141
* <p>
154-
* Handle a single class to process. This method should only be called if the
155-
* class name is accepted by the {@link PackageFilter}.
142+
* Handle a single class to process. This method should only be called if the class name is accepted by the
143+
* {@link PackageFilter}.
156144
* </p>
157145
* <p>
158-
* If <code>classFileStream</code> is not <code>null</code> the method will first
159-
* try to check whether the class files may contain annotations by scanning
160-
* it with the {@link ByteCodeAnnotationFilter}. If no {@link InputStream} is
161-
* supplied, this check will be skipped. After that the method will create an
162-
* instance of the class and then call
146+
* If <code>classFileStream</code> is not <code>null</code> the method will first try to check whether the class
147+
* files may contain annotations by scanning it with the {@link ByteCodeAnnotationFilter}. If no {@link InputStream}
148+
* is supplied, this check will be skipped. After that the method will create an instance of the class and then call
163149
* {@link PrettyAnnotationHandler#processClass(Class)}.
164150
* </p>
165151
* <p>
166-
* Please not the the called of this method is responsible to close the
167-
* supplied {@link InputStream}!
152+
* Please not the the called of this method is responsible to close the supplied {@link InputStream}!
168153
* </p>
169154
*
170-
* @param className
171-
* The FQCN of the class
172-
* @param classFileStream
173-
* The Java class file of the class (may be <code>null</code>)
174-
* @param handler
175-
* the handler to notify
155+
* @param className The FQCN of the class
156+
* @param classFileStream The Java class file of the class (may be <code>null</code>)
157+
* @param handler the handler to notify
176158
*/
177-
protected void processClass(String className, InputStream classFileStream, PrettyAnnotationHandler handler)
159+
protected void processClass(final String className, final InputStream classFileStream,
160+
final PrettyAnnotationHandler handler)
178161
{
179162

180-
// bytecode check is only performed if the InputStream is available
163+
// bytecode check is only performed if the InputStream is available
181164
if (classFileStream != null)
182165
{
183-
166+
184167
// we must take care of IOExceptions thrown by ByteCodeAnnotationFilter
185168
try
186169
{
@@ -199,7 +182,7 @@ protected void processClass(String className, InputStream classFileStream, Prett
199182
{
200183
log.debug("Bytecode filter recommends to scan class: " + className);
201184
}
202-
185+
203186
}
204187
catch (IOException e)
205188
{
@@ -209,7 +192,7 @@ protected void processClass(String className, InputStream classFileStream, Prett
209192
}
210193
}
211194
}
212-
195+
213196
try
214197
{
215198
// request this class from the ClassLoader

0 commit comments

Comments
 (0)