Register a new Dolphin Platform controller as a MBean
@param controllerClass the controller class
@param controllerId the controller id
@param modelProvider the model provider
@return the subscription for deregistration
762881
public Subscription registerController(Class<?> controllerClass, String controllerId, ModelProvider modelProvider) {
        Assert.requireNonNull(controllerClass, "controllerClass");
        Assert.requireNonBlank(controllerId, "controllerId");
        Assert.requireNonNull(modelProvider, "modelProvider");
        DolphinControllerInfoMBean mBean = new DolphinControllerInfo(dolphinContextId, controllerClass, controllerId, modelProvider);
        return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", controllerClass.getSimpleName(), "controller"));
    }
1323474
public Routes add(String controllerKey, Class<? extends Controller> controllerClass) {
		return add(controllerKey, controllerClass, controllerKey);
	}
1330695
protected final void registerModelBuilder(RestApiContext context, ModelBuilder mbProto, int version) {
    Class<? extends water.api.Handler> handlerClass = water.api.ModelBuilderHandler.class;
    if (H2O.ARGS.features_level.compareTo(mbProto.builderVisibility()) > 0) {
      return; // Skip endpoint registration
    }
    String base = mbProto.getClass().getSimpleName();
    String lbase = base.toLowerCase();
    // This is common model builder handler

    context.registerEndpoint(
        "train_" + lbase,
        "POST /" + version + "/ModelBuilders/" + lbase,
        handlerClass,
        "train",
        "Train a " + base + " model."
    );

    context.registerEndpoint(
        "validate_" + lbase,
        "POST /" + version + "/ModelBuilders/" + lbase + "/parameters",
        handlerClass,
        "validate_parameters",
        "Validate a set of " + base + " model builder parameters."
    );

    // Grid search is experimental feature
    context.registerEndpoint(
        "grid_search_" + lbase,
        "POST /99/Grid/" + lbase,
        GridSearchHandler.class,
        "train",
        "Run grid search for " + base + " model."
    );
  }
707076
public HandlerRegistration addController(final I_CmsDNDController controller) {

        m_controllers.add(controller);
        return new HandlerRegistration() {

            public void removeHandler() {

                m_controllers.remove(controller);
            }
        };
    }
1360804
private function registerController(string $controllerClassName)
    {
        $controllerAnnotation = $this->getControllerAnnotation($controllerClassName);

        if ($controllerAnnotation instanceof Controller) {
            $controllerName = trim($controllerClassName, "\\");
            $this->app["$controllerName"] = function (Application $app) use ($controllerName) {
                return new $controllerName($app);
            };

            $this->processClassAnnotation($controllerAnnotation);
        }
    }
721582
private DataMediaPairDO modelToDo(DataMediaPair dataMediaPair) {
        DataMediaPairDO dataMediaPairDo = new DataMediaPairDO();
        try {
            dataMediaPairDo.setId(dataMediaPair.getId());
            dataMediaPairDo.setPipelineId(dataMediaPair.getPipelineId());
            dataMediaPairDo.setSourceDataMediaId(dataMediaPair.getSource().getId());
            dataMediaPairDo.setTargetDataMediaId(dataMediaPair.getTarget().getId());
            dataMediaPairDo.setFilter(JsonUtils.marshalToString(dataMediaPair.getFilterData()));
            dataMediaPairDo.setResolver(JsonUtils.marshalToString(dataMediaPair.getResolverData()));
            dataMediaPairDo.setPullWeight(dataMediaPair.getPullWeight());
            dataMediaPairDo.setPushWeight(dataMediaPair.getPushWeight());
            dataMediaPairDo.setColumnPairMode(dataMediaPair.getColumnPairMode());
            dataMediaPairDo.setGmtCreate(dataMediaPair.getGmtCreate());
            dataMediaPairDo.setGmtModified(dataMediaPair.getGmtModified());
        } catch (Exception e) {
            logger.error("ERROR ## change the dataMediaPair Model to Do has an exception", e);
            throw new ManagerException(e);
        }

        return dataMediaPairDo;
    }
1237405
public static void registerMbean(Object mbean, ObjectName name) {
        registerMbean(ManagementFactory.getPlatformMBeanServer(),
                      JmxUtils.createModelMBean(mbean),
                      name);
    }
713275
public static <T> ObservableList<T> wrapList(com.canoo.platform.remoting.ObservableList<T> dolphinList) {
        Assert.requireNonNull(dolphinList, "dolphinList");
        final ObservableList<T> list = FXCollections.observableArrayList(dolphinList);

        list.addListener((ListChangeListener<T>) c -> {
            if (listenToFx) {
                listenToDolphin = false;
                while (c.next()) {
                    if (c.wasAdded() || c.wasRemoved() || c.wasReplaced()) {
                        for (T removed : c.getRemoved()) {
                            dolphinList.remove(removed);
                        }
                        for (T added : c.getAddedSubList()) {
                            dolphinList.add(list.indexOf(added), added);
                        }
                    }
                }
                listenToDolphin = true;
            }
        });

        dolphinList.onChanged(e -> {
            if (listenToDolphin) {
                listenToFx = false;
                for (ListChangeEvent.Change<? extends T> c : e.getChanges()) {
                    if (c.isAdded()) {
                        for (int i = c.getFrom(); i < c.getTo(); i++) {
                            list.add(i, dolphinList.get(i));
                        }
                    } else if (c.isRemoved()) {
                        final int index = c.getFrom();
                        list.remove(index, index + c.getRemovedElements().size());
                    }
                }
                listenToFx = true;
            }
        });

        return list;
    }
1073846
private function modelIdFromInput(InputProviderInterface $inputProvider)
    {
        if ($inputProvider->hasParameter('id') && $inputProvider->getParameter('id')) {
            return ModelId::fromSerialized($inputProvider->getParameter('id'))->getId();
        }

        return null;
    }
1172809
protected Provider<ObjectMapper> getJacksonProvider()
    {
        return new Provider<ObjectMapper>()
        {
            @Override
            public ObjectMapper get()
            {
                final ObjectMapper mapper = new ObjectMapper();
                mapper.registerModule(new JodaModule());
                mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
                return mapper;
            }
        };
    }
1312148
@Override
	public MessageConsumer createConsumer(Destination destination, String messageSelector, boolean noLocal) throws JMSException
    {
    	return createConsumer(idProvider.createID(), destination, messageSelector, noLocal);
    }
1165262
@Override
    public ModelService getModelService(String serviceName){
        ModelService service = null;
        if (getCache().isCached(serviceName)) {
            service = getCache().getService(serviceName);
        } else {
            service= this.getDirectoryServiceClient().getService(serviceName, watcher);
            if(service != null){
                getCache().putService(serviceName, service);
            }
        }
        return service;
    }
1055046
public void register(Class<? extends Controller>... controllerClasses) {
        for (Class<? extends Controller> controllerClass : controllerClasses) {
            register(controllerClass);
        }
    }
481366
public void addControllerListener(ControllerListener listener) {
		if (controllerListeners.contains(listener)) {
			return;
		}
		controllerListeners.add(listener);
		allListeners.add(listener);
	}
409853
protected <T extends InvocationMarshaller<?>> T addProvider (
        InvocationProvider prov, Class<T> mclass)
    {
        return _plmgr.addProvider(prov, mclass);
    }
341123
public function addResource($serviceId, $modelClass, $adminClass, $controllerName, $managerType)
    {
        $rc = new \ReflectionClass($modelClass);
        $modelClassShortName = $rc->getShortName();

        $code = "services:\n";

        if (is_file($this->file)) {
            $code = rtrim(file_get_contents($this->file));
            $data = (array) Yaml::parse($code);

            if ($code !== '') {
                $code .= "\n";
            }

            if (array_key_exists('services', $data)) {
                if (array_key_exists($serviceId, (array) $data['services'])) {
                    throw new \RuntimeException(sprintf(
                        'The service "%s" is already defined in the file "%s".',
                        $serviceId,
                        realpath($this->file)
                    ));
                }

                if ($data['services'] !== null) {
                    $code .= "\n";
                }
            } else {
                $code .= $code === '' ? '' : "\n" . "services:\n";
            }
        }

        $code .= sprintf(
            $this->template,
            $serviceId,
            $adminClass,
            $modelClass,
            $controllerName,
            $modelClassShortName,
            $managerType,
            current(array_slice(explode('\\', $modelClass), -1))
        );
        @mkdir(dirname($this->file), 0777, true);

        if (@file_put_contents($this->file, $code) === false) {
            throw new \RuntimeException(sprintf(
                'Unable to append service "%s" to the file "%s". You will have to do it manually.',
                $serviceId,
                $this->file
            ));
        }
    }
494768
@Override
    public void deregister(Controllable controllable, ControllableType type)
                    throws NotRegisteredException, SIBExceptionInvalidValue {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deregister", new Object[] { controllable, type });
        try {
            if (type == ControllableType.QUEUE_POINT) {
                ServiceRegistration<QueueMBean> qMBean = (ServiceRegistration<QueueMBean>) this.serviceObjects.get(controllable.getName());
                qMBean.unregister();
            } else if (type == ControllableType.PUBLICATION_POINT) {
                ServiceRegistration<TopicMBean> topicMBean = (ServiceRegistration<TopicMBean>) this.serviceObjects.get(controllable.getName());
                topicMBean.unregister();
            } else if (type == ControllableType.SUBSCRIPTION_POINT) {
                ServiceRegistration<SubscriberMBean> subMBean = (ServiceRegistration<SubscriberMBean>) this.serviceObjects.get(controllable.getName());
                subMBean.unregister();
            }
        } catch (Exception e) {
            SibTr.exception(tc, e);
        }

        deregister(controllable);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deregister");
        return;
    }