Changeset 2517 for branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager
- Timestamp:
- 11/20/09 16:35:13 (15 years ago)
- Location:
- branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/ApplicationDescription.cs
r2504 r2517 37 37 public string Name { 38 38 get { return name; } 39 set { name = value; }39 internal set { name = value; } 40 40 } 41 41 private Version version; … … 53 53 /// Gets or sets the description of the application. 54 54 /// </summary> 55 publicstring Description {55 internal string Description { 56 56 get { return description; } 57 57 set { description = value; } -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/DefaultApplicationManager.cs
r2504 r2517 80 80 private void LoadPlugins(IEnumerable<PluginDescription> plugins) { 81 81 // load all loadable plugins (all dependencies available) into the execution context 82 foreach (var desc in PluginDescriptionIterator.Iterate InDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) {82 foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) { 83 83 foreach (string assembly in desc.Assemblies) { 84 84 var asm = Assembly.LoadFrom(assembly); … … 105 105 plugin.OnUnload(); 106 106 } 107 foreach (var desc in PluginDescriptionIterator.Iterate InDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) {107 foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) { 108 108 desc.Unload(); 109 109 OnPluginUnloaded(new PluginInfrastructureEventArgs("Plugin unloaded", desc)); … … 134 134 /// <typeparam name="T">Most general type.</typeparam> 135 135 /// <returns>Enumerable of the created instances.</returns> 136 public IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {136 public static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class { 137 137 return from t in GetTypes(typeof(T), plugin) 138 138 where !t.IsAbstract && !t.IsInterface && !t.HasElementType … … 155 155 /// <typeparam name="T">Most general type.</typeparam> 156 156 /// <returns>Enumerable of the created instances.</returns> 157 public IEnumerable<T> GetInstances<T>() where T : class {157 public static IEnumerable<T> GetInstances<T>() where T : class { 158 158 return from i in GetInstances(typeof(T)) 159 159 select (T)i; … … 165 165 /// <typeparam name="type">Most general type.</typeparam> 166 166 /// <returns>Enumerable of the created instances.</returns> 167 public IEnumerable<object> GetInstances(Type type) {167 public static IEnumerable<object> GetInstances(Type type) { 168 168 return from t in GetTypes(type) 169 169 where !t.IsAbstract && !t.IsInterface && !t.HasElementType … … 176 176 /// <param name="type">Most general type for which to find matching types.</param> 177 177 /// <returns>Enumerable of the discovered types.</returns> 178 public IEnumerable<Type> GetTypes(Type type) {178 public static IEnumerable<Type> GetTypes(Type type) { 179 179 return from asm in AppDomain.CurrentDomain.GetAssemblies() 180 180 from t in GetTypes(type, asm) … … 189 189 /// <param name="plugin">The plugin the subtypes must be part of.</param> 190 190 /// <returns>Enumerable of the discovered types.</returns> 191 public IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {191 public static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) { 192 192 PluginDescription pluginDesc = (PluginDescription)pluginDescription; 193 193 return from asm in AppDomain.CurrentDomain.GetAssemblies() … … 225 225 return null; 226 226 } 227 228 #region IApplicationManager Members 229 230 231 IEnumerable<T> IApplicationManager.GetInstances<T>(IPluginDescription plugin) { 232 return GetInstances<T>(plugin); 233 } 234 235 IEnumerable<T> IApplicationManager.GetInstances<T>() { 236 return GetInstances<T>(); 237 } 238 239 IEnumerable<Type> IApplicationManager.GetTypes(Type type) { 240 return GetTypes(type); 241 } 242 243 IEnumerable<Type> IApplicationManager.GetTypes(Type type, IPluginDescription plugin) { 244 return GetTypes(type, plugin); 245 } 246 247 #endregion 227 248 } 228 249 } -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs
r2513 r2517 30 30 /// </summary> 31 31 [Serializable] 32 internalsealed class PluginDescription : IPluginDescription {32 public sealed class PluginDescription : IPluginDescription { 33 33 private int nTimesLoaded; 34 34 … … 46 46 /// Gets or sets the description of the plugin. 47 47 /// </summary> 48 publicstring Description {48 internal string Description { 49 49 get { return description; } 50 internalset { description = value; }50 set { description = value; } 51 51 } 52 52 private Version version; -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginValidator.cs
r2513 r2517 218 218 219 219 // minimal sanity check of the attribute values 220 if (!string.IsNullOrEmpty(pluginName) && !string.IsNullOrEmpty(pluginDescription) &&220 if (!string.IsNullOrEmpty(pluginName) && 221 221 pluginFiles.Count > 0 && 222 222 pluginAssemblies.Count > 0 && … … 250 250 var matchingDescriptions = pluginDescriptions.Where(x => x.Name == pluginName); 251 251 if (matchingDescriptions.Count() > 0) { 252 desc.AddDependency(matchingDescriptions. First());252 desc.AddDependency(matchingDescriptions.Single()); 253 253 } else { 254 254 // no plugin description that matches the dependency name is available => plugin is disabled 255 255 desc.Disable(); 256 break; // stop processing more dependencies257 256 } 258 257 } … … 279 278 private void LoadPlugins(IEnumerable<PluginDescription> pluginDescriptions) { 280 279 // load all loadable plugins (all dependencies available) into the execution context 281 foreach (var desc in PluginDescriptionIterator.Iterate InDependencyOrder(pluginDescriptions280 foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(pluginDescriptions 282 281 .Where(x => x.PluginState != PluginState.Disabled))) { 283 282 List<Type> types = new List<Type>();
Note: See TracChangeset
for help on using the changeset viewer.