Removed OC4J support (including documentation references)
This commit is contained in:
parent
a03d125b4e
commit
9c52ae9558
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -55,13 +55,7 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
* Spring's JPA bootstrap support.
|
||||
*
|
||||
* <h2>Customizing the {@code LoadTimeWeaver}</h2>
|
||||
* The default weaver is determined automatically. As of Spring 3.1: detecting
|
||||
* Sun's GlassFish, Oracle's OC4J, Spring's VM agent and any ClassLoader supported by
|
||||
* Spring's {@link
|
||||
* org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
|
||||
* ReflectiveLoadTimeWeaver} (for example, the {@link
|
||||
* org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader
|
||||
* TomcatInstrumentableClassLoader}).
|
||||
* The default weaver is determined automatically: see {@link DefaultContextLoadTimeWeaver}.
|
||||
*
|
||||
* <p>To customize the weaver used, the {@code @Configuration} class annotated with
|
||||
* {@code @EnableLoadTimeWeaving} may also implement the {@link LoadTimeWeavingConfigurer}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -22,6 +22,7 @@ import java.lang.instrument.IllegalClassFormatException;
|
|||
import java.security.ProtectionDomain;
|
||||
|
||||
import org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
|
@ -82,9 +83,7 @@ public class AspectJWeavingEnabler
|
|||
|
||||
/**
|
||||
* ClassFileTransformer decorator that suppresses processing of AspectJ
|
||||
* classes in order to avoid potential LinkageErrors. Required especially for OC4J and
|
||||
* Tomcat (in Glassfish).
|
||||
*
|
||||
* classes in order to avoid potential LinkageErrors.
|
||||
* @see org.springframework.context.annotation.LoadTimeWeavingConfiguration
|
||||
*/
|
||||
private static class AspectJClassBypassingClassFileTransformer implements ClassFileTransformer {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -29,7 +29,6 @@ import org.springframework.instrument.classloading.LoadTimeWeaver;
|
|||
import org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver;
|
||||
import org.springframework.instrument.classloading.glassfish.GlassFishLoadTimeWeaver;
|
||||
import org.springframework.instrument.classloading.jboss.JBossLoadTimeWeaver;
|
||||
import org.springframework.instrument.classloading.oc4j.OC4JLoadTimeWeaver;
|
||||
import org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver;
|
||||
import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWeaver;
|
||||
|
||||
|
@ -43,12 +42,11 @@ import org.springframework.instrument.classloading.websphere.WebSphereLoadTimeWe
|
|||
*
|
||||
* <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
|
||||
* Oracle WebLogic 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}
|
||||
* for Tomcat 5, 6 and 7).
|
||||
* for Tomcat 6 and 7).
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Ramnivas Laddad
|
||||
|
@ -112,9 +110,6 @@ public class DefaultContextLoadTimeWeaver implements LoadTimeWeaver, BeanClassLo
|
|||
if (name.startsWith("weblogic")) {
|
||||
return new WebLogicLoadTimeWeaver(classLoader);
|
||||
}
|
||||
else if (name.startsWith("oracle")) {
|
||||
return new OC4JLoadTimeWeaver(classLoader);
|
||||
}
|
||||
else if (name.startsWith("com.sun.enterprise") || name.startsWith("org.glassfish")) {
|
||||
return new GlassFishLoadTimeWeaver(classLoader);
|
||||
}
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.instrument.classloading.oc4j;
|
||||
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Reflective wrapper around a OC4J class loader. Used to
|
||||
* encapsulate the classloader-specific methods (discovered and
|
||||
* called through reflection) from the load-time weaver.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
class OC4JClassLoaderAdapter {
|
||||
|
||||
private static final String CL_UTILS = "oracle.classloader.util.ClassLoaderUtilities";
|
||||
private static final String PREPROCESS_UTILS = "oracle.classloader.util.ClassPreprocessor";
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
private final Class<?> processorClass;
|
||||
private final Method addTransformer;
|
||||
private final Method copy;
|
||||
|
||||
public OC4JClassLoaderAdapter(ClassLoader classLoader) {
|
||||
try {
|
||||
// Since OC4J 10.1.3's PolicyClassLoader is going to be removed,
|
||||
// we rely on the ClassLoaderUtilities API instead.
|
||||
Class<?> utilClass = classLoader.loadClass(CL_UTILS);
|
||||
this.processorClass = classLoader.loadClass(PREPROCESS_UTILS);
|
||||
|
||||
this.addTransformer = utilClass.getMethod("addPreprocessor", new Class[] { ClassLoader.class,
|
||||
this.processorClass });
|
||||
this.copy = utilClass.getMethod("copy", new Class[] { ClassLoader.class });
|
||||
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException(
|
||||
"Could not initialize OC4J LoadTimeWeaver because OC4J API classes are not available", ex);
|
||||
}
|
||||
|
||||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
public void addTransformer(ClassFileTransformer transformer) {
|
||||
Assert.notNull(transformer, "ClassFileTransformer must not be null");
|
||||
try {
|
||||
OC4JClassPreprocessorAdapter adapter = new OC4JClassPreprocessorAdapter(transformer);
|
||||
Object adapterInstance = Proxy.newProxyInstance(this.processorClass.getClassLoader(),
|
||||
new Class[] { this.processorClass }, adapter);
|
||||
this.addTransformer.invoke(null, new Object[] { this.classLoader, adapterInstance });
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw new IllegalStateException("OC4J addPreprocessor method threw exception", ex.getCause());
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException("Could not invoke OC4J addPreprocessor method", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader() {
|
||||
return this.classLoader;
|
||||
}
|
||||
|
||||
public ClassLoader getThrowawayClassLoader() {
|
||||
try {
|
||||
return (ClassLoader) this.copy.invoke(null, new Object[] { this.classLoader });
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw new IllegalStateException("OC4J copy method failed", ex.getCause());
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalStateException("Could not copy OC4J classloader", ex);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.instrument.classloading.oc4j;
|
||||
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
import java.lang.instrument.IllegalClassFormatException;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
/**
|
||||
* Adapter that implements OC4J ClassPreProcessor interface, delegating to a
|
||||
* standard JDK {@link ClassFileTransformer} underneath.
|
||||
*
|
||||
* <p>To avoid compile time checks again the vendor API, a dynamic proxy is
|
||||
* being used.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
class OC4JClassPreprocessorAdapter implements InvocationHandler {
|
||||
|
||||
private final ClassFileTransformer transformer;
|
||||
|
||||
/**
|
||||
* Creates a new {@link OC4JClassPreprocessorAdapter}.
|
||||
* @param transformer the {@link ClassFileTransformer} to be adapted (must
|
||||
* not be {@code null})
|
||||
*/
|
||||
public OC4JClassPreprocessorAdapter(ClassFileTransformer transformer) {
|
||||
this.transformer = transformer;
|
||||
}
|
||||
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String name = method.getName();
|
||||
|
||||
if ("equals".equals(name)) {
|
||||
return (Boolean.valueOf(proxy == args[0]));
|
||||
} else if ("hashCode".equals(name)) {
|
||||
return hashCode();
|
||||
} else if ("toString".equals(name)) {
|
||||
return toString();
|
||||
} else if ("initialize".equals(name)) {
|
||||
initialize(proxy, (ClassLoader) args[0]);
|
||||
return null;
|
||||
} else if ("processClass".equals(name)) {
|
||||
return processClass((String) args[0], (byte[]) args[1], (Integer) args[2], (Integer) args[3],
|
||||
(ProtectionDomain) args[4], (ClassLoader) args[5]);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown method: " + method);
|
||||
}
|
||||
}
|
||||
|
||||
// maps to oracle.classloader.util.ClassPreprocessor#initialize
|
||||
// the proxy is passed since it implements the Oracle interface which
|
||||
// is asked as a return type
|
||||
public Object initialize(Object proxy, ClassLoader loader) {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public byte[] processClass(String className, byte origClassBytes[], int offset, int length, ProtectionDomain pd,
|
||||
ClassLoader loader) {
|
||||
try {
|
||||
byte[] tempArray = new byte[length];
|
||||
System.arraycopy(origClassBytes, offset, tempArray, 0, length);
|
||||
|
||||
// NB: OC4J passes className as "." without class while the
|
||||
// transformer expects a VM, "/" format
|
||||
byte[] result = this.transformer.transform(loader, className.replace('.', '/'), null, pd, tempArray);
|
||||
return (result != null ? result : origClassBytes);
|
||||
} catch (IllegalClassFormatException ex) {
|
||||
throw new IllegalStateException("Cannot transform because of illegal class format", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder(getClass().getName());
|
||||
builder.append(" for transformer: ");
|
||||
builder.append(this.transformer);
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.instrument.classloading.oc4j;
|
||||
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
|
||||
import org.springframework.instrument.classloading.LoadTimeWeaver;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link LoadTimeWeaver} implementation for OC4J's instrumentable ClassLoader.
|
||||
* Requires Oracle OC4J version 10.1.3.1 or higher.
|
||||
*
|
||||
* <p>Many thanks to <a href="mailto:mike.keith@oracle.com">Mike Keith</a>
|
||||
* for his assistance.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
* @deprecated as of Spring 3.2, in favor of
|
||||
* {@link org.springframework.instrument.classloading.weblogic.WebLogicLoadTimeWeaver}
|
||||
* since Oracle end-of-lifed OC4J in favor of WebLogic
|
||||
*/
|
||||
@Deprecated
|
||||
public class OC4JLoadTimeWeaver implements LoadTimeWeaver {
|
||||
|
||||
private final OC4JClassLoaderAdapter classLoader;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of thie {@link OC4JLoadTimeWeaver} class
|
||||
* using the default {@link ClassLoader class loader}.
|
||||
* @see org.springframework.util.ClassUtils#getDefaultClassLoader()
|
||||
*/
|
||||
public OC4JLoadTimeWeaver() {
|
||||
this(ClassUtils.getDefaultClassLoader());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of the {@link OC4JLoadTimeWeaver} class
|
||||
* using the supplied {@link ClassLoader}.
|
||||
* @param classLoader the {@code ClassLoader} to delegate to for weaving
|
||||
*/
|
||||
public OC4JLoadTimeWeaver(ClassLoader classLoader) {
|
||||
Assert.notNull(classLoader, "ClassLoader must not be null");
|
||||
this.classLoader = new OC4JClassLoaderAdapter(classLoader);
|
||||
}
|
||||
|
||||
|
||||
public void addTransformer(ClassFileTransformer transformer) {
|
||||
Assert.notNull(transformer, "Transformer must not be null");
|
||||
// Since OC4J 10.1.3's PolicyClassLoader is going to be removed,
|
||||
// we rely on the ClassLoaderUtilities API instead.
|
||||
this.classLoader.addTransformer(transformer);
|
||||
}
|
||||
|
||||
public ClassLoader getInstrumentableClassLoader() {
|
||||
return this.classLoader.getClassLoader();
|
||||
}
|
||||
|
||||
public ClassLoader getThrowawayClassLoader() {
|
||||
return this.classLoader.getThrowawayClassLoader();
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
/**
|
||||
*
|
||||
* Support for class instrumentation on Oracle OC4J.
|
||||
*
|
||||
*/
|
||||
package org.springframework.instrument.classloading.oc4j;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -51,8 +51,6 @@ import org.springframework.util.ReflectionUtils;
|
|||
*/
|
||||
public abstract class RmiClientInterceptorUtils {
|
||||
|
||||
private static final String ORACLE_CONNECTION_EXCEPTION = "com.evermind.server.rmi.RMIConnectionException";
|
||||
|
||||
private static final Log logger = LogFactory.getLog(RmiClientInterceptorUtils.class);
|
||||
|
||||
|
||||
|
@ -198,9 +196,7 @@ public abstract class RmiClientInterceptorUtils {
|
|||
/**
|
||||
* Determine whether the given RMI exception indicates a connect failure.
|
||||
* <p>Treats RMI's ConnectException, ConnectIOException, UnknownHostException,
|
||||
* NoSuchObjectException and StubNotFoundException as connect failure,
|
||||
* as well as Oracle's OC4J {@code com.evermind.server.rmi.RMIConnectionException}
|
||||
* (which doesn't derive from from any well-known RMI connect exception).
|
||||
* NoSuchObjectException and StubNotFoundException as connect failure.
|
||||
* @param ex the RMI exception to check
|
||||
* @return whether the exception should be treated as connect failure
|
||||
* @see java.rmi.ConnectException
|
||||
|
@ -213,7 +209,7 @@ public abstract class RmiClientInterceptorUtils {
|
|||
return (ex instanceof ConnectException || ex instanceof ConnectIOException ||
|
||||
ex instanceof UnknownHostException || ex instanceof NoSuchObjectException ||
|
||||
ex instanceof StubNotFoundException || ex.getCause() instanceof SocketException ||
|
||||
isCorbaConnectFailure(ex.getCause()) || ORACLE_CONNECTION_EXCEPTION.equals(ex.getClass().getName()));
|
||||
isCorbaConnectFailure(ex.getCause()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,531 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/context"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
targetNamespace="http://www.springframework.org/schema/context"
|
||||
elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.2.xsd" />
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.2.xsd" />
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines the configuration elements for the Spring Framework's application
|
||||
context support. Effects the activation of various configuration styles
|
||||
for the containing Spring ApplicationContext.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexType name="propertyPlaceholder">
|
||||
<xsd:attribute name="location" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The location of the properties file to resolve placeholders against, as a Spring
|
||||
resource location: a URL, a "classpath:" pseudo URL, or a relative file path.
|
||||
Multiple locations may be specified, separated by commas. If neither location nor properties-ref is
|
||||
specified, placeholders will be resolved against system properties.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="properties-ref" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:java.util.Properties"><![CDATA[
|
||||
The bean name of a Java Properties object that will be used for property substitution.
|
||||
If neither location nor properties-ref is specified, placeholders will be resolved against system properties.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="file-encoding" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Specifies the encoding to use for parsing properties files. Default is none,
|
||||
using the java.util.Properties default encoding. Only applies to classic
|
||||
properties files, not to XML files.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="order" type="xsd:integer">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Specifies the order for this placeholder configurer. If more than one is present in a context
|
||||
the order can be important since the first one to be match a placeholder will win. Often used
|
||||
in conjunction with
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="ignore-resource-not-found" type="xsd:boolean"
|
||||
default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Specifies if failure to find the property resource location should be ignored. Default
|
||||
is "false", meaning that if there is no file in the location specified an exception will
|
||||
be raised at runtime.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="ignore-unresolvable" type="xsd:boolean"
|
||||
default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Specifies if failure to find the property value to replace a key should be ignored. Default
|
||||
is "false", meaning that this placeholder configurer will raise an exception if it cannot resolve
|
||||
a key. Set to "true" to allow the configurer to pass on the key to any others in
|
||||
the context that have not yet visited the key in question.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="local-override" type="xsd:boolean"
|
||||
default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Specifies whether local properties override properties from files. Default
|
||||
is "false": Properties from files override local defaults.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:element name="property-placeholder">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Activates replacement of ${...} placeholders by registering a
|
||||
PropertySourcesPlaceholderConfigurer within the application context. Properties will
|
||||
be resolved against the specified properties file or Properties object -- so called
|
||||
"local properties", if any, and against the Spring Environment's current set of
|
||||
PropertySources.
|
||||
|
||||
Note that as of Spring 3.1 the system-properties-mode attribute has been removed in
|
||||
favor of the more flexible PropertySources mechanism. However, Spring 3.1-based
|
||||
applications may continue to use the 3.0 (and older) versions of the spring-context
|
||||
schema in order to preserve system-properties-mode behavior. In this case, the
|
||||
traditional PropertyPlaceholderConfigurer component will be registered instead of the
|
||||
new PropertySourcesPlaceholderConfigurer.
|
||||
|
||||
See ConfigurableEnvironment Javadoc for more information on using.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports
|
||||
type="org.springframework.context.support.PropertySourcesPlaceholderConfigurer" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="propertyPlaceholder">
|
||||
<xsd:attribute name="system-properties-mode" default="ENVIRONMENT">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Controls how to resolve placeholders against system properties. As of Spring 3.1, this
|
||||
attribute value defaults to "ENVIRONMENT", indicating that resolution of placeholders
|
||||
against system properties is handled via PropertySourcesPlaceholderConfigurer and its
|
||||
delegation to the current Spring Environment object.
|
||||
|
||||
For maximum backward compatibility, this attribute is preserved going forward with the
|
||||
3.1 version of the context schema, and any values other than the default "ENVIRONMENT"
|
||||
will cause a traditional PropertyPlaceholderConfigurer to be registered instead of the
|
||||
newer PropertySourcesPlaceholderConfigurer variant. In this case, the Spring Environment
|
||||
and its property sources are not interrogated when resolving placeholders. Users are
|
||||
encouraged to consider this attribute deprecated, and to take advantage of
|
||||
Environment/PropertySource mechanisms. See ConfigurableEnvironment Javadoc for examples.
|
||||
|
||||
"ENVIRONMENT" indicates placeholders should be resolved against the current Environment and against any local properties;
|
||||
"NEVER" indicates placeholders should be resolved only against local properties and never against system properties;
|
||||
"FALLBACK" indicates placeholders should be resolved against any local properties and then against system properties;
|
||||
"OVERRIDE" indicates placeholders should be resolved first against system properties and then against any local properties;
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="ENVIRONMENT"/>
|
||||
<xsd:enumeration value="NEVER"/>
|
||||
<xsd:enumeration value="FALLBACK"/>
|
||||
<xsd:enumeration value="OVERRIDE"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="property-override">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Activates pushing of override values into bean properties, based on configuration
|
||||
lines of the following format: beanName.property=value
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports
|
||||
type="org.springframework.beans.factory.config.PropertyOverrideConfigurer" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="propertyPlaceholder" />
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="annotation-config">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Activates various annotations to be detected in bean classes: Spring's @Required and
|
||||
@Autowired, as well as JSR 250's @PostConstruct, @PreDestroy and @Resource (if available),
|
||||
JAX-WS's @WebServiceRef (if available), EJB3's @EJB (if available), and JPA's
|
||||
@PersistenceContext and @PersistenceUnit (if available). Alternatively, you may
|
||||
choose to activate the individual BeanPostProcessors for those annotations.
|
||||
|
||||
Note: This tag does not activate processing of Spring's @Transactional or EJB3's
|
||||
@TransactionAttribute annotation. Consider the use of the <tx:annotation-driven>
|
||||
tag for that purpose.
|
||||
|
||||
See Javadoc for org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||
for information on code-based alternatives to bootstrapping annotation-driven support.
|
||||
from XML.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="component-scan">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Scans the classpath for annotated components that will be auto-registered as
|
||||
Spring beans. By default, the Spring-provided @Component, @Repository,
|
||||
@Service, and @Controller stereotypes will be detected.
|
||||
|
||||
Note: This tag implies the effects of the 'annotation-config' tag, activating @Required,
|
||||
@Autowired, @PostConstruct, @PreDestroy, @Resource, @PersistenceContext and @PersistenceUnit
|
||||
annotations in the component classes, which is usually desired for autodetected components
|
||||
(without external configuration). Turn off the 'annotation-config' attribute to deactivate
|
||||
this default behavior, for example in order to use custom BeanPostProcessor definitions
|
||||
for handling those annotations.
|
||||
|
||||
Note: You may use placeholders in package paths, but only resolved against system
|
||||
properties (analogous to resource paths). A component scan results in new bean definition
|
||||
being registered; Spring's PropertyPlaceholderConfigurer will apply to those bean
|
||||
definitions just like to regular bean definitions, but it won't apply to the component
|
||||
scan settings themselves.
|
||||
|
||||
See Javadoc for org.springframework.context.annotation.ComponentScan for information
|
||||
on code-based alternatives to bootstrapping component-scanning.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="include-filter" type="filterType"
|
||||
minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Controls which eligible types to include for component scanning.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:element name="exclude-filter" type="filterType"
|
||||
minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Controls which eligible types to exclude for component scanning.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="base-package" type="xsd:string"
|
||||
use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The comma-separated list of packages to scan for annotated components.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="resource-pattern" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Controls the class files eligible for component detection. Defaults to "**/*.class", the recommended value.
|
||||
Consider use of the include-filter and exclude-filter elements for a more fine-grained approach.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="use-default-filters" type="xsd:boolean"
|
||||
default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether automatic detection of classes annotated with @Component, @Repository, @Service,
|
||||
or @Controller should be enabled. Default is "true".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="annotation-config" type="xsd:boolean"
|
||||
default="true">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether the implicit annotation post-processors should be enabled. Default is "true".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="name-generator" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The fully-qualified class name of the BeanNameGenerator to be used for naming detected components.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:expected-type type="java.lang.Class" />
|
||||
<tool:assignable-to
|
||||
type="org.springframework.beans.factory.support.BeanNameGenerator" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="scope-resolver" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The fully-qualified class name of the ScopeMetadataResolver to be used for resolving the scope of
|
||||
detected components.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:expected-type type="java.lang.Class" />
|
||||
<tool:assignable-to
|
||||
type="org.springframework.context.annotation.ScopeMetadataResolver" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="scoped-proxy">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates whether proxies should be generated for detected components, which may be necessary
|
||||
when using scopes in a proxy-style fashion. Default is to generate no such proxies.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="no" />
|
||||
<xsd:enumeration value="interfaces" />
|
||||
<xsd:enumeration value="targetClass" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="load-time-weaver">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Activates a Spring LoadTimeWeaver for this application context, available as
|
||||
a bean with the name "loadTimeWeaver". Any bean that implements the
|
||||
LoadTimeWeaverAware interface will then receive the LoadTimeWeaver reference
|
||||
automatically; for example, Spring's JPA bootstrap support.
|
||||
|
||||
The default weaver is determined automatically: see DefaultContextLoadTimeWeaver's
|
||||
javadoc for details.
|
||||
|
||||
The activation of AspectJ load-time weaving is specified via a simple flag
|
||||
(the 'aspectj-weaving' attribute), with the AspectJ class transformer
|
||||
registered through Spring's LoadTimeWeaver. AspectJ weaving will be activated
|
||||
by default if a "META-INF/aop.xml" resource is present in the classpath.
|
||||
|
||||
This also activates the current application context for applying dependency
|
||||
injection to non-managed classes that are instantiated outside of the Spring
|
||||
bean factory (typically classes annotated with the @Configurable annotation).
|
||||
This will only happen if the AnnotationBeanConfigurerAspect is on the classpath
|
||||
(i.e. spring-aspects.jar), effectively activating "spring-configured" by default.
|
||||
|
||||
See Javadoc for org.springframework.context.annotation.EnableLoadTimeWeaving
|
||||
for information on code-based alternatives to bootstrapping load-time weaving support.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports
|
||||
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="weaver-class" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The fully-qualified classname of the LoadTimeWeaver that is to be activated.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:expected-type type="java.lang.Class" />
|
||||
<tool:assignable-to
|
||||
type="org.springframework.instrument.classloading.LoadTimeWeaver" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="aspectj-weaving" default="autodetect">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="on">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Switches Spring-based AspectJ load-time weaving on.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
<xsd:enumeration value="off">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Switches Spring-based AspectJ load-time weaving off.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
<xsd:enumeration value="autodetect">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Switches AspectJ load-time weaving on if a "META-INF/aop.xml" resource
|
||||
is present in the classpath. If there is no such resource, then AspectJ
|
||||
load-time weaving will be switched off.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:enumeration>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="spring-configured">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="java:org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect">
|
||||
<![CDATA[
|
||||
Signals the current application context to apply dependency injection
|
||||
to non-managed classes that are instantiated outside of the Spring bean
|
||||
factory (typically classes annotated with the @Configurable annotation).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string" />
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="mbean-export">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="java:org.springframework.jmx.export.annotation.AnnotationMBeanExporter"><![CDATA[
|
||||
Activates default exporting of MBeans by detecting standard MBeans in the Spring
|
||||
context as well as @ManagedResource annotations on Spring-defined beans.
|
||||
|
||||
The resulting MBeanExporter bean is defined under the name "mbeanExporter".
|
||||
Alternatively, consider defining a custom AnnotationMBeanExporter bean explicitly.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports
|
||||
type="org.springframework.jmx.export.annotation.AnnotationMBeanExporter" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="default-domain" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The default domain to use when generating JMX ObjectNames.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="server" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The bean name of the MBeanServer to which MBeans should be exported.
|
||||
Default is to use the platform's default MBeanServer (autodetecting
|
||||
WebLogic 9+, WebSphere 5.1+ and the JDK 1.5+ platform MBeanServer).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="registration">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The registration behavior, indicating how to deal with existing MBeans
|
||||
of the same name: fail with an exception, ignore and keep the existing
|
||||
MBean, or replace the existing one with the new MBean.
|
||||
|
||||
Default is to fail with an exception.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:NMTOKEN">
|
||||
<xsd:enumeration value="failOnExisting" />
|
||||
<xsd:enumeration value="ignoreExisting" />
|
||||
<xsd:enumeration value="replaceExisting" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="mbean-server">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation
|
||||
source="java:org.springframework.jmx.support.MBeanServerFactoryBean"><![CDATA[
|
||||
Exposes a default MBeanServer for the current platform.
|
||||
Autodetects WebLogic 9+, WebSphere 6.1+ and the JDK 1.5+ platform MBeanServer.
|
||||
|
||||
The default bean name for the exposed MBeanServer is "mbeanServer".
|
||||
This may be customized through specifying the "id" attribute.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="javax.management.MBeanServer" />
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="beans:identifiedType">
|
||||
<xsd:attribute name="agent-id" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The agent id of the target MBeanServer, if any.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="filterType">
|
||||
<xsd:attribute name="type" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Controls the type of filtering to apply to the expression.
|
||||
|
||||
"annotation" indicates an annotation to be present at the type level in target components;
|
||||
"assignable" indicates a class (or interface) that the target components are assignable to (extend/implement);
|
||||
"aspectj" indicates an AspectJ type expression to be matched by the target components;
|
||||
"regex" indicates a regex expression to be matched by the target components' class names;
|
||||
"custom" indicates a custom implementation of the org.springframework.core.type.TypeFilter interface.
|
||||
|
||||
Note: This attribute will not be inherited by child bean definitions.
|
||||
Hence, it needs to be specified per concrete bean definition.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="annotation" />
|
||||
<xsd:enumeration value="assignable" />
|
||||
<xsd:enumeration value="aspectj" />
|
||||
<xsd:enumeration value="regex" />
|
||||
<xsd:enumeration value="custom" />
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="expression" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Indicates the filter expression, the type of which is indicated by "type".
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -75,9 +75,6 @@ public abstract class ResourceUtils {
|
|||
/** URL protocol for an entry from a WebSphere jar file: "wsjar" */
|
||||
public static final String URL_PROTOCOL_WSJAR = "wsjar";
|
||||
|
||||
/** URL protocol for an entry from an OC4J jar file: "code-source" */
|
||||
public static final String URL_PROTOCOL_CODE_SOURCE = "code-source";
|
||||
|
||||
/** Separator between JAR URL and file path within the JAR */
|
||||
public static final String JAR_URL_SEPARATOR = "!/";
|
||||
|
||||
|
@ -261,18 +258,14 @@ public abstract class ResourceUtils {
|
|||
/**
|
||||
* Determine whether the given URL points to a resource in a jar file,
|
||||
* that is, has protocol "jar", "zip", "wsjar" or "code-source".
|
||||
* <p>"zip" and "wsjar" are used by BEA WebLogic Server and IBM WebSphere, respectively,
|
||||
* but can be treated like jar files. The same applies to "code-source" URLs on Oracle
|
||||
* OC4J, provided that the path contains a jar separator.
|
||||
* <p>"zip" and "wsjar" are used by WebLogic Server and WebSphere, respectively,
|
||||
* but can be treated like jar files.
|
||||
* @param url the URL to check
|
||||
* @return whether the URL has been identified as a JAR URL
|
||||
*/
|
||||
public static boolean isJarURL(URL url) {
|
||||
String protocol = url.getProtocol();
|
||||
return (URL_PROTOCOL_JAR.equals(protocol) ||
|
||||
URL_PROTOCOL_ZIP.equals(protocol) ||
|
||||
URL_PROTOCOL_WSJAR.equals(protocol) ||
|
||||
(URL_PROTOCOL_CODE_SOURCE.equals(protocol) && url.getPath().contains(JAR_URL_SEPARATOR)));
|
||||
String up = url.getProtocol();
|
||||
return (URL_PROTOCOL_JAR.equals(up) || URL_PROTOCOL_ZIP.equals(up) || URL_PROTOCOL_WSJAR.equals(up));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
|
@ -38,22 +38,14 @@ package org.springframework.jdbc.support.nativejdbc;
|
|||
* <p>SimpleNativeJdbcExtractor is a common choice for use with OracleLobHandler,
|
||||
* which just needs Connection unwrapping via the
|
||||
* {@link #getNativeConnectionFromStatement} method. This usage will work
|
||||
* with almost any connection pool. Known to work are, for example:
|
||||
* <ul>
|
||||
* <li>Caucho Resin 2.1.x, 3.0.x
|
||||
* <li>Sun Java System Application Server 8
|
||||
* <li>Oracle OC4J 9.0.3, 9.0.4
|
||||
* <li>C3P0 0.8.x
|
||||
* <li>Jakarta Commons DBCP 1.0, 1.1, 1.2 (used in Tomcat 4.1.x, 5.0.x)
|
||||
* <li>JBoss 3.2.x
|
||||
* </ul>
|
||||
* with almost any connection pool.
|
||||
*
|
||||
* <p>For full usage with JdbcTemplate, i.e. to also provide Statement unwrapping:
|
||||
* <ul>
|
||||
* <li>Use a default SimpleNativeJdbcExtractor for Resin and SJSAS (no JDBC
|
||||
* Statement objects are wrapped, therefore no special unwrapping is necessary).
|
||||
* <li>Use a SimpleNativeJdbcExtractor with all "nativeConnectionNecessaryForXxx"
|
||||
* flags set to "true" for OC4J and C3P0 (all JDBC Statement objects are wrapped,
|
||||
* flags set to "true" for C3P0 (all JDBC Statement objects are wrapped,
|
||||
* but none of the wrappers allow for unwrapping).
|
||||
* <li>Use a CommonsDbcpNativeJdbcExtractor for Jakarta Commons DBCP respectively
|
||||
* a JBossNativeJdbcExtractor for JBoss (all JDBC Statement objects are wrapped,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
* Copyright 2002-2013 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,7 +25,7 @@ import org.springframework.util.ClassUtils;
|
|||
|
||||
/**
|
||||
* Parser for the <tx:jta-transaction-manager/> element,
|
||||
* autodetecting BEA WebLogic, IBM WebSphere and Oracle OC4J.
|
||||
* autodetecting BEA WebLogic and IBM WebSphere.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Christian Dupuis
|
||||
|
@ -39,9 +39,6 @@ public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBea
|
|||
private static final String WEBSPHERE_TRANSACTION_MANAGER_CLASS_NAME =
|
||||
"org.springframework.transaction.jta.WebSphereUowTransactionManager";
|
||||
|
||||
private static final String OC4J_TRANSACTION_MANAGER_CLASS_NAME =
|
||||
"org.springframework.transaction.jta.OC4JJtaTransactionManager";
|
||||
|
||||
private static final String JTA_TRANSACTION_MANAGER_CLASS_NAME =
|
||||
"org.springframework.transaction.jta.JtaTransactionManager";
|
||||
|
||||
|
@ -52,9 +49,6 @@ public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBea
|
|||
private static final boolean webspherePresent = ClassUtils.isPresent(
|
||||
"com.ibm.wsspi.uow.UOWManager", JtaTransactionManagerBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
private static final boolean oc4jPresent = ClassUtils.isPresent(
|
||||
"oracle.j2ee.transaction.OC4JTransactionManager", JtaTransactionManagerBeanDefinitionParser.class.getClassLoader());
|
||||
|
||||
|
||||
@Override
|
||||
protected String getBeanClassName(Element element) {
|
||||
|
@ -64,9 +58,6 @@ public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBea
|
|||
else if (webspherePresent) {
|
||||
return WEBSPHERE_TRANSACTION_MANAGER_CLASS_NAME;
|
||||
}
|
||||
else if (oc4jPresent) {
|
||||
return OC4J_TRANSACTION_MANAGER_CLASS_NAME;
|
||||
}
|
||||
else {
|
||||
return JTA_TRANSACTION_MANAGER_CLASS_NAME;
|
||||
}
|
||||
|
|
|
@ -79,21 +79,20 @@ import org.springframework.util.StringUtils;
|
|||
* Almost all Java EE servers expose it, but do so as extension to EE. There might be some
|
||||
* issues with compatibility, despite the TransactionManager interface being part of JTA.
|
||||
* As a consequence, Spring provides various vendor-specific PlatformTransactionManagers,
|
||||
* which are recommended to be used if appropriate: {@link WebLogicJtaTransactionManager},
|
||||
* {@link WebSphereUowTransactionManager} and {@link OC4JJtaTransactionManager}.
|
||||
* For all other Java EE servers, the standard JtaTransactionManager is sufficient.
|
||||
* which are recommended to be used if appropriate: {@link WebLogicJtaTransactionManager}
|
||||
* and {@link WebSphereUowTransactionManager}. For all other Java EE servers, the
|
||||
* standard JtaTransactionManager is sufficient.
|
||||
*
|
||||
* <p>This pure JtaTransactionManager class supports timeouts but not per-transaction
|
||||
* isolation levels. Custom subclasses may override the {@link #doJtaBegin} method for
|
||||
* specific JTA extensions in order to provide this functionality; Spring includes
|
||||
* corresponding {@link WebLogicJtaTransactionManager} and {@link OC4JJtaTransactionManager}
|
||||
* classes, for BEA's WebLogic Server and Oracle's OC4J, respectively. Such adapters
|
||||
* for specific Java EE transaction coordinators may also expose transaction names for
|
||||
* monitoring; with standard JTA, transaction names will simply be ignored.
|
||||
* specific JTA extensions in order to provide this functionality; Spring includes a
|
||||
* corresponding {@link WebLogicJtaTransactionManager} class for WebLogic Server. Such
|
||||
* adapters for specific Java EE transaction coordinators may also expose transaction
|
||||
* names for monitoring; with standard JTA, transaction names will simply be ignored.
|
||||
*
|
||||
* <p><b>Consider using Spring's {@code tx:jta-transaction-manager} configuration
|
||||
* element for automatically picking the appropriate JTA platform transaction manager
|
||||
* (automatically detecting WebLogic, WebSphere and OC4J).</b>
|
||||
* (automatically detecting WebLogic and WebSphere).</b>
|
||||
*
|
||||
* <p>JTA 1.1 adds the TransactionSynchronizationRegistry facility, as public Java EE 5
|
||||
* API in addition to the standard JTA UserTransaction handle. As of Spring 2.5, this
|
||||
|
|
|
@ -1,253 +0,0 @@
|
|||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.transaction.jta;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.transaction.NotSupportedException;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.Transaction;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Special {@link JtaTransactionManager} variant for Oracle OC4J (10.1.3 and higher).
|
||||
* Supports the full power of Spring's transaction definitions on OC4J's
|
||||
* transaction coordinator, <i>beyond standard JTA</i>: transaction names
|
||||
* and per-transaction isolation levels.
|
||||
*
|
||||
* <p>Uses OC4J's special {@code begin(name)} method to start a JTA transaction,
|
||||
* in orderto make <b>Spring-driven transactions visible in OC4J's transaction
|
||||
* monitor</b>. In case of Spring's declarative transactions, the exposed name will
|
||||
* (by default) be the fully-qualified class name + "." + method name.
|
||||
*
|
||||
* <p>Supports a <b>per-transaction isolation level</b> through OC4J's corresponding
|
||||
* {@code OC4JTransaction.setTransactionIsolation(int)} method. This will
|
||||
* apply the specified isolation level (e.g. ISOLATION_SERIALIZABLE) to all
|
||||
* JDBC Connections that participate in the given transaction.
|
||||
*
|
||||
* <p>Automatically detects the available OC4J server version and adapts accordingly.
|
||||
* Supports the "com.evermind.server" package in OC4J 10.1.3.2 as well as the
|
||||
* "oracle.j2ee.transaction" package in later OC4J versions.
|
||||
*
|
||||
* <p>By default, the JTA UserTransaction and TransactionManager handles are
|
||||
* fetched directly from OC4J's {@code TransactionUtility} in 10.1.3.2+.
|
||||
* This can be overridden by specifying "userTransaction"/"userTransactionName"
|
||||
* and "transactionManager"/"transactionManagerName", passing in existing handles
|
||||
* or specifying corresponding JNDI locations to look up.
|
||||
*
|
||||
* <p>Thanks to Oracle for donating the original version of this extended OC4J
|
||||
* integration code to the Spring project!
|
||||
*
|
||||
* @author Paul Parkinson
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.0.3
|
||||
* @see org.springframework.transaction.TransactionDefinition#getName
|
||||
* @see org.springframework.transaction.TransactionDefinition#getIsolationLevel
|
||||
* @deprecated as of Spring 3.2, in favor of {@link WebLogicJtaTransactionManager}
|
||||
* since Oracle end-of-lifed OC4J in favor of WebLogic
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("serial")
|
||||
public class OC4JJtaTransactionManager extends JtaTransactionManager {
|
||||
|
||||
private static final String TRANSACTION_UTILITY_CLASS_NAME =
|
||||
"oracle.j2ee.transaction.TransactionUtility";
|
||||
|
||||
private static final String TRANSACTION_MANAGER_CLASS_NAME =
|
||||
"oracle.j2ee.transaction.OC4JTransactionManager";
|
||||
|
||||
private static final String TRANSACTION_CLASS_NAME =
|
||||
"oracle.j2ee.transaction.OC4JTransaction";
|
||||
|
||||
private static final String FALLBACK_TRANSACTION_MANAGER_CLASS_NAME =
|
||||
"com.evermind.server.ApplicationServerTransactionManager";
|
||||
|
||||
private static final String FALLBACK_TRANSACTION_CLASS_NAME =
|
||||
"com.evermind.server.ApplicationServerTransaction";
|
||||
|
||||
|
||||
private Method beginWithNameMethod;
|
||||
|
||||
private Method setTransactionIsolationMethod;
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws TransactionSystemException {
|
||||
super.afterPropertiesSet();
|
||||
loadOC4JTransactionClasses();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserTransaction retrieveUserTransaction() throws TransactionSystemException {
|
||||
try {
|
||||
Class transactionUtilityClass = getClass().getClassLoader().loadClass(TRANSACTION_UTILITY_CLASS_NAME);
|
||||
Method getInstanceMethod = transactionUtilityClass.getMethod("getInstance");
|
||||
Object transactionUtility = getInstanceMethod.invoke(null);
|
||||
logger.debug("Retrieving JTA UserTransaction from OC4J TransactionUtility");
|
||||
Method getUserTransactionMethod =
|
||||
transactionUtility.getClass().getMethod("getOC4JUserTransaction");
|
||||
return (UserTransaction) getUserTransactionMethod.invoke(transactionUtility);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
logger.debug("Could not find OC4J 10.1.3.2 TransactionUtility: " + ex);
|
||||
// Return null to make the superclass perform its standard J2EE lookup,
|
||||
// which will work on earlier OC4J versions.
|
||||
return null;
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
throw new TransactionSystemException(
|
||||
"OC4J's TransactionUtility.getOC4JUserTransaction() method failed", ex.getTargetException());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new TransactionSystemException(
|
||||
"Could not invoke OC4J's TransactionUtility.getOC4JUserTransaction() method", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadOC4JTransactionClasses() throws TransactionSystemException {
|
||||
// Find available OC4J API (in "oracle.j2ee.transaction" or "com.evermind.server")
|
||||
Class transactionManagerClass = null;
|
||||
Class transactionClass = null;
|
||||
try {
|
||||
transactionManagerClass = getClass().getClassLoader().loadClass(TRANSACTION_MANAGER_CLASS_NAME);
|
||||
transactionClass = getClass().getClassLoader().loadClass(TRANSACTION_CLASS_NAME);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
try {
|
||||
transactionManagerClass = getClass().getClassLoader().loadClass(FALLBACK_TRANSACTION_MANAGER_CLASS_NAME);
|
||||
transactionClass = getClass().getClassLoader().loadClass(FALLBACK_TRANSACTION_CLASS_NAME);
|
||||
}
|
||||
catch (ClassNotFoundException ex2) {
|
||||
throw new TransactionSystemException(
|
||||
"Could not initialize OC4JJtaTransactionManager because OC4J API classes are not available", ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Cache reflective Method references for later use.
|
||||
if (transactionManagerClass.isInstance(getUserTransaction())) {
|
||||
this.beginWithNameMethod = ClassUtils.getMethodIfAvailable(
|
||||
transactionManagerClass, "begin", String.class);
|
||||
this.setTransactionIsolationMethod = ClassUtils.getMethodIfAvailable(
|
||||
transactionClass, "setTransactionIsolation", int.class);
|
||||
logger.info("Support for OC4J transaction names and isolation levels available");
|
||||
}
|
||||
else {
|
||||
logger.info("Support for OC4J transaction names and isolation levels not available");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition)
|
||||
throws NotSupportedException, SystemException {
|
||||
|
||||
int timeout = determineTimeout(definition);
|
||||
applyTimeout(txObject, timeout);
|
||||
|
||||
// Apply transaction name, if any, through the extended OC4J transaction begin method.
|
||||
if (this.beginWithNameMethod != null && definition.getName() != null) {
|
||||
/*
|
||||
oracle.j2ee.transaction.OC4JTransactionManager otm = (oracle.j2ee.transaction.OC4JTransactionManager) ut;
|
||||
otm.begin(definition.getName());
|
||||
*/
|
||||
try {
|
||||
this.beginWithNameMethod.invoke(txObject.getUserTransaction(), definition.getName());
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
throw new TransactionSystemException(
|
||||
"OC4J's UserTransaction.begin(String) method failed", ex.getTargetException());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new TransactionSystemException(
|
||||
"Could not invoke OC4J's UserTransaction.begin(String) method", ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// No OC4J UserTransaction available or no transaction name specified
|
||||
// -> standard JTA begin call.
|
||||
txObject.getUserTransaction().begin();
|
||||
}
|
||||
|
||||
// Specify isolation level, if any, through the corresponding OC4J transaction method.
|
||||
if (this.setTransactionIsolationMethod != null) {
|
||||
if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
|
||||
try {
|
||||
Transaction tx = getTransactionManager().getTransaction();
|
||||
/*
|
||||
oracle.j2ee.transaction.OC4JTransaction otx = (oracle.j2ee.transaction.OC4JTransaction) tx;
|
||||
otx.setTransactionIsolation(definition.getIsolationLevel());
|
||||
*/
|
||||
this.setTransactionIsolationMethod.invoke(tx, definition.getIsolationLevel());
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
throw new TransactionSystemException(
|
||||
"OC4J's Transaction.setTransactionIsolation(int) method failed", ex.getTargetException());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new TransactionSystemException(
|
||||
"Could not invoke OC4J's Transaction.setTransactionIsolation(int) method", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
applyIsolationLevel(txObject, definition.getIsolationLevel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
|
||||
if (this.beginWithNameMethod != null && name != null) {
|
||||
UserTransaction ut = getUserTransaction();
|
||||
if (timeout >= 0) {
|
||||
ut.setTransactionTimeout(timeout);
|
||||
}
|
||||
try {
|
||||
this.beginWithNameMethod.invoke(ut, name);
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
if (ex.getTargetException() instanceof NotSupportedException) {
|
||||
throw (NotSupportedException) ex.getTargetException();
|
||||
}
|
||||
else if (ex.getTargetException() instanceof SystemException) {
|
||||
throw (SystemException) ex.getTargetException();
|
||||
}
|
||||
else if (ex.getTargetException() instanceof RuntimeException) {
|
||||
throw (RuntimeException) ex.getTargetException();
|
||||
}
|
||||
else {
|
||||
throw new SystemException(
|
||||
"OC4J's begin(String) method failed with an unexpected error: " + ex.getTargetException());
|
||||
}
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new SystemException("Could not invoke OC4J's UserTransaction.begin(String) method: " + ex);
|
||||
}
|
||||
return new ManagedTransactionAdapter(getTransactionManager());
|
||||
}
|
||||
|
||||
else {
|
||||
// No name specified - standard JTA is sufficient.
|
||||
return super.createTransaction(name, timeout);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
|
||||
<xsd:schema xmlns="http://www.springframework.org/schema/tx"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:tool="http://www.springframework.org/schema/tool"
|
||||
targetNamespace="http://www.springframework.org/schema/tx"
|
||||
elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified">
|
||||
|
||||
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"/>
|
||||
<xsd:import namespace="http://www.springframework.org/schema/tool" schemaLocation="http://www.springframework.org/schema/tool/spring-tool-3.2.xsd"/>
|
||||
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Defines the elements used in the Spring Framework's declarative
|
||||
transaction management infrastructure.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:element name="advice">
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.interceptor.TransactionInterceptor"><![CDATA[
|
||||
Defines the transactional semantics of the AOP advice that is to be
|
||||
executed.
|
||||
|
||||
That is, this advice element is where the transactional semantics of
|
||||
any number of methods are defined (where transactional semantics
|
||||
includes the propagation settings, the isolation level, the rollback
|
||||
rules, and suchlike).
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="org.springframework.transaction.interceptor.TransactionInterceptor"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="beans:identifiedType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="attributes" type="attributesType" minOccurs="0" maxOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="transaction-manager" type="xsd:string" default="transactionManager">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.PlatformTransactionManager"><![CDATA[
|
||||
The bean name of the PlatformTransactionManager that is to be used
|
||||
to drive transactions.
|
||||
|
||||
This attribute is not required, and only needs to be specified
|
||||
explicitly if the bean name of the desired PlatformTransactionManager
|
||||
is not 'transactionManager'.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.transaction.PlatformTransactionManager"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="annotation-driven">
|
||||
<xsd:complexType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"><![CDATA[
|
||||
Indicates that transaction configuration is defined by Java 5
|
||||
annotations on bean classes, and that proxies are automatically
|
||||
to be created for the relevant annotated beans.
|
||||
|
||||
The default annotations supported are Spring's @Transactional
|
||||
and EJB3's @TransactionAttribute (if available).
|
||||
|
||||
Transaction semantics such as propagation settings, the isolation level,
|
||||
the rollback rules, etc are all defined in the annotation metadata.
|
||||
|
||||
See org.springframework.transaction.annotation.EnableTransactionManagement Javadoc
|
||||
for information on code-based alternatives to this XML element.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="transaction-manager" type="xsd:string" default="transactionManager">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.PlatformTransactionManager"><![CDATA[
|
||||
The bean name of the PlatformTransactionManager that is to be used
|
||||
to drive transactions.
|
||||
|
||||
This attribute is not required, and only needs to be specified
|
||||
explicitly if the bean name of the desired PlatformTransactionManager
|
||||
is not 'transactionManager'.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation kind="ref">
|
||||
<tool:expected-type type="org.springframework.transaction.PlatformTransactionManager"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="mode" default="proxy">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Should annotated beans be proxied using Spring's AOP framework,
|
||||
or should they rather be weaved with an AspectJ transaction aspect?
|
||||
|
||||
AspectJ weaving requires spring-aspects.jar on the classpath,
|
||||
as well as load-time weaving (or compile-time weaving) enabled.
|
||||
|
||||
Note: The weaving-based aspect requires the @Transactional annotation to be
|
||||
defined on the concrete class. Annotations in interfaces will not work
|
||||
in that case (they will rather only work with interface-based proxies)!
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="proxy"/>
|
||||
<xsd:enumeration value="aspectj"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="proxy-target-class" type="xsd:boolean" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Are class-based (CGLIB) proxies to be created? By default, standard
|
||||
Java interface-based proxies are created.
|
||||
|
||||
Note: Class-based proxies require the @Transactional annotation to be
|
||||
defined on the concrete class. Annotations in interfaces will not work
|
||||
in that case (they will rather only work with interface-based proxies)!
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="order" type="xsd:int">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.core.Ordered"><![CDATA[
|
||||
Controls the ordering of the execution of the transaction advisor
|
||||
when multiple advice executes at a specific joinpoint.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:element name="jta-transaction-manager">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Creates a default JtaTransactionManager bean with name "transactionManager",
|
||||
matching the default bean name expected by the "annotation-driven" tag.
|
||||
Automatically detects WebLogic and WebSphere: creating a WebLogicJtaTransactionManager
|
||||
or WebSphereUowTransactionManager, respectively.
|
||||
|
||||
For customization needs, consider defining a JtaTransactionManager bean as a regular
|
||||
Spring bean definition with name "transactionManager", replacing this element.
|
||||
]]></xsd:documentation>
|
||||
<xsd:appinfo>
|
||||
<tool:annotation>
|
||||
<tool:exports type="org.springframework.transaction.jta.JtaTransactionManager"/>
|
||||
</tool:annotation>
|
||||
</xsd:appinfo>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="attributesType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="method" minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The method name(s) with which the transaction attributes are to be
|
||||
associated. The wildcard (*) character can be used to associate the
|
||||
same transaction attribute settings with a number of methods; for
|
||||
example, 'get*', 'handle*', '*Order', 'on*Event', etc.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="propagation" default="REQUIRED">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.annotation.Propagation"><![CDATA[
|
||||
The transaction propagation behavior.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="REQUIRED"/>
|
||||
<xsd:enumeration value="SUPPORTS"/>
|
||||
<xsd:enumeration value="MANDATORY"/>
|
||||
<xsd:enumeration value="REQUIRES_NEW"/>
|
||||
<xsd:enumeration value="NOT_SUPPORTED"/>
|
||||
<xsd:enumeration value="NEVER"/>
|
||||
<xsd:enumeration value="NESTED"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="isolation" default="DEFAULT">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation source="java:org.springframework.transaction.annotation.Isolation"><![CDATA[
|
||||
The transaction isolation level.
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="DEFAULT"/>
|
||||
<xsd:enumeration value="READ_UNCOMMITTED"/>
|
||||
<xsd:enumeration value="READ_COMMITTED"/>
|
||||
<xsd:enumeration value="REPEATABLE_READ"/>
|
||||
<xsd:enumeration value="SERIALIZABLE"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="timeout" type="xsd:integer" default="-1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The transaction timeout value (in seconds).
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="read-only" type="xsd:boolean" default="false">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
Is this transaction read-only?
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="rollback-for" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The Exception(s) that will trigger rollback; comma-delimited.
|
||||
For example, 'com.foo.MyBusinessException,ServletException'
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="no-rollback-for" type="xsd:string">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The Exception(s) that will *not* trigger rollback; comma-delimited.
|
||||
For example, 'com.foo.MyBusinessException,ServletException'
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
|
||||
</xsd:schema>
|
|
@ -3589,13 +3589,6 @@ http://www.springframework.org/schema/context
|
|||
<entry><para><classname>WebSphereLoadTimeWeaver</classname></para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><para>Running in <link
|
||||
xl:href="http://www.oracle.com/technology/products/oc4j/index.html">Oracle's
|
||||
OC4J</link></para></entry>
|
||||
<entry><para><classname>OC4JLoadTimeWeaver</classname></para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry><para>Running in <link xl:href="http://glassfish.dev.java.net/">GlassFish</link></para></entry>
|
||||
<entry><para><classname>GlassFishLoadTimeWeaver</classname></para></entry>
|
||||
|
@ -3854,10 +3847,11 @@ TR: REVISED, PLS REVIEW. Chnaged the last one to *inside*--> is recommended
|
|||
</section>
|
||||
|
||||
<section xml:id="aop-aj-ltw-environments-weblogic-oc4j-resin-glassfish-jboss">
|
||||
<title>WebLogic, WebSphere, OC4J, Resin, GlassFish, JBoss</title>
|
||||
<title>WebLogic, WebSphere, Resin, GlassFish, JBoss</title>
|
||||
|
||||
<para>Recent versions of BEA WebLogic (version 10 and above), IBM WebSphere Application Server (version 7 and above),
|
||||
Oracle Containers for Java EE (OC4J 10.1.3.1 and above), Resin (3.1 and above) and JBoss (5.x or above)
|
||||
<para>Recent versions of WebLogic Server (version 10 and above),
|
||||
IBM WebSphere Application Server (version 7 and above),
|
||||
Resin (3.1 and above) and JBoss (5.x or above)
|
||||
provide a ClassLoader that is capable of local instrumentation.
|
||||
Spring's native LTW leverages such ClassLoaders to enable AspectJ weaving.
|
||||
You can enable LTW by simply activating load-time weaving
|
||||
|
|
|
@ -1474,14 +1474,14 @@ TR: OK AS IS. The requirement is to provide the classloader for the runtime envi
|
|||
|
||||
<para>Refer to <xref linkend="aop-aj-ltw-spring" /> in the AOP chapter for more insight regarding the
|
||||
<interfacename>LoadTimeWeaver</interfacename> implementations and their setup, either generic or customized to
|
||||
various platforms (such as Tomcat, WebLogic, OC4J, GlassFish, Resin and JBoss).</para>
|
||||
various platforms (such as Tomcat, WebLogic, GlassFish, Resin and JBoss).</para>
|
||||
|
||||
|
||||
<para>As described in the aforementioned section, you can configure a context-wide <interfacename>LoadTimeWeaver</interfacename>
|
||||
using the <interfacename>@EnableLoadTimeWeaving</interfacename> annotation of <literal>context:load-time-weaver</literal> XML element.
|
||||
Such a global weaver is picked up by all JPA <classname>LocalContainerEntityManagerFactoryBeans</classname>
|
||||
automatically. This is the preferred way of setting up a load-time weaver, delivering autodetection of the platform
|
||||
(WebLogic, OC4J, GlassFish, Tomcat, Resin, JBoss or VM agent) and automatic propagation of the weaver to all weaver-aware beans:</para>
|
||||
(WebLogic, GlassFish, Tomcat, Resin, JBoss or VM agent) and automatic propagation of the weaver to all weaver-aware beans:</para>
|
||||
|
||||
<programlisting language="xml"><context:load-time-weaver/>
|
||||
<bean id="emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
|
|
|
@ -2427,15 +2427,14 @@ txManager.commit(status);</programlisting>
|
|||
<para>Spring's <classname>JtaTransactionManager</classname> is the
|
||||
standard choice to run on Java EE application servers, and is known to
|
||||
work on all common servers. Advanced functionality such as transaction
|
||||
suspension works on many servers as well -- including GlassFish, JBoss,
|
||||
Geronimo, and Oracle OC4J -- without any special configuration required.
|
||||
suspension works on many servers as well -- including GlassFish, JBoss
|
||||
and Geronimo -- without any special configuration required.
|
||||
However, for fully supported transaction suspension and further advanced
|
||||
integration, Spring ships special adapters for IBM WebSphere, BEA WebLogic
|
||||
Server, and Oracle OC4J. These adapters are discussed in the following
|
||||
sections.</para>
|
||||
integration, Spring ships special adapters for WebLogic Server and
|
||||
WebSphere. These adapters are discussed in the following sections.</para>
|
||||
|
||||
<para><emphasis>For standard scenarios, including WebLogic Server,
|
||||
WebSphere and OC4J, consider using the convenient
|
||||
<para><emphasis>For standard scenarios, including WebLogic Server and
|
||||
WebSphere, consider using the convenient
|
||||
<literal><tx:jta-transaction-manager/></literal> configuration
|
||||
element.</emphasis> When configured, this element automatically detects
|
||||
the underlying server and chooses the best transaction manager available
|
||||
|
@ -2459,7 +2458,7 @@ txManager.commit(status);</programlisting>
|
|||
</section>
|
||||
|
||||
<section xml:id="transaction-application-server-integration-weblogic">
|
||||
<title>BEA WebLogic Server</title>
|
||||
<title>Oracle WebLogic Server</title>
|
||||
|
||||
<para>On WebLogic Server 9.0 or above, you typically would use the
|
||||
<classname>WebLogicJtaTransactionManager</classname> instead of the
|
||||
|
@ -2472,23 +2471,6 @@ txManager.commit(status);</programlisting>
|
|||
transactions in all cases.</para>
|
||||
</section>
|
||||
|
||||
<section xml:id="transaction-application-server-integration-oc4j">
|
||||
<title>Oracle OC4J</title>
|
||||
|
||||
<para>Spring ships a special adapter class for OC4J 10.1.3 or later
|
||||
called <classname>OC4JJtaTransactionManager</classname>. This class is
|
||||
analogous to the <classname>WebLogicJtaTransactionManager</classname>
|
||||
class discussed in the previous section, providing similar value-adds on
|
||||
OC4J: transaction names and per-transaction isolation levels.</para>
|
||||
|
||||
<para>The full JTA functionality, including transaction suspension,
|
||||
works fine with Spring's <classname>JtaTransactionManager</classname> on
|
||||
OC4J as well. The special
|
||||
<classname>OC4JJtaTransactionManager</classname> adapter simply provides
|
||||
value-adds beyond standard JTA.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section xml:id="transaction-solutions-to-common-problems">
|
||||
<title>Solutions to common problems</title>
|
||||
|
||||
|
|
Loading…
Reference in New Issue