updated javadoc for server-specific LoadTimeWeavers
This commit is contained in:
parent
f800a026cb
commit
2c199cf190
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -20,6 +20,7 @@ import java.lang.instrument.ClassFileTransformer;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.instrument.InstrumentationSavingAgent;
|
||||
|
|
@ -40,13 +41,14 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe
|
|||
* "<code>loadTimeWeaver</code>"; the most convenient way to achieve this is
|
||||
* Spring's <code><context:load-time-weaver></code> XML tag.
|
||||
*
|
||||
* <p>This class implements a runtime environment check for obtaining the
|
||||
* appropriate weaver implementation: As of Spring 2.5, it detects Sun's
|
||||
* GlassFish, Oracle's OC4J, BEA's WebLogic 10,
|
||||
* {@link InstrumentationSavingAgent Spring's VM agent} and any
|
||||
* {@link ClassLoader} supported by Spring's {@link ReflectiveLoadTimeWeaver}
|
||||
* <p>This class implements a runtime environment check for obtaining
|
||||
* the appropriate weaver implementation: As of Spring 3.1, it detects
|
||||
* Oracle WebLogic 10, Oracle OC4J 10, GlassFish 3, JBoss AS 5, 6 and 7,
|
||||
* IBM WebSphere 7 and 8, {@link InstrumentationSavingAgent Spring's VM agent}
|
||||
* and any {@link ClassLoader} supported by Spring's {@link ReflectiveLoadTimeWeaver}
|
||||
* (for example the
|
||||
* {@link org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader}).
|
||||
* {@link org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader}
|
||||
* for Tomcat 5, 6 and 7).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Ramnivas Laddad
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -20,8 +20,9 @@ import java.lang.instrument.ClassFileTransformer;
|
|||
|
||||
/**
|
||||
* Simple interface used for handling the different JBoss class loader adapters.
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
*/
|
||||
interface JBossClassLoaderAdapter {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -25,18 +25,16 @@ import org.springframework.util.ClassUtils;
|
|||
|
||||
/**
|
||||
* {@link LoadTimeWeaver} implementation for JBoss's instrumentable ClassLoader.
|
||||
* Currently supports JBoss 5, 6 and 7 (since Spring 3.1).
|
||||
* Autodetects the specific JBoss version at runtime: currently supports
|
||||
* JBoss AS 5, 6 and 7 (as of Spring 3.1).
|
||||
*
|
||||
* <p><b>NOTE:</b> Requires JBoss AS version 5.0.0 or higher.
|
||||
* <p><b>NOTE:</b> On JBoss 6.0.0, to avoid the container loading the classes before
|
||||
* <p><b>NOTE:</b> On JBoss 6.0, to avoid the container loading the classes before
|
||||
* the application actually starts, one needs to add <tt>WEB-INF/jboss-scanning.xml</tt>
|
||||
* to her archive with the following content:
|
||||
* <pre>
|
||||
* <scanning xmlns="urn:jboss:scanning:1.0"/>
|
||||
* </pre>
|
||||
*
|
||||
* <pre><scanning xmlns="urn:jboss:scanning:1.0"/></pre>
|
||||
*
|
||||
* <p>Thanks to Ales Justin and Marius Bogoevici for the initial prototype.</p>
|
||||
*
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.0
|
||||
*/
|
||||
|
|
@ -44,6 +42,7 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
|||
|
||||
private final JBossClassLoaderAdapter adapter;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance of the {@link JBossLoadTimeWeaver} class using
|
||||
* the default {@link ClassLoader class loader}.
|
||||
|
|
@ -66,14 +65,17 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
|||
if (loaderClassName.startsWith("org.jboss.classloader")) {
|
||||
// JBoss AS 5 or JBoss AS 6
|
||||
this.adapter = new JBossMCAdapter(classLoader);
|
||||
} else if (loaderClassName.startsWith("org.jboss.modules")) {
|
||||
}
|
||||
else if (loaderClassName.startsWith("org.jboss.modules")) {
|
||||
// JBoss AS 7
|
||||
this.adapter = new JBossModulesAdapter(classLoader);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unexpected classloader type: " + loaderClassName);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Unexpected ClassLoader type: " + loaderClassName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addTransformer(ClassFileTransformer transformer) {
|
||||
this.adapter.addTransformer(transformer);
|
||||
}
|
||||
|
|
@ -85,4 +87,5 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
|||
public ClassLoader getThrowawayClassLoader() {
|
||||
return new SimpleThrowawayClassLoader(getInstrumentableClassLoader());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* Copyright 2006-2009 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
|
@ -28,6 +28,7 @@ import org.springframework.util.ReflectionUtils;
|
|||
* through reflection) for load time weaving.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
*/
|
||||
class JBossMCAdapter implements JBossClassLoaderAdapter {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* Copyright 2006-2009 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
|
@ -28,6 +28,7 @@ import java.security.ProtectionDomain;
|
|||
* being used.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
*/
|
||||
class JBossMCTranslatorAdapter implements InvocationHandler {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2011 the original author or authors.
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -24,9 +24,10 @@ import org.springframework.util.Assert;
|
|||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* JBoss 7 Adapter.
|
||||
*
|
||||
* JBoss 7 adapter.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
*/
|
||||
class JBossModulesAdapter implements JBossClassLoaderAdapter {
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@ import org.springframework.util.Assert;
|
|||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link LoadTimeWeaver} implementation for WebSphere instrumentable classloader.
|
||||
*
|
||||
* <p><b>NOTE:</b> Requires WebSphere Application Server version 7.0.0 or higher.
|
||||
* {@link LoadTimeWeaver} implementation for WebSphere's instrumentable ClassLoader.
|
||||
* Compatible with WebSphere 7 as well as 8.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @since 3.1
|
||||
|
|
|
|||
Loading…
Reference in New Issue