[webbeans-commits] Webbeans SVN: r2097 - ri/trunk/impl/src/main/java/org/jboss/webbeans/util.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-18 16:36:32 -0400 (Wed, 18 Mar 2009)
New Revision: 2097
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
Log:
WBRI-192, thanks to Takeshi Kondo
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-03-18 20:26:40 UTC (rev 2096)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-03-18 20:36:32 UTC (rev 2097)
@@ -1,213 +1,217 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javassist.util.proxy.ProxyFactory;
-
-/**
- * Utilties for working with Javassist proxies
- *
- * @author Nicklas Karlsson
- * @author Pete Muir
- *
- */
-public class Proxies
-{
-
- public static class TypeInfo
- {
-
- private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
-
- private final Set<Class<?>> interfaces;
- private final Set<Class<?>> classes;
-
- private TypeInfo()
- {
- super();
- this.interfaces = new LinkedHashSet<Class<?>>();
- this.classes = new LinkedHashSet<Class<?>>();
- }
-
- public Class<?> getSuperClass()
- {
- if (classes.isEmpty())
- {
- throw new AssertionError("TypeInfo not properly initialized");
- }
- Iterator<Class<?>> it = classes.iterator();
- Class<?> superclass = it.next();
- while (it.hasNext())
- {
- Class<?> clazz = it.next();
- if (superclass.isAssignableFrom(clazz))
- {
- superclass = clazz;
- }
- }
- return superclass;
- }
-
- private Class<?>[] getInterfaces()
- {
- return interfaces.toArray(EMPTY_INTERFACES_ARRAY);
- }
-
- public ProxyFactory createProxyFactory()
- {
- ProxyFactory proxyFactory = new ProxyFactory();
- proxyFactory.setSuperclass(getSuperClass());
- proxyFactory.setInterfaces(getInterfaces());
- return proxyFactory;
- }
-
- private void add(Type type)
- {
- if (type instanceof Class)
- {
- Class<?> clazz = (Class<?>) type;
- if (clazz.isInterface())
- {
- interfaces.add(clazz);
- }
- else
- {
- classes.add(clazz);
- }
- }
- else
- {
- throw new IllegalArgumentException("Cannot proxy non-Class Type " + type);
- }
- }
-
- public static TypeInfo ofTypes(Set<? extends Type> types)
- {
- TypeInfo typeInfo = new TypeInfo();
- for (Type type : types)
- {
- typeInfo.add(type);
- }
- return typeInfo;
- }
-
- public static TypeInfo ofClasses(Set<Class<?>> classes)
- {
- TypeInfo typeInfo = new TypeInfo();
- for (Class<?> type : classes)
- {
- typeInfo.add(type);
- }
- return typeInfo;
- }
-
- }
-
- /**
- * Get the proxy factory for the given set of types
- *
- * @param types The types to create the proxy factory for
- * @param classes Additional interfaces the proxy should implement
- * @return the proxy factory
- */
- public static ProxyFactory getProxyFactory(Set<Type> types)
- {
- return TypeInfo.ofTypes(types).createProxyFactory();
- }
-
- /**
- * Indicates if a class is proxyable
- *
- * @param type The class to test
- * @return True if proxyable, false otherwise
- */
- public static boolean isTypeProxyable(Type type)
- {
- if (type instanceof Class)
- {
- return isClassProxyable((Class<?>) type);
- }
- else if (type instanceof ParameterizedType)
- {
- Type rawType = ((ParameterizedType) type).getRawType();
- if (rawType instanceof Class)
- {
- return isClassProxyable((Class<?>) rawType);
- }
- }
- return false;
- }
-
-
- /**
- * Indicates if a set of types are all proxyable
- *
- * @param types The types to test
- * @return True if proxyable, false otherwise
- */
- public static boolean isTypesProxyable(Iterable<? extends Type> types)
- {
- for (Type apiType : types)
- {
- if (Object.class.equals(apiType))
- {
- continue;
- }
- if (!isTypeProxyable(apiType))
- {
- return false;
- }
- }
- return true;
- }
-
- private static boolean isClassProxyable(Class<?> clazz)
- {
- if (clazz.isInterface())
- {
- return true;
- }
- else if (Reflections.getConstructor(clazz) == null)
- {
- return false;
- }
- else if (Reflections.isTypeOrAnyMethodFinal(clazz))
- {
- return false;
- }
- else if (Reflections.isPrimitive(clazz))
- {
- return false;
- }
- else if (Reflections.isArrayType(clazz))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javassist.util.proxy.ProxyFactory;
+
+/**
+ * Utilties for working with Javassist proxies
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ */
+public class Proxies
+{
+
+ public static class TypeInfo
+ {
+
+ private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
+
+ private final Set<Class<?>> interfaces;
+ private final Set<Class<?>> classes;
+
+ private TypeInfo()
+ {
+ super();
+ this.interfaces = new LinkedHashSet<Class<?>>();
+ this.classes = new LinkedHashSet<Class<?>>();
+ }
+
+ public Class<?> getSuperClass()
+ {
+ if (classes.isEmpty())
+ {
+ throw new AssertionError("TypeInfo not properly initialized");
+ }
+ Iterator<Class<?>> it = classes.iterator();
+ Class<?> superclass = it.next();
+ while (it.hasNext())
+ {
+ Class<?> clazz = it.next();
+ if (superclass.isAssignableFrom(clazz))
+ {
+ superclass = clazz;
+ }
+ }
+ return superclass;
+ }
+
+ private Class<?>[] getInterfaces()
+ {
+ return interfaces.toArray(EMPTY_INTERFACES_ARRAY);
+ }
+
+ public ProxyFactory createProxyFactory()
+ {
+ ProxyFactory proxyFactory = new ProxyFactory();
+ proxyFactory.setSuperclass(getSuperClass());
+ proxyFactory.setInterfaces(getInterfaces());
+ return proxyFactory;
+ }
+
+ private void add(Type type)
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ if (clazz.isInterface())
+ {
+ interfaces.add(clazz);
+ }
+ else
+ {
+ classes.add(clazz);
+ }
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ add(((ParameterizedType)type).getRawType());
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot proxy non-Class Type " + type);
+ }
+ }
+
+ public static TypeInfo ofTypes(Set<? extends Type> types)
+ {
+ TypeInfo typeInfo = new TypeInfo();
+ for (Type type : types)
+ {
+ typeInfo.add(type);
+ }
+ return typeInfo;
+ }
+
+ public static TypeInfo ofClasses(Set<Class<?>> classes)
+ {
+ TypeInfo typeInfo = new TypeInfo();
+ for (Class<?> type : classes)
+ {
+ typeInfo.add(type);
+ }
+ return typeInfo;
+ }
+
+ }
+
+ /**
+ * Get the proxy factory for the given set of types
+ *
+ * @param types The types to create the proxy factory for
+ * @param classes Additional interfaces the proxy should implement
+ * @return the proxy factory
+ */
+ public static ProxyFactory getProxyFactory(Set<Type> types)
+ {
+ return TypeInfo.ofTypes(types).createProxyFactory();
+ }
+
+ /**
+ * Indicates if a class is proxyable
+ *
+ * @param type The class to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isTypeProxyable(Type type)
+ {
+ if (type instanceof Class)
+ {
+ return isClassProxyable((Class<?>) type);
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ Type rawType = ((ParameterizedType) type).getRawType();
+ if (rawType instanceof Class)
+ {
+ return isClassProxyable((Class<?>) rawType);
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Indicates if a set of types are all proxyable
+ *
+ * @param types The types to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isTypesProxyable(Iterable<? extends Type> types)
+ {
+ for (Type apiType : types)
+ {
+ if (Object.class.equals(apiType))
+ {
+ continue;
+ }
+ if (!isTypeProxyable(apiType))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isClassProxyable(Class<?> clazz)
+ {
+ if (clazz.isInterface())
+ {
+ return true;
+ }
+ else if (Reflections.getConstructor(clazz) == null)
+ {
+ return false;
+ }
+ else if (Reflections.isTypeOrAnyMethodFinal(clazz))
+ {
+ return false;
+ }
+ else if (Reflections.isPrimitive(clazz))
+ {
+ return false;
+ }
+ else if (Reflections.isArrayType(clazz))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2096 - ri/trunk/impl/src/main/java/org/jboss/webbeans/util/xml.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-18 16:26:40 -0400 (Wed, 18 Mar 2009)
New Revision: 2096
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/xml/XmlParserImpl.java
Log:
Changed XmlParserImpl to use official WB logging rather than Log4J
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/xml/XmlParserImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/xml/XmlParserImpl.java 2009-03-18 19:32:38 UTC (rev 2095)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/xml/XmlParserImpl.java 2009-03-18 20:26:40 UTC (rev 2096)
@@ -9,17 +9,18 @@
import java.util.List;
import java.util.Set;
-import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
public class XmlParserImpl // implements XmlParser
{
- private static Logger log = Logger.getLogger(XmlParserImpl.class);
+ private static Log log = Logging.getLog(XmlParserImpl.class);
public Set<AnnotatedItem<?, ?>> parse(Set<URL> xmls)
{
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2095 - in test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone: subpackage and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-18 15:32:38 -0400 (Wed, 18 Mar 2009)
New Revision: 2095
Added:
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DummyExtraPackageSpecifiedTest.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/subpackage/Vole.java
Modified:
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DeclarativeStandaloneTest.java
Log:
Add ability to specify additional packages to include
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DeclarativeStandaloneTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DeclarativeStandaloneTest.java 2009-03-18 19:31:44 UTC (rev 2094)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DeclarativeStandaloneTest.java 2009-03-18 19:32:38 UTC (rev 2095)
@@ -2,6 +2,8 @@
import java.io.File;
import java.io.FilenameFilter;
+import java.util.Arrays;
+import java.util.List;
import org.jboss.testharness.api.Configuration;
import org.jboss.testharness.impl.packaging.ArtifactGenerator;
@@ -103,6 +105,21 @@
}
@Test
+ public void testClassesPackageSpecifiedArtifact() throws Exception
+ {
+ TCKArtifactDescriptor artifact = new ArtifactGenerator(standaloneConfiguration).createArtifact(DummyExtraPackageSpecifiedTest.class);
+ File root = artifact.getExplodedJar();
+ File currentPackage = getCurrentPackageAsFile(root);
+ List<String> currentPackageFileNames = Arrays.asList(currentPackage.list());
+ assert currentPackageFileNames.contains(DummyExtraPackageSpecifiedTest.class.getSimpleName() + ".class");
+ File subPackage = new File(currentPackage, "subpackage");
+ List<String> subPackageFileNames = Arrays.asList(subPackage.list());
+ assert subPackageFileNames.size() == 2;
+ assert subPackageFileNames.contains("Rat.class");
+ assert subPackageFileNames.contains("Vole.class");
+ }
+
+ @Test
public void testResourcesSpecifiedArtifact() throws Exception
{
TCKArtifactDescriptor artifact = new ArtifactGenerator(standaloneConfiguration).createArtifact(DummyResourcesSpecifiedTest.class);
Added: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DummyExtraPackageSpecifiedTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DummyExtraPackageSpecifiedTest.java (rev 0)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DummyExtraPackageSpecifiedTest.java 2009-03-18 19:32:38 UTC (rev 2095)
@@ -0,0 +1,17 @@
+package org.jboss.testharness.test.impl.packaging.declarative.standalone;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+
+
+@Artifact
+@Classes(packages="org.jboss.testharness.test.impl.packaging.declarative.standalone.subpackage")
+class DummyExtraPackageSpecifiedTest
+{
+
+ public void test()
+ {
+ assert true;
+ }
+
+}
Property changes on: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/DummyExtraPackageSpecifiedTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/subpackage/Vole.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/subpackage/Vole.java (rev 0)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/subpackage/Vole.java 2009-03-18 19:32:38 UTC (rev 2095)
@@ -0,0 +1,6 @@
+package org.jboss.testharness.test.impl.packaging.declarative.standalone.subpackage;
+
+public class Vole
+{
+
+}
Property changes on: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/declarative/standalone/subpackage/Vole.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2094 - test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-18 15:31:44 -0400 (Wed, 18 Mar 2009)
New Revision: 2094
Modified:
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/Classes.java
Log:
Add ability to specify additional packages to include
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java 2009-03-18 17:42:59 UTC (rev 2093)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java 2009-03-18 19:31:44 UTC (rev 2094)
@@ -40,6 +40,7 @@
private final Collection<Class<?>> classes;
private final Class<? extends Throwable> expectedDeploymentException;
private final Set<ResourceDescriptor> extraLibraries;
+ private final String[] packages;
private final Class<?> declaringClass;
@@ -100,10 +101,12 @@
if (declaringClass.isAnnotationPresent(Classes.class))
{
this.classes = Arrays.asList(declaringClass.getAnnotation(Classes.class).value());
+ this.packages = declaringClass.getAnnotation(Classes.class).packages();
}
else
{
this.classes = Collections.emptyList();
+ this.packages = new String[0];
}
if (declaringClass.isAnnotationPresent(ExpectedDeploymentException.class))
{
@@ -157,6 +160,10 @@
artifact.getResources().removeAll(resources);
artifact.getResources().addAll(resources);
artifact.getLibraries().addAll(extraLibraries);
+ for (String packageName : packages)
+ {
+ artifact.addPackage(packageName, false);
+ }
return artifact;
}
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/Classes.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/Classes.java 2009-03-18 17:42:59 UTC (rev 2093)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/Classes.java 2009-03-18 19:31:44 UTC (rev 2094)
@@ -22,6 +22,8 @@
public @interface Classes
{
- Class<?>[] value();
+ Class<?>[] value() default {};
+ String[] packages() default {};
+
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2093 - ri/trunk/logging.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-18 13:42:59 -0400 (Wed, 18 Mar 2009)
New Revision: 2093
Modified:
ri/trunk/logging/pom.xml
Log:
Made Log4J dependency optional
Modified: ri/trunk/logging/pom.xml
===================================================================
--- ri/trunk/logging/pom.xml 2009-03-18 16:53:17 UTC (rev 2092)
+++ ri/trunk/logging/pom.xml 2009-03-18 17:42:59 UTC (rev 2093)
@@ -26,6 +26,7 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
+ <optional>true</optional>
</dependency>
</dependencies>
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2092 - in extensions/trunk: logger and 25 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-18 12:53:17 -0400 (Wed, 18 Mar 2009)
New Revision: 2092
Added:
extensions/trunk/logger/
extensions/trunk/logger/.settings/
extensions/trunk/logger/.settings/org.maven.ide.eclipse.prefs
extensions/trunk/logger/pom.xml
extensions/trunk/logger/src/
extensions/trunk/logger/src/main/
extensions/trunk/logger/src/main/java/
extensions/trunk/logger/src/main/java/org/
extensions/trunk/logger/src/main/java/org/jboss/
extensions/trunk/logger/src/main/java/org/jboss/webbeans/
extensions/trunk/logger/src/main/java/org/jboss/webbeans/annotation/
extensions/trunk/logger/src/main/java/org/jboss/webbeans/annotation/Logger.java
extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/
extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/LoggerProducer.java
extensions/trunk/logger/src/test/
extensions/trunk/logger/src/test/java/
extensions/trunk/logger/src/test/java/org/
extensions/trunk/logger/src/test/java/org/jboss/
extensions/trunk/logger/src/test/java/org/jboss/webbeans/
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/AbstractLogTest.java
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/StandaloneContainersImpl.java
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java
extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java
extensions/trunk/logger/src/test/resources/
extensions/trunk/logger/src/test/resources/META-INF/
extensions/trunk/logger/src/test/resources/META-INF/web-beans-tck.properties
extensions/trunk/logger/src/test/resources/jndi.properties
extensions/trunk/logger/src/test/resources/org/
extensions/trunk/logger/src/test/resources/org/jboss/
extensions/trunk/logger/src/test/resources/org/jboss/testharness/
extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/
extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/packaging/
extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/
extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/
extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
Log:
New logger project that provides new binding type @Logger
Property changes on: extensions/trunk/logger
___________________________________________________________________
Name: svn:ignore
+ target
.project
.classpath
temp-testng-customsuite.xml
Added: extensions/trunk/logger/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- extensions/trunk/logger/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ extensions/trunk/logger/.settings/org.maven.ide.eclipse.prefs 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,8 @@
+#Wed Mar 18 12:02:59 CET 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+version=1
Property changes on: extensions/trunk/logger/.settings/org.maven.ide.eclipse.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/pom.xml
===================================================================
--- extensions/trunk/logger/pom.xml (rev 0)
+++ extensions/trunk/logger/pom.xml 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,75 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>webbeans-parent</artifactId>
+ <groupId>org.jboss.webbeans</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>Web Beans Injectable Logger</name>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ <exclusions>
+ <exclusion>
+ <artifactId>junit</artifactId>
+ <groupId>junit</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>jsr299-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-jboss-as-5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jbossws</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-transaction-api</artifactId>
+ <groupId>org.jboss.javaee</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+
+</project>
Property changes on: extensions/trunk/logger/pom.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/main/java/org/jboss/webbeans/annotation/Logger.java
===================================================================
--- extensions/trunk/logger/src/main/java/org/jboss/webbeans/annotation/Logger.java (rev 0)
+++ extensions/trunk/logger/src/main/java/org/jboss/webbeans/annotation/Logger.java 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+/**
+ * Injects a log
+ *
+ * @author Gavin King
+ */
+@Target(FIELD)
+@Retention(RUNTIME)
+@Documented
+@BindingType
+public @interface Logger
+{
+ /**
+ * @return the log category
+ */
+ String value() default "";
+}
Property changes on: extensions/trunk/logger/src/main/java/org/jboss/webbeans/annotation/Logger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/LoggerProducer.java
===================================================================
--- extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/LoggerProducer.java (rev 0)
+++ extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/LoggerProducer.java 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.producer;
+
+import javax.context.ApplicationScoped;
+import javax.inject.Current;
+import javax.inject.DefinitionException;
+import javax.inject.Produces;
+import javax.inject.manager.InjectionPoint;
+
+import org.jboss.webbeans.annotation.Logger;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
+
+/**
+ * The <code>LoggerProducer</code> provides a producer method for all
+ * @Logger annotated log objects. Each logger is application scoped
+ * since the logger applies to the class, not each instance of the
+ * class.
+ *
+ * @author David Allen
+ *
+ */
+public class LoggerProducer
+{
+ @Produces @ApplicationScoped
+ public Log produceLog(@Current InjectionPoint injectionPoint)
+ {
+ Log log = null;
+ String category = null;
+ if (injectionPoint.getType().equals(Log.class))
+ {
+ throw new DefinitionException("Cannot use @Logger on any type other than org.jboss.webbeans.log.Log: " + injectionPoint);
+ }
+ category = injectionPoint.getAnnotation(Logger.class).value();
+ if (category == null)
+ {
+ log = Logging.getLog((Class<?>) injectionPoint.getMember().getDeclaringClass());
+ }
+ else
+ {
+ log = Logging.getLog(category);
+ }
+ return log;
+ }
+}
Property changes on: extensions/trunk/logger/src/main/java/org/jboss/webbeans/producer/LoggerProducer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/AbstractLogTest.java
===================================================================
--- extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/AbstractLogTest.java (rev 0)
+++ extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/AbstractLogTest.java 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.test;
+
+import org.jboss.testharness.AbstractTest;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.ManagerImpl;
+import org.testng.ITestContext;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
+
+/**
+ * Some basic abstractions useful for tests in this project.
+ *
+ * @author David Allen
+ *
+ */
+public abstract class AbstractLogTest extends AbstractTest
+{
+ private ManagerImpl manager;
+
+ @Override
+ @BeforeSuite
+ public void beforeSuite(ITestContext context) throws Exception
+ {
+ if (!isInContainer())
+ {
+ getCurrentConfiguration().setStandaloneContainers(new StandaloneContainersImpl());
+ getCurrentConfiguration().getExtraPackages().add(AbstractLogTest.class.getPackage().getName());
+ }
+ super.beforeSuite(context);
+ }
+
+ @BeforeMethod
+ public void before() throws Exception
+ {
+ this.manager = CurrentManager.rootManager();
+ }
+
+ @AfterMethod
+ public void after() throws Exception
+ {
+ manager = null;
+ }
+
+ public ManagerImpl getCurrentManager()
+ {
+ return manager;
+ }
+}
Property changes on: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/AbstractLogTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/StandaloneContainersImpl.java (from rev 2086, ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/StandaloneContainersImpl.java)
===================================================================
--- extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/StandaloneContainersImpl.java (rev 0)
+++ extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/StandaloneContainersImpl.java 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,78 @@
+package org.jboss.webbeans.test;
+
+import java.net.URL;
+
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.spi.StandaloneContainers;
+import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.mock.MockServletLifecycle;
+import org.jboss.webbeans.mock.MockWebBeanDiscovery;
+
+public class StandaloneContainersImpl implements StandaloneContainers
+{
+
+ // TODO this is a hack ;-)
+ public static Class<? extends MockServletLifecycle> lifecycleClass = MockEELifecycle.class;
+
+ private MockServletLifecycle lifecycle;
+
+ public void deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml) throws DeploymentException
+ {
+ try
+ {
+ this.lifecycle = lifecycleClass.newInstance();
+ }
+ catch (InstantiationException e1)
+ {
+ throw new DeploymentException("Error instantiating lifeycle", e1);
+ }
+ catch (IllegalAccessException e1)
+ {
+ throw new DeploymentException("Error instantiating lifeycle", e1);
+ }
+ lifecycle.initialize();
+ try
+ {
+ MockWebBeanDiscovery discovery = lifecycle.getWebBeanDiscovery();
+ discovery.setWebBeanClasses(classes);
+ if (beansXml != null)
+ {
+ discovery.setWebBeansXmlFiles(beansXml);
+ }
+ lifecycle.beginApplication();
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Error deploying beans", e);
+ }
+ lifecycle.beginSession();
+ lifecycle.beginRequest();
+ }
+
+ public void deploy(Iterable<Class<?>> classes) throws DeploymentException
+ {
+ deploy(classes, null);
+ }
+
+ public void cleanup()
+ {
+ // Np-op
+
+ }
+
+ public void setup()
+ {
+ // No-op
+ }
+
+ public void undeploy()
+ {
+ lifecycle.endRequest();
+ lifecycle.endSession();
+ lifecycle.endApplication();
+ CurrentManager.setRootManager(null);
+ lifecycle = null;
+ }
+
+}
Added: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java
===================================================================
--- extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java (rev 0)
+++ extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.test.log;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractLogTest;
+import org.testng.annotations.Test;
+
+/**
+ * All the tests related to the @Logger binding type and injection.
+ *
+ * @author David Allen
+ *
+ */
+@Artifact
+public class LoggerInjectionTest extends AbstractLogTest
+{
+ @Test( groups = { "broken" } )
+ public void testBasicLogInjection()
+ {
+ Sparrow bird = getCurrentManager().getInstanceByType(Sparrow.class);
+ bird.generateLogMessage();
+ }
+}
Property changes on: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/LoggerInjectionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java
===================================================================
--- extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java (rev 0)
+++ extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.log;
+
+import org.jboss.webbeans.annotation.Logger;
+import org.jboss.webbeans.log.Log;
+
+class Sparrow
+{
+ @Logger
+ private Log log;
+
+ public void generateLogMessage()
+ {
+ log.info("A test message");
+ }
+}
Property changes on: extensions/trunk/logger/src/test/java/org/jboss/webbeans/test/log/Sparrow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/test/resources/META-INF/web-beans-tck.properties
===================================================================
--- extensions/trunk/logger/src/test/resources/META-INF/web-beans-tck.properties (rev 0)
+++ extensions/trunk/logger/src/test/resources/META-INF/web-beans-tck.properties 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,3 @@
+org.jboss.testharness.spi.StandaloneContainers=org.jboss.webbeans.test.StandaloneContainersImpl
+org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
+org.jboss.testharness.testPackage=org.jboss.webbeans.test
\ No newline at end of file
Property changes on: extensions/trunk/logger/src/test/resources/META-INF/web-beans-tck.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/test/resources/jndi.properties
===================================================================
--- extensions/trunk/logger/src/test/resources/jndi.properties (rev 0)
+++ extensions/trunk/logger/src/test/resources/jndi.properties 2009-03-18 16:53:17 UTC (rev 2092)
@@ -0,0 +1,4 @@
+#jboss JNDI properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file
Property changes on: extensions/trunk/logger/src/test/resources/jndi.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
===================================================================
Property changes on: extensions/trunk/logger/src/test/resources/org/jboss/testharness/impl/packaging/jsr299/default/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2091 - in extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd: model and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-18 08:49:03 -0400 (Wed, 18 Mar 2009)
New Revision: 2091
Modified:
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java
Log:
some xsd stuff
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java 2009-03-18 12:29:51 UTC (rev 2090)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java 2009-03-18 12:49:03 UTC (rev 2091)
@@ -17,6 +17,9 @@
package org.jboss.webbeans.xsd.helpers;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
@@ -35,7 +38,13 @@
*/
public class DataSetter
{
-
+ public static Map<TypedModel, TypedModel> typeSubstitutions = new HashMap<TypedModel, TypedModel>()
+ {
+ private static final long serialVersionUID = 8092480390430415094L;
+ {
+ put(TypedModel.of("java.lang.String", false), TypedModel.of("string", true));
+ }};
+
/**
* Checks if an element is public
*
@@ -83,6 +92,7 @@
{
boolean primitive = parameterElement.asType().getKind().isPrimitive();
TypedModel parameter = new TypedModel(parameterElement.asType().toString(), primitive);
+ parameter = typeSubstitutions.containsKey(parameter) ? typeSubstitutions.get(parameter) : parameter;
method.addParameter(parameter);
}
// OK, cheating a little with a common model for methods and constructors
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java 2009-03-18 12:29:51 UTC (rev 2090)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java 2009-03-18 12:49:03 UTC (rev 2091)
@@ -83,13 +83,14 @@
@Override
public boolean equals(Object other)
{
- return type.equals(other);
+ TypedModel otherType = (TypedModel) other;
+ return type.equals(otherType.getType()) && primitive == otherType.isPrimitive();
}
@Override
public int hashCode()
{
- return type.hashCode();
+ return type.hashCode() + (isPrimitive() ? 0 : 1);
}
public Element toXSD(NamespaceHandler namespaceHandler)
@@ -100,4 +101,9 @@
return item;
}
+ public static TypedModel of(String type, boolean primitive)
+ {
+ return new TypedModel(type, primitive);
+ }
+
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2090 - in extensions/trunk/xsd: src/main/java/org/jboss/webbeans/xsd and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-18 08:29:51 -0400 (Wed, 18 Mar 2009)
New Revision: 2090
Modified:
extensions/trunk/xsd/pom.xml
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/Schema.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/XSDHelper.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ClassModel.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java
extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java
Log:
some xsd stuff
Modified: extensions/trunk/xsd/pom.xml
===================================================================
--- extensions/trunk/xsd/pom.xml 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/pom.xml 2009-03-18 12:29:51 UTC (rev 2090)
@@ -34,7 +34,13 @@
<artifactId>log4j</artifactId>
</dependency>
+<!--
<dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ </dependency>
+-->
+ <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/Schema.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/Schema.java 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/Schema.java 2009-03-18 12:29:51 UTC (rev 2090)
@@ -21,9 +21,10 @@
import java.util.Set;
import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
import org.dom4j.Document;
-import org.dom4j.DocumentFactory;
+import org.dom4j.Element;
import org.jboss.webbeans.xsd.NamespaceHandler.SchemaNamespace;
import org.jboss.webbeans.xsd.model.ClassModel;
import org.jboss.webbeans.xsd.model.TypedModel;
@@ -48,6 +49,11 @@
classModels = new HashSet<ClassModel>();
}
+ public String getPackageName()
+ {
+ return packageName;
+ }
+
public void addClass(ClassModel classModel)
{
classModels.add(classModel);
@@ -67,31 +73,55 @@
this.document = document;
}
- public String getPackageName()
+ private boolean isClassInPackage(PackageElement packageElement, String FQN)
{
- return packageName;
+ for (javax.lang.model.element.Element classElement : packageElement.getEnclosedElements())
+ {
+ TypeElement typeElement = (TypeElement) classElement;
+ if (typeElement.getQualifiedName().toString().equals(FQN))
+ {
+ return true;
+ }
+ }
+ return false;
}
- public void setPackageName(String packageName)
- {
- this.packageName = packageName;
- }
-
-// public Set<String> getNamespaces()
-// {
-// return namespaceHandler.getUsedNamespaces();
-// }
-
public void rebuild(PackageElement packageElement)
{
for (SchemaNamespace schemaNamespace : namespaceHandler.getSchemaNamespaces().values())
{
document.getRootElement().addNamespace(schemaNamespace.shortNamespace, schemaNamespace.urn);
}
+
+ for (Object xsdClass : document.selectNodes("//xs:schema//xs:element"))
+ {
+ String className = ((Element) xsdClass).attributeValue("name");
+ if (!isClassInPackage(packageElement, packageName + "." + className))
+ {
+ ((Element) xsdClass).detach();
+ }
+ }
+
for (ClassModel classModel : classModels)
{
+ // Remove old version of class xsd (if present)
+ for (Object previousClass : document.selectNodes("//xs:schema//xs:element[@name=\"" + classModel.getSimpleName() + "\"]"))
+ {
+ ((Element) previousClass).detach();
+ }
document.getRootElement().add(classModel.toXSD(namespaceHandler));
}
+
+ /**
+ * XSD: Foo Bar Tar
+ *
+ * ClassModels: Foo
+ *
+ * Package: Foo Bar
+ *
+ * => update Foo, remove Tar
+ */
+
// System.out.println("Current contents of package " + packageName);
// for (Element e : packageElement.getEnclosedElements())
// {
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/DataSetter.java 2009-03-18 12:29:51 UTC (rev 2090)
@@ -88,6 +88,7 @@
// OK, cheating a little with a common model for methods and constructors
if ("<init>".equals(method.getName()))
{
+ method.setName(classModel.getSimpleName());
classModel.addConstructor(method);
}
else
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/XSDHelper.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/XSDHelper.java 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/helpers/XSDHelper.java 2009-03-18 12:29:51 UTC (rev 2090)
@@ -187,10 +187,7 @@
System.out.println(schema.getDocument().asXML());
try
{
- if (1 == 2)
- {
- writeSchema(schema);
- }
+ writeSchema(schema);
}
catch (IOException e)
{
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ClassModel.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ClassModel.java 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/ClassModel.java 2009-03-18 12:29:51 UTC (rev 2090)
@@ -235,21 +235,26 @@
return new ClassModel(typeElement.getQualifiedName().toString());
}
+ @Override
public Element toXSD(NamespaceHandler namespaceHandler)
{
- Element classElement = DocumentFactory.getInstance().createElement("element");
+ Element classElement = DocumentFactory.getInstance().createElement("xs:element");
classElement.addAttribute("name", getSimpleName());
+ Element complexElement = DocumentFactory.getInstance().createElement("xs:complexType");
+ Element anyElement = DocumentFactory.getInstance().createElement("xs:any");
+ complexElement.add(anyElement);
+ classElement.add(complexElement);
for (MethodModel constructor : getMergedConstructors())
{
- classElement.add(constructor.toXSD(namespaceHandler));
+ anyElement.add(constructor.toXSD(namespaceHandler));
}
for (NamedModel field : getMergedFields())
{
- classElement.add(field.toXSD(namespaceHandler));
+ anyElement.add(field.toXSD(namespaceHandler));
}
for (MethodModel method : getMergedMethods())
{
- classElement.add(method.toXSD(namespaceHandler));
+ anyElement.add(method.toXSD(namespaceHandler));
}
return classElement;
}
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/NamedModel.java 2009-03-18 12:29:51 UTC (rev 2090)
@@ -41,6 +41,11 @@
return name;
}
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
@Override
public String toString()
{
@@ -62,7 +67,7 @@
public Element toXSD(NamespaceHandler namespaceHandler)
{
- Element item = DocumentFactory.getInstance().createElement("element");
+ Element item = DocumentFactory.getInstance().createElement("xs:element");
item.addAttribute("name", name);
return item;
}
Modified: extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java
===================================================================
--- extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java 2009-03-18 11:16:03 UTC (rev 2089)
+++ extensions/trunk/xsd/src/main/java/org/jboss/webbeans/xsd/model/TypedModel.java 2009-03-18 12:29:51 UTC (rev 2090)
@@ -94,9 +94,9 @@
public Element toXSD(NamespaceHandler namespaceHandler)
{
- String namespace = isPrimitive() ? "" : namespaceHandler.getShortNamespace(type);
- Element item = DocumentFactory.getInstance().createElement("element");
- item.addAttribute("type", type);
+ String namespace = isPrimitive() ? ("xs:" + type) : (namespaceHandler.getShortNamespace(type) + ":" + getTypeSimpleName());
+ Element item = DocumentFactory.getInstance().createElement("xs:element");
+ item.addAttribute("type", namespace);
return item;
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2089 - ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-18 07:16:03 -0400 (Wed, 18 Mar 2009)
New Revision: 2089
Modified:
ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java
Log:
minor
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java 2009-03-18 11:06:18 UTC (rev 2088)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/api/SessionObjectReference.java 2009-03-18 11:16:03 UTC (rev 2089)
@@ -36,7 +36,7 @@
* the type of the business interface
* @return a reference
*
- * @throws IllegalArgumentException
+ * @throws IllegalStateException
* if the business interface is not a local business interface of
* the session bean
* @throws NoSuchEJBException
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2088 - ri/trunk/tests.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-18 07:06:18 -0400 (Wed, 18 Mar 2009)
New Revision: 2088
Removed:
ri/trunk/tests/temp-testng-customsuite.xml
Log:
minor
Deleted: ri/trunk/tests/temp-testng-customsuite.xml
===================================================================
--- ri/trunk/tests/temp-testng-customsuite.xml 2009-03-18 10:53:38 UTC (rev 2087)
+++ ri/trunk/tests/temp-testng-customsuite.xml 2009-03-18 11:06:18 UTC (rev 2088)
@@ -1,8 +0,0 @@
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="webbeans-core-tests">
- <test verbose="2" name="org.jboss.webbeans.test.examples.ExampleTest" annotations="JDK">
- <classes>
- <class name="org.jboss.webbeans.test.examples.ExampleTest"/>
- </classes>
- </test>
-</suite>
15 years, 10 months