Registers a servlet model.

@param model servlet model to register
@throws ServletException   - If servlet is already registered
@throws NamespaceException - If servlet alias is already registered
558275
public void addServletModel(final ServletModel model) throws NamespaceException, ServletException {
		servletLock.writeLock().lock();
		try {
            associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
            for (String virtualHost:resolveVirtualHosts(model)) {
                if (servlets.get(virtualHost) == null) {
                    servlets.put(virtualHost, new HashSet<>());
                }
                if (model.getServlet() != null && servlets.get(virtualHost).contains(model.getServlet())) {
                        throw new ServletException("servlet already registered with a different alias");
                }
                if (model.getAlias() != null) {
                        final String alias = getFullPath(model.getContextModel(), model.getAlias());
                        if (aliasMapping.get(virtualHost) == null) {
                            aliasMapping.put(virtualHost, new HashMap<>());
                        }
                        if (aliasMapping.get(virtualHost).containsKey(alias)) {
                                throw new NamespaceException("alias: '" + alias + "' is already in use in this or another context");
                        }
                        aliasMapping.get(virtualHost).put(alias, model);
                }
                if (model.getServlet() != null) {
                        servlets.get(virtualHost).add(model.getServlet());
                }
                for (String urlPattern : model.getUrlPatterns()) {
                        if (servletUrlPatterns.get(virtualHost) == null) {
                            servletUrlPatterns.put(virtualHost, new HashMap<>());
                        }
                        servletUrlPatterns.get(virtualHost).put(getFullPath(model.getContextModel(), urlPattern),
                                        new UrlPattern(getFullPath(model.getContextModel(), urlPattern), model));
                }
            }
		} finally {
			servletLock.writeLock().unlock();
		}
	}
745151
private static void registerFromClasspath(
            String beanName, String deserName, Map<Class<?>, SerDeserializer> map) throws Exception {

        Class<? extends Bean> beanClass = Class.forName(beanName).asSubclass(Bean.class);
        Class<?> deserClass = Class.forName(deserName);

        Field field = null;
        SerDeserializer deser;
        try {
            field = deserClass.getDeclaredField("DESERIALIZER");
            if (!Modifier.isStatic(field.getModifiers())) {
                throw new IllegalStateException("Field " + field + " must be static");
            }
            deser = SerDeserializer.class.cast(field.get(null));
        } catch (NoSuchFieldException ex) {
            Constructor<?> cons = null;
            try {
                cons = deserClass.getConstructor();
                deser = SerDeserializer.class.cast(cons.newInstance());
            } catch (NoSuchMethodException ex2) {
                throw new IllegalStateException(
                        "Class " + deserClass.getName() + " must have field DESERIALIZER or a no-arg constructor");
            } catch (IllegalAccessException ex2) {
                cons.setAccessible(true);
                deser = SerDeserializer.class.cast(cons.newInstance());
            }
        } catch (IllegalAccessException ex) {
            field.setAccessible(true);
            deser = SerDeserializer.class.cast(field.get(null));
        }
        map.put(beanClass, deser);
    }
651663
public void removeServletModel(final ServletModel model) {
		servletLock.writeLock().lock();
		try {
            deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
            for (String virtualHost:resolveVirtualHosts(model)) {
                if (model.getAlias() != null) {
                        aliasMapping.get(virtualHost).remove(getFullPath(model.getContextModel(), model.getAlias()));
                }
                if (model.getServlet() != null) {
                        servlets.get(virtualHost).remove(model.getServlet());
                }
                if (model.getUrlPatterns() != null) {
                        for (String urlPattern : model.getUrlPatterns()) {
                                servletUrlPatterns.get(virtualHost).remove(getFullPath(model.getContextModel(), urlPattern));
                        }
                }
            }
		} finally {
			servletLock.writeLock().unlock();
		}
	}
703361
public void setModelByText(String model) {
        try {
            InputStream is = new ByteArrayInputStream(model.getBytes());
            this.model = SCXMLParser.parse(new InputSource(is), null, customActionsFromTagExtensions());
            this.setStateMachine(this.model);
        } catch (IOException | SAXException | ModelException e) {
            e.printStackTrace();
        }
    }
211427
@Override
    public void register(Module module) {
        if (module == null) {
            return;
        }
        LOGGER.info("Adding JSON module {}", module.getModuleName());
        synchronized (lock) {
            modules.add(module);
            rebuildMappers();
        }
    }
1102642
def register(self, model_alias, code='general', name=None, order=None, display_filter=None):
        
        model_alias = self.get_model_alias(model_alias)

        def wrapper(create_layout):
            item = TabItem(
                code=code,
                create_layout=create_layout,
                name=name,
                order=order,
                display_filter=display_filter
            )

            if item in self.tabs[model_alias]:
                raise Exception("Tab {} already registered for model {}".format(code, model_alias))

            self.tabs[model_alias].append(item)
            self.tabs[model_alias] = sorted(self.tabs[model_alias], key=lambda item: item.order if item.order else 999)

            return create_layout
        return wrapper
943694
static void register(Class<? extends URLStreamHandler> handlerClass) {
    checkArgument("Handler".equals(handlerClass.getSimpleName()));

    String pkg = handlerClass.getPackage().getName();
    int lastDot = pkg.lastIndexOf('.');
    checkArgument(lastDot > 0, "package for Handler (%s) must have a parent package", pkg);

    String parentPackage = pkg.substring(0, lastDot);

    String packages = System.getProperty(JAVA_PROTOCOL_HANDLER_PACKAGES);
    if (packages == null) {
      packages = parentPackage;
    } else {
      packages += "|" + parentPackage;
    }
    System.setProperty(JAVA_PROTOCOL_HANDLER_PACKAGES, packages);
  }
15780
public void registerTransformer(String namespace, String waivePattern, Class<?>... transformerClasses) {
        ExtensionManager jem = extensionManager();
        for (Class<?> extensionClass : transformerClasses) {
            Transformer t = extensionClass.getAnnotation(Transformer.class);
            boolean classAnnotated = null != t;
            String nmsp = namespace;
            boolean namespaceIsEmpty = S.empty(namespace);
            if (classAnnotated && namespaceIsEmpty) {
                nmsp = t.value();
            }
            String waive = waivePattern;
            boolean waiveIsEmpty = S.empty(waive);
            if (classAnnotated && waiveIsEmpty) {
                waive = t.waivePattern();
            }
            boolean clsRequireTemplate = null == t ? false : t.requireTemplate();
            boolean clsLastParam = null == t ? false : t.lastParam();
            for (Method m : extensionClass.getDeclaredMethods()) {
                int flag = m.getModifiers();
                if (!Modifier.isPublic(flag) || !Modifier.isStatic(flag)) continue;
                int len = m.getParameterTypes().length;
                if (len <= 0) continue;

                Transformer tm = m.getAnnotation(Transformer.class);
                boolean methodAnnotated = null != tm;
                if (!methodAnnotated && !classAnnotated) continue;

                String mnmsp = nmsp;
                if (methodAnnotated && namespaceIsEmpty) {
                    mnmsp = tm.value();
                    if (S.empty(mnmsp)) mnmsp = nmsp;
                }

                String mwaive = waive;
                if (methodAnnotated && waiveIsEmpty) {
                    mwaive = tm.waivePattern();
                    if (S.empty(mwaive)) mwaive = waive;
                }
                String cn = extensionClass.getSimpleName();
                if (S.empty(mwaive)) mwaive = cn;

                boolean requireTemplate = clsRequireTemplate;
                if (null != tm && tm.requireTemplate()) {
                    requireTemplate = true;
                }

                boolean lastParam = clsLastParam;
                if (null != tm && tm.lastParam()) {
                    lastParam = true;
                }

                String cn0 = extensionClass.getName();
                String mn = m.getName();
                String fullName = String.format("%s.%s", cn0, mn);
                if (S.notEmpty(mnmsp) && !"rythm".equals(mnmsp)) {
                    mn = mnmsp + "_" + mn;
                }
                if (len == 1) {
                    jem.registerJavaExtension(new IJavaExtension.VoidParameterExtension(mwaive, mn, fullName, requireTemplate));
                } else {
                    jem.registerJavaExtension(new IJavaExtension.ParameterExtension(mwaive, mn, ".+", fullName, requireTemplate, lastParam));
                }
            }
        }
    }
1236313
public static function register($model)
    {
        if (interface_exists(EloquentScope::class)) {
            $model::addGlobalScope(new TenantScope);
        } else {
            $model::addGlobalScope(new LegacyTenantScope);
        }
    }
328374
public synchronized void registerJmxIfRequired() {
        referenceCount++;
        if(isRegistered == false) {
            String domain = JmxUtils.getPackageName(this.getClass());
            this.jmxObjectName = JmxUtils.createObjectName(domain, this.name);
            JmxUtils.registerMbean(this, this.jmxObjectName);
            isRegistered = true;
        }
    }
182377
@Api
	public void setFeatureModel(FeatureModel featureModel) throws LayerException {
		this.featureModel = featureModel;
		if (null != getLayerInfo()) {
			featureModel.setLayerInfo(getLayerInfo());
		}
		filterService.registerFeatureModel(featureModel);
	}
394210
def register_serializer(name, serializer):
    '''
'''
    if not isclass(serializer):
        serializer = serializer.__class__
    _serializers[name] = serializer
864404
public void registerService(Object service)
    {
    	this.setService(service);
    	String serviceClass = getInterfaceClassName(); 

    	if (service != null)
    		serviceRegistration = context.registerService(serviceClass, this.service, properties);
    }
278808
public void addServlet(final WebAppServlet servlet) {
		NullArgumentException.validateNotNull(servlet, "Servlet");
		NullArgumentException.validateNotNull(servlet.getServletName(),
				"Servlet name");
		if (servlet instanceof WebAppJspServlet) {
			NullArgumentException.validateNotNull(
					((WebAppJspServlet) servlet).getJspPath(), "JSP-path");
		} else {
			NullArgumentException.validateNotNull(
					servlet.getServletClassName(), "Servlet class");
		}
		servlets.put(servlet.getServletName(), servlet);
		// add aliases for servlet mappings added before servlet
		for (WebAppServletMapping mapping : getServletMappings(servlet
				.getServletName())) {
			servlet.addUrlPattern(mapping.getUrlPattern());
		}
	}
421480
@GetMapping
  public String init(Model model) {

    final UriComponents uriComponents =
        ServletUriComponentsBuilder.fromCurrentContextPath().build();
    model.addAttribute("molgenisUrl", uriComponents.toUriString() + URI + "/swagger.yml");
    model.addAttribute("baseUrl", uriComponents.toUriString());

    final String currentUsername = SecurityUtils.getCurrentUsername();
    if (currentUsername != null) {
      model.addAttribute(
          "token", tokenService.generateAndStoreToken(currentUsername, "For Swagger UI"));
    }
    return "view-swagger-ui";
  }
1083169
def register(self, models=None, wrapper_cls=None):
        
        self.loaded = True
        for model in models:
            model = model.lower()
            if model not in self.registry:
                self.registry.update({model: wrapper_cls or self.wrapper_cls})
                if self.register_historical:
                    historical_model = ".historical".join(model.split("."))
                    self.registry.update(
                        {historical_model: wrapper_cls or self.wrapper_cls}
                    )
            else:
                raise AlreadyRegistered(f"Model is already registered. Got {model}.")
1165788
public void init() throws ServletException {
		ServletContext sc = this.getServletContext();
		String configList = this.getServletConfig().getInitParameter("configList");
		String[] configs = StringUtil.split(configList, ",");
		for (int i = 0; i < configs.length; i++) {
			Debug.logVerbose("[JdonFramework] locate a configuration in web.xml :" + configs[i], module);
			css.prepare(configs[i], new ServletContextWrapper(sc));
		}
	}