Add an extension to the set of extensions.

@param extension an extension
168643
public Weld addExtension(Extension extension) {
        extensions.add(new MetadataImpl<Extension>(extension, SYNTHETIC_LOCATION_PREFIX + extension.getClass().getName()));
        return this;
    }
269199
public void removeExtension(Extension extension) {
        extensionList.remove(extension);
        extensionsMap.remove(extension.getClass());

        ExtensionHook hook = extensionHooks.remove(extension);
        if (hook == null) {
            logger.error("ExtensionHook not found for: " + extension.getClass().getCanonicalName());
            return;
        }

        unloadOptions(hook);

        unhookProxies(hook);

        removePersistentConnectionListener(hook);

        removeProxyListener(hook);

        removeOverrideMessageProxyListener(hook);

        removeConnectRequestProxyListener(hook);

        removeSiteMapListener(hook);

        for (ContextDataFactory contextDataFactory : hook.getContextDataFactories()) {
            try {
                model.removeContextDataFactory(contextDataFactory);
            } catch (Exception e) {
                logger.error("Error while removing a ContextDataFactory from " + extension.getClass().getCanonicalName(), e);
            }
        }

        for (ApiImplementor apiImplementor : hook.getApiImplementors()) {
            try {
                API.getInstance().removeApiImplementor(apiImplementor);
            } catch (Exception e) {
                logger.error("Error while removing an ApiImplementor from " + extension.getClass().getCanonicalName(), e);
            }
        }

        for (HttpSenderListener httpSenderListener : hook.getHttpSenderListeners()) {
            try {
                HttpSender.removeListener(httpSenderListener);
            } catch (Exception e) {
                logger.error("Error while removing an HttpSenderListener from " + extension.getClass().getCanonicalName(), e);
            }
        }

        removeViewInEDT(extension, hook);
    }
53767
public function setExtensions($extensions)
    {
        $this->_extensions = array();
        $token             = ' ,;';
        $extension         = strtok($extensions, $token);

        while ($extension !== false) {
            $this->_extensions[] = $extension;
            $extension           = strtok($token);
        }

    }
1052005
public X509Extension add(X509Extension extension) {
	if (extension == null) {
	    throw new IllegalArgumentException(i18n
                                               .getMessage("extensionNull"));
	}
	return (X509Extension)this.extensions.put(extension.getOid(),
						  extension);
    }
1374348
public static function addExtension(string $file, string $extension)
    {
        if (substr($file, strlen($extension) * -1) !== $extension) {
            $file .= $extension;
        }
        return $file;
    }
15867
public String add(String extension, String mimeType) {
		Mapping previous = this.map.put(extension, new Mapping(extension, mimeType));
		return (previous != null) ? previous.getMimeType() : null;
	}
1064201
@Override
  public Context addExtension(Context moreSpecific) throws KbTypeException, CreateException {
    return wrapped().addExtension(moreSpecific);
  }
478681
def _register_extensions(self, namespace):
        """"""

        # Register any extension classes for this class.
        extmanager = ExtensionManager(
            'extensions.classes.{}'.format(namespace),
            propagate_map_exceptions=True
        )

        if extmanager.extensions:
            extmanager.map(util.register_extension_class, base=self)

        # Register any extension methods for this class.
        extmanager = ExtensionManager(
            'extensions.methods.{}'.format(namespace),
            propagate_map_exceptions=True
        )
        if extmanager.extensions:
            extmanager.map(util.register_extension_method, base=self)
434834
public void addMimeMapping(String extension, String type) {
        handler.getMimeTypes().addMimeMapping(extension, type);
    }
367931
@SuppressWarnings("PMD.UseVarargs")
    public void disableExtensions(final Class<?>[] extensions) {
        for (Class<?> extension : extensions) {
            registerDisable(ConfigItem.Extension, extension);
        }
    }
1006594
function appendExtension (obj, extension) {
  if (!obj.extensions) {
    obj.extensions = []
  }

  if (obj.extensions.indexOf(extension) === -1) {
    obj.extensions.push(extension)
  }
}
771471
protected function loadExtension($extension)
	{
		if (isset($this->classMap[$extension]))
		{
			return;
		}
		foreach ($this->supportedTypes as $imageType => $extensions)
		{
			if (in_array($extension, $extensions, true))
			{
				$this->loadType($imageType);
			}
		}
	}
315595
def add(self, extension):
        
        index = len(self.extensions)
        self.extensions[index] = extension
        for protocol in extension.protocols:
            self.registry[protocol] = index
24510
public void registerExtensions(final Class<?>... extensions) {
        for (Class<?> extension : extensions) {
            register(ConfigItem.Extension, extension);
        }
    }
191842
public void registerExtension(ExtensionNamespaceSupport extNsSpt)
  {
    String namespace = extNsSpt.getNamespace();
    if (namespaceIndex(namespace, m_extensions) == -1)
    {
      m_extensions.add(extNsSpt);
      if (m_unregisteredExtensions.contains(namespace))
        m_unregisteredExtensions.remove(namespace);
    }
    
  }
1060807
public ExtensionElement overrideExtension(ExtensionElement extension) {
        if (extension == null) return null;
        synchronized (packetExtensions) {
            // Note that we need to use removeExtension(String, String) here. If would use
            // removeExtension(ExtensionElement) then we would remove based on the equality of ExtensionElement, which
            // is not what we want in this case.
            ExtensionElement removedExtension = removeExtension(extension.getElementName(), extension.getNamespace());
            addExtension(extension);
            return removedExtension;
        }
    }
1094326
protected void updateExtension(Extension value, String xmlTag, Counter counter, Element element)
   {
      Element root = element;
      Counter innerCount = new Counter(counter.getDepth() + 1);
      findAndReplaceSimpleElement(innerCount, root, "groupId", value.getGroupId(), null);
      findAndReplaceSimpleElement(innerCount, root, "artifactId", value.getArtifactId(), null);
      findAndReplaceSimpleElement(innerCount, root, "version", value.getVersion(), null);
   }