Bootstrap Maven as non-modular packages
Resolves: rhbz#1951482
This commit is contained in:
parent
da58f0d9c2
commit
9598f99b0c
2
.gitignore
vendored
2
.gitignore
vendored
@ -17,3 +17,5 @@
|
||||
/xbean-4.9-source-release.zip
|
||||
/xbean-4.14-source-release.zip
|
||||
/xbean-4.15-source-release.zip
|
||||
/xbean-4.17-source-release.zip
|
||||
/xbean-4.18-source-release.zip
|
||||
|
25
0001-Remove-unused-import.patch
Normal file
25
0001-Remove-unused-import.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From c7b2913a7d552929a3182901466db69ba40e4340 Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Thu, 12 Dec 2019 08:51:36 +0100
|
||||
Subject: [PATCH 1/3] Remove unused import
|
||||
|
||||
---
|
||||
.../java/org/apache/xbean/propertyeditor/PropertyEditors.java | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java b/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java
|
||||
index dda3bf4d..5c6285f2 100644
|
||||
--- a/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java
|
||||
+++ b/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java
|
||||
@@ -19,8 +19,6 @@ package org.apache.xbean.propertyeditor;
|
||||
import java.beans.PropertyEditorManager;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
-import com.sun.org.apache.regexp.internal.RE;
|
||||
-
|
||||
/**
|
||||
* The property editor manager. This orchestrates Geronimo usage of
|
||||
* property editors, allowing additional search paths to be added and
|
||||
--
|
||||
2.21.0
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 9e1bb9bfee86490163fb1e226556620aa8cdf7bc Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Fri, 21 Nov 2014 10:05:05 +0100
|
||||
Subject: [PATCH 2/3] Port to Eclipse Luna OSGi
|
||||
|
||||
---
|
||||
xbean-bundleutils/pom.xml | 8 +-------
|
||||
.../apache/xbean/osgi/bundle/util/DelegatingBundleContext.java | 10 ++++++++++
|
||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/xbean-bundleutils/pom.xml b/xbean-bundleutils/pom.xml
|
||||
index 72f4865..2b3459d 100644
|
||||
--- a/xbean-bundleutils/pom.xml
|
||||
+++ b/xbean-bundleutils/pom.xml
|
||||
@@ -35,15 +35,9 @@
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
- <groupId>org.osgi</groupId>
|
||||
- <artifactId>org.osgi.core</artifactId>
|
||||
- <version>4.3.1</version>
|
||||
- <scope>provided</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
<groupId>org.eclipse</groupId>
|
||||
<artifactId>osgi</artifactId>
|
||||
- <version>3.6.0.v20100517</version>
|
||||
+ <version>3.10.0-v20140606-1445</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
diff --git a/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
|
||||
index 58a392b..cc8d081 100644
|
||||
--- a/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
|
||||
+++ b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
|
||||
@@ -31,7 +31,9 @@ import org.osgi.framework.BundleListener;
|
||||
import org.osgi.framework.Filter;
|
||||
import org.osgi.framework.FrameworkListener;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
+import org.osgi.framework.ServiceFactory;
|
||||
import org.osgi.framework.ServiceListener;
|
||||
+import org.osgi.framework.ServiceObjects;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
|
||||
@@ -153,5 +155,13 @@ public class DelegatingBundleContext implements BundleContext {
|
||||
public Bundle getBundle(String location) {
|
||||
return bundleContext.getBundle(location);
|
||||
}
|
||||
+
|
||||
+ public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) {
|
||||
+ return bundleContext.getServiceObjects(reference);
|
||||
+ }
|
||||
+
|
||||
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, Dictionary<String, ?> properties) {
|
||||
+ return bundleContext.registerService(clazz, factory, properties);
|
||||
+ }
|
||||
|
||||
}
|
||||
--
|
||||
2.9.3
|
||||
|
42
0002-Unbundle-ASM.patch
Normal file
42
0002-Unbundle-ASM.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From 4f7a61dcd47ed0dee2d78e31e2dd50b88ab42f25 Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Thu, 12 Dec 2019 08:51:57 +0100
|
||||
Subject: [PATCH 2/3] Unbundle ASM
|
||||
|
||||
---
|
||||
.../xbean/recipe/XbeanAsmParameterNameLoader.java | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
|
||||
index 20b646c..9e96775 100644
|
||||
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
|
||||
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
|
||||
@@ -17,11 +17,11 @@
|
||||
*/
|
||||
package org.apache.xbean.recipe;
|
||||
|
||||
-import org.apache.xbean.asm9.ClassReader;
|
||||
-import org.apache.xbean.asm9.ClassVisitor;
|
||||
-import org.apache.xbean.asm9.Label;
|
||||
-import org.apache.xbean.asm9.MethodVisitor;
|
||||
-import org.apache.xbean.asm9.Type;
|
||||
+import org.objectweb.asm.ClassReader;
|
||||
+import org.objectweb.asm.ClassVisitor;
|
||||
+import org.objectweb.asm.Label;
|
||||
+import org.objectweb.asm.MethodVisitor;
|
||||
+import org.objectweb.asm.Type;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -36,7 +36,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
-import static org.apache.xbean.asm9.shade.commons.AsmConstants.ASM_VERSION;
|
||||
+import static org.apache.xbean.asm9.original.commons.AsmConstants.ASM_VERSION;
|
||||
|
||||
/**
|
||||
* Implementation of ParameterNameLoader that uses ASM to read the parameter names from the local variable table in the
|
||||
--
|
||||
2.29.2
|
||||
|
@ -1,689 +0,0 @@
|
||||
From 928bd5a98dc500a31197a56c8f6c5e19a3a273f8 Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Fri, 21 Nov 2014 10:51:38 +0100
|
||||
Subject: [PATCH 3/3] Port to QDox 2.0
|
||||
|
||||
---
|
||||
pom.xml | 2 +-
|
||||
.../blueprint/generator/QdoxMappingLoader.java | 144 +++++++++++---------
|
||||
.../xbean/spring/generator/QdoxMappingLoader.java | 148 ++++++++++++---------
|
||||
.../org/apache/xbean/spring/generator/Type.java | 7 +-
|
||||
4 files changed, 166 insertions(+), 135 deletions(-)
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 6e53649..9132fe4 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -297,7 +297,7 @@
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.qdox</groupId>
|
||||
<artifactId>qdox</artifactId>
|
||||
- <version>1.6.3</version>
|
||||
+ <version>2.0-M5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
diff --git a/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java b/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
|
||||
index 6635937..e17fd08 100644
|
||||
--- a/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
|
||||
+++ b/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
|
||||
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
+import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
@@ -31,14 +32,17 @@ import java.util.TreeSet;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
-import com.thoughtworks.qdox.JavaDocBuilder;
|
||||
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
||||
import com.thoughtworks.qdox.model.BeanProperty;
|
||||
import com.thoughtworks.qdox.model.DocletTag;
|
||||
import com.thoughtworks.qdox.model.JavaClass;
|
||||
+import com.thoughtworks.qdox.model.JavaConstructor;
|
||||
import com.thoughtworks.qdox.model.JavaMethod;
|
||||
+import com.thoughtworks.qdox.model.JavaModel;
|
||||
import com.thoughtworks.qdox.model.JavaParameter;
|
||||
import com.thoughtworks.qdox.model.JavaSource;
|
||||
-import com.thoughtworks.qdox.model.Type;
|
||||
+import com.thoughtworks.qdox.model.JavaType;
|
||||
+
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -62,7 +66,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
private final String defaultNamespace;
|
||||
private final File[] srcDirs;
|
||||
private final String[] excludedClasses;
|
||||
- private Type collectionType;
|
||||
+ private JavaClass collectionType;
|
||||
|
||||
public QdoxMappingLoader(String defaultNamespace, File[] srcDirs, String[] excludedClasses) {
|
||||
this.defaultNamespace = defaultNamespace;
|
||||
@@ -79,7 +83,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
|
||||
public Set<NamespaceMapping> loadNamespaces() throws IOException {
|
||||
- JavaDocBuilder builder = new JavaDocBuilder();
|
||||
+ JavaProjectBuilder builder = new JavaProjectBuilder();
|
||||
|
||||
log.debug("Source directories: ");
|
||||
|
||||
@@ -92,11 +96,11 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
getSourceFiles(sourceDirectory, excludedClasses, builder);
|
||||
}
|
||||
|
||||
- collectionType = builder.getClassByName("java.util.Collection").asType();
|
||||
+ collectionType = builder.getClassByName("java.util.Collection");
|
||||
return loadNamespaces(builder);
|
||||
}
|
||||
|
||||
- private Set<NamespaceMapping> loadNamespaces(JavaDocBuilder builder) {
|
||||
+ private Set<NamespaceMapping> loadNamespaces(JavaProjectBuilder builder) {
|
||||
// load all of the elements
|
||||
List<ElementMapping> elements = loadElements(builder);
|
||||
|
||||
@@ -131,14 +135,14 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return Collections.unmodifiableSet(namespaces);
|
||||
}
|
||||
|
||||
- private List<ElementMapping> loadElements(JavaDocBuilder builder) {
|
||||
- JavaSource[] javaSources = builder.getSources();
|
||||
+ private List<ElementMapping> loadElements(JavaProjectBuilder builder) {
|
||||
+ Collection<JavaSource> javaSources = builder.getSources();
|
||||
List<ElementMapping> elements = new ArrayList<ElementMapping>();
|
||||
for (JavaSource javaSource : javaSources) {
|
||||
- if (javaSource.getClasses().length == 0) {
|
||||
+ if (javaSource.getClasses().isEmpty()) {
|
||||
log.info("No Java Classes defined in: " + javaSource.getURL());
|
||||
} else {
|
||||
- JavaClass[] classes = javaSource.getClasses();
|
||||
+ Collection<JavaClass> classes = javaSource.getClasses();
|
||||
for (JavaClass javaClass : classes) {
|
||||
ElementMapping element = loadElement(builder, javaClass);
|
||||
if (element != null && !javaClass.isAbstract()) {
|
||||
@@ -152,7 +156,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return elements;
|
||||
}
|
||||
|
||||
- private ElementMapping loadElement(JavaDocBuilder builder, JavaClass javaClass) {
|
||||
+ private ElementMapping loadElement(JavaProjectBuilder builder, JavaClass javaClass) {
|
||||
DocletTag xbeanTag = javaClass.getTagByName(XBEAN_ANNOTATION);
|
||||
if (xbeanTag == null) {
|
||||
return null;
|
||||
@@ -176,7 +180,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
Map<String, AttributeMapping> attributesByPropertyName = new HashMap<String, AttributeMapping>();
|
||||
|
||||
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||
- BeanProperty[] beanProperties = jClass.getBeanProperties();
|
||||
+ Collection<BeanProperty> beanProperties = jClass.getBeanProperties();
|
||||
for (BeanProperty beanProperty : beanProperties) {
|
||||
// we only care about properties with a setter
|
||||
if (beanProperty.getMutator() != null) {
|
||||
@@ -219,9 +223,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
String destroyMethod = null;
|
||||
String factoryMethod = null;
|
||||
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||
- JavaMethod[] methods = javaClass.getMethods();
|
||||
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||
for (JavaMethod method : methods) {
|
||||
- if (method.isPublic() && !method.isConstructor()) {
|
||||
+ if (method.isPublic()) {
|
||||
if (initMethod == null && method.getTagByName(INIT_METHOD_ANNOTATION) != null) {
|
||||
initMethod = method.getName();
|
||||
}
|
||||
@@ -237,22 +241,43 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
|
||||
List<List<ParameterMapping>> constructorArgs = new ArrayList<List<ParameterMapping>>();
|
||||
- JavaMethod[] methods = javaClass.getMethods();
|
||||
- for (JavaMethod method : methods) {
|
||||
- JavaParameter[] parameters = method.getParameters();
|
||||
- if (isValidConstructor(factoryMethod, method, parameters)) {
|
||||
- List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.length);
|
||||
- for (JavaParameter parameter : parameters) {
|
||||
- AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||
- if (attributeMapping == null) {
|
||||
- attributeMapping = loadParameter(parameter);
|
||||
-
|
||||
- attributes.add(attributeMapping);
|
||||
- attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||
+ if (factoryMethod == null) {
|
||||
+ Collection<JavaConstructor> constructors = javaClass.getConstructors();
|
||||
+ for (JavaConstructor constructor : constructors) {
|
||||
+ Collection<JavaParameter> parameters = constructor.getParameters();
|
||||
+ if (constructor.isPublic() && parameters.size() > 0) {
|
||||
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||
+ for (JavaParameter parameter : parameters) {
|
||||
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||
+ if (attributeMapping == null) {
|
||||
+ attributeMapping = loadParameter(parameter, constructor);
|
||||
+
|
||||
+ attributes.add(attributeMapping);
|
||||
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||
+ }
|
||||
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||
}
|
||||
- args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||
+ for (JavaMethod method : methods) {
|
||||
+ Collection<JavaParameter> parameters = method.getParameters();
|
||||
+ if (method.isPublic() && parameters.size() > 0 && method.getName().equals(factoryMethod)) {
|
||||
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||
+ for (JavaParameter parameter : parameters) {
|
||||
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||
+ if (attributeMapping == null) {
|
||||
+ attributeMapping = loadParameter(parameter, method);
|
||||
+
|
||||
+ attributes.add(attributeMapping);
|
||||
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||
+ }
|
||||
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||
+ }
|
||||
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||
}
|
||||
- constructorArgs.add(Collections.unmodifiableList(args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +328,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
interfaces);
|
||||
}
|
||||
|
||||
- private List<String> getFullyQualifiedNames(JavaClass[] implementedInterfaces) {
|
||||
+ private List<String> getFullyQualifiedNames(Collection<JavaClass> implementedInterfaces) {
|
||||
ArrayList<String> l = new ArrayList<String>();
|
||||
for (JavaClass implementedInterface : implementedInterfaces) {
|
||||
l.add(implementedInterface.getFullyQualifiedName());
|
||||
@@ -395,19 +420,19 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return defaultDescription;
|
||||
}
|
||||
|
||||
- private AttributeMapping loadParameter(JavaParameter parameter) {
|
||||
+ private AttributeMapping loadParameter(JavaParameter parameter, JavaModel methodOrConstructor) {
|
||||
String parameterName = parameter.getName();
|
||||
String parameterDescription = getParameterDescription(parameter);
|
||||
|
||||
// first attempt to load the attribute from the java beans accessor methods
|
||||
- JavaClass javaClass = parameter.getParentMethod().getParentClass();
|
||||
+ JavaClass javaClass = parameter.getParentClass();
|
||||
BeanProperty beanProperty = javaClass.getBeanProperty(parameterName);
|
||||
if (beanProperty != null) {
|
||||
AttributeMapping attributeMapping = loadAttribute(beanProperty, parameterDescription);
|
||||
// if the attribute mapping is null, the property was tagged as hidden and this is an error
|
||||
if (attributeMapping == null) {
|
||||
throw new InvalidModelException("Hidden property usage: " +
|
||||
- "The construction method " + toMethodLocator(parameter.getParentMethod()) +
|
||||
+ "The construction method " + toMethodLocator(parameter.getParentClass(), methodOrConstructor) +
|
||||
" can not use a hidded property " + parameterName);
|
||||
}
|
||||
return attributeMapping;
|
||||
@@ -426,9 +451,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
|
||||
private String getParameterDescription(JavaParameter parameter) {
|
||||
String parameterName = parameter.getName();
|
||||
- DocletTag[] tags = parameter.getParentMethod().getTagsByName("param");
|
||||
+ Collection<DocletTag> tags = parameter.getTagsByName("param");
|
||||
for (DocletTag tag : tags) {
|
||||
- if (tag.getParameters()[0].equals(parameterName)) {
|
||||
+ if (tag.getParameters().get(0).equals(parameterName)) {
|
||||
String parameterDescription = tag.getValue().trim();
|
||||
if (parameterDescription.startsWith(parameterName)) {
|
||||
parameterDescription = parameterDescription.substring(parameterName.length()).trim();
|
||||
@@ -439,18 +464,6 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
- private boolean isValidConstructor(String factoryMethod, JavaMethod method, JavaParameter[] parameters) {
|
||||
- if (!method.isPublic() || parameters.length == 0) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (factoryMethod == null) {
|
||||
- return method.isConstructor();
|
||||
- } else {
|
||||
- return method.getName().equals(factoryMethod);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
private static String getProperty(DocletTag propertyTag, String propertyName) {
|
||||
return getProperty(propertyTag, propertyName, null);
|
||||
}
|
||||
@@ -477,14 +490,17 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return false;
|
||||
}
|
||||
|
||||
- private org.apache.xbean.blueprint.generator.Type toMappingType(Type type, String nestedType) {
|
||||
+ private org.apache.xbean.blueprint.generator.Type toMappingType(JavaType type, String nestedType) {
|
||||
try {
|
||||
- if (type.isArray()) {
|
||||
- return org.apache.xbean.blueprint.generator.Type.newArrayType(type.getValue(), type.getDimensions());
|
||||
- } else if (type.isA(collectionType)) {
|
||||
- if (nestedType == null) nestedType = "java.lang.Object";
|
||||
- return org.apache.xbean.blueprint.generator.Type.newCollectionType(type.getValue(),
|
||||
- org.apache.xbean.blueprint.generator.Type.newSimpleType(nestedType));
|
||||
+ if (type instanceof JavaClass) {
|
||||
+ JavaClass clazz = (JavaClass)type;
|
||||
+ if (clazz.isArray()) {
|
||||
+ return org.apache.xbean.blueprint.generator.Type.newArrayType(type.getValue(), clazz.getDimensions());
|
||||
+ } else if (clazz.isA(collectionType)) {
|
||||
+ if (nestedType == null) nestedType = "java.lang.Object";
|
||||
+ return org.apache.xbean.blueprint.generator.Type.newCollectionType(type.getValue(),
|
||||
+ org.apache.xbean.blueprint.generator.Type.newSimpleType(nestedType));
|
||||
+ }
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
log.debug("Could not load type mapping", t);
|
||||
@@ -492,26 +508,28 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return org.apache.xbean.blueprint.generator.Type.newSimpleType(type.getValue());
|
||||
}
|
||||
|
||||
- private static String toMethodLocator(JavaMethod method) {
|
||||
+ private static String toMethodLocator(JavaClass parentClass, JavaModel methodOrConstructor) {
|
||||
+ JavaMethod method = methodOrConstructor instanceof JavaMethod ? (JavaMethod) methodOrConstructor : null;
|
||||
+ JavaConstructor constructor = methodOrConstructor instanceof JavaConstructor ? (JavaConstructor) methodOrConstructor : null;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
- buf.append(method.getParentClass().getFullyQualifiedName());
|
||||
- if (!method.isConstructor()) {
|
||||
+ buf.append(parentClass.getFullyQualifiedName());
|
||||
+ if (method != null) {
|
||||
buf.append(".").append(method.getName());
|
||||
}
|
||||
buf.append("(");
|
||||
- JavaParameter[] parameters = method.getParameters();
|
||||
- for (int i = 0; i < parameters.length; i++) {
|
||||
- JavaParameter parameter = parameters[i];
|
||||
+ List<JavaParameter> parameters = method != null ? method.getParameters() : constructor.getParameters();
|
||||
+ for (int i = 0; i < parameters.size(); i++) {
|
||||
+ JavaParameter parameter = parameters.get(i);
|
||||
if (i > 0) {
|
||||
buf.append(", ");
|
||||
}
|
||||
buf.append(parameter.getName());
|
||||
}
|
||||
- buf.append(") : ").append(method.getLineNumber());
|
||||
+ buf.append(") : ").append(method != null ? method.getLineNumber() : constructor.getLineNumber());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
- private static void getSourceFiles(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||
+ private static void getSourceFiles(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||
if (base.isDirectory()) {
|
||||
listAllFileNames(base, "", excludedClasses, builder);
|
||||
} else {
|
||||
@@ -519,7 +537,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
}
|
||||
|
||||
- private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||
+ private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||
if (!base.canRead() || !base.isDirectory()) {
|
||||
throw new IllegalArgumentException(base.getAbsolutePath());
|
||||
}
|
||||
@@ -536,7 +554,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
}
|
||||
|
||||
- private static void listAllJarEntries(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||
+ private static void listAllJarEntries(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||
JarFile jarFile = new JarFile(base);
|
||||
for (Enumeration entries = jarFile.entries(); entries.hasMoreElements(); ) {
|
||||
JarEntry entry = (JarEntry) entries.nextElement();
|
||||
diff --git a/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java b/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
|
||||
index 94bd7a1..228117e 100644
|
||||
--- a/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
|
||||
+++ b/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
|
||||
@@ -20,6 +20,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
+import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
@@ -31,14 +32,17 @@ import java.util.TreeSet;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
-import com.thoughtworks.qdox.JavaDocBuilder;
|
||||
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
||||
import com.thoughtworks.qdox.model.BeanProperty;
|
||||
import com.thoughtworks.qdox.model.DocletTag;
|
||||
import com.thoughtworks.qdox.model.JavaClass;
|
||||
+import com.thoughtworks.qdox.model.JavaConstructor;
|
||||
import com.thoughtworks.qdox.model.JavaMethod;
|
||||
+import com.thoughtworks.qdox.model.JavaModel;
|
||||
import com.thoughtworks.qdox.model.JavaParameter;
|
||||
import com.thoughtworks.qdox.model.JavaSource;
|
||||
-import com.thoughtworks.qdox.model.Type;
|
||||
+import com.thoughtworks.qdox.model.JavaType;
|
||||
+
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -62,7 +66,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
private final String defaultNamespace;
|
||||
private final File[] srcDirs;
|
||||
private final String[] excludedClasses;
|
||||
- private Type collectionType;
|
||||
+ private JavaClass collectionType;
|
||||
|
||||
public QdoxMappingLoader(String defaultNamespace, File[] srcDirs, String[] excludedClasses) {
|
||||
this.defaultNamespace = defaultNamespace;
|
||||
@@ -79,7 +83,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
|
||||
public Set<NamespaceMapping> loadNamespaces() throws IOException {
|
||||
- JavaDocBuilder builder = new JavaDocBuilder();
|
||||
+ JavaProjectBuilder builder = new JavaProjectBuilder();
|
||||
|
||||
log.debug("Source directories: ");
|
||||
|
||||
@@ -92,11 +96,11 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
getSourceFiles(sourceDirectory, excludedClasses, builder);
|
||||
}
|
||||
|
||||
- collectionType = builder.getClassByName("java.util.Collection").asType();
|
||||
+ collectionType = builder.getClassByName("java.util.Collection");
|
||||
return loadNamespaces(builder);
|
||||
}
|
||||
|
||||
- private Set<NamespaceMapping> loadNamespaces(JavaDocBuilder builder) {
|
||||
+ private Set<NamespaceMapping> loadNamespaces(JavaProjectBuilder builder) {
|
||||
// load all of the elements
|
||||
List<ElementMapping> elements = loadElements(builder);
|
||||
|
||||
@@ -131,14 +135,14 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return Collections.unmodifiableSet(namespaces);
|
||||
}
|
||||
|
||||
- private List<ElementMapping> loadElements(JavaDocBuilder builder) {
|
||||
- JavaSource[] javaSources = builder.getSources();
|
||||
+ private List<ElementMapping> loadElements(JavaProjectBuilder builder) {
|
||||
+ Collection<JavaSource> javaSources = builder.getSources();
|
||||
List<ElementMapping> elements = new ArrayList<ElementMapping>();
|
||||
for (JavaSource javaSource : javaSources) {
|
||||
- if (javaSource.getClasses().length == 0) {
|
||||
+ if (javaSource.getClasses().isEmpty()) {
|
||||
log.info("No Java Classes defined in: " + javaSource.getURL());
|
||||
} else {
|
||||
- JavaClass[] classes = javaSource.getClasses();
|
||||
+ Collection<JavaClass> classes = javaSource.getClasses();
|
||||
for (JavaClass javaClass : classes) {
|
||||
ElementMapping element = loadElement(builder, javaClass);
|
||||
if (element != null && !javaClass.isAbstract()) {
|
||||
@@ -152,7 +156,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return elements;
|
||||
}
|
||||
|
||||
- private ElementMapping loadElement(JavaDocBuilder builder, JavaClass javaClass) {
|
||||
+ private ElementMapping loadElement(JavaProjectBuilder builder, JavaClass javaClass) {
|
||||
DocletTag xbeanTag = javaClass.getTagByName(XBEAN_ANNOTATION);
|
||||
if (xbeanTag == null) {
|
||||
return null;
|
||||
@@ -176,7 +180,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
Map<String, AttributeMapping> attributesByPropertyName = new HashMap<String, AttributeMapping>();
|
||||
|
||||
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||
- BeanProperty[] beanProperties = jClass.getBeanProperties();
|
||||
+ Collection<BeanProperty> beanProperties = jClass.getBeanProperties();
|
||||
for (BeanProperty beanProperty : beanProperties) {
|
||||
// we only care about properties with a setter
|
||||
if (beanProperty.getMutator() != null) {
|
||||
@@ -219,9 +223,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
String destroyMethod = null;
|
||||
String factoryMethod = null;
|
||||
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||
- JavaMethod[] methods = javaClass.getMethods();
|
||||
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||
for (JavaMethod method : methods) {
|
||||
- if (method.isPublic() && !method.isConstructor()) {
|
||||
+ if (method.isPublic()) {
|
||||
if (initMethod == null && method.getTagByName(INIT_METHOD_ANNOTATION) != null) {
|
||||
initMethod = method.getName();
|
||||
}
|
||||
@@ -237,27 +241,48 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
|
||||
List<List<ParameterMapping>> constructorArgs = new ArrayList<List<ParameterMapping>>();
|
||||
- JavaMethod[] methods = javaClass.getMethods();
|
||||
- for (JavaMethod method : methods) {
|
||||
- JavaParameter[] parameters = method.getParameters();
|
||||
- if (isValidConstructor(factoryMethod, method, parameters)) {
|
||||
- List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.length);
|
||||
- for (JavaParameter parameter : parameters) {
|
||||
- AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||
- if (attributeMapping == null) {
|
||||
- attributeMapping = loadParameter(parameter);
|
||||
-
|
||||
- attributes.add(attributeMapping);
|
||||
- attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||
+ if (factoryMethod == null) {
|
||||
+ Collection<JavaConstructor> constructors = javaClass.getConstructors();
|
||||
+ for (JavaConstructor constructor : constructors) {
|
||||
+ Collection<JavaParameter> parameters = constructor.getParameters();
|
||||
+ if (constructor.isPublic() && parameters.size() > 0) {
|
||||
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||
+ for (JavaParameter parameter : parameters) {
|
||||
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||
+ if (attributeMapping == null) {
|
||||
+ attributeMapping = loadParameter(parameter, constructor);
|
||||
+
|
||||
+ attributes.add(attributeMapping);
|
||||
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||
+ }
|
||||
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||
}
|
||||
- args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||
+ for (JavaMethod method : methods) {
|
||||
+ Collection<JavaParameter> parameters = method.getParameters();
|
||||
+ if (method.isPublic() && parameters.size() > 0 && method.getName().equals(factoryMethod)) {
|
||||
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||
+ for (JavaParameter parameter : parameters) {
|
||||
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||
+ if (attributeMapping == null) {
|
||||
+ attributeMapping = loadParameter(parameter, method);
|
||||
+
|
||||
+ attributes.add(attributeMapping);
|
||||
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||
+ }
|
||||
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||
+ }
|
||||
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||
}
|
||||
- constructorArgs.add(Collections.unmodifiableList(args));
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<String> interfaces = new HashSet<String>();
|
||||
- interfaces.addAll(getFullyQualifiedNames(javaClass.getImplementedInterfaces()));
|
||||
+ interfaces.addAll(getFullyQualifiedNames(javaClass.getInterfaces()));
|
||||
|
||||
JavaClass actualClass = javaClass;
|
||||
if (factoryClass != null) {
|
||||
@@ -282,7 +307,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
p = s;
|
||||
superClasses.add(p.getFullyQualifiedName());
|
||||
- interfaces.addAll(getFullyQualifiedNames(p.getImplementedInterfaces()));
|
||||
+ interfaces.addAll(getFullyQualifiedNames(p.getInterfaces()));
|
||||
}
|
||||
|
||||
return new ElementMapping(namespace,
|
||||
@@ -303,7 +328,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
interfaces);
|
||||
}
|
||||
|
||||
- private List<String> getFullyQualifiedNames(JavaClass[] implementedInterfaces) {
|
||||
+ private List<String> getFullyQualifiedNames(Collection<JavaClass> implementedInterfaces) {
|
||||
ArrayList<String> l = new ArrayList<String>();
|
||||
for (JavaClass implementedInterface : implementedInterfaces) {
|
||||
l.add(implementedInterface.getFullyQualifiedName());
|
||||
@@ -395,19 +420,19 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return defaultDescription;
|
||||
}
|
||||
|
||||
- private AttributeMapping loadParameter(JavaParameter parameter) {
|
||||
+ private AttributeMapping loadParameter(JavaParameter parameter, JavaModel methodOrConstructor) {
|
||||
String parameterName = parameter.getName();
|
||||
String parameterDescription = getParameterDescription(parameter);
|
||||
|
||||
// first attempt to load the attribute from the java beans accessor methods
|
||||
- JavaClass javaClass = parameter.getParentMethod().getParentClass();
|
||||
+ JavaClass javaClass = parameter.getDeclaringClass();
|
||||
BeanProperty beanProperty = javaClass.getBeanProperty(parameterName);
|
||||
if (beanProperty != null) {
|
||||
AttributeMapping attributeMapping = loadAttribute(beanProperty, parameterDescription);
|
||||
// if the attribute mapping is null, the property was tagged as hidden and this is an error
|
||||
if (attributeMapping == null) {
|
||||
throw new InvalidModelException("Hidden property usage: " +
|
||||
- "The construction method " + toMethodLocator(parameter.getParentMethod()) +
|
||||
+ "The construction method " + toMethodLocator(parameter.getDeclaringClass(), methodOrConstructor) +
|
||||
" can not use a hidded property " + parameterName);
|
||||
}
|
||||
return attributeMapping;
|
||||
@@ -426,9 +451,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
|
||||
private String getParameterDescription(JavaParameter parameter) {
|
||||
String parameterName = parameter.getName();
|
||||
- DocletTag[] tags = parameter.getParentMethod().getTagsByName("param");
|
||||
+ Collection<DocletTag> tags = parameter.getTagsByName("param");
|
||||
for (DocletTag tag : tags) {
|
||||
- if (tag.getParameters()[0].equals(parameterName)) {
|
||||
+ if (tag.getParameters().get(0).equals(parameterName)) {
|
||||
String parameterDescription = tag.getValue().trim();
|
||||
if (parameterDescription.startsWith(parameterName)) {
|
||||
parameterDescription = parameterDescription.substring(parameterName.length()).trim();
|
||||
@@ -439,18 +464,6 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return null;
|
||||
}
|
||||
|
||||
- private boolean isValidConstructor(String factoryMethod, JavaMethod method, JavaParameter[] parameters) {
|
||||
- if (!method.isPublic() || parameters.length == 0) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (factoryMethod == null) {
|
||||
- return method.isConstructor();
|
||||
- } else {
|
||||
- return method.getName().equals(factoryMethod);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
private static String getProperty(DocletTag propertyTag, String propertyName) {
|
||||
return getProperty(propertyTag, propertyName, null);
|
||||
}
|
||||
@@ -477,14 +490,17 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return false;
|
||||
}
|
||||
|
||||
- private org.apache.xbean.spring.generator.Type toMappingType(Type type, String nestedType) {
|
||||
+ private org.apache.xbean.spring.generator.Type toMappingType(JavaType type, String nestedType) {
|
||||
try {
|
||||
- if (type.isArray()) {
|
||||
- return org.apache.xbean.spring.generator.Type.newArrayType(type.getValue(), type.getDimensions());
|
||||
- } else if (type.isA(collectionType)) {
|
||||
- if (nestedType == null) nestedType = "java.lang.Object";
|
||||
- return org.apache.xbean.spring.generator.Type.newCollectionType(type.getValue(),
|
||||
- org.apache.xbean.spring.generator.Type.newSimpleType(nestedType));
|
||||
+ if (type instanceof JavaClass) {
|
||||
+ JavaClass clazz = (JavaClass)type;
|
||||
+ if (clazz.isArray()) {
|
||||
+ return org.apache.xbean.spring.generator.Type.newArrayType(type.getValue(), clazz.getDimensions());
|
||||
+ } else if (clazz.isA(collectionType)) {
|
||||
+ if (nestedType == null) nestedType = "java.lang.Object";
|
||||
+ return org.apache.xbean.spring.generator.Type.newCollectionType(type.getValue(),
|
||||
+ org.apache.xbean.spring.generator.Type.newSimpleType(nestedType));
|
||||
+ }
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
log.debug("Could not load type mapping", t);
|
||||
@@ -492,26 +508,28 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
return org.apache.xbean.spring.generator.Type.newSimpleType(type.getValue());
|
||||
}
|
||||
|
||||
- private static String toMethodLocator(JavaMethod method) {
|
||||
+ private static String toMethodLocator(JavaClass parentClass, JavaModel methodOrConstructor) {
|
||||
+ JavaMethod method = methodOrConstructor instanceof JavaMethod ? (JavaMethod) methodOrConstructor : null;
|
||||
+ JavaConstructor constructor = methodOrConstructor instanceof JavaConstructor ? (JavaConstructor) methodOrConstructor : null;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
- buf.append(method.getParentClass().getFullyQualifiedName());
|
||||
- if (!method.isConstructor()) {
|
||||
+ buf.append(parentClass.getFullyQualifiedName());
|
||||
+ if (method != null) {
|
||||
buf.append(".").append(method.getName());
|
||||
}
|
||||
buf.append("(");
|
||||
- JavaParameter[] parameters = method.getParameters();
|
||||
- for (int i = 0; i < parameters.length; i++) {
|
||||
- JavaParameter parameter = parameters[i];
|
||||
+ List<JavaParameter> parameters = method != null ? method.getParameters() : constructor.getParameters();
|
||||
+ for (int i = 0; i < parameters.size(); i++) {
|
||||
+ JavaParameter parameter = parameters.get(i);
|
||||
if (i > 0) {
|
||||
buf.append(", ");
|
||||
}
|
||||
buf.append(parameter.getName());
|
||||
}
|
||||
- buf.append(") : ").append(method.getLineNumber());
|
||||
+ buf.append(") : ").append(method != null ? method.getLineNumber() : constructor.getLineNumber());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
- private static void getSourceFiles(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||
+ private static void getSourceFiles(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||
if (base.isDirectory()) {
|
||||
listAllFileNames(base, "", excludedClasses, builder);
|
||||
} else {
|
||||
@@ -519,7 +537,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
}
|
||||
|
||||
- private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||
+ private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||
if (!base.canRead() || !base.isDirectory()) {
|
||||
throw new IllegalArgumentException(base.getAbsolutePath());
|
||||
}
|
||||
@@ -536,7 +554,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||
}
|
||||
}
|
||||
|
||||
- private static void listAllJarEntries(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||
+ private static void listAllJarEntries(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||
JarFile jarFile = new JarFile(base);
|
||||
for (Enumeration entries = jarFile.entries(); entries.hasMoreElements(); ) {
|
||||
JarEntry entry = (JarEntry) entries.nextElement();
|
||||
diff --git a/xbean-spring/src/main/java/org/apache/xbean/spring/generator/Type.java b/xbean-spring/src/main/java/org/apache/xbean/spring/generator/Type.java
|
||||
index 5eac64c..0d9fa63 100644
|
||||
--- a/xbean-spring/src/main/java/org/apache/xbean/spring/generator/Type.java
|
||||
+++ b/xbean-spring/src/main/java/org/apache/xbean/spring/generator/Type.java
|
||||
@@ -41,12 +41,7 @@ public class Type {
|
||||
public static Type newArrayType(String type, int dimensions) {
|
||||
if (type == null) throw new NullPointerException("type");
|
||||
if (dimensions < 1) throw new IllegalArgumentException("dimensions must be atleast one");
|
||||
- StringBuffer buf = new StringBuffer(type.length() + (dimensions * 2));
|
||||
- buf.append(type);
|
||||
- for (int i = 0; i < dimensions; i ++) {
|
||||
- buf.append("[]");
|
||||
- }
|
||||
- return new Type(buf.toString(), newSimpleType(type));
|
||||
+ return new Type(type, newSimpleType(type.replaceAll("\\[\\]", "")));
|
||||
}
|
||||
|
||||
public static Type newCollectionType(String collectionType, Type elementType) {
|
||||
--
|
||||
2.9.3
|
||||
|
35
0003-Remove-dependency-on-log4j-and-commons-logging.patch
Normal file
35
0003-Remove-dependency-on-log4j-and-commons-logging.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 28e37850d8343f44f82e3138c772dd65d1d0ff2f Mon Sep 17 00:00:00 2001
|
||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||
Date: Thu, 12 Dec 2019 08:52:26 +0100
|
||||
Subject: [PATCH 3/3] Remove dependency on log4j and commons-logging
|
||||
|
||||
---
|
||||
.../xbean/propertyeditor/PropertyEditorRegistry.java | 12 ------------
|
||||
1 file changed, 12 deletions(-)
|
||||
|
||||
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorRegistry.java b/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorRegistry.java
|
||||
index e7e17edd..be302861 100644
|
||||
--- a/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorRegistry.java
|
||||
+++ b/xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditorRegistry.java
|
||||
@@ -84,18 +84,6 @@ public class PropertyEditorRegistry implements Closeable {
|
||||
register(new VectorEditor());
|
||||
register(new WeakHashMapEditor());
|
||||
|
||||
- try {
|
||||
- register(new Log4jConverter());
|
||||
- } catch (final Throwable e) {
|
||||
- // no-op
|
||||
- }
|
||||
-
|
||||
- try {
|
||||
- register(new CommonsLoggingConverter());
|
||||
- } catch (final Throwable e) {
|
||||
- // no-op
|
||||
- }
|
||||
-
|
||||
return this;
|
||||
}
|
||||
|
||||
--
|
||||
2.21.0
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (xbean-4.15-source-release.zip) = fd76c882a1348bc00e79a1bfd9231a31c07b800908332d8ba2f24483dce054d25953aadef29427e1892b59bb8e44e8bf44c0822f806cefd2bcc5c1768123249f
|
||||
SHA512 (xbean-4.18-source-release.zip) = 766746caa4f9ea87ceff1af1fe052481a9478cab4754b18cb7c760fb9dc466e5fd85533f2040583c3378cf36a4e17ba357d48060896af86a933916008cb2dda6
|
||||
|
141
xbean.spec
141
xbean.spec
@ -1,38 +1,31 @@
|
||||
%bcond_with equinox
|
||||
%bcond_with groovy
|
||||
# Workaround for rhbz#1969370: __bootstrap macro is not defined in
|
||||
# CentOS Stream, See https://bugzilla.redhat.com/1969370
|
||||
%global __bootstrap ~bootstrap
|
||||
|
||||
%bcond_without bootstrap
|
||||
|
||||
Name: xbean
|
||||
Version: 4.18
|
||||
Release: 3%{?dist}
|
||||
Summary: Java plugin based web server
|
||||
Version: 4.15
|
||||
Release: 8%{?dist}
|
||||
License: ASL 2.0
|
||||
|
||||
URL: http://geronimo.apache.org/xbean/
|
||||
Source0: http://repo2.maven.org/maven2/org/apache/%{name}/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
||||
|
||||
# Compatibility with Eclipse Luna (rhbz#1087461)
|
||||
Patch1: 0002-Port-to-Eclipse-Luna-OSGi.patch
|
||||
Patch2: 0003-Port-to-QDox-2.0.patch
|
||||
|
||||
URL: https://geronimo.apache.org/xbean/
|
||||
BuildArch: noarch
|
||||
|
||||
Source0: https://repo1.maven.org/maven2/org/apache/%{name}/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
||||
|
||||
Patch1: 0001-Remove-unused-import.patch
|
||||
Patch2: 0002-Unbundle-ASM.patch
|
||||
Patch3: 0003-Remove-dependency-on-log4j-and-commons-logging.patch
|
||||
|
||||
BuildRequires: maven-local
|
||||
BuildRequires: mvn(commons-logging:commons-logging-api)
|
||||
%if %{with bootstrap}
|
||||
BuildRequires: javapackages-bootstrap
|
||||
%else
|
||||
BuildRequires: mvn(junit:junit)
|
||||
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
|
||||
BuildRequires: mvn(org.apache.logging.log4j:log4j-1.2-api)
|
||||
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
|
||||
BuildRequires: mvn(org.osgi:osgi.core)
|
||||
BuildRequires: mvn(org.ow2.asm:asm)
|
||||
BuildRequires: mvn(org.ow2.asm:asm-commons)
|
||||
BuildRequires: mvn(org.slf4j:slf4j-api)
|
||||
|
||||
%if %{with equinox}
|
||||
BuildRequires: mvn(org.eclipse:osgi)
|
||||
%endif
|
||||
|
||||
%if %{with groovy}
|
||||
BuildRequires: mvn(org.codehaus.groovy:groovy-all)
|
||||
%endif
|
||||
|
||||
%description
|
||||
@ -44,103 +37,65 @@ support for running with no IoC system, JMX without JMX code,
|
||||
lifecycle and class loader management, and a rock solid Spring
|
||||
integration.
|
||||
|
||||
|
||||
%package javadoc
|
||||
Summary: API documentation for %{name}
|
||||
|
||||
%description javadoc
|
||||
This package provides %{summary}.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
# build failing on this due to doxia-sitetools problems
|
||||
rm src/site/site.xml
|
||||
|
||||
%if %{with equinox}
|
||||
%patch1 -p1
|
||||
%endif
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
cp xbean-asm-util/src/main/java/org/apache/xbean/asm9/original/commons/AsmConstants.java xbean-reflect/src/main/java/org/apache/xbean/recipe/
|
||||
|
||||
# Parent POM is not packaged
|
||||
%pom_remove_parent
|
||||
%pom_remove_dep mx4j:mx4j
|
||||
|
||||
# use osgi-core instead of felix-osgi-core
|
||||
%pom_change_dep -r :org.osgi.core org.osgi:osgi.core
|
||||
%pom_remove_dep :commons-logging-api xbean-reflect
|
||||
%pom_remove_dep :log4j xbean-reflect
|
||||
%pom_remove_dep :xbean-asm9-shaded xbean-reflect
|
||||
find -name CommonsLoggingConverter.java -delete
|
||||
find -name Log4jConverter.java -delete
|
||||
|
||||
# switch from log4j 1.2 compat package to log4j 1.2 API shim
|
||||
%pom_change_dep -r log4j:log4j org.apache.logging.log4j:log4j-1.2-api
|
||||
|
||||
# Unshade ASM
|
||||
%pom_remove_dep -r :xbean-asm7-shaded
|
||||
%pom_remove_dep -r :xbean-finder-shaded
|
||||
%pom_disable_module xbean-asm7-shaded
|
||||
%pom_disable_module xbean-finder-shaded
|
||||
%pom_add_dep org.apache.xbean:xbean-asm-util:%{version} xbean-reflect
|
||||
%pom_xpath_remove pom:optional xbean-reflect xbean-asm-util
|
||||
%pom_xpath_remove 'pom:scope[text()="provided"]' xbean-reflect xbean-asm-util
|
||||
sed -i 's/org\.apache\.xbean\.asm7/org.objectweb.asm/g' `find xbean-reflect -name '*.java'`
|
||||
|
||||
# Springframework is not available in Fedora
|
||||
%pom_remove_dep org.springframework:
|
||||
%pom_disable_module xbean-blueprint
|
||||
%pom_disable_module xbean-classloader
|
||||
%pom_disable_module xbean-spring
|
||||
%pom_disable_module maven-xbean-plugin
|
||||
|
||||
# Disable uneeded modules that cannot be built on JDK 11
|
||||
%pom_disable_module xbean-classpath
|
||||
|
||||
# Disable one test that fails on JDK 11
|
||||
sed -i '/testGetBytecode/i@org.junit.Ignore' xbean-finder/src/test/java/org/apache/xbean/finder/archive/MJarJarArchiveTest.java
|
||||
|
||||
# Unused import which is not available in OpenJDK 11
|
||||
# Forwarded upstream: https://issues.apache.org/jira/browse/XBEAN-329
|
||||
sed -i '/import com.sun.org.apache.regexp.internal.RE/d' xbean-reflect/src/main/java/org/apache/xbean/propertyeditor/PropertyEditors.java
|
||||
|
||||
%if %{without equinox}
|
||||
%pom_remove_dep :xbean-bundleutils xbean-finder
|
||||
rm -r xbean-finder/src/main/java/org/apache/xbean/finder{,/archive}/Bundle*
|
||||
%pom_disable_module xbean-bundleutils
|
||||
%endif
|
||||
|
||||
%if %{without groovy}
|
||||
%pom_disable_module xbean-telnet
|
||||
%endif
|
||||
|
||||
# maven-xbean-plugin invocation makes no sense as there are no namespaces
|
||||
%pom_remove_plugin :maven-xbean-plugin xbean-classloader
|
||||
|
||||
# Remove plugins useful for upstream only.
|
||||
# Plugins useful for upstream only
|
||||
%pom_remove_plugin :apache-rat-plugin
|
||||
%pom_remove_plugin :maven-source-plugin
|
||||
|
||||
|
||||
%build
|
||||
%mvn_build
|
||||
|
||||
%mvn_build -- -f xbean-reflect
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
|
||||
|
||||
%files -f .mfiles
|
||||
%license LICENSE NOTICE
|
||||
|
||||
%files javadoc -f .mfiles-javadoc
|
||||
%license LICENSE NOTICE
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 4.15-8
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
* Tue Jun 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.18-3
|
||||
- Bootstrap Maven for CentOS Stream 9
|
||||
|
||||
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.18-2
|
||||
- Bootstrap build
|
||||
- Non-bootstrap build
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.15-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Jan 26 2021 Marian Koncek <mkoncek@redhat.com> - 4.18-1
|
||||
- Update to upstream version 4.18
|
||||
|
||||
* Wed Sep 09 2020 Fabio Valentini <decathorpe@gmail.com> - 4.15-6
|
||||
- Switch from log4j 1.2 compat package to log4j 1.2 API shim.
|
||||
|
||||
* Wed Jul 29 2020 Marian Koncek <mkoncek@redhat.com> - 4.17-1
|
||||
- Update to upsteam version 4.17
|
||||
|
||||
* Wed Jul 29 2020 Mat Booth <mat.booth@redhat.com> - 4.15-5
|
||||
- Remove springframework conditionals, the deps are a long time removed from
|
||||
Fedora and this simplifies the spec a bit
|
||||
@ -152,12 +107,21 @@ sed -i '/import com.sun.org.apache.regexp.internal.RE/d' xbean-reflect/src/main/
|
||||
* Thu Jun 25 2020 Jeff Johnston <jjohnstn@redhat.com> - 4.15-3
|
||||
- Fix JVM as 1.8.0 as package cannot be built with Java 9 and above
|
||||
|
||||
* Fri May 15 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.14-4
|
||||
- Remove dependency on log4j and commons-logging
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.15-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Nov 13 2019 Fabio Valentini <decathorpe@gmail.com> - 4.15-1
|
||||
- Update to version 4.15.
|
||||
|
||||
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.14-3
|
||||
- Mass rebuild for javapackages-tools 201902
|
||||
|
||||
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.14-2
|
||||
- Disable all modules except xbean-reflect
|
||||
|
||||
* Wed Sep 18 2019 Fabio Valentini <decathorpe@gmail.com> - 4.14-2
|
||||
- Migrate from the obsolete felix-osgi-core to osgi-core.
|
||||
|
||||
@ -173,6 +137,12 @@ sed -i '/import com.sun.org.apache.regexp.internal.RE/d' xbean-reflect/src/main/
|
||||
* Tue Jul 09 2019 Fabio Valentini <decathorpe@gmail.com> - 4.9-3
|
||||
- Disable eclipse equinox functionality to fix the FTBFS issue on 32bit arches.
|
||||
|
||||
* Wed Jun 26 2019 Marian Koncek <mkoncek@redhat.com> - 4.14-1
|
||||
- Update to upstream version 4.14
|
||||
|
||||
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.8-2
|
||||
- Mass rebuild for javapackages-tools 201901
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.9-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
@ -349,4 +319,3 @@ sed -i '/import com.sun.org.apache.regexp.internal.RE/d' xbean-reflect/src/main/
|
||||
|
||||
* Mon Jun 21 2010 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.7-1
|
||||
- First release
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user