/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.aspects.versioned;

import org.jboss.aop.Advisor;
import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.joinpoint.Joinpoint;
import org.jboss.util.NestedRuntimeException;

/**
 *
 *  @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 *  @version $Revision: 1.4.2.3 $
 */
public class VersionedConstructorInterceptorFactory implements org.jboss.aop.advice.AspectFactory
{
   private static VersionedConstructorInterceptor instance = null;


   public static synchronized VersionedConstructorInterceptor getInstance() 
   {
      try
      {
         if (instance == null)
         {
            instance = new VersionedConstructorInterceptor();
         }
         return instance;
      }
      catch (Exception ex)
      {
         throw new NestedRuntimeException(ex);
      }
   }

   public Object createPerVM()
   {
      return getInstance();
   }

   public Object createPerClass(Advisor advisor)
   {
      return getInstance();
   }

   public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
   {
      return getInstance();
   }

   public Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
   {
      return getInstance();
   }

   public Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
   {
      return getInstance();
   }

   public String getName()
   {
      return getClass().getName();
   }
}
