Registers/unregisters a command resource.

@param shell The running shell.
@param owner Owner of the resource.
@param register If true, register the resource. If false, unregister it.
961489
@Override
    public void register(CareWebShell shell, ElementBase owner, boolean register) {
        if (register) {
            CommandUtil.associateCommand(getId(), ((ElementUI) owner).getOuterComponent());
        }
    }
964906
protected static void setShell(CareWebShell shell) {
        if (getShell() != null) {
            throw new RuntimeException("A CareWeb shell instance has already been registered.");
        }

        ExecutionContext.getPage().setAttribute(Constants.SHELL_INSTANCE, shell);
    }
635385
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null) if (m_recordToSync != null)
            m_recordToSync.addListener(new FileRemoveBOnCloseHandler(this));
    }
74309
def register(self, cmd: Type[Command]) -> None:
        
        self.commands[cmd.command] = cmd
519727
protected void registerUnregisterJMX(boolean doRegister) {
		if (this.mbs == null ){ // this way makes it easier for mocking.
			this.mbs = ManagementFactory.getPlatformMBeanServer();
		}
		try {
			String suffix = "";

			if (this.config.getPoolName()!=null){
				suffix="-"+this.config.getPoolName();
			}

			ObjectName name = new ObjectName(MBEAN_BONECP +suffix);
			ObjectName configname = new ObjectName(MBEAN_CONFIG + suffix);


			if (doRegister){
				if (!this.mbs.isRegistered(name)){
					this.mbs.registerMBean(this.statistics, name);
				}
				if (!this.mbs.isRegistered(configname)){
					this.mbs.registerMBean(this.config, configname);
				}
			} else {
				if (this.mbs.isRegistered(name)){
					this.mbs.unregisterMBean(name);
				}
				if (this.mbs.isRegistered(configname)){
					this.mbs.unregisterMBean(configname);
				}
			}
		} catch (Exception e) {
			logger.error("Unable to start/stop JMX", e);
		}
	}
372094
@Override
  public void registerProcessEngine(ProcessEngine processEngine) {
    ensureNotNull("Cannot register process engine in Jmx Runtime Container", "process engine", processEngine);

    String processEngineName = processEngine.getName();

    // build and start the service.
    JmxManagedProcessEngine managedProcessEngine = new JmxManagedProcessEngine(processEngine);
    serviceContainer.startService(ServiceTypes.PROCESS_ENGINE, processEngineName, managedProcessEngine);

  }
333739
@Override
  public void setOwner(Path p, String username, String groupname
      ) throws IOException {
    if (username == null && groupname == null) {
      throw new IOException("username == null && groupname == null");
    }

    if (username == null) {
      execCommand(pathToFile(p), Shell.SET_GROUP_COMMAND, groupname); 
    } else {
      //OWNER[:[GROUP]]
      String s = username + (groupname == null? "": ":" + groupname);
      execCommand(pathToFile(p), Shell.SET_OWNER_COMMAND, s);
    }
  }
111368
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            if (m_fldValue1 != null)
                if (m_fldValue1.getRecord() != this.getOwner().getRecord())
                    m_fldValue1.addListener(new FieldRemoveBOnCloseHandler(this));      // Not same file, if target file closes, remove this listener!
            if (m_fldValue2 != null)
                if (m_fldValue2.getRecord() != this.getOwner().getRecord())
                if (m_fldValue2.getRecord() != m_fldValue1.getRecord())
                    m_fldValue2.addListener(new FieldRemoveBOnCloseHandler(this));      // Not same file, if target file closes, remove this listener!
        }
    }
372891
void unregisterUse() {
		final int value = this.uses.decrementAndGet();
		if (value == 0) {
			uninstall(UninstallationStage.PRE_DESTROY_EVENT);
			uninstall(UninstallationStage.POST_DESTROY_EVENT);
		}
	}
616399
public synchronized void unregister(final OStorage iStorage) {
		for (ODatabaseComplex<?> db : new HashSet<ODatabaseComplex<?>>(instances.keySet())) {
			if (db != null && db.getStorage() == iStorage) {
				db.close();
				instances.remove(db);
			}
		}
	}
59518
@Override
    public void register(CareWebShell shell, ElementBase owner, boolean register) {
        if (register) {
            ActionRegistry.register(false, getId(), getLabel(), getScript());
        }
    }
516292
protected void doUnRegister(String serviceName, ProviderInfo providerInfo) {

        UnPublishServiceRequest unPublishServiceRequest = new UnPublishServiceRequest();
        unPublishServiceRequest.setServiceName(serviceName);
        client.unPublishService(unPublishServiceRequest);

    }
295067
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            if (m_fldSource == null)
                m_fldSource = this.getOwner();
    
            if ((m_fldDest != null)
                && (((BaseField)m_fldDest.getField()).getRecord() != null)
                && (((BaseField)m_fldDest.getField()).getRecord() != this.getOwner().getRecord()))
                    ((BaseField)m_fldDest.getField()).getRecord().addListener(new FileRemoveBOnCloseHandler(this));     // Not same file, if target file closes, remove this listener!
            else if ((m_fldSource.getField() != null)
                && (((BaseField)m_fldSource.getField()).getRecord() != null)
                && (((BaseField)m_fldSource.getField()).getRecord() != this.getOwner().getRecord()))
                    ((BaseField)m_fldSource.getField()).getRecord().addListener(new FileRemoveBOnCloseHandler(this)); // Not same file, if target file closes, remove this listener!
        }
    }
1123442
@Override
    public void destroy() {
        shell.unregisterPlugin(this);
        executeAction(PluginAction.UNLOAD, false);
        CommandUtil.dissociateAll(container);

        if (pluginEventListeners1 != null) {
            pluginEventListeners1.clear();
            pluginEventListeners1 = null;
        }

        if (pluginEventListeners2 != null) {
            executeAction(PluginAction.UNSUBSCRIBE, false);
            pluginEventListeners2.clear();
            pluginEventListeners2 = null;
        }

        if (registeredProperties != null) {
            registeredProperties.clear();
            registeredProperties = null;
        }

        if (registeredBeans != null) {
            registeredBeans.clear();
            registeredBeans = null;
        }

        if (registeredComponents != null) {
            for (BaseComponent component : registeredComponents) {
                component.destroy();
            }

            registeredComponents.clear();
            registeredComponents = null;
        }

        super.destroy();
    }
1096581
def register_remove_user_command(self, remove_user_func):
        
        description = "Removes user permission to access a remote project."
        remove_user_parser = self.subparsers.add_parser('remove-user', description=description)
        add_project_name_or_id_arg(remove_user_parser, help_text_suffix="remove a user from")
        user_or_email = remove_user_parser.add_mutually_exclusive_group(required=True)
        add_user_arg(user_or_email)
        add_email_arg(user_or_email)
        remove_user_parser.set_defaults(func=remove_user_func)
392079
private static void unregisterMBean(String name) {
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        try {
            synchronized (mbs) {
                ObjectName objName = new ObjectName(name);
                if (mbs.isRegistered(objName)) {
                    mbs.unregisterMBean(objName);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
857514
public void unregisterTaskManager(InstanceID instanceId, boolean terminated){
		Instance instance = registeredHostsById.get(instanceId);

		if (instance != null){
			registeredHostsById.remove(instance.getId());
			registeredHostsByResource.remove(instance.getTaskManagerID());

			if (terminated) {
				deadHosts.add(instance.getTaskManagerID());
			}

			instance.markDead();

			totalNumberOfAliveTaskSlots -= instance.getTotalNumberOfSlots();

			notifyDeadInstance(instance);

			LOG.info(
				"Unregistered task manager " + instance.getTaskManagerLocation().addressString() +
				". Number of registered task managers " + getNumberOfRegisteredTaskManagers() +
				". Number of available slots " + getTotalNumberOfSlots() + ".");
		} else {
			LOG.warn("Tried to unregister instance {} but it is not registered.", instanceId);
		}
	}