Exemple #1
0
 public ScanEvent(Net.Vpc.Upa.UPAContext context, Net.Vpc.Upa.PersistenceGroup persistenceGroup, Net.Vpc.Upa.PersistenceUnit persistenceUnit, System.Type contract, System.Type type, object instance)
 {
     this.context          = context;
     this.persistenceGroup = persistenceGroup;
     this.persistenceUnit  = persistenceUnit;
     this.contract         = contract;
     this.visitedType      = type;
     this.userObject       = instance;
 }
Exemple #2
0
 public static void Close()
 {
     if (contextProviderCreated)
     {
         Net.Vpc.Upa.UPAContext context = Net.Vpc.Upa.UPAContextProviderLazyHolder.INSTANCE.GetContext();
         if (context != null)
         {
             context.Close();
         }
     }
 }
Exemple #3
0
 public ScanEvent(Net.Vpc.Upa.UPAContext context, Net.Vpc.Upa.PersistenceGroup persistenceGroup, Net.Vpc.Upa.PersistenceUnit persistenceUnit, System.Type contract, System.Type type, System.Reflection.MethodInfo method, Net.Vpc.Upa.Field field, Net.Vpc.Upa.Config.Decoration decoration, object instance)
 {
     this.context           = context;
     this.persistenceGroup  = persistenceGroup;
     this.persistenceUnit   = persistenceUnit;
     this.contract          = contract;
     this.visitedType       = type;
     this.visitedMethod     = method;
     this.visitedField      = field;
     this.visitedDecoration = decoration;
     this.userObject        = instance;
 }
Exemple #4
0
 public override System.Collections.Generic.IEnumerable <System.Type> ToIterable(object context)
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.ScanFilter> _filters = new System.Collections.Generic.List <Net.Vpc.Upa.Config.ScanFilter>();
     if (context is Net.Vpc.Upa.UPAContext)
     {
         Net.Vpc.Upa.UPAContext pg = (Net.Vpc.Upa.UPAContext)context;
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(_filters, new System.Collections.Generic.List <Net.Vpc.Upa.Config.ScanFilter>(pg.GetContextAnnotationStrategyFilters()));
     }
     else if (context is Net.Vpc.Upa.PersistenceGroup)
     {
         Net.Vpc.Upa.PersistenceGroup pg = (Net.Vpc.Upa.PersistenceGroup)context;
         foreach (Net.Vpc.Upa.Config.ScanFilter filter in pg.GetContext().GetContextAnnotationStrategyFilters())
         {
             if (filter.IsPropagate())
             {
                 _filters.Add(filter);
             }
         }
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(_filters, new System.Collections.Generic.List <Net.Vpc.Upa.Config.ScanFilter>(pg.GetContextAnnotationStrategyFilters()));
     }
     else if (context is Net.Vpc.Upa.PersistenceUnit)
     {
         Net.Vpc.Upa.PersistenceUnit pu = (Net.Vpc.Upa.PersistenceUnit)context;
         foreach (Net.Vpc.Upa.Config.ScanFilter filter in pu.GetPersistenceGroup().GetContext().GetContextAnnotationStrategyFilters())
         {
             if (filter.IsPropagate())
             {
                 _filters.Add(filter);
             }
         }
         foreach (Net.Vpc.Upa.Config.ScanFilter filter in pu.GetPersistenceGroup().GetContextAnnotationStrategyFilters())
         {
             if (filter.IsPropagate())
             {
                 _filters.Add(filter);
             }
         }
         foreach (Net.Vpc.Upa.Config.ScanFilter filter in pu.GetContextAnnotationStrategyFilters())
         {
             _filters.Add(filter);
         }
     }
     else
     {
         throw new System.ArgumentException("Unsupported context " + context);
     }
     return(new Net.Vpc.Upa.Impl.Util.Classpath.URLClassIterable(Net.Vpc.Upa.Impl.Util.Classpath.ClassPathUtils.ResolveClassPathLibs(), new Net.Vpc.Upa.Impl.Util.Classpath.DefaultConfigFilter(_filters.ToArray()), null));
 }
 public virtual void ContextItemScanned(Net.Vpc.Upa.ScanEvent @event)
 {
     if (listener != null)
     {
         listener.ContextItemScanned(@event);
     }
     Net.Vpc.Upa.UPAContext context = @event.GetContext();
     System.Type            tt      = @event.GetVisitedType();
     if (@event.GetContract().Equals(typeof(Net.Vpc.Upa.Callbacks.PersistenceGroupDefinitionListener)))
     {
         object i = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, tt);
         if (i == null)
         {
             i             = context.GetFactory().CreateObject <object>(tt);
             instances[tt] = i;
         }
         context.AddPersistenceGroupDefinitionListener((Net.Vpc.Upa.Callbacks.PersistenceGroupDefinitionListener)i);
     }
 }
Exemple #6
0
 /**
  * Thread Safe retrieval of UPAContext
  *
  * @return current UPAContext
  */
 public static Net.Vpc.Upa.UPAContext GetContext() /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.UPAContextProvider contextProvider = null;
     Net.Vpc.Upa.UPAContext         context         = contextProvider.GetContext();
     //Double Checking Lock will/should work here because we are not about to instantiate the object,
     //this is the responsibility of the contextProvider
     if (context == null)
     {
         lock (typeof(Net.Vpc.Upa.UPAContext)) {
             context = contextProvider.GetContext();
             if (context == null)
             {
                 Net.Vpc.Upa.ObjectFactory bootstrapFactory = GetBootstrapFactory();
                 context = bootstrapFactory.CreateObject <Net.Vpc.Upa.UPAContext>(typeof(Net.Vpc.Upa.UPAContext));
                 context.Start(bootstrapFactory);
                 contextProvider.SetContext(context);
             }
         }
     }
     return(context);
 }
Exemple #7
0
 public ContextEvent(Net.Vpc.Upa.UPAContext context)
 {
     this.context = context;
 }
 public virtual void SetContext(Net.Vpc.Upa.UPAContext newInstance)
 {
     instance = newInstance;
 }
 public PersistenceGroupEvent(Net.Vpc.Upa.PersistenceGroup persistenceGroup, Net.Vpc.Upa.UPAContext context)
 {
     this.persistenceGroup = persistenceGroup;
     this.context          = context;
 }
 public virtual void SetContext(Net.Vpc.Upa.UPAContext context)
 {
     this.context = context;
 }