Plugin for JSTestDriver
Connection point between scenario's jstd output and jstestdriver.

@see jstestdriver.PluginRegistrar
549155
function JstdPlugin() {
  var nop = function() {};

  this.reportResult = nop;
  this.reportEnd = nop;
  this.runScenario = nop;

  this.name = 'Angular Scenario Adapter';

  /**
   * Called for each JSTD TestCase
   *
   * Handles only SCENARIO_TYPE test cases. There should be only one fake TestCase.
   * Runs all scenario tests (under one fake TestCase) and report all results to JSTD.
   *
   * @param {jstestdriver.TestRunConfiguration} configuration
   * @param {Function} onTestDone
   * @param {Function} onAllTestsComplete
   * @returns {boolean} True if this type of test is handled by this plugin, false otherwise
   */
  this.runTestConfiguration = function(configuration, onTestDone, onAllTestsComplete) {
    if (configuration.getTestCaseInfo().getType() != SCENARIO_TYPE) return false;

    this.reportResult = onTestDone;
    this.reportEnd = onAllTestsComplete;
    this.runScenario();

    return true;
  };

  this.getTestRunsConfigurationFor = function(testCaseInfos, expressions, testRunsConfiguration) {
    testRunsConfiguration.push(
        new jstestdriver.TestRunConfiguration(
            new jstestdriver.TestCaseInfo(
                'Angular Scenario Tests', function() {}, SCENARIO_TYPE), []));

    return true;
  };
}
796309
@VisibleForTesting
  Map<String, Plugin> instantiatePluginClasses(Map<PluginClassLoaderDef, ClassLoader> classloaders) {
    // instantiate plugins
    Map<String, Plugin> instancesByPluginKey = new HashMap<>();
    for (Map.Entry<PluginClassLoaderDef, ClassLoader> entry : classloaders.entrySet()) {
      PluginClassLoaderDef def = entry.getKey();
      ClassLoader classLoader = entry.getValue();

      // the same classloader can be used by multiple plugins
      for (Map.Entry<String, String> mainClassEntry : def.getMainClassesByPluginKey().entrySet()) {
        String pluginKey = mainClassEntry.getKey();
        String mainClass = mainClassEntry.getValue();
        try {
          instancesByPluginKey.put(pluginKey, (Plugin) classLoader.loadClass(mainClass).newInstance());
        } catch (UnsupportedClassVersionError e) {
          throw new IllegalStateException(String.format("The plugin [%s] does not support Java %s",
            pluginKey, SystemUtils.JAVA_VERSION_TRIMMED), e);
        } catch (Throwable e) {
          throw new IllegalStateException(String.format(
            "Fail to instantiate class [%s] of plugin [%s]", mainClass, pluginKey), e);
        }
      }
    }
    return instancesByPluginKey;
  }
626651
public <T> Gauge<T> register(
      final String component, final String methodName, final Gauge<T> gauge) {
    registry.register(
        MetricRegistry.name(component, methodName),
        new Gauge<T>() {
          @Override
          public T getValue() {
            return gauge.getValue();
          }
        });

    return gauge;
  }
988906
@Override
    public Future<Void> registerProvider(final String domain,
                                         Object provider,
                                         ProviderQos providerQos,
                                         boolean awaitGlobalRegistration) {
        if (providerQos == null) {
            throw new JoynrRuntimeException("providerQos == null. It must not be null");
        }
        ProviderContainer providerContainer = providerContainerFactory.create(provider);
        String participantId = participantIdStorage.getProviderParticipantId(domain,
                                                                             providerContainer.getInterfaceName(),
                                                                             providerContainer.getMajorVersion());
        String defaultPublicKeyId = "";
        DiscoveryEntry discoveryEntry = new DiscoveryEntry(getVersionFromAnnotation(provider.getClass()),
                                                           domain,
                                                           providerContainer.getInterfaceName(),
                                                           participantId,
                                                           providerQos,
                                                           System.currentTimeMillis(),
                                                           System.currentTimeMillis() + defaultExpiryTimeMs,
                                                           defaultPublicKeyId);
        final boolean isGloballyVisible = (discoveryEntry.getQos().getScope() == ProviderScope.GLOBAL);
        messageRouter.addNextHop(participantId, libjoynrMessagingAddress, isGloballyVisible);
        providerDirectory.add(participantId, providerContainer);

        Callback<Void> callback = new Callback<Void>() {
            @Override
            public void onSuccess(@CheckForNull Void result) {

            }

            @Override
            public void onFailure(JoynrRuntimeException runtimeException) {
                logger.error("Unexpected Error while registering Provider:", runtimeException);

            }
        };
        return localDiscoveryAggregator.add(callback, discoveryEntry, awaitGlobalRegistration);
    }
646689
static PluginTypeConfiguration getConfiguration(String pluginType) {
        PluginTypeConfiguration conf = registry.get(pluginType);
        if (conf == null)
            throw new IllegalArgumentException("PluginType '"+pluginType+"' not registered!");
        return conf;
    }
232034
@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {

		Map<String, Object> annotationAttributes = importingClassMetadata
				.getAnnotationAttributes(EnablePluginRegistries.class.getName());

		if (annotationAttributes == null) {
			LOG.info("No EnablePluginRegistries annotation found on type {}!", importingClassMetadata.getClassName());
			return;
		}

		Class<?>[] types = (Class<?>[]) annotationAttributes.get("value");

		for (Class<?> type : types) {

			BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(PluginRegistryFactoryBean.class);
			builder.addPropertyValue("type", type);

			RootBeanDefinition beanDefinition = (RootBeanDefinition) builder.getBeanDefinition();
			beanDefinition.setTargetType(getTargetType(type));

			Qualifier annotation = type.getAnnotation(Qualifier.class);

			// If the plugin interface has a Qualifier annotation, propagate that to the bean definition of the registry
			if (annotation != null) {
				AutowireCandidateQualifier qualifierMetadata = new AutowireCandidateQualifier(Qualifier.class);
				qualifierMetadata.setAttribute(AutowireCandidateQualifier.VALUE_KEY, annotation.value());
				beanDefinition.addQualifier(qualifierMetadata);
			}

			// Default
			String beanName = annotation == null //
					? StringUtils.uncapitalize(type.getSimpleName() + "Registry") //
					: annotation.value();

			registry.registerBeanDefinition(beanName, builder.getBeanDefinition());
		}
	}
1076581
public void registerPlugin(final DajlabExtension plugin) {

		if (plugin != null) {
			if (plugin instanceof DajlabControllerExtensionInterface) {
				controllers.add((DajlabControllerExtensionInterface<DajlabModelInterface>) plugin);
			}
			if (plugin instanceof TabExtensionInterface) {
				tabPlugins.add((TabExtensionInterface) plugin);
			}
			if (plugin instanceof MenuExtensionInterface) {
				menuPlugins.add((MenuExtensionInterface) plugin);
			}
		}
	}
852939
public static void registerOsgiScriptEngineManager(BundleContext context) {
        OSGiScriptEngineManager scriptEngineManager = new OSGiScriptEngineManager(context);
        ScriptEngineManagerContext.setScriptEngineManager(scriptEngineManager);

        if (LOGGER.isFinestEnabled()) {
            LOGGER.finest(scriptEngineManager.printScriptEngines());
        }
    }
1016135
@Override
    public <T> T getPluginDescriptor(final Class<T> targetDescriptor) {
        return targetDescriptor.cast(pluginDescriptors.get(targetDescriptor.getName()));
    }
62871
def register_plugin(self):
        """"""
        self.focus_changed.connect(self.main.plugin_focus_changed)
        self.main.add_dockwidget(self)
        self.main.console.set_help(self)

        self.internal_shell = self.main.console.shell
        self.console = self.main.console
1067226
void choosePaginationPlugin(Context context) {
    DatabaseType type = detectDB(context);
    PluginConfiguration pluginConfiguration = new PluginConfiguration();
    switch (type) {
      case MYSQL:
        pluginConfiguration.setConfigurationType(MySqlPaginationPlugin.class.getTypeName());
        context.addPluginConfiguration(pluginConfiguration);
        if (verbose) getLog().info("enable pagination service with mysql for context " + context.getId());
        break;
      case POSTGRESQL:
        pluginConfiguration.setConfigurationType(PostgreSQLPaginationPlugin.class.getTypeName());
        context.addPluginConfiguration(pluginConfiguration);
        if (verbose) getLog().info("enable pagination service with postgresql for context " + context.getId());
        break;
      case SQLSERVER:
        pluginConfiguration.setConfigurationType(SQLServerPaginationPlugin.class.getTypeName());
        context.addPluginConfiguration(pluginConfiguration);
        if (verbose) getLog().info("enable pagination service with sqlserver for context " + context.getId());
        break;
      case DB2:
        pluginConfiguration.setConfigurationType(DB2PaginationPlugin.class.getTypeName());
        context.addPluginConfiguration(pluginConfiguration);
        if (verbose) getLog().info("enable pagination service with db2 for context " + context.getId());
        break;
      case ORACLE:
        pluginConfiguration.setConfigurationType(OraclePaginationPlugin.class.getTypeName());
        context.addPluginConfiguration(pluginConfiguration);
        if (verbose) getLog().info("enable pagination service with oracle for context " + context.getId());
        break;
      case HSQLDB:
        pluginConfiguration.setConfigurationType(HsqldbPaginationPlugin.class.getTypeName());
        context.addPluginConfiguration(pluginConfiguration);
        if (verbose) getLog().info("enable pagination service with hsqldb for context " + context.getId());
        break;
    }
  }
194868
def register_plugin(self, plugin):
        
        if hasattr(plugin, 'initialise'):
            plugin.initialise()
        if self.valid_api_plugin(plugin):
            log.debug("Registering API plugin: {}".format(plugin))
            self._api_plugins[plugin.request] = plugin()
        elif self.valid_debugger_plugin(plugin):
            log.debug("Registering debugger plugin: {}".format(plugin))
            self._debugger_plugins[plugin.host] = plugin()
        elif self.valid_view_plugin(plugin):
            log.debug("Registering view plugin: {}".format(plugin))
            self._view_plugins[plugin.name] = plugin()
        elif self.valid_web_plugin(plugin):
            log.debug("Registering web plugin: {}".format(plugin))
            self._web_plugins[plugin.name] = plugin()
        elif self.valid_command_plugin(plugin):
            log.debug("Registering command plugin: {}".format(plugin))
            self._command_plugins[plugin.name] = plugin()
            if voltron.debugger:
                voltron.debugger.register_command_plugin(plugin.name, plugin.command_class)
        else:
            log.debug("Ignoring invalid plugin: {}".format(plugin))
927348
@Override
    public void register(BindingRegisterContext<JsonArray> ctx) throws SQLException {
        ctx.statement().registerOutParameter(ctx.index(), Types.VARCHAR);
    }
1368834
private ServiceRegistration<?> registerMBeanService(String jmsResourceName, BundleContext bundleContext) {
        Dictionary<String, String> props = new Hashtable<String, String>();
        props.put(KEY_SERVICE_VENDOR, "IBM");

        JmsServiceProviderMBeanImpl jmsProviderMBean = new JmsServiceProviderMBeanImpl(getServerName(), KEY_JMS2_PROVIDER);
        props.put(KEY_JMX_OBJECTNAME, jmsProviderMBean.getobjectName());

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "JmsQueueMBeanImpl=" + jmsProviderMBean.getobjectName() + " props=" + props);
        }
        return bundleContext.registerService(JmsServiceProviderMBeanImpl.class, jmsProviderMBean, props);
    }
300621
def autoload
    logger.info("Autoloading registered plugins at #{Time.now}")

    @@environments[@actor_id].autoload do |namespace, plugin_type, provider, plugin|
      logger.debug("Autoloading provider #{provider} at #{plugin[:directory]}")

      # Make sure extensions are listening from the time they are loaded
      if plugin[:namespace] == :nucleon && plugin_type == :extension
        logger.debug("Creating #{plugin_type} #{provider}")

        # Create a persistent instance
        load(plugin[:namespace], :extension, provider, { :name => provider })
      end
    end
  end
879381
private void register(PathMapping pathMapping) throws IOException {

		GeneratorRegistry generatorRegistry = bundlesHandler.getConfig().getGeneratorRegistry();
		List<PathMapping> mappings = new ArrayList<>();
		if (generatorRegistry.isPathGenerated(pathMapping.getPath())) {
			List<PathMapping> genPathMappings = generatorRegistry.getGeneratedPathMappings(pathMapping.getBundle(),
					pathMapping.getPath(), rsReader);
			if (genPathMappings != null) {
				mappings.addAll(genPathMappings);
			} else {
				mappings.add(pathMapping);
			}
		} else {
			mappings.add(pathMapping);
		}

		for (PathMapping pMapping : mappings) {
			String filePath = rsReader.getFilePath(pMapping.getPath());
			registerPathMapping(pMapping, filePath);
		}
	}
1188062
@VisibleForTesting
  static void register(SpanExporter spanExporter, Handler handler) {
    StackdriverTraceExporter.register(spanExporter, handler);
  }