Пример #1
0
 protected internal virtual void LoadServerExtender(ServerExtender extender)
 {
     foreach (PluginPoint plugin in GetDefaultExtensionPoints(extender.PluginPointFactory))
     {
         extender.AddExtension(plugin.ForType(), plugin);
     }
 }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private PluginPoint extension(String name, Class type, String method) throws PluginLookupException
        private PluginPoint Extension(string name, Type type, string method)
        {
            ServerExtender extender = _extensions[name];

            if (extender == null)
            {
                throw new PluginLookupException("No such ServerPlugin: \"" + name + "\"");
            }
            return(extender.GetExtensionPoint(type, method));
        }
Пример #3
0
        public override IList <ExtensionPointRepresentation> DescribeAll(string name)
        {
            ServerExtender extender = _extensions[name];

            if (extender == null)
            {
                throw new PluginLookupException("No such ServerPlugin: \"" + name + "\"");
            }
            IList <ExtensionPointRepresentation> result = new List <ExtensionPointRepresentation>();

            foreach (PluginPoint plugin in extender.All())
            {
                result.Add(Describe(plugin));
            }
            return(result);
        }
Пример #4
0
        public DefaultPluginManager(LogProvider logProvider)
        {
            IDictionary <string, Pair <ServerPlugin, ServerExtender> > extensions = new Dictionary <string, Pair <ServerPlugin, ServerExtender> >();
            Log log = logProvider.getLog(this.GetType());
            IEnumerable <ServerPlugin> loadedPlugins = ServerPlugin.Load();

            foreach (ServerPlugin plugin in loadedPlugins)
            {
                PluginPointFactory factory = new PluginPointFactoryImpl();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ServerExtender extender = new ServerExtender(factory);
                ServerExtender extender = new ServerExtender(factory);
                try
                {
                    plugin.LoadServerExtender(extender);
                }
                catch (Exception ex) when(ex is Exception || ex is LinkageError)
                {
                    log.Warn("Failed to load plugin [%s]: %s", plugin.ToString(), ex.Message);
                    continue;
                }
                Pair <ServerPlugin, ServerExtender> old = extensions[plugin.Name] = Pair.of(plugin, extender);
                if (old != null)
                {
                    log.Warn(string.Format("Extension naming conflict \"{0}\" between \"{1}\" and \"{2}\"", plugin.Name, old.First().GetType(), plugin.GetType()));
                }
            }
            foreach (Pair <ServerPlugin, ServerExtender> extension in extensions.Values)
            {
                log.Info(string.Format("Loaded server plugin \"{0}\"", extension.First().Name));
                foreach (PluginPoint point in extension.Other().all())
                {
                    log.Info(string.Format("  {0}.{1}: {2}", point.ForType().Name, point.Name(), point.Description));
                }
                this._extensions[extension.First().Name] = extension.Other();
            }
        }
Пример #5
0
 public NestingIterableAnonymousInnerClass(ServerExtender outerInstance, UnknownType values) : base(values)
 {
     this.outerInstance = outerInstance;
 }