⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemconfig.java

📁 这是外国一个开源推理机
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	}	/**	 * Sets the sail with the supplied old class of the repository with the	 * given id to the supplied new class	 *	 * @param id Repository id	 * @param oldClass Old sail class	 * @param newClass New sail class	 */	public void setSail(String id, String oldClass, String newClass) {		getRepositoryConfig(id).getSail(oldClass).setSailClass(newClass);		_notifyListeners();	}	/**	 * Sets the key of the parameter with the supplied old key of the sail with	 * the given class of the repository with the supplied id to the given new	 * key	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @param oldKey Old parameter key	 * @param newKey New parameter key	 */	public void setParameterKey(String id, String sailClass, String oldKey, String newKey) {		getRepositoryConfig(id).getSail(sailClass).setParameterKey(oldKey, newKey);		_notifyListeners();	}	/**	 * Sets the value of the parameter with the supplied key of the sail with the	 * given class of the repository with the supplied id to the given value	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @param key Parameter key	 * @param value Parameter value	 */	public void setParameterValue(String id, String sailClass, String key, String value) {		getRepositoryConfig(id).getSail(sailClass).setParameter(key, value);		_notifyListeners();	}	/**	 * Checks if an user exists	 *	 * @return Boolean indicating if an user exists	 */	public boolean hasAnUser() {		return !_userList.isEmpty();	}	/**	 * Checks if an user with the supplied login exists	 *	 * @param login User login	 * @return Boolean indicating if the user exists	 */	public boolean hasUser(String login) {		return _userMap.containsKey(login);	}	/**	 * Checks if a repository exists	 *	 * @return Boolean indicating if a repository exists	 */	public boolean hasARepository() {		return !_repositoryList.isEmpty();	}	/**	 * Checks if a repository with the supplied id exists	 *	 * @param id The repository id	 * @return Boolean indicating if the repository exists	 */	public boolean hasRepository(String id) {		return _repositoryMap.containsKey(id);	}	/**	 * Checks if the repository with the supplied id has a sail	 *	 * @param id Repository id	 * @return Boolean indicating if the repository has a sail	 */	public boolean hasASail(String id) {		return getRepositoryConfig(id).hasASail();	}	/**	 * Checks if the repository with the supplied id has a sail with the supplied	 * class	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @return Boolean indicating if the repository has the sail	 */	public boolean hasSail(String id, String sailClass) {		return getRepositoryConfig(id).hasSail(sailClass);	}	/**	 * Checks if the sail with the supplied class of the repository with the	 * given id has a parameter with the supplied key	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @param key Parameter key	 * @return Boolean indicating if the sail of the repository has the parameter	 */	public boolean hasParameter(String id, String sailClass, String key) {		return getRepositoryConfig(id).getSail(sailClass).hasParameter(key);	}	/**	 * Adds a new user with the supplied id, login, full name and password	 *	 * @param id User id	 * @param login User login	 * @param fullName User full name	 * @param password User password	 */	public void addUser(int id, String login, String fullName, String password) {		addUserInfo(new UserInfo(id, login, fullName, password));	}	/**	 * Adds a new repository with the supplied id and title	 *	 * @param id Repository id	 * @param title Repository title	 */	public void addRepository(String id, String title) {		addRepositoryConfig(new RepositoryConfig(id, title));	}	/**	 * Clones the repository with the specified id, changes its id to	 * the specified new id, and adds this new repository.	 *	 * @param origID The repository to clone.	 * @param cloneID The ID of the cloned repository.	 */	public RepositoryConfig cloneRepository(String origID, String cloneID) {		RepositoryConfig repConfig = getRepositoryConfig(origID);		repConfig = (RepositoryConfig)repConfig.clone();		repConfig.setRepositoryId(cloneID);		addRepositoryConfig(repConfig);		return repConfig;	}	/**	 * Adds the sail with the supplied class to the sail stack of the repository	 * with the given id at the supplied index	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @param idx Sail index	 */	public void addSail(String id, String sailClass, int idx) {		getRepositoryConfig(id).addSail(new SailConfig(sailClass), idx);		_notifyListeners();	}	/**	 * Adds the parameter with the supplied key-value pair to the sail with the	 * given class of the repository with the supplied id	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @param key Parameter key	 * @param value Parameter value	 */	public void setParameter(String id, String sailClass, String key, String value) {		getRepositoryConfig(id).getSail(sailClass).setParameter(key, value);		_notifyListeners();	}	/**	 * Removes the repository with the supplied id	 *	 * @param id Repository id	 */	public void removeRepository(String id) {		RepositoryConfig repository = (RepositoryConfig)_repositoryMap.remove(id);		_repositoryList.remove(repository);		_notifyListeners();	}	/**	 * Removes the sail with the supplied class from the sail stack of the	 * repository with the supplied id	 *	 * @param id Repository id	 * @param sailClass Sail class	 */	public void removeSail(String id, String sailClass) {		RepositoryConfig repository = getRepositoryConfig(id);		repository.removeSail(repository.getSail(sailClass));		_notifyListeners();	}	/**	 * Removes the parameter with the supplied key from the sail with the given	 * class of the repository with the supplied id	 *	 * @param id Repository id	 * @param sailClass Sail class	 * @param key Parameter key	 */	public void removeParameter(String id, String sailClass, String key) {		getRepositoryConfig(id).getSail(sailClass).removeParameter(key);		_notifyListeners();	}	/**	 * Moves the sail with the supplied class one level up in the sail stack of	 * the repository with the given id	 *	 * @param id Repository id	 * @param sailClass Sail class	 */	public void sailUp(String id, String sailClass) {		getRepositoryConfig(id).sailUp(sailClass);		_notifyListeners();	}	/**	 * Moves the sail with the supplied class one level down in the sail stack of	 * the repository with the given id	 *	 * @param id Repository id	 * @param sailClass Sail class	 */	public void sailDown(String id, String sailClass) {		getRepositoryConfig(id).sailDown(sailClass);		_notifyListeners();	}	/**	 * Checks if the user with the supplied login has read access to	 * the specified repository.	 *	 * @param id Repository id	 * @param login User login	 * @return Boolean indicating if the user has read access to the repository	 */	public boolean hasReadAccess(String id, String login) {		boolean result = false;		RepositoryConfig repository = getRepositoryConfig(id);		if (repository.isWorldReadable()) {			result = true;		}		else if (login != null) {			UserInfo user = getUserInfo(login);			if (user != null) {				result = user.hasReadAccess(id);			}		}		return result;	}	/**	 * Sets the read access of the user with supplied login to the repository	 * with the given id to the supplied read access	 *	 * @param id Repository id	 * @param login User login	 * @param readAccess Boolean indicating if the user has read access to the	 * repository	 */	public void setReadAccess(String id, String login, boolean readAccess) {		UserInfo user = getUserInfo(login);		RepositoryConfig repository = getRepositoryConfig(id);		if (readAccess == true) {			user.addReadAccess(repository);		}		else {			user.removeReadAccess(repository);		}		_notifyListeners();	}	/**	 * Checks if the user with the supplied login has write access to	 * the specified repository.	 *	 * @param id Repository id	 * @param login User login	 * @return Boolean indicating if the user has write access to the repository	 */	public boolean hasWriteAccess(String id, String login) {		boolean result = false;		RepositoryConfig repository = getRepositoryConfig(id);		if (repository.isWorldWriteable()) {			result = true;		}		else if (login != null) {			UserInfo user = getUserInfo(login);			if (user != null) {				result = user.hasWriteAccess(id);			}		}		return result;	}	/**	 * Sets the write access of the user with supplied login to the repository	 * with the given id to the supplied write access	 *	 * @param id Repository id	 * @param login User login	 * @param writeAccess Boolean indicating if the user has write access to the	 * repository	 */	public void setWriteAccess(String id, String login, boolean writeAccess) {		UserInfo user = getUserInfo(login);		RepositoryConfig repository = getRepositoryConfig(id);		if (writeAccess == true) {			user.addWriteAccess(repository);		}		else {			user.removeWriteAccess(repository);		}		_notifyListeners();	}	/**	 * Checks if the user with the supplied login has read or write	 * access to the specified repository.	 *	 * @param id Repository id	 * @param login User login	 * @return Boolean indicating if the user has access to the repository	 */	public boolean hasReadOrWriteAccess(String id, String login) {		return hasReadAccess(id, login) || hasWriteAccess(id, login);	}	/**	 * Checks if the user with the supplied login has both read and	 * write access to the specified repository.	 *	 * @param id Repository id	 * @param login User login	 * @return Boolean indicating if the user has access to the repository	 */	public boolean hasReadAndWriteAccess(String id, String login) {		return hasReadAccess(id, login) && hasWriteAccess(id, login);	}	/**	 * Copies the data from <tt>other</tt> to this SystemConfig.	 *	 * @param other The SystemConfig to copy.	 */	public void setSystemConfig(SystemConfig other) {		_adminPassword = other._adminPassword;		_logDir = other._logDir;		_logLevel = other._logLevel;		_tmpDir = other._tmpDir;		_rmiEnabled = other._rmiEnabled;		_rmiFactoryClass = other._rmiFactoryClass;		_rmiPort = other._rmiPort;		_systemProps = new Properties(other._systemProps);		_userMap = new HashMap(other._userMap);		_userList = new ArrayList(other._userList);		_repositoryMap = new HashMap(other._repositoryMap);		_repositoryList = new ArrayList(other._repositoryList);		_notifyListeners();	}	/**	 * Adds the supplied SystemConfigListener	 *	 * @param listener SystemConfigListener	 */	public void addListener(SystemConfigListener listener) {		_listeners.add(listener);	}	/**	 * Removes the supplied SystemConfigListener	 *	 * @param listener SystemConfigListener	 */	public void removeListener(SystemConfigListener listener) {		_listeners.remove(listener);	}	protected void _notifyListeners() {		Iterator i = _listeners.iterator();		while (i.hasNext()) {			SystemConfigListener listener = (SystemConfigListener)i.next();			listener.configurationChanged();		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -