Beispiel #1
0
 public PathRegistry<TK, TE> Copy() {
     var copy = new HashMap<TK, PathModuleEntry<TE>>();
     foreach (var entry in _entities) {
         PathModuleEntry<TE> entryCopy = entry.Value.Copy();
         copy[entry.Key] = entryCopy;
     }
     return new PathRegistry<TK, TE>(ObjectType, copy);
 }
Beispiel #2
0
        public void AddEntry(TK entityKey,
            String moduleName,
            PathDeploymentEntry<TE> entity)
        {
            CheckModuleNameParameter(moduleName);
            if (!_entities.TryGetValue(entityKey, out var existing)) {
                existing = new PathModuleEntry<TE>();
                _entities[entityKey] = existing;
            }
            else {
                var existingDeploymentId = existing.GetDeploymentId(moduleName);
                if (existingDeploymentId != null) {
                    throw new PathExceptionAlreadyRegistered(entityKey.ToString(), ObjectType, moduleName);
                }
            }

            existing.Add(moduleName, entity);
        }
Beispiel #3
0
        public void Add(
            TK entityKey,
            string moduleName,
            TE entity,
            string deploymentId)
        {
            CheckModuleNameParameter(moduleName);
            var existing = _entities.Get(entityKey);
            if (existing == null) {
                existing = new PathModuleEntry<TE>();
                _entities.Put(entityKey, existing);
            }
            else {
                var existingDeploymentId = existing.GetDeploymentId(moduleName);
                if (existingDeploymentId != null) {
                    throw new PathExceptionAlreadyRegistered(entityKey.ToString(), ObjectType, moduleName);
                }
            }

            existing.Add(moduleName, entity, deploymentId);
        }