// Register registers a handler constructor to be called upon a request arrival
// at the specified URI. The new handler made by this constructor is then used
// to handle the request.
2828
func (t *Mux) Register(uri string, h func() Handler) {
	a := &adapter{handler: h, log: t.log}
	t.handlers = append(t.handlers, a)
	t.mux.Handle(uri, a)
}
180145
func (n *Node) Register(constructor ServiceConstructor) error {
	n.lock.Lock()
	defer n.lock.Unlock()

	if n.server != nil {
		return ErrNodeRunning
	}
	n.serviceFuncs = append(n.serviceFuncs, constructor)
	return nil
}
409348
func Register(s *Service, opts ...RegisterOption) error {
	return DefaultRegistry.Register(s, opts...)
}
1165423
func (a Authorizer) Register(rw http.ResponseWriter, req *http.Request, user UserData, password string) error {
	if user.Username == "" {
		return mkerror("no username given")
	}
	if user.Email == "" {
		return mkerror("no email given")
	}
	if user.Hash != nil {
		return mkerror("hash will be overwritten")
	}
	if password == "" {
		return mkerror("no password given")
	}

	// Validate username
	_, err := a.backend.User(user.Username)
	if err == nil {
		a.addMessage(rw, req, "Username has been taken.")
		return mkerror("user already exists")
	} else if err != ErrMissingUser {
		if err != nil {
			return mkerror(err.Error())
		}
		return nil
	}

	// Generate and save hash
	hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
	if err != nil {
		return mkerror("couldn't save password: " + err.Error())
	}
	user.Hash = hash

	// Validate role
	if user.Role == "" {
		user.Role = a.defaultRole
	} else {
		if _, ok := a.roles[user.Role]; !ok {
			return mkerror("nonexistent role")
		}
	}

	err = a.backend.SaveUser(user)
	if err != nil {
		a.addMessage(rw, req, err.Error())
		return mkerror(err.Error())
	}
	return nil
}
802451
func (ed *Dispatcher) RegisterHandler(t interface{}, h Handler) {
	htype := reflect.TypeOf(t)
	if _, ok := ed.handlers[htype]; !ok {
		logger.Debugf("Registering handler for %s on dispatcher %T", htype, ed)
		ed.handlers[htype] = h
	} else {
		logger.Debugf("Cannot register handler %s on dispatcher %T since it's already registered", htype, ed)
	}
}
756395
func (r *Registry) Register(name string, v interface{}) interface{} {
	r.m.Lock()
	defer r.m.Unlock()
	switch v.(type) {
	case instruments.Discrete, instruments.Sample:
		i, present := r.instruments[name]
		if present {
			return i
		}
		r.instruments[name] = v
		return v
	}
	return nil
}
782683
func (r *Registry) Register(name string, f ClientFactory) {
	r.lock.Lock()
	defer r.lock.Unlock()

	if _, ok := r.protocols[name]; ok {
		panic(fmt.Errorf("streamclient: protocol already registered for [%s]", name))
	}
	if r.protocols == nil {
		r.protocols = make(map[string]ClientFactory)
	}
	r.protocols[name] = f
}
501010
func (l *LARS) Register404(notFound ...Handler) {

	chain := make(HandlersChain, len(notFound))

	for i, h := range notFound {
		chain[i] = l.wrapHandler(h)
	}

	l.http404 = chain
}
947401
func Register(lang string, builder Builder) {
	lock.Lock()
	builders[lang] = builder
	lock.Unlock()
}
1355846
func (f *Factory) Register(componentName string, constructor Constructor) error {
	if _, exists := f.registry[componentName]; exists {
		return fmt.Errorf("Registry error: component '%s' already registered", componentName)
	}
	f.registry[componentName] = registryEntry{
		Constructor: constructor,
		Info: ComponentInfo{
			Name: componentName,
		},
	}
	return nil
}
68759
func (r *PrefixedRegistry) Register(name string, metric interface{}) error {
	realName := r.prefix + name
	return r.underlying.Register(realName, metric)
}
914278
func (p *Registrar) Register() {
	if err := p.client.Register(p.registration); err != nil {
		p.logger.Log("err", err)
	} else {
		p.logger.Log("action", "register")
	}
}
1037001
func Register(c component.Component, options ...component.Option) {
	handlerComp = append(handlerComp, regComp{c, options})
}
1192227
func Register(s *grpc.Server, server queryservice.QueryService) {
	queryservicepb.RegisterQueryServer(s, &query{server})
}
163455
func Register(s *grpc.Server) {
	rpb.RegisterServerReflectionServer(s, &serverReflectionServer{
		s: s,
	})
}
421114
func (ovs *OvsdbClient) Register(handler NotificationHandler) {
	ovs.handlersMutex.Lock()
	defer ovs.handlersMutex.Unlock()
	ovs.handlers = append(ovs.handlers, handler)
}
169970
func (r *Listeners) Register(l Listener) error {
	r.Lock()
	defer r.Unlock()

	if _, ok := r.Listeners[l.key()]; ok {
		return errors.New("listener already registered")
	}

	r.Listeners[l.key()] = l
	return nil
}