From 2c199cf190fd860ad29799ee4e85b38cb092597a Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 21 Jul 2011 08:36:40 +0000 Subject: [PATCH] updated javadoc for server-specific LoadTimeWeavers --- .../weaving/DefaultContextLoadTimeWeaver.java | 16 +++++----- .../jboss/JBossClassLoaderAdapter.java | 5 ++-- .../jboss/JBossLoadTimeWeaver.java | 29 ++++++++++--------- .../classloading/jboss/JBossMCAdapter.java | 9 +++--- .../jboss/JBossMCTranslatorAdapter.java | 9 +++--- .../jboss/JBossModulesAdapter.java | 7 +++-- .../websphere/WebSphereLoadTimeWeaver.java | 5 ++-- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java b/org.springframework.context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java index da36bfa4e6..0630d290c6 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java +++ b/org.springframework.context/src/main/java/org/springframework/context/weaving/DefaultContextLoadTimeWeaver.java @@ -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 * "loadTimeWeaver"; the most convenient way to achieve this is * Spring's <context:load-time-weaver> XML tag. * - *

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} + *

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 diff --git a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossClassLoaderAdapter.java b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossClassLoaderAdapter.java index 3fefc04ab3..38126a76cd 100644 --- a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossClassLoaderAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossClassLoaderAdapter.java @@ -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 { diff --git a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java index 008deb56c3..5de17d6298 100644 --- a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java +++ b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java @@ -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). * - *

NOTE: Requires JBoss AS version 5.0.0 or higher. - *

NOTE: On JBoss 6.0.0, to avoid the container loading the classes before + *

NOTE: On JBoss 6.0, to avoid the container loading the classes before * the application actually starts, one needs to add WEB-INF/jboss-scanning.xml * to her archive with the following content: - *

- *   <scanning xmlns="urn:jboss:scanning:1.0"/>
- * 
- * + *
<scanning xmlns="urn:jboss:scanning:1.0"/>
+ * *

Thanks to Ales Justin and Marius Bogoevici for the initial prototype.

- * + * * @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()); } -} \ No newline at end of file + +} diff --git a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java index ec4ca6db09..4e7d16bcfd 100644 --- a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCAdapter.java @@ -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 { diff --git a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java index 4b65878cd6..16570a514f 100644 --- a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossMCTranslatorAdapter.java @@ -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 { diff --git a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java index a03889d104..be0291d59d 100644 --- a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/jboss/JBossModulesAdapter.java @@ -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 { diff --git a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereLoadTimeWeaver.java b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereLoadTimeWeaver.java index a4df2427fa..724a1db6b1 100644 --- a/org.springframework.context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereLoadTimeWeaver.java +++ b/org.springframework.context/src/main/java/org/springframework/instrument/classloading/websphere/WebSphereLoadTimeWeaver.java @@ -23,9 +23,8 @@ import org.springframework.util.Assert; import org.springframework.util.ClassUtils; /** - * {@link LoadTimeWeaver} implementation for WebSphere instrumentable classloader. - * - *

NOTE: 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 -- GitLab