[jboss-cvs] JBossAS SVN: r92888 - in projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist: classpool and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Aug 27 15:15:26 EDT 2009
Author: flavia.rainone at jboss.com
Date: 2009-08-27 15:15:26 -0400 (Thu, 27 Aug 2009)
New Revision: 92888
Added:
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/ClassPoolFactory.java
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/DefaultClassPoolFactory.java
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/RepositoryClassPoolFactory.java
Removed:
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/ClassPoolFactory.java
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DefaultClassPoolFactory.java
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DummyClassPoolFactory.java
Modified:
projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
Log:
[JBREFLECT-58] Apparently it was not even necessary to add a dependency to the jboss-classpool project. I created a RepositoryClassPoolFactory, that uses ScopedClassPoolRepository in order to create classes. All factories have been moved to org.jboss.reflect.plugins.javassist.classpools.
Deleted: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/ClassPoolFactory.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/ClassPoolFactory.java 2009-08-27 19:07:10 UTC (rev 92887)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/ClassPoolFactory.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.reflect.plugins.javassist;
-
-import javassist.ClassPool;
-import javassist.scopedpool.ScopedClassPoolRepository;
-
-/**
- * A ClassPoolFactory.
- *
- * @author <a href="mailto:stale.pedersen at jboss.org">Stale W. Pedersen</a>
- * @version $Revision: 1.1 $
- */
-public interface ClassPoolFactory
-{
- /**
- * Get class pool for class loader.
- *
- * @param cl the classloader
- * @return class pool instance
- */
- public ClassPool getPoolForLoader(ClassLoader cl);
-}
Deleted: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DefaultClassPoolFactory.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DefaultClassPoolFactory.java 2009-08-27 19:07:10 UTC (rev 92887)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DefaultClassPoolFactory.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.reflect.plugins.javassist;
-
-import javassist.ClassPool;
-
-/**
- * A default class pool factory. Creates instances of {@code javassist.ClassPool}.
- *
- * @author <a href="mailto:stale.pedersen at jboss.org">Stale W. Pedersen</a>
- * @version $Revision: 1.1 $
- */
-public class DefaultClassPoolFactory implements ClassPoolFactory
-{
-
- public ClassPool create(ClassLoader cl)
- {
- return ClassPool.getDefault();
- }
-
- public ClassPool create(ClassLoader cl, ClassPool parentPool)
- {
- return new ClassPool(parentPool);
- }
-
- public ClassPool getPoolForLoader(ClassLoader cl){return null;}
-}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DummyClassPoolFactory.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DummyClassPoolFactory.java 2009-08-27 19:07:10 UTC (rev 92887)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DummyClassPoolFactory.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.reflect.plugins.javassist;
-
-import javassist.ClassPool;
-
-import org.jboss.reflect.plugins.javassist.ClassPoolFactory;
-
-/**
- * A DummyClassPoolFactory.
- *
- * @author <a href="mailto:stale.pedersen at jboss.org">Stale W. Pedersen</a>
- * @version $Revision: 1.1 $
- */
-public class DummyClassPoolFactory implements ClassPoolFactory
-{
-
- public ClassPool getPoolForLoader(ClassLoader cl)
- {
- return ClassPool.getDefault();
- }
-
-}
Modified: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java 2009-08-27 19:07:10 UTC (rev 92887)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -32,15 +32,17 @@
import javassist.CtMethod;
import javassist.CtPrimitiveType;
import javassist.NotFoundException;
+
import org.jboss.reflect.plugins.AnnotationAttributeImpl;
import org.jboss.reflect.plugins.AnnotationHelper;
import org.jboss.reflect.plugins.AnnotationValueFactory;
import org.jboss.reflect.plugins.AnnotationValueImpl;
import org.jboss.reflect.plugins.EnumConstantInfoImpl;
+import org.jboss.reflect.plugins.javassist.classpool.ClassPoolFactory;
+import org.jboss.reflect.plugins.javassist.classpool.DefaultClassPoolFactory;
import org.jboss.reflect.spi.AnnotationInfo;
import org.jboss.reflect.spi.AnnotationValue;
import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.plugins.javassist.ClassPoolFactory;
import org.jboss.reflect.spi.MutableClassInfo;
import org.jboss.reflect.spi.MutableTypeInfoFactory;
import org.jboss.reflect.spi.NumberInfo;
@@ -58,7 +60,7 @@
public class JavassistTypeInfoFactoryImpl extends WeakClassCache implements MutableTypeInfoFactory, AnnotationHelper
{
//TODO JBREFLECT-58: Need to change this to a usable CPF.
- static final ClassPoolFactory poolFactory = new DummyClassPoolFactory();
+ static final ClassPoolFactory poolFactory = DefaultClassPoolFactory.getInstance();
static final AnnotationValue[] NO_ANNOTATIONS = new AnnotationValue[0];
/**
Copied: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/ClassPoolFactory.java (from rev 92885, projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/ClassPoolFactory.java)
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/ClassPoolFactory.java (rev 0)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/ClassPoolFactory.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reflect.plugins.javassist.classpool;
+
+import javassist.ClassPool;
+
+/**
+ * A ClassPoolFactory.
+ *
+ * @author <a href="mailto:stale.pedersen at jboss.org">Stale W. Pedersen</a>
+ *
+ * @version $Revision: 1.1 $
+ */
+public interface ClassPoolFactory
+{
+ /**
+ * Get class pool for class loader.
+ *
+ * @param cl the classloader
+ * @return class pool instance
+ */
+ public ClassPool getPoolForLoader(ClassLoader classLoader);
+}
Copied: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/DefaultClassPoolFactory.java (from rev 92885, projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/DefaultClassPoolFactory.java)
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/DefaultClassPoolFactory.java (rev 0)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/DefaultClassPoolFactory.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reflect.plugins.javassist.classpool;
+
+
+import javassist.ClassPool;
+
+/**
+ * A default class pool factory. Obtains the default instance of {@code javassist.ClassPool}.
+ *
+ * @author <a href="mailto:stale.pedersen at jboss.org">Stale W. Pedersen</a>
+ * @version $Revision: 1.1 $
+ * @see ClassPool#getDefault()
+ */
+public class DefaultClassPoolFactory implements ClassPoolFactory
+{
+ public static final DefaultClassPoolFactory INSTANCE = new DefaultClassPoolFactory();
+
+ public static final DefaultClassPoolFactory getInstance()
+ {
+ return INSTANCE;
+ }
+
+ private DefaultClassPoolFactory() {}
+
+ public ClassPool getPoolForLoader(ClassLoader cl)
+ {
+ return ClassPool.getDefault();
+ }
+}
\ No newline at end of file
Added: projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/RepositoryClassPoolFactory.java
===================================================================
--- projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/RepositoryClassPoolFactory.java (rev 0)
+++ projects/jboss-reflect/branches/JBREFLECT-58/src/main/java/org/jboss/reflect/plugins/javassist/classpool/RepositoryClassPoolFactory.java 2009-08-27 19:15:26 UTC (rev 92888)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.reflect.plugins.javassist.classpool;
+
+
+import javassist.ClassPool;
+import javassist.scopedpool.ScopedClassPoolRepository;
+
+/**
+ * This ClassPoolFactory is tailored for use with scoped class pools.
+ * In order to retrieve a ClassPool, this factory registers the
+ * corresponding ClassLoader with
+ * {@link ScopedClassPoolRepository#registerClassLoader(ClassLoader)}.
+ * For that reason, it is important to register a ScopedClassPoolFactory
+ * ({@link ScopedClassPoolRepository#setClassPoolFactory(javassist.scopedpool.ScopedClassPoolFactory))
+ * prior to using this factory.
+ *
+ * @author <a href="mailto:flavia.rainone at jboss.org">Flavia Rainone</a>
+ *
+ * @version $Revision: 1.1 $
+ * @see ScopedClassPoolRepository#registerClassLoader(ClassLoader)
+ */
+public class RepositoryClassPoolFactory implements ClassPoolFactory
+{
+ private ScopedClassPoolRepository classPoolRepository;
+
+ private RepositoryClassPoolFactory(ScopedClassPoolRepository classPoolRepository)
+ {
+ this.classPoolRepository = classPoolRepository;
+ }
+
+ public ClassPool getPoolForLoader(ClassLoader cl)
+ {
+ return classPoolRepository.registerClassLoader(cl);
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list