[jboss-cvs] JBossAS SVN: r110530 - projects/jboss-reflect/branches/Branch_2_2/src/main/java/org/jboss/reflect/plugins/javassist.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 4 09:29:45 EST 2011


Author: alesj
Date: 2011-02-04 09:29:45 -0500 (Fri, 04 Feb 2011)
New Revision: 110530

Added:
   projects/jboss-reflect/branches/Branch_2_2/src/main/java/org/jboss/reflect/plugins/javassist/JavassistInitializer.java
Log:
Add Javassist initializaiton bean.


Copied: projects/jboss-reflect/branches/Branch_2_2/src/main/java/org/jboss/reflect/plugins/javassist/JavassistInitializer.java (from rev 110312, projects/jboss-reflect/branches/Branch_2_2/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_2/src/main/java/org/jboss/reflect/plugins/javassist/JavassistInitializer.java	                        (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_2/src/main/java/org/jboss/reflect/plugins/javassist/JavassistInitializer.java	2011-02-04 14:29:45 UTC (rev 110530)
@@ -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;
+
+import org.jboss.classpool.scoped.ScopedClassPoolRepository;
+import org.jboss.reflect.plugins.javassist.classpool.ClassPoolFactory;
+import org.jboss.reflect.plugins.javassist.classpool.DefaultClassPoolFactory;
+import org.jboss.reflect.plugins.javassist.classpool.RepositoryClassPoolFactory;
+
+/**
+ * Initialize Javassist usage.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JavassistInitializer
+{
+   private final ScopedClassPoolRepository poolRepository;
+
+   public JavassistInitializer(ScopedClassPoolRepository repository)
+   {
+      if (repository == null)
+         throw new IllegalArgumentException("Null repository");
+      this.poolRepository = repository;
+   }
+
+   public void create()
+   {
+      ClassPoolFactory classPoolFactory = new RepositoryClassPoolFactory(poolRepository);
+      JavassistTypeInfoFactoryImpl.setPoolFactory(classPoolFactory);
+   }
+
+   public void destroy()
+   {
+      JavassistTypeInfoFactoryImpl.setPoolFactory(DefaultClassPoolFactory.getInstance());
+   }
+}



More information about the jboss-cvs-commits mailing list