public HostBundleMetadataNode(IResolver resolver, Interface1 metadata) : base(resolver, metadata) { this._referencableProxy = new Referencable(); AssertUtility.ArgumentNotNull(resolver, "resolver"); this.FragmentNodes = new List <IFragmentBundleMetadataNode>(); BundleUtility.BuildFragments(this); }
public BundleDelta(IBundleMetadata bundleMetadata, BundleDeltaType deltaType) { AssertUtility.ArgumentNotNull(bundleMetadata, "bundleMetadata"); AssertUtility.EnumDefined(typeof(BundleDeltaType), deltaType, "deltaType"); this.Bundle = bundleMetadata; this.Type = deltaType; }
private T Find <T>(Func <ServiceManager.InterfaceHolder, bool> comparer, Func <ServiceManager.InterfaceHolder> creator, Func <ServiceManager.FindServiceResult, T> func) { T result; using (DictionaryLocker <ServiceManager.InterfaceHolder, ServiceManager.ServiceInstancesHolder> dictionaryLocker = CreateLocker()) { foreach (KeyValuePair <ServiceManager.InterfaceHolder, ServiceManager.ServiceInstancesHolder> current in dictionaryLocker) { if (comparer(current.Key) && func != null) { result = func(new ServiceManager.FindServiceResult(base.Container, current.Key)); return(result); } } if (creator != null) { AssertUtility.ArgumentNotNull(creator, "creator"); ServiceManager.InterfaceHolder key = creator(); dictionaryLocker[key] = new ServiceManager.ServiceInstancesHolder(); if (func != null) { result = func(new ServiceManager.FindServiceResult(base.Container, key)); return(result); } } result = default(T); } return(result); }
public ObjectCreator(IBundle owner, string classType, Func <string, T> creator) { AssertUtility.ArgumentNotNull(classType, "classType"); AssertUtility.ArgumentNotNull(creator, "creator"); Class = classType; Creator = creator; Owner = owner; }
public ServiceTracker(IBundleContext context, bool throwsExceptionIfServiceNotFound) { AssertUtility.ArgumentNotNull(context, "BundleContext"); BundleContext = context; _defaultOrFirstService = context.GetFirstOrDefaultService <TServiceInterface>(); _serviceInstances = context.GetService <TServiceInterface>(); context.ServiceChanged += new EventHandler <ServiceEventArgs>(ServiceChanged); }
public DisposableLocker(object syncRoot, int millisecondsTimeout) { AssertUtility.ArgumentNotNull(syncRoot, "syncRoot"); this._syncRoot = syncRoot; this._millisecondsTimeout = millisecondsTimeout; this._lockAcquired = Monitor.TryEnter(this._syncRoot, this._millisecondsTimeout); this.LogWhenAcquireLockFailed(); }
public ExtensionManager(Framework framework) { AssertUtility.ArgumentNotNull(framework, "framework"); this._framework = framework; this.ExtensionPoints = new List <ExtensionPoint>(); this.Extensions = new Dictionary <string, List <Extension> >(); framework.EventManager.AddBundleEventListener(new EventHandler <BundleStateChangedEventArgs>(this.BundleEventHandler), true); }
public static string Content(IBundle bundle, string url) { AssertUtility.ArgumentNotNull(bundle, "bundle"); AssertUtility.ArgumentHasText(url, "url"); while (url.StartsWith("~") || url.StartsWith("/") || url.StartsWith("\\")) { url = url.Remove(0, 1); } return(Path.Combine(bundle.Location.Replace(WebRootPath, "~\\"), url).Replace("\\", "/")); }
public List <IAssemblyMetadataNode> AttachFragment(IFragmentBundleMetadataNode fragment) { AssertUtility.ArgumentNotNull(fragment, "fragement"); if (!this.FragmentNodes.Contains(fragment)) { fragment.HostNode = this; base.ConstraintResolver.ResolvedAssemblyMetadataNodes.AddRange(fragment.SharedAssemblyNodes); base.ConstraintResolver.ResolvedAssemblyMetadataNodes.AddRange(fragment.PrivateAssemblyNodes); this.FragmentNodes.Add(fragment); this.SortByBundleID <IFragmentBundleMetadataNode>(this.FragmentNodes, true); } return(null); }
public BundleContext(AbstractBundle bundle) { AssertUtility.ArgumentNotNull(bundle, "BundleContext.bundle"); Bundle = bundle; Framework = bundle.Framework; AssertUtility.ArgumentNotNull(Framework, "Framework"); ExtensionManager = GetFirstOrDefaultService <IExtensionManager>(); AssertUtility.ArgumentNotNull(ExtensionManager, "ExtensionManager"); ExtensionManager.ExtensionChanged += new EventHandler <ExtensionEventArgs>(OnExtensionChanged); ExtensionManager.ExtensionPointChanged += new EventHandler <ExtensionPointEventArgs>(OnExtensionPointChanged); Framework.EventManager.AddFrameworkEventListener(new EventHandler <FrameworkEventArgs>(OnFrameworkStateChanged)); Framework.EventManager.AddBundleEventListener(new EventHandler <BundleStateChangedEventArgs>(OnBundleStateChanged), false); Framework.EventManager.AddBundleEventListener(new EventHandler <BundleStateChangedEventArgs>(OnSyncBundleStateChanged), true); Framework.EventManager.AddServiceEventListener(new EventHandler <ServiceEventArgs>(OnServiceChanged)); Framework.EventManager.AddBundleLazyActivatedEventListener(new EventHandler <BundleLazyActivatedEventArgs>(OnBundleLazyActivated)); }
private T Find <T>(Func <ServiceManager.InterfaceHolder, bool> comparer, Func <ServiceManager.InterfaceHolder> creator, Func <ServiceManager.FindServiceResult, T> func) { using (DictionaryLocker <ServiceManager.InterfaceHolder, ServiceManager.ServiceInstancesHolder> locker = this.CreateLocker()) { foreach (KeyValuePair <ServiceManager.InterfaceHolder, ServiceManager.ServiceInstancesHolder> pair in locker) { if (comparer(pair.Key) && (func != null)) { return(func(new ServiceManager.FindServiceResult(base.Container, pair.Key))); } } if (creator != null) { AssertUtility.ArgumentNotNull(creator, "creator"); ServiceManager.InterfaceHolder key = creator(); locker[key] = new ServiceManager.ServiceInstancesHolder(); if (func != null) { return(func(new ServiceManager.FindServiceResult(base.Container, key))); } } return(default(T)); } }
public void RecordBundleRemovalPending(IBundleMetadata bundle) { AssertUtility.ArgumentNotNull(bundle, "bundle"); this._changes.Add(new BundleDelta(bundle, BundleDeltaType.RemovalPending)); }
public ExtensionHooker(IExtensionManager extensionManager) { AssertUtility.ArgumentNotNull(extensionManager, "extensionManager"); _extensionManager = extensionManager; _extensionManager.ExtensionChanged += _extensionManager_ExtensionChanged; }
public IBundleMetadata BuildBundleMetadata(BundleData bundleData, long bundleID) { AssertUtility.ArgumentNotNull(bundleData, "bundleData"); IBundleMetadata bundleMetadata = null; if (!string.IsNullOrEmpty(bundleData.HostBundleSymbolicName)) { FragmentBundleMetadata metadata = new FragmentBundleMetadata(); bundleMetadata = metadata; HostConstraint constraint = new HostConstraint { BundleSymbolicName = bundleData.HostBundleSymbolicName, BundleVersion = bundleData.HostBundleVersion }; metadata.HostConstraint = constraint; } else { bundleMetadata = new HostBundleMetadata(); } bundleMetadata.BundleID = bundleID; bundleMetadata.SymbolicName = bundleData.SymbolicName; if (bundleData.Version != null) { bundleMetadata.Version = bundleData.Version; } else { bundleMetadata.Version = FrameworkConstants.DEFAULT_VERSION; } bundleMetadata.Location = bundleData.Path; bundleData.Runtime.Assemblies.ForEach(delegate(AssemblyData assemblyData) { List <IAssemblyMetadata> assemblyMetadata = this.BuildAssemblyPathConstraintMetadata(assemblyData, bundleMetadata); this.ResolveAndValidateAssembly(bundleData.Path, assemblyMetadata); if (assemblyData.Share) { bundleMetadata.SharedAssemblies.AddRange(assemblyMetadata); } else { bundleMetadata.PrivateAssemblies.AddRange(assemblyMetadata); } }); bundleData.Runtime.Dependencies.ForEach(delegate(DependencyData a) { if (!string.IsNullOrEmpty(a.AssemblyName)) { DependentAssemblyConstraint item = new DependentAssemblyConstraint { AssemblyName = a.AssemblyName, BundleSymbolicName = a.BundleSymbolicName, AssemblyVersion = a.AssemblyVersion, BundleVersion = a.BundleVersion, Owner = bundleMetadata, Resolution = a.Resolution }; bundleMetadata.DependentAssemblies.Add(item); } else { bundleMetadata.DependentBundles.Add(this.BuildDependencyConstraintMetadata(a, bundleMetadata)); } }); return(bundleMetadata); }
public void RemoveCommand(ICommandAdaptor cmd) { AssertUtility.ArgumentNotNull(cmd, "cmd"); this.Commands.Commands.Remove(cmd); }
public void AddCommand(ICommandAdaptor cmd) { AssertUtility.ArgumentNotNull(cmd, "cmd"); this.Commands.Commands.Add(cmd); }
public ShellLayoutViewProxy(Control owner, Action <object, object> showSmartPart) { AssertUtility.ArgumentNotNull(owner, "owner"); _owner = owner; _showSmartPart = showSmartPart; }
public BundlePersistentData(IBundle bundle) { AssertUtility.ArgumentNotNull(bundle, "bundle"); State = bundle.State; }
public ServiceManager(IFramework framework) { AssertUtility.ArgumentNotNull(framework, "framework"); // framework.EventManager.AddBundleEventListener(new EventHandler<BundleStateChangedEventArgs>( BundleEventListener), true); }
public void RecordBundleUnresolved(IBundleMetadata bundle) { AssertUtility.ArgumentNotNull(bundle, "bundle"); this._changes.Add(new BundleDelta(bundle, BundleDeltaType.Unresolved)); }
public ObjectCreator(IBundle owner, T instance) { AssertUtility.ArgumentNotNull(instance, "defaultValue"); _serviceInstance = instance; Owner = owner; }
internal ExtensionPoint(IExtensionManager extensionManager) { AssertUtility.ArgumentNotNull(extensionManager, "extensionManager"); _extensionManager = extensionManager; }