Skip to content

Commit 6355f08

Browse files
committed
All SPIs should now implement Weighted (just in case) and some more refactoring and documentation
1 parent 9240abb commit 6355f08

29 files changed

Lines changed: 138 additions & 24 deletions

File tree

‎annotations-api/src/main/java/org/ocpsoft/rewrite/annotation/spi/ClassFinder.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
*/
1616
package org.ocpsoft.rewrite.annotation.spi;
1717

18+
import org.ocpsoft.common.pattern.Weighted;
1819
import org.ocpsoft.rewrite.annotation.api.ClassVisitor;
1920

2021
/**
2122
* Common interface for implementations that scan for classes on the classpath.
2223
*
2324
* @author Christian Kaltepoth
2425
*/
25-
public interface ClassFinder
26+
public interface ClassFinder extends Weighted
2627
{
2728
/**
2829
* Starting to search for classes. The supplied {@link ClassVisitor} must be called for every class found.

‎annotations-impl/src/main/java/org/ocpsoft/rewrite/annotation/scan/WebClassesFinder.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,10 @@ private String getPathRelativeToClassesFolder(String path, String classesFolderP
234234

235235
}
236236

237+
@Override
238+
public int priority()
239+
{
240+
return 0;
241+
}
242+
237243
}

‎annotations-impl/src/main/java/org/ocpsoft/rewrite/annotation/scan/WebLibFinder.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,10 @@ private void processJarFile(URL jarUrl, ClassVisitor visitor)
166166

167167
}
168168

169+
@Override
170+
public int priority()
171+
{
172+
return 0;
173+
}
174+
169175
}

‎api-el/src/main/java/org/ocpsoft/rewrite/el/spi/BeanNameResolver.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
* </p>
2222
*
2323
* @author Christian Kaltepoth
24-
*
2524
*/
2625
public interface BeanNameResolver
2726
{
28-
27+
/**
28+
* Resolve the EL name of the given {@link Class} bean type.
29+
*/
2930
String getBeanName(Class<?> clazz);
30-
3131
}

‎api-servlet/src/main/java/org/ocpsoft/rewrite/servlet/spi/ContextListener.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
*/
1616
package org.ocpsoft.rewrite.servlet.spi;
1717

18+
import javax.servlet.ServletContext;
1819
import javax.servlet.ServletContextEvent;
1920

21+
import org.ocpsoft.common.pattern.Weighted;
22+
2023
/**
2124
* Listens to {@link ServletContextEvent}.
2225
*
@@ -31,9 +34,15 @@
3134
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3235
*
3336
*/
34-
public interface ContextListener
37+
public interface ContextListener extends Weighted
3538
{
39+
/**
40+
* Respond to {@link ServletContext} initialized event.
41+
*/
3642
void contextInitialized(ServletContextEvent event);
3743

44+
/**
45+
* Respond to {@link ServletContext} destroyed event.
46+
*/
3847
void contextDestroyed(ServletContextEvent event);
3948
}

‎api-servlet/src/main/java/org/ocpsoft/rewrite/servlet/spi/InboundRewriteProducer.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@
2020

2121
import org.ocpsoft.common.pattern.Specialized;
2222
import org.ocpsoft.common.pattern.Weighted;
23-
2423
import org.ocpsoft.rewrite.servlet.event.InboundServletRewrite;
2524

2625
/**
27-
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
26+
* SPI for creating {@link InboundServletRewrite} event types.
2827
*
28+
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
2929
*/
3030
public interface InboundRewriteProducer<IN extends ServletRequest, OUT extends ServletResponse> extends
31-
Specialized<ServletRequest>, Weighted
31+
Specialized<ServletRequest>, Weighted
3232
{
33+
/**
34+
* Create an {@link InboundServletRewrite} instance.
35+
*/
3336
InboundServletRewrite<IN, OUT> createInboundRewrite(ServletRequest request, ServletResponse response);
3437
}

‎api-servlet/src/main/java/org/ocpsoft/rewrite/servlet/spi/OutboundRewriteProducer.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@
2020

2121
import org.ocpsoft.common.pattern.Specialized;
2222
import org.ocpsoft.common.pattern.Weighted;
23-
2423
import org.ocpsoft.rewrite.servlet.event.OutboundServletRewrite;
2524

2625
/**
26+
* SPI for creating {@link OutboundRewriteEvent} instances.
2727
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
2828
*
2929
*/
3030
public interface OutboundRewriteProducer<IN extends ServletRequest, OUT extends ServletResponse, P> extends
3131
Specialized<ServletResponse>, Weighted
3232
{
33+
/**
34+
* Create an {@link OutboundServletRewrite} instance.
35+
*/
3336
OutboundServletRewrite<IN, OUT> createOutboundRewrite(ServletRequest request, ServletResponse response, P payload);
3437
}

‎api-servlet/src/main/java/org/ocpsoft/rewrite/servlet/spi/RequestListener.java‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,26 @@
1515
*/
1616
package org.ocpsoft.rewrite.servlet.spi;
1717

18+
import javax.servlet.ServletContext;
19+
import javax.servlet.ServletRequest;
1820
import javax.servlet.ServletRequestEvent;
1921

22+
import org.ocpsoft.common.pattern.Weighted;
23+
2024
/**
21-
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
25+
* Respond to {@link ServletRequest} event types.
2226
*
27+
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
2328
*/
24-
public interface RequestListener
29+
public interface RequestListener extends Weighted
2530
{
31+
/**
32+
* Respond to {@link ServletRequest} initialized event.
33+
*/
2634
void requestInitialized(ServletRequestEvent event);
2735

36+
/**
37+
* Respond to {@link ServletContext} destroyed event.
38+
*/
2839
void requestDestroyed(ServletRequestEvent event);
2940
}

‎api-servlet/src/main/java/org/ocpsoft/rewrite/servlet/spi/RequestParameterProvider.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import javax.servlet.ServletResponse;
2222
import javax.servlet.http.HttpServletRequest;
2323

24+
import org.ocpsoft.common.pattern.Weighted;
25+
2426
/**
2527
* Supplies additional request parameters to the {@link HttpServletRequest} object.
2628
*
@@ -35,7 +37,7 @@
3537
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3638
*
3739
*/
38-
public interface RequestParameterProvider
40+
public interface RequestParameterProvider extends Weighted
3941
{
4042
/**
4143
* Return a map of parameters to be added to the current request as if they had been passed with the HTTP request

‎api/src/main/java/org/ocpsoft/rewrite/spi/InstanceProvider.java‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2012 <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.ocpsoft.rewrite.spi;
217

318
import org.ocpsoft.common.pattern.Weighted;

0 commit comments

Comments
 (0)