You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2017/02/14 09:49:52 UTC
[47/51] [partial] cxf git commit: Remove all trailing whitespaces
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java b/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
index 847ce28..beebcc7 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/BusDefinitionParser.java
@@ -54,7 +54,7 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
}
protected void doParse(Element element, ParserContext ctx, BeanDefinitionBuilder bean) {
- String bus = element.getAttribute("bus");
+ String bus = element.getAttribute("bus");
if (StringUtils.isEmpty(bus)) {
bus = element.getAttribute("name");
if (StringUtils.isEmpty(bus)) {
@@ -71,7 +71,7 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
}
super.doParse(element, ctx, bean);
-
+
if (ctx.getRegistry().containsBeanDefinition(bus)) {
BeanDefinition def = ctx.getRegistry().getBeanDefinition(bus);
copyProps(bean, def);
@@ -87,12 +87,12 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
}
} else {
addBusWiringAttribute(bean, BusWiringType.PROPERTY, bus, ctx);
- bean.getRawBeanDefinition().setAttribute(WIRE_BUS_CREATE,
+ bean.getRawBeanDefinition().setAttribute(WIRE_BUS_CREATE,
resolveId(element, null, ctx));
bean.addConstructorArgValue(bus);
}
}
- protected boolean processBusAttribute(Element element, ParserContext ctx,
+ protected boolean processBusAttribute(Element element, ParserContext ctx,
BeanDefinitionBuilder bean,
String val) {
return false;
@@ -104,13 +104,13 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
}
src.getBeanDefinition().getPropertyValues().removePropertyValue(v);
}
-
+
}
@Override
- protected void mapElement(ParserContext ctx,
- BeanDefinitionBuilder bean,
- Element e,
+ protected void mapElement(ParserContext ctx,
+ BeanDefinitionBuilder bean,
+ Element e,
String name) {
if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
|| "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
@@ -123,7 +123,7 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
}
}
@Override
- protected String resolveId(Element element, AbstractBeanDefinition definition,
+ protected String resolveId(Element element, AbstractBeanDefinition definition,
ParserContext ctx) {
String bus = null;
try {
@@ -132,7 +132,7 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
//ignore
}
if (bus == null) {
- bus = element.getAttribute("bus");
+ bus = element.getAttribute("bus");
if (StringUtils.isEmpty(bus)) {
bus = element.getAttribute("name");
}
@@ -144,26 +144,26 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
try {
element.setUserData("ID", bus, null);
} catch (Throwable t) {
- //maybe no DOM level 3, ignore, but, may have issues with the counter
+ //maybe no DOM level 3, ignore, but, may have issues with the counter
}
}
return bus;
}
-
+
@NoJSR250Annotations
public static class BusConfig extends AbstractBasicInterceptorProvider
implements ApplicationContextAware {
-
+
Bus bus;
String busName;
String id;
Collection<Feature> features;
Map<String, Object> properties;
-
+
public BusConfig(String busName) {
this.busName = busName;
}
-
+
public void setBus(Bus bb) {
if (bus == bb) {
return;
@@ -197,9 +197,9 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
if (bus != null) {
return;
- }
+ }
}
-
+
public List<Interceptor<? extends Message>> getOutFaultInterceptors() {
if (bus != null) {
return bus.getOutFaultInterceptors();
@@ -259,7 +259,7 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
super.setOutFaultInterceptors(interceptors);
}
}
-
+
public Collection<Feature> getFeatures() {
if (bus != null) {
return bus.getFeatures();
@@ -273,13 +273,13 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
} else {
this.features = CastUtils.cast(features);
}
-
+
}
-
+
public Map<String, Object> getProperties() {
if (bus != null) {
return bus.getProperties();
- }
+ }
return properties;
}
public void setProperties(Map<String, Object> s) {
@@ -289,7 +289,7 @@ public class BusDefinitionParser extends AbstractBeanDefinitionParser {
this.properties = s;
}
}
-
+
public void setId(String s) {
id = s;
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/BusEntityResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/BusEntityResolver.java b/core/src/main/java/org/apache/cxf/bus/spring/BusEntityResolver.java
index 65d3ffc..d3d747e 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/BusEntityResolver.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/BusEntityResolver.java
@@ -38,25 +38,25 @@ import org.springframework.core.io.support.PropertiesLoaderUtils;
import org.springframework.util.CollectionUtils;
/**
- *
+ *
*/
public class BusEntityResolver extends DelegatingEntityResolver {
-
+
private static final Logger LOG = LogUtils.getL7dLogger(BusEntityResolver.class);
-
+
private EntityResolver dtdResolver;
private EntityResolver schemaResolver;
private Map<String, String> schemaMappings;
private ClassLoader classLoader;
-
+
public BusEntityResolver(ClassLoader loader, EntityResolver dr, EntityResolver sr) {
super(dr, sr);
classLoader = loader;
dtdResolver = dr;
schemaResolver = sr;
-
+
try {
- Properties mappings = PropertiesLoaderUtils.loadAllProperties("META-INF/spring.schemas",
+ Properties mappings = PropertiesLoaderUtils.loadAllProperties("META-INF/spring.schemas",
classLoader);
schemaMappings = new ConcurrentHashMap<String, String>(mappings.size());
CollectionUtils.mergePropertiesIntoMap(mappings, schemaMappings);
@@ -71,19 +71,19 @@ public class BusEntityResolver extends DelegatingEntityResolver {
if (null == source && null != systemId) {
// try the schema and dtd resolver in turn, ignoring the suffix in publicId
LOG.log(Level.FINE, "Attempting to resolve systemId {0}", systemId);
- source = schemaResolver.resolveEntity(publicId, systemId);
+ source = schemaResolver.resolveEntity(publicId, systemId);
if (null == source) {
- source = dtdResolver.resolveEntity(publicId, systemId);
+ source = dtdResolver.resolveEntity(publicId, systemId);
}
}
String resourceLocation = schemaMappings.get(systemId);
if (resourceLocation != null && publicId == null) {
Resource resource = new ClassPathResource(resourceLocation, classLoader);
if (resource != null && resource.exists()) {
- source.setPublicId(systemId);
+ source.setPublicId(systemId);
source.setSystemId(resource.getURL().toString());
}
}
return source;
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java b/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
index 3c6369d..8ef72ef 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/BusExtensionPostProcessor.java
@@ -37,13 +37,13 @@ public class BusExtensionPostProcessor implements BeanPostProcessor, Application
public void setApplicationContext(ApplicationContext ctx) {
context = ctx;
- }
-
+ }
+
public int getOrder() {
return 1001;
}
-
-
+
+
public Object postProcessAfterInitialization(Object bean, String beanId) throws BeansException {
return bean;
}
@@ -60,7 +60,7 @@ public class BusExtensionPostProcessor implements BeanPostProcessor, Application
private <T> void registerExt(Object bean, Class<T> cls) {
getBus().setExtension(cls.cast(bean), cls);
}
-
+
private Bus getBus() {
if (bus == null) {
bus = (Bus)context.getBean(Bus.DEFAULT_BUS_ID);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/BusWiringBeanFactoryPostProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/BusWiringBeanFactoryPostProcessor.java b/core/src/main/java/org/apache/cxf/bus/spring/BusWiringBeanFactoryPostProcessor.java
index f4f826e..4119214 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/BusWiringBeanFactoryPostProcessor.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/BusWiringBeanFactoryPostProcessor.java
@@ -52,7 +52,7 @@ public class BusWiringBeanFactoryPostProcessor implements BeanFactoryPostProcess
Bus bus;
String busName;
-
+
public BusWiringBeanFactoryPostProcessor() {
}
@@ -88,9 +88,9 @@ public class BusWiringBeanFactoryPostProcessor implements BeanFactoryPostProcess
BeanDefinition bd = factory.getBeanDefinition(name);
bd.getPropertyValues().addPropertyValue("busConfig", new RuntimeBeanReference(cn));
}
- return new RuntimeBeanReference(name);
+ return new RuntimeBeanReference(name);
}
-
+
public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException {
Object inject = bus;
if (inject == null) {
@@ -103,7 +103,7 @@ public class BusWiringBeanFactoryPostProcessor implements BeanFactoryPostProcess
}
for (String beanName : factory.getBeanDefinitionNames()) {
BeanDefinition beanDefinition = factory.getBeanDefinition(beanName);
- BusWiringType type
+ BusWiringType type
= (BusWiringType)beanDefinition.getAttribute(AbstractBeanDefinitionParser.WIRE_BUS_ATTRIBUTE);
if (type == null) {
continue;
@@ -138,7 +138,7 @@ public class BusWiringBeanFactoryPostProcessor implements BeanFactoryPostProcess
* argument set, then re-insert all its generic arguments, then re-insert all its indexed arguments with
* their indices incremented by 1, and finally set the first indexed argument (at index 0) to the given
* value.
- *
+ *
* @param constructorArgs the argument definition to modify.
* @param valueToInsert the value to insert as the first argument.
*/
@@ -157,7 +157,7 @@ public class BusWiringBeanFactoryPostProcessor implements BeanFactoryPostProcess
}
constructorArgs.addIndexedArgumentValue(0, valueToInsert);
}
-
+
public static Bus addDefaultBus(ApplicationContext ctx) {
if (!ctx.containsBean(Bus.DEFAULT_BUS_ID)) {
Bus b = getBusForName(Bus.DEFAULT_BUS_ID, ctx, true);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/ControlledValidationXmlBeanDefinitionReader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/ControlledValidationXmlBeanDefinitionReader.java b/core/src/main/java/org/apache/cxf/bus/spring/ControlledValidationXmlBeanDefinitionReader.java
index 007ce70..74fd14a 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/ControlledValidationXmlBeanDefinitionReader.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/ControlledValidationXmlBeanDefinitionReader.java
@@ -46,22 +46,22 @@ import org.springframework.core.io.support.EncodedResource;
* The time it takes to parse them, especially if validating, builds up.
* The XML files shipped in a release in the JARs are valid and invariant.
* To speed things up, this class implements two levels of optimization.
- * When a CXF distribution is fully-packaged, each of the Spring XML
+ * When a CXF distribution is fully-packaged, each of the Spring XML
* bus extension .xml files is accompanied by a FastInfoset '.fixml' file.
* These read much more rapidly. When one of those is present, this classs
- * reads it instead of reading the XML text file.
- *
+ * reads it instead of reading the XML text file.
+ *
* Absent a .fixml file, this class uses WoodStox instead of Xerces (or
* whatever the JDK is providing).
- *
+ *
* The Woodstox optimization also applies to user cxf.xml or cxf-servlet.xml files
* if the user has disabled XML validation of Spring files with
* the org.apache.cxf.spring.validation.mode system property.
- *
- * Note that the fastInfoset optimization is only applied for the
+ *
+ * Note that the fastInfoset optimization is only applied for the
* methods here that start from a Resource. If this is called with an InputSource,
* that optimization is not applied, since we can't reliably know the
- * location of the XML.
+ * location of the XML.
*/
public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefinitionReader {
@@ -74,7 +74,7 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
}
- // the following flag allows performance comparisons with and
+ // the following flag allows performance comparisons with and
// without fast infoset processing.
private boolean noFastinfoset;
// Spring has no 'getter' for this, so we need our own copy.
@@ -88,12 +88,12 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
super(beanFactory);
tunedDocumentLoader = new TunedDocumentLoader();
this.setDocumentLoader(tunedDocumentLoader);
- noFastinfoset = SystemPropertyAction.getPropertyOrNull("org.apache.cxf.nofastinfoset") != null
+ noFastinfoset = SystemPropertyAction.getPropertyOrNull("org.apache.cxf.nofastinfoset") != null
|| !TunedDocumentLoader.hasFastInfoSet();
}
@Override
- protected int doLoadBeanDefinitions(InputSource inputSource,
+ protected int doLoadBeanDefinitions(InputSource inputSource,
Resource resource) throws BeanDefinitionStoreException {
// sadly, the Spring class we are extending has the critical function
// getValidationModeForResource
@@ -107,7 +107,7 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
} catch (IOException e) {
// this space intentionally left blank.
}
-
+
int savedValidation = visibleValidationMode;
if (suppressValidation) {
setValidationMode(VALIDATION_NONE);
@@ -140,7 +140,7 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
public Integer run() throws Exception {
return internalLoadBeanDefinitions(encodedResource);
}
-
+
});
} catch (PrivilegedActionException e) {
if (e.getException() instanceof RuntimeException) {
@@ -149,15 +149,15 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
throw (BeanDefinitionStoreException)e.getException();
}
}
-
+
private int internalLoadBeanDefinitions(EncodedResource encodedResource) {
return super.loadBeanDefinitions(encodedResource);
}
-
+
private int fastInfosetLoadBeanDefinitions(EncodedResource encodedResource)
- throws IOException, StaleFastinfosetException,
+ throws IOException, StaleFastinfosetException,
ParserConfigurationException, XMLStreamException {
-
+
URL resUrl = encodedResource.getResource().getURL();
// There are XML files scampering around that don't end in .xml.
// We don't apply the optimization to them.
@@ -170,7 +170,7 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
if ("jar".equals(protocol)) {
fixmlPath = fixmlPath.replaceFirst("^.*!", "");
}
-
+
URL fixmlUrl = new URL(resUrl, fixmlPath);
// if we are in unpacked files, we take some extra time
@@ -184,8 +184,8 @@ public class ControlledValidationXmlBeanDefinitionReader extends XmlBeanDefiniti
throw new StaleFastinfosetException();
}
}
-
- Resource newResource = new UrlResource(fixmlUrl);
+
+ Resource newResource = new UrlResource(fixmlUrl);
Document doc = TunedDocumentLoader.loadFastinfosetDocument(fixmlUrl);
if (doc == null) {
//something caused FastinfoSet to not be able to read the doc
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java b/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
index 25748bf..d5c8766 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/Jsr250BeanPostProcessor.java
@@ -31,7 +31,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.Ordered;
-public class Jsr250BeanPostProcessor
+public class Jsr250BeanPostProcessor
implements DestructionAwareBeanPostProcessor, Ordered, ApplicationContextAware {
private ResourceManager resourceManager;
@@ -43,9 +43,9 @@ public class Jsr250BeanPostProcessor
Jsr250BeanPostProcessor() {
}
-
+
public void setApplicationContext(ApplicationContext arg0) throws BeansException {
- context = arg0;
+ context = arg0;
try {
Class<?> cls = Class
.forName("org.springframework.context.annotation.CommonAnnotationBeanPostProcessor");
@@ -54,11 +54,11 @@ public class Jsr250BeanPostProcessor
isProcessing = true;
}
}
-
+
public int getOrder() {
return 1010;
}
-
+
private boolean injectable(Object bean, String beanId) {
return !"cxf".equals(beanId) && ResourceInjector.processable(bean.getClass(), bean);
}
@@ -111,7 +111,7 @@ public class Jsr250BeanPostProcessor
}
return bean;
}
- if (bean != null
+ if (bean != null
&& injectable(bean, beanId)) {
new ResourceInjector(getResourceManager(bean)).construct(bean);
}
@@ -130,14 +130,14 @@ public class Jsr250BeanPostProcessor
Thread.dumpStack();
}
*/
-
- if (bean != null
+
+ if (bean != null
&& injectable(bean, beanId)) {
new ResourceInjector(getResourceManager(bean)).inject(bean);
/*
System.out.println("p :" + (++count) + ": " + bean.getClass().getName() + " " + beanId);
} else if (bean != null) {
- System.out.println("np: " + (++count2)
+ System.out.println("np: " + (++count2)
+ ": " + bean.getClass().getName() + " " + beanId);
*/
}
@@ -148,7 +148,7 @@ public class Jsr250BeanPostProcessor
if (!isProcessing) {
return;
}
- if (bean != null
+ if (bean != null
&& injectable(bean, beanId)) {
new ResourceInjector(getResourceManager(bean)).destroy(bean);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/NamespaceHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/NamespaceHandler.java b/core/src/main/java/org/apache/cxf/bus/spring/NamespaceHandler.java
index 9a67b84..a2b0511 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/NamespaceHandler.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/NamespaceHandler.java
@@ -36,7 +36,7 @@ public class NamespaceHandler extends NamespaceHandlerSupport {
new SimpleBeanDefinitionParser(LoggingFeature.class));
registerBeanDefinitionParser("fastinfoset",
new SimpleBeanDefinitionParser(FastInfosetFeature.class));
-
+
registerBeanDefinitionParser("workqueue",
new SimpleBeanDefinitionParser(AutomaticWorkQueueImpl.class) {
@@ -50,7 +50,7 @@ public class NamespaceHandler extends NamespaceHandlerSupport {
val = "cxf.workqueue." + val;
element.setAttribute("id", val);
}
-
+
}
});
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java b/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
index 6a42c11..b080e65 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/SpringBeanLocator.java
@@ -48,17 +48,17 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
/**
- *
+ *
*/
public class SpringBeanLocator implements ConfiguredBeanLocator {
private static final Logger LOG = LogUtils.getL7dLogger(SpringBeanLocator.class);
-
+
ApplicationContext context;
ConfiguredBeanLocator orig;
Set<String> passThroughs = new HashSet<>();
Object bundleContext;
boolean osgi = true;
-
+
public SpringBeanLocator(ApplicationContext ctx) {
this(ctx, null);
}
@@ -74,7 +74,7 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
names.add(s2);
}
}
-
+
((ExtensionManagerImpl)orig).removeBeansOfNames(names);
}
}
@@ -87,7 +87,7 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
osgi = false;
}
}
-
+
private Object findBundleContext(ApplicationContext applicationContext, Bus b) {
Object answer = null;
ApplicationContext aContext = applicationContext;
@@ -98,7 +98,7 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
}
return answer;
}
-
+
private Object getBundleContext(ApplicationContext applicationContext, Bus b) {
try {
//use a little reflection to allow this to work without the spring-dm jars
@@ -116,7 +116,7 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
}
return null;
}
-
+
public <T> T getBeanOfType(String name, Class<T> type) {
T t = null;
try {
@@ -129,7 +129,7 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
}
return t;
}
-
+
/** {@inheritDoc}*/
public List<String> getBeanNamesOfType(Class<?> type) {
Set<String> s = new LinkedHashSet<String>(Arrays.asList(context.getBeanNamesForType(type,
@@ -198,10 +198,10 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
if (c2 != null) {
return c2;
}
-
+
return cls;
}
-
+
public <T> boolean loadBeansOfType(Class<T> type,
BeanLoaderListener<T> listener) {
@@ -234,13 +234,13 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
}
Collection<?> ids = null;
PropertyValue pv = def.getPropertyValues().getPropertyValue(propertyName);
-
+
if (pv != null) {
Object value = pv.getValue();
if (!(value instanceof Collection)) {
throw new RuntimeException("The property " + propertyName + " must be a collection!");
}
-
+
if (value instanceof Mergeable) {
if (!((Mergeable)value).isMergeEnabled()) {
ids = (Collection<?>)value;
@@ -248,8 +248,8 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
} else {
ids = (Collection<?>)value;
}
- }
-
+ }
+
if (ids != null) {
for (Iterator<?> itr = ids.iterator(); itr.hasNext();) {
Object o = itr.next();
@@ -273,13 +273,13 @@ public class SpringBeanLocator implements ConfiguredBeanLocator {
if (!osgi) {
return lst;
}
-
+
Class<?> contextClass = findContextClass(bundleContext.getClass());
try {
Method m = contextClass.getMethod("getServiceReference", String.class);
Class<?> servRefClass = m.getReturnType();
m = contextClass.getMethod("getServiceReferences", String.class, String.class);
-
+
Object o = ReflectionUtil.setAccessible(m).invoke(bundleContext, type.getName(), null);
if (o != null) {
m = contextClass.getMethod("getService", servRefClass);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java b/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
index 6272f3b..8b5d1ac 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
@@ -34,21 +34,21 @@ import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.support.AbstractApplicationContext;
/**
- *
+ *
*/
-public class SpringBus extends ExtensionManagerBus
+public class SpringBus extends ExtensionManagerBus
implements ApplicationContextAware {
AbstractApplicationContext ctx;
boolean closeContext;
-
+
public SpringBus() {
}
-
+
public void setBusConfig(BusDefinitionParser.BusConfig bc) {
bc.setBus(this);
}
-
+
/** {@inheritDoc}*/
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ctx = (AbstractApplicationContext)applicationContext;
@@ -66,15 +66,15 @@ public class SpringBus extends ExtensionManagerBus
}
ac = ac.getParent();
}
-
+
// set the classLoader extension with the application context classLoader
setExtension(applicationContext.getClassLoader(), ClassLoader.class);
-
+
setExtension(new ConfigurerImpl(applicationContext), Configurer.class);
-
+
ResourceManager m = getExtension(ResourceManager.class);
m.addResourceResolver(new BusApplicationContextResourceResolver(applicationContext));
-
+
setExtension(applicationContext, ApplicationContext.class);
ConfiguredBeanLocator loc = getExtension(ConfiguredBeanLocator.class);
if (!(loc instanceof SpringBeanLocator)) {
@@ -104,20 +104,20 @@ public class SpringBus extends ExtensionManagerBus
initialize();
}
} else if (event instanceof ContextClosedEvent && getState() == BusState.RUNNING) {
- // The bus could be create by using SpringBusFactory.createBus("/cxf.xml");
+ // The bus could be create by using SpringBusFactory.createBus("/cxf.xml");
// Just to make sure the shutdown is called rightly
shutdown();
}
}
}
-
+
public void destroyBeans() {
if (closeContext) {
ctx.close();
}
super.destroyBeans();
}
-
+
public String getId() {
if (id == null) {
try {
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java b/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
index 04ea866..84b2761 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
@@ -40,9 +40,9 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.Resource;
public class SpringBusFactory extends BusFactory {
-
+
private static final Logger LOG = LogUtils.getL7dLogger(SpringBusFactory.class);
-
+
private final ApplicationContext context;
private NamespaceHandlerResolver resolver;
@@ -58,7 +58,7 @@ public class SpringBusFactory extends BusFactory {
context = null;
this.resolver = r;
}
-
+
private static NamespaceHandlerResolver tryFindNamespaceHandler(ApplicationContext ctx) {
try {
SpringBeanLocator sbl = new SpringBeanLocator(ctx);
@@ -78,11 +78,11 @@ public class SpringBusFactory extends BusFactory {
public void setNamespaceHandlerResolver(NamespaceHandlerResolver r) {
resolver = r;
}
-
+
public Bus createBus() {
return createBus((String)null);
}
-
+
private boolean defaultBusNotExists() {
if (null != context) {
return !context.containsBean(Bus.DEFAULT_BUS_ID);
@@ -93,11 +93,11 @@ public class SpringBusFactory extends BusFactory {
public Bus createBus(String cfgFile) {
return createBus(cfgFile, defaultBusNotExists());
}
-
+
public Bus createBus(String cfgFiles[]) {
return createBus(cfgFiles, defaultBusNotExists());
}
-
+
protected Bus finishCreatingBus(ConfigurableApplicationContext bac) {
final Bus bus = (Bus)bac.getBean(Bus.DEFAULT_BUS_ID);
@@ -106,29 +106,29 @@ public class SpringBusFactory extends BusFactory {
bus.setExtension((BusApplicationContext)bac, BusApplicationContext.class);
}
possiblySetDefaultBus(bus);
-
- initializeBus(bus);
-
+
+ initializeBus(bus);
+
registerApplicationContextLifeCycleListener(bus, bac);
-
+
if (bus instanceof SpringBus && defaultBusNotExists()) {
((SpringBus)bus).setCloseContext(true);
}
return bus;
}
-
+
public Bus createBus(String cfgFile, boolean includeDefaults) {
if (cfgFile == null) {
return createBus((String[])null, includeDefaults);
}
return createBus(new String[] {cfgFile}, includeDefaults);
- }
-
+ }
+
public Bus createBus(String cfgFiles[], boolean includeDefaults) {
try {
- String userCfgFile
+ String userCfgFile
= SystemPropertyAction.getPropertyOrNull(Configurer.USER_CFG_FILE_PROPERTY_NAME);
- String sysCfgFileUrl
+ String sysCfgFileUrl
= SystemPropertyAction.getPropertyOrNull(Configurer.USER_CFG_FILE_PROPERTY_URL);
final Resource r = BusApplicationContext.findResource(Configurer.DEFAULT_USER_CFG_FILE);
@@ -141,7 +141,7 @@ public class SpringBusFactory extends BusFactory {
}
});
}
- if (context == null && userCfgFile == null && cfgFiles == null && sysCfgFileUrl == null
+ if (context == null && userCfgFile == null && cfgFiles == null && sysCfgFileUrl == null
&& (r == null || !exists) && includeDefaults) {
return new org.apache.cxf.bus.CXFBusFactory().createBus();
}
@@ -151,9 +151,9 @@ public class SpringBusFactory extends BusFactory {
throw new RuntimeException(ex);
}
}
-
+
protected ConfigurableApplicationContext createApplicationContext(String cfgFiles[], boolean includeDefaults) {
- try {
+ try {
return new BusApplicationContext(cfgFiles, includeDefaults, context, resolver);
} catch (BeansException ex) {
LogUtils.log(LOG, Level.WARNING, "INITIAL_APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
@@ -162,7 +162,7 @@ public class SpringBusFactory extends BusFactory {
Thread.currentThread().setContextClassLoader(
BusApplicationContext.class.getClassLoader());
try {
- return new BusApplicationContext(cfgFiles, includeDefaults, context);
+ return new BusApplicationContext(cfgFiles, includeDefaults, context);
} finally {
Thread.currentThread().setContextClassLoader(contextLoader);
}
@@ -171,30 +171,30 @@ public class SpringBusFactory extends BusFactory {
}
}
}
-
+
public Bus createBus(URL url) {
return createBus(url, defaultBusNotExists());
}
public Bus createBus(URL[] urls) {
return createBus(urls, defaultBusNotExists());
}
-
+
public Bus createBus(URL url, boolean includeDefaults) {
if (url == null) {
return createBus((URL[])null, includeDefaults);
}
return createBus(new URL[] {url}, includeDefaults);
}
-
+
public Bus createBus(URL[] urls, boolean includeDefaults) {
- try {
+ try {
return finishCreatingBus(createAppContext(urls, includeDefaults));
} catch (BeansException ex) {
LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
throw new RuntimeException(ex);
}
}
-
+
protected ConfigurableApplicationContext createAppContext(URL[] urls, boolean includeDefaults) {
return new BusApplicationContext(urls, includeDefaults, context, resolver);
}
@@ -204,7 +204,7 @@ public class SpringBusFactory extends BusFactory {
if (null != lm) {
lm.registerLifeCycleListener(new BusApplicationContextLifeCycleListener(bac));
}
- }
+ }
static class BusApplicationContextLifeCycleListener implements BusLifeCycleListener {
private ConfigurableApplicationContext bac;
@@ -222,6 +222,6 @@ public class SpringBusFactory extends BusFactory {
public void postShutdown() {
bac.close();
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java b/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
index b67fd94..bb8189b 100644
--- a/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
+++ b/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
@@ -50,27 +50,27 @@ import org.springframework.beans.factory.xml.DefaultDocumentLoader;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
/**
- * A Spring DocumentLoader that uses WoodStox when we are not validating to speed up the process.
+ * A Spring DocumentLoader that uses WoodStox when we are not validating to speed up the process.
*/
class TunedDocumentLoader extends DefaultDocumentLoader {
- private static final Logger LOG = LogUtils.getL7dLogger(TunedDocumentLoader.class);
-
+ private static final Logger LOG = LogUtils.getL7dLogger(TunedDocumentLoader.class);
+
private static boolean hasFastInfoSet;
-
+
static {
- try {
+ try {
ClassLoaderUtils
- .loadClass("com.sun.xml.fastinfoset.stax.StAXDocumentParser",
- TunedDocumentLoader.class);
+ .loadClass("com.sun.xml.fastinfoset.stax.StAXDocumentParser",
+ TunedDocumentLoader.class);
hasFastInfoSet = true;
- } catch (Throwable e) {
+ } catch (Throwable e) {
LOG.fine("FastInfoset not found on classpath. Disabling context load optimizations.");
hasFastInfoSet = false;
- }
+ }
}
private SAXParserFactory saxParserFactory;
private SAXParserFactory nsasaxParserFactory;
-
+
TunedDocumentLoader() {
try {
Class<?> cls = ClassLoaderUtils.loadClass("com.ctc.wstx.sax.WstxSAXParserFactory",
@@ -84,15 +84,15 @@ class TunedDocumentLoader extends DefaultDocumentLoader {
}
try {
- nsasaxParserFactory.setFeature("http://xml.org/sax/features/namespaces", true);
- nsasaxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",
+ nsasaxParserFactory.setFeature("http://xml.org/sax/features/namespaces", true);
+ nsasaxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",
true);
} catch (Throwable e) {
//ignore
}
-
+
}
-
+
public static boolean hasFastInfoSet() {
return hasFastInfoSet;
}
@@ -102,7 +102,7 @@ class TunedDocumentLoader extends DefaultDocumentLoader {
ErrorHandler errorHandler, int validationMode, boolean namespaceAware)
throws Exception {
if (validationMode == XmlBeanDefinitionReader.VALIDATION_NONE) {
- SAXParserFactory parserFactory =
+ SAXParserFactory parserFactory =
namespaceAware ? nsasaxParserFactory : saxParserFactory;
SAXParser parser = parserFactory.newSAXParser();
XMLReader reader = parser.getXMLReader();
@@ -128,11 +128,11 @@ class TunedDocumentLoader extends DefaultDocumentLoader {
// we can get all kinds of exceptions from this
// due to old copies of Xerces and whatnot.
}
-
+
return factory;
}
-
- static Document loadFastinfosetDocument(URL url)
+
+ static Document loadFastinfosetDocument(URL url)
throws IOException, ParserConfigurationException, XMLStreamException {
InputStream is = url.openStream();
InputStream in = new BufferedInputStream(is);
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/buslifecycle/BusCreationListener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/buslifecycle/BusCreationListener.java b/core/src/main/java/org/apache/cxf/buslifecycle/BusCreationListener.java
index 07010d1..99d657f 100644
--- a/core/src/main/java/org/apache/cxf/buslifecycle/BusCreationListener.java
+++ b/core/src/main/java/org/apache/cxf/buslifecycle/BusCreationListener.java
@@ -25,18 +25,18 @@ import org.apache.cxf.Bus;
* The listener interface for receiving notification of when <code>Bus</code>
* objects are created.
*
- * It's a simplified form of BusLifeCycleListener that takes the
- * target Bus as a parameter which is appropriate if the listener needs
- * to be a singleton that works with multiple Bus objects.
- *
+ * It's a simplified form of BusLifeCycleListener that takes the
+ * target Bus as a parameter which is appropriate if the listener needs
+ * to be a singleton that works with multiple Bus objects.
+ *
* A common pattern would be to register a full BusLifeCycleListener on the
* target Bus to receive full Bus events
*/
public interface BusCreationListener {
/**
- * Invoked to create a BusLifeCycleListener.
+ * Invoked to create a BusLifeCycleListener.
*/
void busCreated(Bus b);
-
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/buslifecycle/BusLifeCycleListener.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/buslifecycle/BusLifeCycleListener.java b/core/src/main/java/org/apache/cxf/buslifecycle/BusLifeCycleListener.java
index 6d65d18..86ce9a4 100644
--- a/core/src/main/java/org/apache/cxf/buslifecycle/BusLifeCycleListener.java
+++ b/core/src/main/java/org/apache/cxf/buslifecycle/BusLifeCycleListener.java
@@ -35,7 +35,7 @@ public interface BusLifeCycleListener {
*
*/
void initComplete();
-
+
/**
* Invoked before the <code>Bus</code> is shutdown.
*
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java b/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
index 16fcf65..07d330a 100644
--- a/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
+++ b/core/src/main/java/org/apache/cxf/catalog/CatalogXmlSchemaURIResolver.java
@@ -44,9 +44,9 @@ public class CatalogXmlSchemaURIResolver implements URIResolver {
public CatalogXmlSchemaURIResolver(Bus bus) {
this.resolver = new TransportURIResolver(bus);
- this.bus = bus;
+ this.bus = bus;
}
-
+
public Map<String, String> getResolvedMap() {
return resolved;
}
@@ -55,12 +55,12 @@ public class CatalogXmlSchemaURIResolver implements URIResolver {
String resolvedSchemaLocation = null;
OASISCatalogManager catalogResolver = OASISCatalogManager.getCatalogManager(bus);
try {
- resolvedSchemaLocation = new OASISCatalogManagerHelper().resolve(catalogResolver,
+ resolvedSchemaLocation = new OASISCatalogManagerHelper().resolve(catalogResolver,
schemaLocation, baseUri);
} catch (Exception e) {
throw new RuntimeException("Catalog resolution failed", e);
}
-
+
InputSource in = null;
if (resolvedSchemaLocation == null) {
in = this.resolver.resolve(schemaLocation, baseUri);
@@ -81,7 +81,7 @@ public class CatalogXmlSchemaURIResolver implements URIResolver {
} else if (in.getByteStream() != null
&& !(in.getByteStream() instanceof ByteArrayInputStream)) {
//workaround bug in XmlSchema - XmlSchema is not closing the InputStreams
- //that are returned for imports. Thus, with a lot of services starting up
+ //that are returned for imports. Thus, with a lot of services starting up
//or a lot of schemas imported or similar, it's easy to run out of
//file handles. We'll just load the file into a byte[] and return that.
try {
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java b/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
index 2aa061e..6950ac2 100644
--- a/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
+++ b/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManager.java
@@ -50,9 +50,9 @@ public class OASISCatalogManager {
private static final Logger LOG =
LogUtils.getL7dLogger(OASISCatalogManager.class);
- private static final String DEBUG_LEVEL
+ private static final String DEBUG_LEVEL
= SystemPropertyAction.getPropertyOrNull(CATALOG_DEBUG_KEY);
-
+
private EntityResolver resolver;
private Object catalog;
@@ -63,18 +63,18 @@ public class OASISCatalogManager {
resolver = getResolver();
catalog = getCatalog(resolver);
}
-
+
public OASISCatalogManager(Bus b) {
bus = b;
resolver = getResolver();
catalog = getCatalog(resolver);
loadContextCatalogs(DEFAULT_CATALOG_NAME);
}
-
+
public boolean hasCatalogs() {
return !loadedCatalogs.isEmpty();
}
-
+
private static Object getCatalog(EntityResolver resolver) {
try {
return ((CatalogResolver)resolver).getCatalog();
@@ -111,7 +111,7 @@ public class OASISCatalogManager {
return catalogResolver;
} catch (Throwable t) {
//ignore
- }
+ }
return null;
}
@@ -180,7 +180,7 @@ public class OASISCatalogManager {
}
}
}
-
+
private static OASISCatalogManager getContextCatalog() {
try {
OASISCatalogManager oasisCatalog = new OASISCatalogManager();
@@ -201,9 +201,9 @@ public class OASISCatalogManager {
if (catalog != null) {
bus.setExtension(catalog, OASISCatalogManager.class);
}
- }
+ }
return catalog;
-
+
}
public String resolveSystem(String sys) throws MalformedURLException, IOException {
@@ -225,7 +225,7 @@ public class OASISCatalogManager {
}
return ((Catalog)catalog).resolvePublic(uri, parent);
}
-
+
public EntityResolver getEntityResolver() {
return resolver;
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManagerHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManagerHelper.java b/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManagerHelper.java
index 7d471ef..25c4318 100644
--- a/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManagerHelper.java
+++ b/core/src/main/java/org/apache/cxf/catalog/OASISCatalogManagerHelper.java
@@ -26,13 +26,13 @@ public class OASISCatalogManagerHelper {
String resolvedLocation = null;
if (catalogResolver != null) {
resolvedLocation = catalogResolver.resolveSystem(target);
-
+
if (resolvedLocation == null) {
resolvedLocation = catalogResolver.resolveURI(target);
}
if (resolvedLocation == null) {
resolvedLocation = catalogResolver.resolvePublic(target, base);
- }
+ }
}
return resolvedLocation;
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java b/core/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java
index f1ec27a..3093b82 100644
--- a/core/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java
+++ b/core/src/main/java/org/apache/cxf/common/annotation/AbstractAnnotationVisitor.java
@@ -28,23 +28,23 @@ import java.util.List;
public abstract class AbstractAnnotationVisitor implements AnnotationVisitor {
protected Object target;
protected Class<?> targetClass;
-
- private final List<Class<? extends Annotation>> targetAnnotations =
- new ArrayList<Class<? extends Annotation>>();
-
-
+
+ private final List<Class<? extends Annotation>> targetAnnotations =
+ new ArrayList<Class<? extends Annotation>>();
+
+
protected AbstractAnnotationVisitor(Class<? extends Annotation> ann) {
addTargetAnnotation(ann);
}
-
+
protected AbstractAnnotationVisitor(List<Class<? extends Annotation>> ann) {
targetAnnotations.addAll(ann);
}
- protected final void addTargetAnnotation(Class<? extends Annotation> ann) {
- targetAnnotations.add(ann);
- }
+ protected final void addTargetAnnotation(Class<? extends Annotation> ann) {
+ targetAnnotations.add(ann);
+ }
public void visitClass(Class<?> clz, Annotation annotation) {
// complete
@@ -70,12 +70,12 @@ public abstract class AbstractAnnotationVisitor implements AnnotationVisitor {
target = object;
targetClass = cls;
}
-
- public Object getTarget() {
+
+ public Object getTarget() {
return target;
- }
- public Class<?> getTargetClass() {
+ }
+ public Class<?> getTargetClass() {
return targetClass;
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java b/core/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
index 2e14680..6c7f950 100644
--- a/core/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
+++ b/core/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
@@ -38,45 +38,45 @@ import org.apache.cxf.common.util.ReflectionUtil;
* level annotation
*/
public class AnnotationProcessor {
-
- private static final Logger LOG = LogUtils.getL7dLogger(AnnotationProcessor.class);
-
- private final Object target;
- private List<Class<? extends Annotation>> annotationTypes;
-
-
+
+ private static final Logger LOG = LogUtils.getL7dLogger(AnnotationProcessor.class);
+
+ private final Object target;
+ private List<Class<? extends Annotation>> annotationTypes;
+
+
public AnnotationProcessor(Object o) {
if (o == null) {
- throw new IllegalArgumentException(new Message("INVALID_CTOR_ARGS", LOG).toString());
+ throw new IllegalArgumentException(new Message("INVALID_CTOR_ARGS", LOG).toString());
}
- target = o;
+ target = o;
}
-
- /**
+
+ /**
* Visits each of the annotated elements of the object.
- *
- * @param visitor a visitor
+ *
+ * @param visitor a visitor
* @param claz the Class of the targe object
*/
- public void accept(AnnotationVisitor visitor, Class<?> claz) {
-
+ public void accept(AnnotationVisitor visitor, Class<?> claz) {
+
if (visitor == null) {
throw new IllegalArgumentException();
}
-
+
annotationTypes = visitor.getTargetAnnotations();
visitor.setTarget(target);
//recursively check annotation in super class
processClass(visitor, claz);
- processFields(visitor, claz);
+ processFields(visitor, claz);
processMethods(visitor, claz);
- }
-
+ }
+
public void accept(AnnotationVisitor visitor) {
accept(visitor, target.getClass());
}
-
-
+
+
private void processMethods(AnnotationVisitor visitor, Class<? extends Object> targetClass) {
if (targetClass.getSuperclass() != null) {
@@ -84,38 +84,38 @@ public class AnnotationProcessor {
}
for (Method element : ReflectionUtil.getDeclaredMethods(targetClass)) {
for (Class<? extends Annotation> clz : annotationTypes) {
- Annotation ann = element.getAnnotation(clz);
+ Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitMethod(element, ann);
}
}
}
}
-
- private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) {
+
+ private void processFields(AnnotationVisitor visitor, Class<? extends Object> targetClass) {
if (targetClass.getSuperclass() != null) {
processFields(visitor, targetClass.getSuperclass());
}
for (Field element : ReflectionUtil.getDeclaredFields(targetClass)) {
for (Class<? extends Annotation> clz : annotationTypes) {
- Annotation ann = element.getAnnotation(clz);
+ Annotation ann = element.getAnnotation(clz);
if (ann != null) {
visitor.visitField(element, ann);
}
}
}
- }
-
-
+ }
+
+
private void processClass(AnnotationVisitor visitor, Class<? extends Object> targetClass) {
if (targetClass.getSuperclass() != null) {
processClass(visitor, targetClass.getSuperclass());
}
for (Class<? extends Annotation> clz : annotationTypes) {
- Annotation ann = targetClass.getAnnotation(clz);
+ Annotation ann = targetClass.getAnnotation(clz);
if (ann != null) {
visitor.visitClass(targetClass, ann);
}
}
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/annotation/AnnotationVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/annotation/AnnotationVisitor.java b/core/src/main/java/org/apache/cxf/common/annotation/AnnotationVisitor.java
index 0356bb9..1c2e0cd 100644
--- a/core/src/main/java/org/apache/cxf/common/annotation/AnnotationVisitor.java
+++ b/core/src/main/java/org/apache/cxf/common/annotation/AnnotationVisitor.java
@@ -31,12 +31,12 @@ import java.util.List;
public interface AnnotationVisitor {
/** set the target object being visited. Invoked before any of
- * the visit methods.
+ * the visit methods.
*
* @see AnnotationProcessor
*
- * @param target the target object
- */
+ * @param target the target object
+ */
void setTarget(Object target);
@@ -46,39 +46,39 @@ public interface AnnotationVisitor {
* @return list of annotation types to be informed about
*
*/
- List<Class<? extends Annotation>> getTargetAnnotations();
-
+ List<Class<? extends Annotation>> getTargetAnnotations();
+
/** visit an annotated class. Invoked when the class of an object
* is annotated by one of the specified annotations.
* <code>visitClass</code> is called for each of the annotations
- * that matches and for each class.
+ * that matches and for each class.
*
* @param clz the class with the annotation
- * @param annotation the annotation
+ * @param annotation the annotation
*
*/
- void visitClass(Class<?> clz, Annotation annotation);
+ void visitClass(Class<?> clz, Annotation annotation);
+
-
/** visit an annotated field. Invoked when the field of an object
* is annotated by one of the specified annotations.
* <code>visitField</code> is called for each of the annotations
- * that matches and for each field.
+ * that matches and for each field.
*
* @param field the annotated field
- * @param annotation the annotation
+ * @param annotation the annotation
*
*/
- void visitField(Field field, Annotation annotation);
+ void visitField(Field field, Annotation annotation);
/** visit an annotated method. Invoked when the method of an object
* is annotated by one of the specified annotations.
* <code>visitMethod</code> is called for each of the annotations
- * that matches and for each method.
+ * that matches and for each method.
*
* @param method the annotated fieldx
- * @param annotation the annotation
+ * @param annotation the annotation
*
*/
- void visitMethod(Method method, Annotation annotation);
+ void visitMethod(Method method, Annotation annotation);
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java b/core/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
index 421d1d2..971045f 100644
--- a/core/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/classloader/ClassLoaderUtils.java
@@ -36,16 +36,16 @@ import java.util.List;
* verify any change on 6 different application servers.
*/
public final class ClassLoaderUtils {
-
+
private ClassLoaderUtils() {
}
-
+
public static class ClassLoaderHolder {
ClassLoader loader;
ClassLoaderHolder(ClassLoader c) {
loader = c;
}
-
+
public void reset() {
ClassLoaderUtils.setThreadContextClassloader(loader);
}
@@ -59,7 +59,7 @@ public final class ClassLoaderUtils {
}
});
}
-
+
public static ClassLoader getURLClassLoader(
final URL[] urls, final ClassLoader parent
) {
@@ -75,7 +75,7 @@ public final class ClassLoaderUtils {
) {
return getURLClassLoader(urlList.toArray(new URL[urlList.size()]), parent);
}
-
+
/**
* Load a given resource. <p/> This method will try to load the resource
* using the following methods (in order):
@@ -84,7 +84,7 @@ public final class ClassLoaderUtils {
* <li>From ClassLoaderUtil.class.getClassLoader()
* <li>callingClass.getClassLoader()
* </ul>
- *
+ *
* @param resourceName The name of the resource to load
* @param callingClass The Class object of the calling object
*/
@@ -119,14 +119,14 @@ public final class ClassLoaderUtils {
if (url == null) {
url = callingClass.getResource(resourceName);
}
-
+
if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
return getResource('/' + resourceName, callingClass);
}
return url;
}
-
+
/**
* Load a given resources. <p/> This method will try to load the resources
* using the following methods (in order):
@@ -135,7 +135,7 @@ public final class ClassLoaderUtils {
* <li>From ClassLoaderUtil.class.getClassLoader()
* <li>callingClass.getClassLoader()
* </ul>
- *
+ *
* @param resourceName The name of the resource to load
* @param callingClass The Class object of the calling object
*/
@@ -148,7 +148,7 @@ public final class ClassLoaderUtils {
public URL nextElement() {
return null;
}
-
+
};
try {
urls = Thread.currentThread().getContextClassLoader()
@@ -208,7 +208,7 @@ public final class ClassLoaderUtils {
ret.add(urls.nextElement());
}
-
+
if (ret.isEmpty() && (resourceName != null) && (resourceName.charAt(0) != '/')) {
return getResources('/' + resourceName, callingClass);
}
@@ -219,7 +219,7 @@ public final class ClassLoaderUtils {
/**
* This is a convenience method to load a resource as a stream. <p/> The
* algorithm used to find the resource is given in getResource()
- *
+ *
* @param resourceName The name of the resource to load
* @param callingClass The Class object of the calling object
*/
@@ -242,7 +242,7 @@ public final class ClassLoaderUtils {
* <li>From ClassLoaderUtil.class.getClassLoader()
* <li>From the callingClass.getClassLoader()
* </ul>
- *
+ *
* @param className The name of the class to load
* @param callingClass The Class object of the calling object
* @throws ClassNotFoundException If the class cannot be found anywhere.
@@ -254,7 +254,7 @@ public final class ClassLoaderUtils {
if (cl != null) {
return cl.loadClass(className);
- }
+ }
} catch (ClassNotFoundException e) {
//ignore
}
@@ -267,7 +267,7 @@ public final class ClassLoaderUtils {
if (cl != null) {
return cl.loadClass(className).asSubclass(type);
- }
+ }
} catch (ClassNotFoundException e) {
//ignore
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java b/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
index 5fdd3b4..011d00e 100644
--- a/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
+++ b/core/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
@@ -45,7 +45,7 @@ public final class BundleUtils {
/**
* Encapsulates the logic related to naming the default resource bundle
- * for a class.
+ * for a class.
*
* @param cls the Class requiring the bundle
* @return an appropriate ResourceBundle name
@@ -53,12 +53,12 @@ public final class BundleUtils {
public static String getBundleName(Class<?> cls) {
// Class.getPackage() can return null, so change to another way to get Package Name
return PackageUtils.getPackageName(cls) + MESSAGE_BUNDLE;
-
+
}
-
+
/**
* Encapsulates the logic related to naming the resource bundle
- * with the given relative name for a class.
+ * with the given relative name for a class.
*
* @param cls the Class requiring the bundle
* @return an appropriate ResourceBundle name
@@ -69,13 +69,13 @@ public final class BundleUtils {
/**
* Encapsulates the logic related to locating the default resource bundle
- * for a class.
+ * for a class.
*
* @param cls the Class requiring the bundle
* @return an appropriate ResourceBundle
*/
public static ResourceBundle getBundle(Class<?> cls) {
-
+
try {
ClassLoader loader = cls.getClassLoader();
if (loader == null) {
@@ -92,12 +92,12 @@ public final class BundleUtils {
return ResourceBundle.getBundle(getBundleName(cls),
Locale.getDefault(),
loader);
-
+
}
}
-
+
/**
- * Encapsulates the logic related to locating the resource bundle with the given
+ * Encapsulates the logic related to locating the resource bundle with the given
* relative name for a class.
*
* @param cls the Class requiring the bundle
@@ -121,13 +121,13 @@ public final class BundleUtils {
return ResourceBundle.getBundle(getBundleName(cls, name),
Locale.getDefault(),
loader);
-
+
}
}
-
+
/**
* Encapsulates the logic to format a string based on the key in the resource bundle
- *
+ *
* @param b Resource bundle to use
* @param key The key in the bundle to lookup
* @param params the params to expand into the string
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/i18n/Exception.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/i18n/Exception.java b/core/src/main/java/org/apache/cxf/common/i18n/Exception.java
index 26e06b1..874142c 100644
--- a/core/src/main/java/org/apache/cxf/common/i18n/Exception.java
+++ b/core/src/main/java/org/apache/cxf/common/i18n/Exception.java
@@ -22,32 +22,32 @@ package org.apache.cxf.common.i18n;
public class Exception extends java.lang.Exception {
-
+
private static final long serialVersionUID = 1L;
-
+
private final Message message;
-
+
public Exception(Message msg) {
message = msg;
}
-
+
public Exception(Message msg, Throwable t) {
super(t);
message = msg;
}
-
+
public Exception(Throwable cause) {
super(cause);
message = null;
- }
-
+ }
+
public String getCode() {
if (null != message) {
return message.getCode();
}
return null;
}
-
+
public String getMessage() {
if (null != message) {
return message.toString();
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/i18n/Message.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/i18n/Message.java b/core/src/main/java/org/apache/cxf/common/i18n/Message.java
index b675aaf..51dd9ce 100644
--- a/core/src/main/java/org/apache/cxf/common/i18n/Message.java
+++ b/core/src/main/java/org/apache/cxf/common/i18n/Message.java
@@ -28,7 +28,7 @@ import java.util.logging.Logger;
public class Message implements Serializable {
private static final long serialVersionUID = 42L;
-
+
transient String code;
transient Object[] parameters;
transient ResourceBundle bundle;
@@ -56,24 +56,24 @@ public class Message implements Serializable {
bundle = catalog;
parameters = params;
}
-
+
public String toString() {
String fmt = null;
try {
if (null == bundle) {
return code;
}
- fmt = bundle.getString(code);
+ fmt = bundle.getString(code);
} catch (MissingResourceException ex) {
return code;
}
return MessageFormat.format(fmt, parameters);
}
-
+
public String getCode() {
- return code;
+ return code;
}
-
+
public Object[] getParameters() {
return parameters;
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/i18n/UncheckedException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/i18n/UncheckedException.java b/core/src/main/java/org/apache/cxf/common/i18n/UncheckedException.java
index 90906d5..46b5264 100644
--- a/core/src/main/java/org/apache/cxf/common/i18n/UncheckedException.java
+++ b/core/src/main/java/org/apache/cxf/common/i18n/UncheckedException.java
@@ -25,55 +25,55 @@ import java.util.logging.Logger;
public class UncheckedException extends java.lang.RuntimeException {
-
+
private static final long serialVersionUID = 1L;
-
+
protected final Message message;
-
+
public UncheckedException(Message msg) {
message = msg;
}
-
+
public UncheckedException(Message msg, Throwable t) {
super(t);
message = msg;
}
-
+
public UncheckedException(Throwable cause) {
super(cause);
message = null;
- }
-
+ }
+
public UncheckedException(Logger log, String msg, Object ... params) {
message = new org.apache.cxf.common.i18n.Message(msg,
log,
params);
- }
+ }
public UncheckedException(ResourceBundle bundle, String msg, Object ... params) {
message = new org.apache.cxf.common.i18n.Message(msg,
bundle,
params);
- }
+ }
public UncheckedException(Logger log, String msg, Throwable t, Object ... params) {
super(t);
message = new org.apache.cxf.common.i18n.Message(msg,
log,
params);
- }
+ }
public UncheckedException(ResourceBundle bundle, String msg, Throwable t, Object ... params) {
super(t);
message = new org.apache.cxf.common.i18n.Message(msg,
bundle,
params);
- }
-
+ }
+
public String getCode() {
if (null != message) {
return message.getCode();
}
return null;
}
-
+
public String getMessage() {
if (null != message) {
return message.toString();
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java b/core/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
index 8bb1a04..86c29f5 100644
--- a/core/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
+++ b/core/src/main/java/org/apache/cxf/common/injection/NoJSR250Annotations.java
@@ -27,16 +27,16 @@ import java.lang.annotation.Target;
/**
* Marker annotation to let our JSR250 Processor know
* not to bother examining the class for annotations
- * as it's know not to have any
+ * as it's know not to have any
*/
@Target({ ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface NoJSR250Annotations {
-
+
/**
* If these fields are null, it will go ahead and do JSR250 processing
* as it assumes the values were not set via a constructor.
- *
+ *
* Be careful with this. If the field is injected with a value via @Resource,
* when the other annotations are processed (@PostConstruct), the field is then
* not-null so they won't be run. The best bet is to make sure the @Resource
http://git-wip-us.apache.org/repos/asf/cxf/blob/8cea7c87/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java b/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
index 2e6eb3b..27efdcc 100644
--- a/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
+++ b/core/src/main/java/org/apache/cxf/common/injection/ResourceInjector.java
@@ -46,22 +46,22 @@ import org.apache.cxf.resource.ResourceResolver;
/**
- * injects references specified using @Resource annotation
- *
+ * injects references specified using @Resource annotation
+ *
*/
public class ResourceInjector extends AbstractAnnotationVisitor {
private static final Logger LOG = LogUtils.getL7dLogger(ResourceInjector.class);
- private static final List<Class<? extends Annotation>> ANNOTATIONS =
+ private static final List<Class<? extends Annotation>> ANNOTATIONS =
new ArrayList<Class<? extends Annotation>>();
-
+
static {
ANNOTATIONS.add(Resource.class);
ANNOTATIONS.add(Resources.class);
}
-
-
- private final ResourceManager resourceManager;
+
+
+ private final ResourceManager resourceManager;
private final List<ResourceResolver> resourceResolvers;
public ResourceInjector(ResourceManager resMgr) {
@@ -73,7 +73,7 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
resourceManager = resMgr;
resourceResolvers = resolvers;
}
-
+
private static Field getField(Class<?> cls, String name) {
if (cls == null) {
return null;
@@ -84,7 +84,7 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
return getField(cls.getSuperclass(), name);
}
}
-
+
public static boolean processable(Class<?> cls, Object o) {
if (cls.getName().startsWith("java.")
|| cls.getName().startsWith("javax.")) {
@@ -107,18 +107,18 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
return true;
}
-
- public void inject(Object o) {
+
+ public void inject(Object o) {
inject(o, o.getClass());
}
-
+
public void inject(Object o, Class<?> claz) {
if (processable(claz, o)) {
- AnnotationProcessor processor = new AnnotationProcessor(o);
+ AnnotationProcessor processor = new AnnotationProcessor(o);
processor.accept(this, claz);
}
}
-
+
public void construct(Object o) {
setTarget(o);
if (processable(targetClass, o)) {
@@ -144,64 +144,64 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
// Implementation of org.apache.cxf.common.annotation.AnnotationVisitor
public final void visitClass(final Class<?> clz, final Annotation annotation) { //NOPMD
-
- assert annotation instanceof Resource || annotation instanceof Resources : annotation;
- if (annotation instanceof Resource) {
- injectResourceClassLevel((Resource)annotation);
- } else if (annotation instanceof Resources) {
+ assert annotation instanceof Resource || annotation instanceof Resources : annotation;
+
+ if (annotation instanceof Resource) {
+ injectResourceClassLevel((Resource)annotation);
+ } else if (annotation instanceof Resources) {
Resources resources = (Resources)annotation;
for (Resource resource : resources.value()) {
- injectResourceClassLevel(resource);
+ injectResourceClassLevel(resource);
}
- }
+ }
}
- private void injectResourceClassLevel(Resource res) {
- if (res.name() == null || "".equals(res.name())) {
+ private void injectResourceClassLevel(Resource res) {
+ if (res.name() == null || "".equals(res.name())) {
LOG.log(Level.INFO, "RESOURCE_NAME_NOT_SPECIFIED", target.getClass().getName());
return;
- }
+ }
Object resource = null;
// first find a setter that matches this resource
Method setter = findSetterForResource(res);
- if (setter != null) {
- Class<?> type = getResourceType(res, setter);
+ if (setter != null) {
+ Class<?> type = getResourceType(res, setter);
resource = resolveResource(res.name(), type);
if (resource == null) {
LOG.log(Level.INFO, "RESOURCE_RESOLVE_FAILED");
return;
- }
+ }
invokeSetter(setter, resource);
return;
}
-
+
Field field = findFieldForResource(res);
- if (field != null) {
- Class<?> type = getResourceType(res, field);
+ if (field != null) {
+ Class<?> type = getResourceType(res, field);
resource = resolveResource(res.name(), type);
if (resource == null) {
LOG.log(Level.INFO, "RESOURCE_RESOLVE_FAILED");
return;
- }
- injectField(field, resource);
+ }
+ injectField(field, resource);
return;
}
LOG.log(Level.SEVERE, "NO_SETTER_OR_FIELD_FOR_RESOURCE", getTarget().getClass().getName());
- }
+ }
public final void visitField(final Field field, final Annotation annotation) {
assert annotation instanceof Resource : annotation;
-
+
Resource res = (Resource)annotation;
String name = getFieldNameForResource(res, field);
- Class<?> type = getResourceType(res, field);
-
+ Class<?> type = getResourceType(res, field);
+
Object resource = resolveResource(name, type);
if (resource == null
&& "".equals(res.name())) {
@@ -215,13 +215,13 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
public final void visitMethod(final Method method, final Annotation annotation) {
-
+
assert annotation instanceof Resource : annotation;
- Resource res = (Resource)annotation;
-
+ Resource res = (Resource)annotation;
+
String resourceName = getResourceName(res, method);
- Class<?> clz = getResourceType(res, method);
+ Class<?> clz = getResourceType(res, method);
Object resource = resolveResource(resourceName, clz);
if (resource == null
@@ -236,26 +236,26 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
private Field findFieldForResource(Resource res) {
- assert target != null;
+ assert target != null;
assert res.name() != null;
- for (Field field : target.getClass().getFields()) {
- if (field.getName().equals(res.name())) {
+ for (Field field : target.getClass().getFields()) {
+ if (field.getName().equals(res.name())) {
return field;
- }
+ }
}
- for (Field field : target.getClass().getDeclaredFields()) {
- if (field.getName().equals(res.name())) {
+ for (Field field : target.getClass().getDeclaredFields()) {
+ if (field.getName().equals(res.name())) {
return field;
- }
+ }
}
return null;
}
private Method findSetterForResource(Resource res) {
- assert target != null;
+ assert target != null;
String setterName = resourceNameToSetter(res.name());
Method setterMethod = null;
@@ -266,78 +266,78 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
break;
}
}
-
+
if (setterMethod != null && setterMethod.getParameterTypes().length != 1) {
LOG.log(Level.WARNING, "SETTER_INJECTION_WITH_INCORRECT_TYPE", setterMethod);
}
return setterMethod;
}
-
+
private String resourceNameToSetter(String resName) {
return "set" + Character.toUpperCase(resName.charAt(0)) + resName.substring(1);
}
-
- private void invokeSetter(Method method, Object resource) {
+
+ private void invokeSetter(Method method, Object resource) {
try {
ReflectionUtil.setAccessible(method);
if (method.getDeclaringClass().isAssignableFrom(getTarget().getClass())) {
method.invoke(getTarget(), resource);
} else { // deal with the proxy setter method
Method targetMethod = getTarget().getClass().getMethod(method.getName(),
- method.getParameterTypes());
+ method.getParameterTypes());
targetMethod.invoke(getTarget(), resource);
}
- } catch (IllegalAccessException e) {
+ } catch (IllegalAccessException e) {
LOG.log(Level.SEVERE, "INJECTION_SETTER_NOT_VISIBLE", method);
- } catch (InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
LogUtils.log(LOG, Level.SEVERE, "INJECTION_SETTER_RAISED_EXCEPTION", e, method);
} catch (SecurityException e) {
LogUtils.log(LOG, Level.SEVERE, "INJECTION_SETTER_RAISED_EXCEPTION", e, method);
} catch (NoSuchMethodException e) {
LOG.log(Level.SEVERE, "INJECTION_SETTER_METHOD_NOT_FOUND", new Object[] {method.getName()});
- }
- }
+ }
+ }
- private String getResourceName(Resource res, Method method) {
- assert method != null;
- assert res != null;
+ private String getResourceName(Resource res, Method method) {
+ assert method != null;
+ assert res != null;
assert method.getName().startsWith("set") : method;
if (res.name() == null || "".equals(res.name())) {
- String name = method.getName().substring(3);
- name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
+ String name = method.getName().substring(3);
+ name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
return method.getDeclaringClass().getCanonicalName() + "/" + name;
}
return res.name();
- }
+ }
- private void injectField(Field field, Object resource) {
- assert field != null;
- assert resource != null;
+ private void injectField(Field field, Object resource) {
+ assert field != null;
+ assert resource != null;
- boolean accessible = field.isAccessible();
+ boolean accessible = field.isAccessible();
try {
if (field.getType().isAssignableFrom(resource.getClass())) {
ReflectionUtil.setAccessible(field);
field.set(ClassHelper.getRealObject(getTarget()), resource);
}
- } catch (IllegalAccessException e) {
+ } catch (IllegalAccessException e) {
e.printStackTrace();
- LOG.severe("FAILED_TO_INJECT_FIELD");
+ LOG.severe("FAILED_TO_INJECT_FIELD");
} finally {
ReflectionUtil.setAccessible(field, accessible);
}
- }
+ }
public void invokePostConstruct() {
-
- boolean accessible = false;
+
+ boolean accessible = false;
for (Method method : getPostConstructMethods()) {
PostConstruct pc = method.getAnnotation(PostConstruct.class);
if (pc != null) {
@@ -356,8 +356,8 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
public void invokePreDestroy() {
-
- boolean accessible = false;
+
+ boolean accessible = false;
for (Method method : getPreDestroyMethods()) {
PreDestroy pd = method.getAnnotation(PreDestroy.class);
if (pd != null) {
@@ -376,37 +376,37 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
- private Collection<Method> getPostConstructMethods() {
+ private Collection<Method> getPostConstructMethods() {
return getAnnotatedMethods(PostConstruct.class);
}
- private Collection<Method> getPreDestroyMethods() {
+ private Collection<Method> getPreDestroyMethods() {
return getAnnotatedMethods(PreDestroy.class);
}
- private Collection<Method> getAnnotatedMethods(Class<? extends Annotation> acls) {
+ private Collection<Method> getAnnotatedMethods(Class<? extends Annotation> acls) {
- Collection<Method> methods = new LinkedList<Method>();
- addAnnotatedMethods(acls, getTarget().getClass().getMethods(), methods);
+ Collection<Method> methods = new LinkedList<Method>();
+ addAnnotatedMethods(acls, getTarget().getClass().getMethods(), methods);
addAnnotatedMethods(acls, ReflectionUtil.getDeclaredMethods(getTarget().getClass()), methods);
if (getTargetClass() != getTarget().getClass()) {
- addAnnotatedMethods(acls, getTargetClass().getMethods(), methods);
- addAnnotatedMethods(acls, ReflectionUtil.getDeclaredMethods(getTargetClass()), methods);
+ addAnnotatedMethods(acls, getTargetClass().getMethods(), methods);
+ addAnnotatedMethods(acls, ReflectionUtil.getDeclaredMethods(getTargetClass()), methods);
}
return methods;
}
-
+
private void addAnnotatedMethods(Class<? extends Annotation> acls, Method[] methods,
Collection<Method> annotatedMethods) {
- for (Method method : methods) {
- if (method.getAnnotation(acls) != null
+ for (Method method : methods) {
+ if (method.getAnnotation(acls) != null
&& !annotatedMethods.contains(method)) {
- annotatedMethods.add(method);
+ annotatedMethods.add(method);
}
}
- }
-
-
+ }
+
+
/**
* making this protected to keep pmd happy
*/
@@ -420,11 +420,11 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
- private Class<?> getResourceType(Resource res, Method method) {
- return res.type() != null && !Object.class.equals(res.type())
- ? res.type()
+ private Class<?> getResourceType(Resource res, Method method) {
+ return res.type() != null && !Object.class.equals(res.type())
+ ? res.type()
: method.getParameterTypes()[0];
- }
+ }
private String getFieldNameForResource(Resource res, Field field) {
@@ -441,5 +441,5 @@ public class ResourceInjector extends AbstractAnnotationVisitor {
}
return resourceManager.resolveResource(resourceName, type, resourceResolvers);
}
-
+
}