/*
Initialize the routing strategy map for system stores. This is used
during get / put on system stores.
170654
private void initSystemRoutingStrategies(Cluster cluster) {
        HashMap<String, RoutingStrategy> routingStrategyMap = createRoutingStrategyMap(cluster,
                                                                                       makeStoreDefinitionMap(getSystemStoreDefList()));
        this.metadataCache.put(SYSTEM_ROUTING_STRATEGY_KEY,
                               new Versioned<Object>(routingStrategyMap));
    }
767911
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['url'] = self._url_default
        self._my_map['data'] = self._data_default
        self._my_map['accessibilityTypeId'] = self._accessibility_type_default
        self._my_map['assignedRepositoryIds'] = [str(kwargs['repository_id'])]
        self._my_map['assetId'] = str(kwargs['asset_id'])
678019
public BackupConfigurationBuilder strategy(BackupConfiguration.BackupStrategy strategy) {
      attributes.attribute(STRATEGY).set(strategy);
      return this;
   }
262267
public void addStrategy(MappingStrategy strategy)
    {
        if (strategies == null)
        {
            strategies = new ArrayList<>();
        }
        strategies.add(strategy);
    }
1193790
protected void initialize(MapConfiguration configuration) {
		this.configuration = configuration;
		this.crs = configuration.getCrs();

		// Calculate maximum bounds:
		this.maxBounds = new Bbox(configuration.getMaxBounds().getX(), configuration.getMaxBounds().getY(),
				configuration.getMaxBounds().getWidth(), configuration.getMaxBounds().getHeight());

		if (configuration.getResolutions() != null && configuration.getResolutions().size() > 0) {
			for (Double resolution : configuration.getResolutions()) {
				resolutions.add(resolution);
			}
		} else if (configuration.getMinimumResolution() != 0) {
			// If there are no resolutions, we'll calculate them:
			double tempResolution = getMaxBoundsResolution();
			if (tempResolution == 0.0) {
				throw new IllegalStateException("Could not initialize the map. Could it be it has no size?");
			}
			// always add one resolution under the minimum resolution:
			// this ensures the possibility to display the map at minimum resolution
			resolutions.add(tempResolution);
			while (tempResolution > configuration.getMinimumResolution()) {
				tempResolution /= 2;
				resolutions.add(tempResolution);
			}
		} else {
			throw new IllegalStateException(
					"The map configuration must either contain a fixed list resolutions or a minimum resolution");
		}
		Collections.sort(resolutions, new Comparator<Double>() {

			@Override
			public int compare(Double o1, Double o2) {
				return o2.compareTo(o1);
			}
		});
	}
988069
public void initEvictor() {
        MapEvictionPolicy mapEvictionPolicy = getMapEvictionPolicy();
        if (mapEvictionPolicy == null) {
            evictor = NULL_EVICTOR;
        } else {
            MemoryInfoAccessor memoryInfoAccessor = getMemoryInfoAccessor();
            EvictionChecker evictionChecker = new EvictionChecker(memoryInfoAccessor, mapServiceContext);
            NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
            IPartitionService partitionService = nodeEngine.getPartitionService();
            int batchSize = nodeEngine.getProperties().getInteger(MAP_EVICTION_BATCH_SIZE);
            evictor = new EvictorImpl(mapEvictionPolicy, evictionChecker, partitionService, batchSize);
        }
    }
1082820
@Override
  public void setStorageStrategy(LCMSDataSubset subset, StorageStrategy storageStrategy) {
    NavigableMap<Integer, IScan> scansInSubsetByNumber = getScansInSubsetByNumber(getMapNum2scan(),
        subset);

    for (IScan scan : scansInSubsetByNumber.values()) {
      if (subset.isInSubset(scan)) {
        scan.setStorageStrategy(storageStrategy);
      }
    }
  }
381733
public function mapRoute()
    {
        $this->map('/null/create', 'create')->via('GET', 'POST');
        $this->map('/:id/read', 'read')->via('GET');
        $this->map('/:id/update', 'update')->via('GET', 'POST');
        $this->map('/:id/delete', 'delete')->via('GET', 'POST');

        $this->map('/', 'search')->via('GET');
        $this->map('/', 'create')->via('POST');
        $this->map('/:id', 'read')->via('GET');
        $this->map('/:id', 'update')->via('PUT');
        $this->map('/:id', 'delete')->via('DELETE');

    }
659180
private function applyStorageStrategy(array &$mapping) : void
    {
        if (! isset($mapping['type']) || isset($mapping['id'])) {
            return;
        }

        switch (true) {
            case $mapping['type'] === 'int':
            case $mapping['type'] === 'float':
                $defaultStrategy   = self::STORAGE_STRATEGY_SET;
                $allowedStrategies = [self::STORAGE_STRATEGY_SET, self::STORAGE_STRATEGY_INCREMENT];
                break;

            case $mapping['type'] === 'many':
                $defaultStrategy   = CollectionHelper::DEFAULT_STRATEGY;
                $allowedStrategies = [
                    self::STORAGE_STRATEGY_PUSH_ALL,
                    self::STORAGE_STRATEGY_ADD_TO_SET,
                    self::STORAGE_STRATEGY_SET,
                    self::STORAGE_STRATEGY_SET_ARRAY,
                    self::STORAGE_STRATEGY_ATOMIC_SET,
                    self::STORAGE_STRATEGY_ATOMIC_SET_ARRAY,
                ];
                break;

            default:
                $defaultStrategy   = self::STORAGE_STRATEGY_SET;
                $allowedStrategies = [self::STORAGE_STRATEGY_SET];
        }

        if (! isset($mapping['strategy'])) {
            $mapping['strategy'] = $defaultStrategy;
        }

        if (! in_array($mapping['strategy'], $allowedStrategies)) {
            throw MappingException::invalidStorageStrategy($this->name, $mapping['fieldName'], $mapping['type'], $mapping['strategy']);
        }

        if (isset($mapping['reference']) && $mapping['type'] === 'many' && $mapping['isOwningSide']
            && ! empty($mapping['sort']) && ! CollectionHelper::usesSet($mapping['strategy'])) {
            throw MappingException::referenceManySortMustNotBeUsedWithNonSetCollectionStrategy($this->name, $mapping['fieldName'], $mapping['strategy']);
        }
    }
753737
@Override
	public <T extends Endpoint> Strategy<T> create() {
		if (transporter == null) {
			return new RoundRobinStrategy<T>(broker, preferLocal);
		}
		return new NetworkLatencyStrategy<T>(broker, preferLocal, maxTries, this);
	}
915251
function setupStore() {
	store = new Store();


	mmrpNode.on('delivery.msgServer.connect', function (envelope) {
		if (store && !envelope.routeRemains() && envelope.hasReturnRoute()) {
			var address = String(envelope.messages[0]);
			var disconnects = String(envelope.messages[1]);

			store.connectAddress(envelope.returnRoute, address, disconnects);

			store.forward(address, function (error) {
				if (error) {
					informHostGone(envelope.returnRoute, address);
				}
			});
		}
	});

	mmrpNode.on('delivery.msgServer.disconnect', function (envelope) {
		if (store) {
			store.disconnectAddress(String(envelope.messages[0]));
		}
	});

	mmrpNode.on('delivery.msgServer.confirm', function (envelope) {
		if (store && !envelope.routeRemains()) {
			// this is for us

			var payload = JSON.parse(envelope.messages[0]);

			store.confirm(payload.address, payload.msgIds);
		}
	});

	mmrpNode.on('delivery.msgServer.send', function (envelope) {
		var address = String(envelope.messages[0]);

		if (store && store.managesAddress(address)) {
			logger.verbose('Sending envelope messages into store for address', address);

			store.send(address, envelope.messages.slice(1));

			store.forward(address, function (error) {
				if (error && envelope.hasReturnRoute()) {
					informHostGone(envelope.returnRoute, address);
				}
			});

			if (envelope.routeRemains()) {
				logger.warning('Message store was the endpoint, yet route remains:', envelope.route);
				envelope.consumeRoute();
			}
		} else {
			logger.verbose('Envelope passing by for address', address, '(not hosted here)');
		}
	});

	mmrpNode.on('delivery.msgServer.broadcast', function (envelope) {
		function quietLog(error) {
			if (error) {
				logger.verbose(error);
			}
		}

		if (store) {
			var addresses = store.getAddresses();

			for (var i = 0, len = addresses.length; i < len; i += 1) {
				var address = addresses[i];

				store.send(address, envelope.messages);
				store.forward(address, quietLog);
			}
		}
	});

	store.setForwarder(function (messages, address, route, cb) {
		if (mmrpNode) {
			mmrpNode.send(new Envelope('msgServer.messagepack', [address].concat(messages), route), null, cb);
		} else {
			if (cb) {
				cb();
			}
		}
	});
}
1354408
private static function init() {
        self::$routes = new RoutesManager();
        self::$beforeRoutes = new RoutesManager();
        self::$afterRoutes = new RoutesManager();
        self::$errorRoutes = new RoutesManager();
        self::$notFoundRoutes = new RoutesManager();
    }
243106
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['assignedBinIds'] = [str(kwargs['bin_id'])]
        self._my_map['group'] = self._group_default
        self._my_map['avatarId'] = self._avatar_default
1275052
def _init_routes_and_middlewares(self):
        """"""
        self._init_middlewares()
        self._init_endpoints()

        self.app = falcon.API(middleware=self.middleware)
        self.app.add_error_handler(Exception, self._error_handler)

        for version_path, endpoints in self.catalog:
            for route, resource in endpoints:
                self.app.add_route(version_path + route, resource)
1370636
function initResource (ravelInstance, koaRouter) {
  // decorate methods with @mapping before handing off to Routes init
  buildRoute(ravelInstance, this, Routes.GET, 'getAll');
  buildRoute(ravelInstance, this, Routes.PUT, 'putAll');
  buildRoute(ravelInstance, this, Routes.DELETE, 'deleteAll');
  buildRoute(ravelInstance, this, Routes.GET, 'get');
  buildRoute(ravelInstance, this, Routes.POST, 'post');
  buildRoute(ravelInstance, this, Routes.PUT, 'put');
  buildRoute(ravelInstance, this, Routes.DELETE, 'delete');

  // hand off to routes init
  initRoutes.call(this, ravelInstance, koaRouter);
}
849094
private synchronized void initSystemCache() {
        List<StoreDefinition> value = storeMapper.readStoreList(new StringReader(SystemStoreConstants.SYSTEM_STORE_SCHEMA));
        metadataCache.put(SYSTEM_STORES_KEY, new Versioned<Object>(value));
    }
532411
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidObjectForm._init_map(self, record_types=record_types)
        self._my_map['assignedObjectiveBankIds'] = [str(kwargs['objective_bank_id'])]
        self._my_map['courseIds'] = self._courses_default
        self._my_map['assessmentIds'] = self._assessments_default
        self._my_map['objectiveId'] = str(kwargs['objective_id'])
        self._my_map['assetIds'] = self._assets_default