// Register adds the handler based on type.
967846
func (d *dispatcher) Register(c StreamType, h Handler) {
	d.handlers[c] = h
}
532160
func (mgr *MockCAClient) Register(request *api.RegistrationRequest) (string, error) {
	return "", errors.New("not implemented")
}
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
}
199519
func (a *Module) Register(p string, v interface{}, methods ...string) *Module {
	if len(methods) < 1 {
		methods = append(methods, "GET")
	}
	a.Application.URLBuilder.Set(v)
	h := a.Core.ValidHandler(v)
	a.Router().Match(methods, p, func(ctx echo.Context) error {
		if c, y := ctx.(Initer); y {
			if err := c.Init(ctx); err != nil {
				return err
			}
		}
		return h.Handle(ctx)
	})
	return a
}
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")
	}
}
1070355
func (d *Dispatcher) Register(etype Type, callback Callback) {
	if callback == nil {
		return
	}

	d.Lock()
	defer d.Unlock()
	d.callbacks[etype] = append(d.callbacks[etype], callback)
}
68759
func (r *PrefixedRegistry) Register(name string, metric interface{}) error {
	realName := r.prefix + name
	return r.underlying.Register(realName, metric)
}
1200053
func (tc *Consumer) RegisterCustomHandler(key string, handler func([]byte) (*Response, error)) {
	tc.customHandlers[key] = handler
}
963346
func (TriggersNotSupported) Register(context.Context, Transaction, TriggerConfig) (TriggerHandle, error) {
	return nil, triggersNotSupportedError()
}
1149152
func (s *resourceServiceImpl) Register(ctx context.Context, resourceTypeName string, resourceID, parentResourceID *string, identityID *uuid.UUID) (*resource.Resource, error) {

	var res *resource.Resource

	err := s.ExecuteInTransaction(func() error {

		// Lookup the resource type
		resourceType, err := s.Repositories().ResourceTypeRepository().Lookup(ctx, resourceTypeName)
		if err != nil {
			return errors.NewBadParameterErrorFromString("type", resourceTypeName, err.Error())
		}

		// Lookup the parent resource if it's specified
		var parentResource *resource.Resource

		if parentResourceID != nil {
			parentResource, err = s.Repositories().ResourceRepository().Load(ctx, *parentResourceID)
			if err != nil {
				return errors.NewBadParameterErrorFromString("parent resource ID", *parentResourceID, err.Error())
			}
		}

		var rID string
		if resourceID != nil {
			rID = *resourceID
		} else {
			rID = uuid.NewV4().String()
		}

		// Create a new resource instance
		res = &resource.Resource{
			ResourceID:       rID,
			ParentResourceID: parentResourceID,
			ResourceType:     *resourceType,
			ResourceTypeID:   resourceType.ResourceTypeID,
			ParentResource:   parentResource,
		}

		// Persist the resource
		err = s.Repositories().ResourceRepository().Create(ctx, res)
		if err != nil {
			return err
		}

		// Search for any default role mappings for the resource type
		defaultRoleMappings, err := s.Repositories().DefaultRoleMappingRepository().FindForResourceType(ctx, resourceType.ResourceTypeID)
		if err != nil {
			return err
		}

		// For each default role mapping for the same resource type, create a role mapping for the resource
		for _, m := range defaultRoleMappings {
			roleMapping := &repository.RoleMapping{
				ResourceID: rID,
				FromRoleID: m.FromRoleID,
				ToRoleID:   m.ToRoleID,
			}

			err = s.Repositories().RoleMappingRepository().Create(ctx, roleMapping)
			if err != nil {
				return err
			}
		}

		if identityID != nil {
			err = s.Repositories().Identities().CheckExists(ctx, (*identityID).String())
			if err != nil {
				return err
			}
			if resourceType.DefaultRoleID != nil {
				defaultRole, err := s.Repositories().RoleRepository().Load(ctx, *resourceType.DefaultRoleID)
				if err != nil {
					return err
				}
				if defaultRole != nil {
					err = s.Services().RoleManagementService().ForceAssign(ctx, *identityID, defaultRole.Name, *res)
					if err != nil {
						return err
					}
				}

			}
		}
		return nil
	})

	return res, err
}
561520
func (i *interruptListener) Register(cb func()) {
	if cb == nil {
		return
	}

	i.listenOnce()
	i.mu.Lock()
	i.onInterrupt = append(i.onInterrupt, cb)
	i.mu.Unlock()
}
889851
func RegisterHandler(sign string, callback HandlerFunc) {
	ghMu.Lock()
	globalHandlers = append(globalHandlers, handler{
		sign:     sign,
		callback: Handler(callback),
	})
	ghMu.Unlock()
}
642923
func (r *Registry) Register(ccid *ccintf.CCID, cc shim.Chaincode) error {
	r.mutex.Lock()
	defer r.mutex.Unlock()

	name := ccid.GetName()
	inprocLogger.Debugf("Registering chaincode instance: %s", name)
	tmp := r.typeRegistry[name]
	if tmp != nil {
		return SysCCRegisteredErr(name)
	}

	r.typeRegistry[name] = &inprocContainer{chaincode: cc}
	return nil
}
1113267
func (g *grip) register(cph syscall.Handle) (err error) {
	if g.handle, err = syscall.CreateFile(
		&g.pathw[0],
		syscall.FILE_LIST_DIRECTORY,
		syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE,
		nil,
		syscall.OPEN_EXISTING,
		syscall.FILE_FLAG_BACKUP_SEMANTICS|syscall.FILE_FLAG_OVERLAPPED,
		0,
	); err != nil {
		return
	}
	if _, err = syscall.CreateIoCompletionPort(g.handle, cph, 0, 0); err != nil {
		syscall.CloseHandle(g.handle)
		return
	}
	return g.readDirChanges()
}
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
}
518932
func (r *Registrar) Register() {
	if err := r.client.Register(r.service); err != nil {
		r.logger.Log("err", err)
	} else {
		r.logger.Log("action", "register")
	}
	if r.service.TTL != nil {
		go r.loop()
	}
}
401737
func Register(proto interface{}, alias string, tag ...string) {
	structType := reflect.TypeOf(proto)
	if structType.Kind() == reflect.Ptr {
		structType = structType.Elem()
	}
	if structType.Kind() != reflect.Struct {
		panic("invalid type: " + structType.String())
	}
	structTypesLocker.Lock()
	structTypes[alias] = structType
	structTypesLocker.Unlock()

	structTypeCacheLocker.Lock()
	cache := &structCache{Alias: alias}
	if len(tag) == 1 {
		cache.Tag = tag[0]
	}
	cache.Fields = getFields(structType, cache.Tag)
	initStructCacheData(cache)
	structTypeCache[(*emptyInterface)(unsafe.Pointer(&structType)).ptr] = cache
	structTypeCacheLocker.Unlock()
}