Skip to content

Commit ebda7b1

Browse files
committedMar 3, 2019
Doc+cleanup
1 parent dcbfdc9 commit ebda7b1

File tree

8 files changed

+35
-22
lines changed

8 files changed

+35
-22
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ uses agent services to:
145145

146146
#### Java frameworks plugins:
147147

148+
* [CXF-JAXRS](plugin/hotswap-agent-cxf-plugin/README.md) (3.x) - redefine JAXRS resource after resource class redefinition, reinject instance if integrated with CDI (Weld/OWB).
148149
* [Deltaspike](plugin/hotswap-agent-deltaspike-plugin/README.md) (1.x) - messages, ViewConfig, repository, proxy reloading. Deltaspike scoped CDI beans reinjection.
149150
* [ELResolver](plugin/hotswap-agent-el-resolver-plugin/README.md) 2.2 (JuelEL, Appache Commons EL, Oracle EL 3.0)- clear ELResolver cache on class change. Support hotswap for #{...} expressions.
150151
* [Hibernate](plugin/hotswap-agent-hibernate-plugin/README.md) (3x,4x,5x) - Reload Hibernate configuration after entity create/change.
+12-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
[CXF plugin](http://)
2-
===========================================
1+
[CXF](http://cxf.apache.org/)
2+
=============================
33

4-
JARX-RS
5-
=======
4+
[CxfJAXRSPlugin](http://cxf.apache.org/docs/jax-rs.html)
5+
=======================================================
6+
CxfJAXRSPlugin redefine resource classes (services) on resource class modification.
7+
8+
This plugin does not handle javax.ws.rs.ext.* annotations like @Provider
69

710
#### Implementation notes:
11+
ClassResourceInfo instance is proxied using javassist delegating proxy. When service class is modified then delegating instance of
12+
ClassResource info is recreated using original creational parameters from first definition. Injection points in service innstance
13+
are re-injected in following enviroments:
14+
* CDI - Weld
15+
* CDI - OWB
816

‎plugin/hotswap-agent-cxf-plugin/src/main/java/org/hotswap/agent/plugin/cxf/jaxrs/ClassResourceInfoProxyHelper.java

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import java.lang.reflect.Method;
2222

23-
import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
2423
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
2524
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
2625
import org.apache.cxf.jaxrs.utils.ResourceUtils;

‎plugin/hotswap-agent-cxf-plugin/src/main/java/org/hotswap/agent/plugin/cxf/jaxrs/CxfJAXRSPlugin.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
import java.util.Map;
2525
import java.util.WeakHashMap;
2626

27-
import org.hotswap.agent.annotation.FileEvent;
2827
import org.hotswap.agent.annotation.Init;
2928
import org.hotswap.agent.annotation.LoadEvent;
30-
import org.hotswap.agent.annotation.OnClassFileEvent;
3129
import org.hotswap.agent.annotation.OnClassLoadEvent;
3230
import org.hotswap.agent.annotation.Plugin;
3331
import org.hotswap.agent.command.Command;
@@ -53,7 +51,7 @@
5351
*
5452
*/
5553
@Plugin(name = "CxfJAXRS",
56-
description = "CXF-JAXRS forntend plugin. Reload services on class change.", //
54+
description = "CXF-JAXRS plugin for JAXRS CXF frontend. Reload jaxrs resource on resource class change. Reinject resource's injection points.", //
5755
testedVersions = { "3.2.7" },
5856
expectedVersions = { "3.2.7" })
5957
public class CxfJAXRSPlugin {
@@ -166,7 +164,7 @@ public static void patchClassResourceInfo(CtClass ctClass, ClassPool classPool)
166164
}
167165

168166
@OnClassLoadEvent(classNameRegexp = ".*", events = LoadEvent.REDEFINE)
169-
public void entityReload(ClassLoader classLoader, CtClass clazz, Class<?> original) {
167+
public void classReload(ClassLoader classLoader, CtClass clazz, Class<?> original) {
170168
if (AnnotationHelper.hasAnnotation(original, PATH_ANNOTATION)
171169
|| AnnotationHelper.hasAnnotation(clazz, PATH_ANNOTATION)) {
172170
if(LOGGER.isLevelEnabled(Level.TRACE)) {
@@ -176,15 +174,17 @@ public void entityReload(ClassLoader classLoader, CtClass clazz, Class<?> origin
176174
}
177175
}
178176

177+
/*
179178
@OnClassFileEvent(classNameRegexp = ".*", events = { FileEvent.CREATE })
180-
public void newEntity(ClassLoader classLoader, CtClass clazz) throws Exception {
179+
public void newClass(ClassLoader classLoader, CtClass clazz) throws Exception {
181180
if (AnnotationHelper.hasAnnotation(clazz, PATH_ANNOTATION)) {
182181
if(LOGGER.isLevelEnabled(Level.TRACE)) {
183182
LOGGER.trace("Load @Path annotated class {}", clazz.getName());
184183
}
185184
refreshClass(classLoader, clazz.getName(), null, WAIT_ON_CREATE);
186185
}
187186
}
187+
*/
188188

189189
private void refreshClass(ClassLoader classLoader, String className, Class<?> original, int timeout) {
190190
try {

‎plugin/hotswap-agent-owb-plugin/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[Open Web Beans/CDI](http://openwebbeans.apache.org/)
22
=====================================
3-
Reinject injection points after bean redefinition. Define and register new bean in BeanManager if a new bean class is defined.
4-
Redefine proxy class if proxied class is redefined. Appropriate redefinition can be specified in `hotswap-agent.properties` file. Generally
5-
there are 2 approaches what to do after bean class redefinition:
3+
Reinject injection points after bean redefinition. Define and register a new bean in BeanManager on new bean definition.
4+
Redefine proxy class if proxied class is redefined. Appropriate redefinition can be specified in `hotswap-agent.properties` file.
5+
There are 2 approaches what to do after bean class redefinition:
66

7-
* reinject injection points in existing bean instances - bean instances **survive**
8-
* reload existing bean instances in contexts - bean instances are **lost**
7+
* reinject injection points in existing bean instances - old bean instances **survive**
8+
* reload existing bean instances in contexts - old bean instances are **lost**
99

1010
OWB plugin uses reinjection by default, but it is not desired in some cases. Therefore it is possible to specify reloading strategy
1111
in `hotswap-agent.properties config`: file using parameter `owb.beanReloadStrategy` with following values:

‎plugin/hotswap-agent-spring-plugin/src/main/java/org/hotswap/agent/plugin/spring/getbean/DetachableBeanHolder.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
*/
3939
public class DetachableBeanHolder implements Serializable {
4040

41+
private static final long serialVersionUID = -7443802320153815102L;
42+
4143
private Object bean;
4244
private Object beanFactory;
4345
private Class<?>[] paramClasses;
@@ -128,8 +130,8 @@ public Object getBean() throws IllegalAccessException, InvocationTargetException
128130
Object freshBean = factoryMethod.invoke(beanFactory, paramValues);
129131

130132
// Factory returns HA proxy, but current method is invoked from HA proxy!
131-
// It migt be the same object (if factory returns same object - meaning
132-
// that although clearAllProxies() was called, this bean did not change)
133+
// It might be the same object (if factory returns same object - meaning
134+
// that although clearAllProxies() was called, this bean did not change)
133135
// Unwrap the target bean, it is always available
134136
// see org.hotswap.agent.plugin.spring.getbean.EnhancerProxyCreater.create()
135137
if (freshBean instanceof SpringHotswapAgentProxy) {

‎plugin/hotswap-agent-spring-plugin/src/main/java/org/hotswap/agent/plugin/spring/getbean/HotswapSpringInvocationHandler.java

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
*
3131
*/
3232
public class HotswapSpringInvocationHandler extends DetachableBeanHolder implements InvocationHandler {
33+
34+
private static final long serialVersionUID = 8037007940960065166L;
35+
3336
/**
3437
*
3538
* @param beanFactry

‎plugin/hotswap-agent-weld-plugin/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[Weld/CDI](http://weld.cdi-spec.org/)
22
=====================================
3-
Reinject injection points after bean redefinition. Define and register new bean in BeanManager if a new bean class is defined.
4-
Redefine proxy class if proxied class is redefined. Appropriate redefinition can be specified in `hotswap-agent.properties` file. Generally
5-
there are 2 approaches what to do after bean class redefinition:
3+
Reinject injection points after bean redefinition. Define and register a new bean in BeanManager on new bean definition.
4+
Redefine proxy class if proxied class is redefined. Appropriate redefinition can be specified in `hotswap-agent.properties` file.
5+
There are 2 approaches what to do after bean class redefinition:
66

7-
* reinject injection points in existing bean instances - bean instances **survives**
8-
* reload existing bean instances in contexts - bean instances are **lost**
7+
* reinject injection points in existing bean instances - old bean instances **survives**
8+
* reload existing bean instances in contexts - old bean instances are **lost**
99

1010
Weld plugin uses reinjection by default, but it is not desired in some cases. Therefore it is possible to specify precise reloading strategy
1111
in `hotswap-agent.properties config` file using parameter `weld.beanReloadStrategy` using following values:

0 commit comments

Comments
 (0)
Please sign in to comment.