generified FactoryBeans and further Java 5 code style updates
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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,7 +24,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Convenient factory for local Stateless Session Bean (SLSB) proxies.
|
||||
* Convenient {@link FactoryBean} for local Stateless Session Bean (SLSB) proxies.
|
||||
* Designed for EJB 2.x, but works for EJB 3 Session Beans as well.
|
||||
*
|
||||
* <p>See {@link org.springframework.jndi.JndiObjectLocator} for info on
|
||||
@@ -49,7 +49,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see AbstractSlsbInvokerInterceptor#setCacheHome
|
||||
*/
|
||||
public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInterceptor
|
||||
implements FactoryBean, BeanClassLoaderAware {
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
/** The business interface of the EJB we're proxying */
|
||||
private Class businessInterface;
|
||||
@@ -95,7 +95,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
return this.businessInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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,7 +24,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Convenient factory for remote SLSB proxies.
|
||||
* Convenient {@link FactoryBean} for remote SLSB proxies.
|
||||
* Designed for EJB 2.x, but works for EJB 3 Session Beans as well.
|
||||
*
|
||||
* <p>See {@link org.springframework.jndi.JndiObjectLocator} for info on
|
||||
@@ -59,7 +59,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see AbstractRemoteSlsbInvokerInterceptor#setRefreshHomeOnConnectFailure
|
||||
*/
|
||||
public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSlsbInvokerInterceptor
|
||||
implements FactoryBean, BeanClassLoaderAware {
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
/** The business interface of the EJB we're proxying */
|
||||
private Class businessInterface;
|
||||
@@ -109,7 +109,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
return this.businessInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -46,7 +46,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see InvalidInvocationException
|
||||
*/
|
||||
public class MBeanProxyFactoryBean extends MBeanClientInterceptor
|
||||
implements FactoryBean, BeanClassLoaderAware, InitializingBean {
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware, InitializingBean {
|
||||
|
||||
private Class proxyInterface;
|
||||
|
||||
@@ -98,7 +98,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
|
||||
return this.mbeanProxy;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
return this.proxyInterface;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -17,9 +17,9 @@
|
||||
package org.springframework.jmx.support;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.management.JMException;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
@@ -32,10 +32,11 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jmx.JmxException;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* <code>FactoryBean</code> that creates a JSR-160 <code>JMXConnectorServer</code>,
|
||||
* optionally registers it with the <code>MBeanServer</code> and then starts it.
|
||||
* {@link FactoryBean} that creates a JSR-160 {@link JMXConnectorServer},
|
||||
* optionally registers it with the {@link MBeanServer} and then starts it.
|
||||
*
|
||||
* <p>The <code>JMXConnectorServer</code> can be started in a separate thread by setting the
|
||||
* <code>threaded</code> property to <code>true</code>. You can configure this thread to be a
|
||||
@@ -52,7 +53,7 @@ import org.springframework.jmx.JmxException;
|
||||
* @see MBeanServer
|
||||
*/
|
||||
public class ConnectorServerFactoryBean extends MBeanRegistrationSupport
|
||||
implements FactoryBean, InitializingBean, DisposableBean {
|
||||
implements FactoryBean<JMXConnectorServer>, InitializingBean, DisposableBean {
|
||||
|
||||
/** The default service URL */
|
||||
public static final String DEFAULT_SERVICE_URL = "service:jmx:jmxmp://localhost:9875";
|
||||
@@ -60,7 +61,7 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport
|
||||
|
||||
private String serviceUrl = DEFAULT_SERVICE_URL;
|
||||
|
||||
private Map environment;
|
||||
private Map<String, Object> environment = new HashMap<String, Object>();
|
||||
|
||||
private ObjectName objectName;
|
||||
|
||||
@@ -83,15 +84,17 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport
|
||||
* as <code>java.util.Properties</code> (String key/value pairs).
|
||||
*/
|
||||
public void setEnvironment(Properties environment) {
|
||||
this.environment = environment;
|
||||
CollectionUtils.mergePropertiesIntoMap(environment, this.environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the environment properties used to construct the <code>JMXConnector</code>
|
||||
* as a <code>Map</code> of String keys and arbitrary Object values.
|
||||
*/
|
||||
public void setEnvironmentMap(Map environment) {
|
||||
this.environment = environment;
|
||||
public void setEnvironmentMap(Map<String, ?> environment) {
|
||||
if (environment != null) {
|
||||
this.environment.putAll(environment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,11 +185,11 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() {
|
||||
public JMXConnectorServer getObject() {
|
||||
return this.connectorServer;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<? extends JMXConnectorServer> getObjectType() {
|
||||
return (this.connectorServer != null ? this.connectorServer.getClass() : JMXConnectorServer.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -18,9 +18,9 @@ package org.springframework.jmx.support;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.remote.JMXConnector;
|
||||
import javax.management.remote.JMXConnectorFactory;
|
||||
@@ -34,9 +34,10 @@ import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* <code>FactoryBean</code> that creates a JMX 1.2 <code>MBeanServerConnection</code>
|
||||
* {@link FactoryBean} that creates a JMX 1.2 <code>MBeanServerConnection</code>
|
||||
* to a remote <code>MBeanServer</code> exposed via a <code>JMXServerConnector</code>.
|
||||
* Exposes the <code>MBeanServer</code> for bean references.
|
||||
*
|
||||
@@ -49,11 +50,11 @@ import org.springframework.util.ClassUtils;
|
||||
* @see org.springframework.jmx.access.NotificationListenerRegistrar#setServer
|
||||
*/
|
||||
public class MBeanServerConnectionFactoryBean
|
||||
implements FactoryBean, BeanClassLoaderAware, InitializingBean, DisposableBean {
|
||||
implements FactoryBean<MBeanServerConnection>, BeanClassLoaderAware, InitializingBean, DisposableBean {
|
||||
|
||||
private JMXServiceURL serviceUrl;
|
||||
|
||||
private Map environment;
|
||||
private Map<String, Object> environment = new HashMap<String, Object>();
|
||||
|
||||
private boolean connectOnStartup = true;
|
||||
|
||||
@@ -78,15 +79,17 @@ public class MBeanServerConnectionFactoryBean
|
||||
* as <code>java.util.Properties</code> (String key/value pairs).
|
||||
*/
|
||||
public void setEnvironment(Properties environment) {
|
||||
this.environment = environment;
|
||||
CollectionUtils.mergePropertiesIntoMap(environment, this.environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the environment properties used to construct the <code>JMXConnector</code>
|
||||
* as a <code>Map</code> of String keys and arbitrary Object values.
|
||||
*/
|
||||
public void setEnvironmentMap(Map environment) {
|
||||
this.environment = environment;
|
||||
public void setEnvironmentMap(Map<String, ?> environment) {
|
||||
if (environment != null) {
|
||||
this.environment.putAll(environment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,11 +146,11 @@ public class MBeanServerConnectionFactoryBean
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() {
|
||||
public MBeanServerConnection getObject() {
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<? extends MBeanServerConnection> getObjectType() {
|
||||
return (this.connection != null ? this.connection.getClass() : MBeanServerConnection.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -28,7 +28,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jmx.MBeanServerNotFoundException;
|
||||
|
||||
/**
|
||||
* FactoryBean that obtains an {@link javax.management.MBeanServer} reference
|
||||
* {@link FactoryBean} that obtains an {@link javax.management.MBeanServer} reference
|
||||
* through the standard JMX 1.2 {@link javax.management.MBeanServerFactory}
|
||||
* API (which is available on JDK 1.5 or as part of a JMX 1.2 provider).
|
||||
* Exposes the <code>MBeanServer</code> for bean references.
|
||||
@@ -51,7 +51,7 @@ import org.springframework.jmx.MBeanServerNotFoundException;
|
||||
* @see MBeanServerConnectionFactoryBean
|
||||
* @see ConnectorServerFactoryBean
|
||||
*/
|
||||
public class MBeanServerFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
|
||||
public class MBeanServerFactoryBean implements FactoryBean<MBeanServer>, InitializingBean, DisposableBean {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -178,11 +178,11 @@ public class MBeanServerFactoryBean implements FactoryBean, InitializingBean, Di
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() {
|
||||
public MBeanServer getObject() {
|
||||
return this.server;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<? extends MBeanServer> getObjectType() {
|
||||
return (this.server != null ? this.server.getClass() : MBeanServer.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -26,7 +26,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jmx.MBeanServerNotFoundException;
|
||||
|
||||
/**
|
||||
* FactoryBean that obtains a WebSphere {@link javax.management.MBeanServer}
|
||||
* {@link FactoryBean} that obtains a WebSphere {@link javax.management.MBeanServer}
|
||||
* reference through WebSphere's proprietary <code>AdminServiceFactory</code> API,
|
||||
* available on WebSphere 5.1 and higher.
|
||||
*
|
||||
@@ -42,7 +42,7 @@ import org.springframework.jmx.MBeanServerNotFoundException;
|
||||
* @see javax.management.MBeanServer
|
||||
* @see MBeanServerFactoryBean
|
||||
*/
|
||||
public class WebSphereMBeanServerFactoryBean implements FactoryBean, InitializingBean {
|
||||
public class WebSphereMBeanServerFactoryBean implements FactoryBean<MBeanServer>, InitializingBean {
|
||||
|
||||
private static final String ADMIN_SERVICE_FACTORY_CLASS = "com.ibm.websphere.management.AdminServiceFactory";
|
||||
|
||||
@@ -60,10 +60,10 @@ public class WebSphereMBeanServerFactoryBean implements FactoryBean, Initializin
|
||||
* this.mbeanServer = AdminServiceFactory.getMBeanFactory().getMBeanServer();
|
||||
*/
|
||||
Class adminServiceClass = getClass().getClassLoader().loadClass(ADMIN_SERVICE_FACTORY_CLASS);
|
||||
Method getMBeanFactoryMethod = adminServiceClass.getMethod(GET_MBEAN_FACTORY_METHOD, new Class[0]);
|
||||
Object mbeanFactory = getMBeanFactoryMethod.invoke(null, new Object[0]);
|
||||
Method getMBeanServerMethod = mbeanFactory.getClass().getMethod(GET_MBEAN_SERVER_METHOD, new Class[0]);
|
||||
this.mbeanServer = (MBeanServer) getMBeanServerMethod.invoke(mbeanFactory, new Object[0]);
|
||||
Method getMBeanFactoryMethod = adminServiceClass.getMethod(GET_MBEAN_FACTORY_METHOD);
|
||||
Object mbeanFactory = getMBeanFactoryMethod.invoke(null);
|
||||
Method getMBeanServerMethod = mbeanFactory.getClass().getMethod(GET_MBEAN_SERVER_METHOD);
|
||||
this.mbeanServer = (MBeanServer) getMBeanServerMethod.invoke(mbeanFactory);
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
throw new MBeanServerNotFoundException("Could not find WebSphere's AdminServiceFactory class", ex);
|
||||
@@ -79,11 +79,11 @@ public class WebSphereMBeanServerFactoryBean implements FactoryBean, Initializin
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() {
|
||||
public MBeanServer getObject() {
|
||||
return this.mbeanServer;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<? extends MBeanServer> getObjectType() {
|
||||
return (this.mbeanServer != null ? this.mbeanServer.getClass() : MBeanServer.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -61,7 +61,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see #setCache
|
||||
* @see JndiObjectTargetSource
|
||||
*/
|
||||
public class JndiObjectFactoryBean extends JndiObjectLocator implements FactoryBean, BeanClassLoaderAware {
|
||||
public class JndiObjectFactoryBean extends JndiObjectLocator implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
private Class[] proxyInterfaces;
|
||||
|
||||
@@ -232,7 +232,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator implements FactoryB
|
||||
return this.jndiObject;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
if (this.proxyInterfaces != null) {
|
||||
if (this.proxyInterfaces.length == 1) {
|
||||
return this.proxyInterfaces[0];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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,7 +24,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Factory bean for RMI proxies from JNDI.
|
||||
* {@link FactoryBean} for RMI proxies from JNDI.
|
||||
*
|
||||
* <p>Typically used for RMI-IIOP (CORBA), but can also be used for EJB home objects
|
||||
* (for example, a Stateful Session Bean home). In contrast to a plain JNDI lookup,
|
||||
@@ -61,7 +61,8 @@ import org.springframework.util.ClassUtils;
|
||||
* @see java.rmi.Remote
|
||||
* @see javax.rmi.PortableRemoteObject#narrow
|
||||
*/
|
||||
public class JndiRmiProxyFactoryBean extends JndiRmiClientInterceptor implements FactoryBean, BeanClassLoaderAware {
|
||||
public class JndiRmiProxyFactoryBean extends JndiRmiClientInterceptor
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -86,7 +87,7 @@ public class JndiRmiProxyFactoryBean extends JndiRmiClientInterceptor implements
|
||||
return this.serviceProxy;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
return getServiceInterface();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -21,8 +21,8 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
/**
|
||||
* FactoryBean for RMI proxies, supporting both conventional RMI services and
|
||||
* RMI invokers. Exposes the proxied service for use as a bean reference,
|
||||
* {@link FactoryBean} for RMI proxies, supporting both conventional RMI services
|
||||
* and RMI invokers. Exposes the proxied service for use as a bean reference,
|
||||
* using the specified service interface. Proxies will throw Spring's unchecked
|
||||
* RemoteAccessException on remote invocation failure instead of RMI's RemoteException.
|
||||
*
|
||||
@@ -58,7 +58,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
* @see org.springframework.remoting.caucho.BurlapProxyFactoryBean
|
||||
* @see org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean
|
||||
*/
|
||||
public class RmiProxyFactoryBean extends RmiClientInterceptor implements FactoryBean, BeanClassLoaderAware {
|
||||
public class RmiProxyFactoryBean extends RmiClientInterceptor implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
private Object serviceProxy;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class RmiProxyFactoryBean extends RmiClientInterceptor implements Factory
|
||||
return this.serviceProxy;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<?> getObjectType() {
|
||||
return getServiceInterface();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -31,7 +31,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* FactoryBean that locates a {@link java.rmi.registry.Registry} and
|
||||
* {@link FactoryBean} that locates a {@link java.rmi.registry.Registry} and
|
||||
* exposes it for bean references. Can also create a local RMI registry
|
||||
* on the fly if none exists already.
|
||||
*
|
||||
@@ -60,7 +60,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
* @see java.rmi.registry.Registry
|
||||
* @see java.rmi.registry.LocateRegistry
|
||||
*/
|
||||
public class RmiRegistryFactoryBean implements FactoryBean, InitializingBean, DisposableBean {
|
||||
public class RmiRegistryFactoryBean implements FactoryBean<Registry>, InitializingBean, DisposableBean {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -278,11 +278,11 @@ public class RmiRegistryFactoryBean implements FactoryBean, InitializingBean, Di
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() throws Exception {
|
||||
public Registry getObject() throws Exception {
|
||||
return this.registry;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<? extends Registry> getObjectType() {
|
||||
return (this.registry != null ? this.registry.getClass() : Registry.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -22,19 +22,14 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.scheduling.support.MethodInvokingRunnable;
|
||||
|
||||
/**
|
||||
* FactoryBean that exposes a TimerTask object that delegates
|
||||
* job execution to a specified (static or non-static) method.
|
||||
* Avoids the need to implement a one-line TimerTask that just
|
||||
* invokes an existing business method.
|
||||
* {@link FactoryBean} that exposes a {@link TimerTask} object which
|
||||
* delegates job execution to a specified (static or non-static) method.
|
||||
* Avoids the need to implement a one-line TimerTask that just invokes
|
||||
* an existing business method.
|
||||
*
|
||||
* <p>Derives from MethodInvokingRunnable to share common properties
|
||||
* <p>Derives from {@link MethodInvokingRunnable} to share common properties
|
||||
* and behavior, effectively providing a TimerTask adapter for it.
|
||||
*
|
||||
* <p>Often used to populate a ScheduledTimerTask object with a specific
|
||||
* reflective method invocation. Note that you can alternatively populate
|
||||
* a ScheduledTimerTask object with a plain MethodInvokingRunnable instance
|
||||
* as well (as of Spring 1.2.4), without the need for this special FactoryBean.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 19.02.2004
|
||||
* @see DelegatingTimerTask
|
||||
@@ -43,7 +38,7 @@ import org.springframework.scheduling.support.MethodInvokingRunnable;
|
||||
* @see org.springframework.scheduling.support.MethodInvokingRunnable
|
||||
* @see org.springframework.beans.factory.config.MethodInvokingFactoryBean
|
||||
*/
|
||||
public class MethodInvokingTimerTaskFactoryBean extends MethodInvokingRunnable implements FactoryBean {
|
||||
public class MethodInvokingTimerTaskFactoryBean extends MethodInvokingRunnable implements FactoryBean<TimerTask> {
|
||||
|
||||
private TimerTask timerTask;
|
||||
|
||||
@@ -55,11 +50,11 @@ public class MethodInvokingTimerTaskFactoryBean extends MethodInvokingRunnable i
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() {
|
||||
public TimerTask getObject() {
|
||||
return this.timerTask;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<TimerTask> getObjectType() {
|
||||
return TimerTask.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
|
||||
* @see java.util.Timer
|
||||
* @see java.util.TimerTask
|
||||
*/
|
||||
public class TimerFactoryBean implements FactoryBean, BeanNameAware, InitializingBean, DisposableBean {
|
||||
public class TimerFactoryBean implements FactoryBean<Timer>, BeanNameAware, InitializingBean, DisposableBean {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -141,11 +141,11 @@ public class TimerFactoryBean implements FactoryBean, BeanNameAware, Initializin
|
||||
}
|
||||
|
||||
|
||||
public Object getObject() {
|
||||
public Timer getObject() {
|
||||
return this.timer;
|
||||
}
|
||||
|
||||
public Class getObjectType() {
|
||||
public Class<? extends Timer> getObjectType() {
|
||||
return Timer.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -39,7 +39,7 @@ public interface Model {
|
||||
/**
|
||||
* Add the supplied attribute to this <code>Map</code> using a
|
||||
* {@link org.springframework.core.Conventions#getVariableName generated name}.
|
||||
* <p/><emphasis>Note: Empty {@link java.util.Collection Collections} are not added to
|
||||
* <p><emphasis>Note: Empty {@link java.util.Collection Collections} are not added to
|
||||
* the model when using this method because we cannot correctly determine
|
||||
* the true convention name. View code should check for <code>null</code> rather
|
||||
* than for empty collections as is already done by JSTL tags.</emphasis>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 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.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.ui;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -81,7 +80,7 @@ public class ModelMap extends LinkedHashMap<String, Object> {
|
||||
/**
|
||||
* Add the supplied attribute to this <code>Map</code> using a
|
||||
* {@link org.springframework.core.Conventions#getVariableName generated name}.
|
||||
* <p/><emphasis>Note: Empty {@link Collection Collections} are not added to
|
||||
* <p><emphasis>Note: Empty {@link Collection Collections} are not added to
|
||||
* the model when using this method because we cannot correctly determine
|
||||
* the true convention name. View code should check for <code>null</code> rather
|
||||
* than for empty collections as is already done by JSTL tags.</emphasis>
|
||||
@@ -102,8 +101,8 @@ public class ModelMap extends LinkedHashMap<String, Object> {
|
||||
*/
|
||||
public ModelMap addAllAttributes(Collection<?> attributeValues) {
|
||||
if (attributeValues != null) {
|
||||
for (Iterator it = attributeValues.iterator(); it.hasNext();) {
|
||||
addAttribute(it.next());
|
||||
for (Object attributeValue : attributeValues) {
|
||||
addAttribute(attributeValue);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user