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

📄 sesameserver.java

📁 这是外国一个开源推理机
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				}			}		}		return _version;	}	/**	 * Gets a Sail for the specified repositoryId. The Sail that is returned	 * is shared with everyone else calling this method with the same	 * repositoryId.	 *	 * @param repositoryId the ID of the repository to get the SAIL for	 * @throws UnknownRepositoryException If the SystemConfigCenter does	 * not know the specified repository ID.	 *//*	public static Sail getSail(String repositoryId)		throws UnknownRepositoryException	{		synchronized (_sharedSails) {			// First check wether the Sail is already created.			Sail result = (Sail)_sharedSails.get(repositoryId);			if (result != null) {				return result;			}			// Get the info on the repository			RepositoryConfig repConfig = _sysConfig.getRepositoryConfig(repositoryId);			if (repConfig == null) {				throw new UnknownRepositoryException("Unknown repository: " + repositoryId);			}			// Create a new Sail for the bottom of the Sail stack			List sailList = repConfig.getSailList();			SailConfig sailConfig = (SailConfig)sailList.get(sailList.size() - 1);			String className = sailConfig.getSailClass();			try {				Class sailClass = Class.forName(className);				ThreadLog.trace("Creating new Sail: " + className);				result = (Sail)sailClass.newInstance();				ThreadLog.trace("Initializing Sail");				result.initialize(sailConfig.getConfigParameters());				ThreadLog.trace("Sail initialized");			}			catch (Exception e) {				//FIXME: throw some other type of exception?				if (e instanceof SailInternalException) {					throw (SailInternalException)e;				}				else {					throw new SailInternalException(e);				}			}			// Add any stacked Sails on top			for (int i = sailList.size() - 2; i >= 0; i--) {				sailConfig = (SailConfig)sailList.get(i);				className = sailConfig.getSailClass();				try {					Class sailClass = Class.forName(className);					ThreadLog.trace("Creating new stacked Sail: " + className);					StackedSail stackedSail = (StackedSail)sailClass.newInstance();					stackedSail.setBaseSail(result);					ThreadLog.trace("Initializing stacked Sail");					stackedSail.initialize(sailConfig.getConfigParameters());					ThreadLog.trace("Stacked Sail initialized");					result = stackedSail;				}				catch (Exception e) {					ThreadLog.error("Error initializing Sail:", e);										//FIXME: throw some other type of exception?					if (e instanceof SailInternalException) {						throw (SailInternalException)e;					}					else {						throw new SailInternalException(e);					}				}			}			// Register the new Sail			_sharedSails.put(repositoryId, result); 			return result;		}	}*/	/**	 * Gets (or creates) a Sail for the specified repositoryId.	 *	 * @param repositoryId the ID of the repository to get the SAIL for	 * @param user the user to authenticate as	 * @param password the password of the user	 * @param wantsReadAccess true if read access is required, otherwise - false	 * @param wantsWriteAccess true if write access is required, otherwise - false	 * @return the first SAIL from the stacked SAILs.	 * @throws AccessDeniedException if no permission are granted to the user	 * @throws UnknownRepositoryException if no such repository is found	 *//*	public static Sail getSail(		String repositoryId, String user, String password,		boolean wantsReadAccess, boolean wantsWriteAccess)		throws AccessDeniedException, UnknownRepositoryException	{		UserAccessManager.checkAccessPermissions(_sysConfig, repositoryId,				user, password, wantsReadAccess, wantsWriteAccess);		return getSail(repositoryId);	}*/	/**	 * Retrieves a list of repositories given a user and a password	 * @param user the user to login as	 * @param password the password of the user	 * @param wantsReadAccess true if read access is required, otherwise - false	 * @param wantsWriteAccess true if write access is required, otherwise - false	 * @return a list of the available repositories	 *//*	public static List getRepositoryList(String user, String password,		boolean wantsReadAccess, boolean wantsWriteAccess)	{		List result = new ArrayList();		Iterator iter = _sysConfig.getRepositoryConfigList().iterator();		while (iter.hasNext()) {			RepositoryConfig repConfig = (RepositoryConfig)iter.next();			try {				UserAccessManager.checkAccessPermissions(						_sysConfig, repConfig.getRepositoryId(),						user, password,						wantsReadAccess, wantsWriteAccess);				// access permissions are OK				result.add(repConfig);			}			catch (AccessDeniedException e) {				// ignore			}			catch (UnknownRepositoryException e) {				// never thrown			}		}		return result;	}*/	/**	 * Clears the LocalService	 */	public static void clear() {		_localService.shutDown();		_unbindRMIServer(_sysConfig.getRMIFactoryClass(), _sysConfig.getRMIPort());	}	/**	 * Adds a SystemConfigCenterListener	 *	 * @param listener SystemConfigCenterListener	 */	public static void addListener(SystemConfigCenterListener listener) {		_listeners.add(listener);	}	/**	 * Removes a SystemConfigCenterListener	 *	 * @param listener SystemConfigCenterListener	 */	public static void removeListener(SystemConfigCenterListener listener) {		_listeners.remove(listener);	}	protected static void _notifyListeners() {		Iterator i = _listeners.iterator();		while (i.hasNext()) {			((SystemConfigCenterListener)i.next()).configurationRefreshed();		}	}/*---------------------------------------------+| (un)binding RMI servers                      |+---------------------------------------------*/	protected static void _bindRMIServer(String rmiFactoryClass, int port) {		if (rmiFactoryClass == null) {			return;		}		// let's bind that rmi-factory		Class rmi_factory = null;		java.lang.reflect.Method rmi_factory_bind = null;		try {			rmi_factory = Class.forName(rmiFactoryClass);			rmi_factory_bind = rmi_factory.getDeclaredMethod("bind", new Class[]{Integer.class});			rmi_factory_bind.invoke(null, new Object[] { new Integer(port) });		}		catch (ClassNotFoundException e) {			ThreadLog.error("RMI factory class '" + rmiFactoryClass + "' not found");		}		catch (NoSuchMethodException e) {			ThreadLog.error("Method 'static void bind(Integer)' not found in RMI factory class '" + rmiFactoryClass + "'");		}		catch (IllegalAccessException e) {			ThreadLog.error("Unable to bind RMI server: " + e.getMessage());		}		catch (java.lang.reflect.InvocationTargetException e) {			ThreadLog.error("Unable to bind RMI server: " + e.getMessage());		}	}	protected static void _unbindRMIServer(String rmiFactoryClass, int port) {		if (rmiFactoryClass == null) {			return;		}		// let's unbind that rmi-factory		Class rmi_factory = null;		java.lang.reflect.Method rmi_factory_unbind = null;		try {			rmi_factory = Class.forName(rmiFactoryClass);			rmi_factory_unbind = rmi_factory.getDeclaredMethod("unbind", new Class[] {Integer.class});			rmi_factory_unbind.invoke(null, new Object[] { new Integer(port) });		}		catch (ClassNotFoundException e) {			ThreadLog.error("RMI factory class '" + rmiFactoryClass + "' not found");		}		catch (NoSuchMethodException e) {			ThreadLog.error("Method 'static void unbind(Integer)' not found in RMI factory class '" + rmiFactoryClass + "'");		}		catch (IllegalAccessException e) {			ThreadLog.error("Unable to unbind RMI server: " + e.getMessage());		}		catch (java.lang.reflect.InvocationTargetException e) {			ThreadLog.error("Unable to unbind RMI server: " + e.getMessage());		}		// clean up on a separate thread		Thread gcThread = new Thread(new Runnable() {			public void run() {				synchronized (this) {					try {						wait(500); System.gc();						wait(500); System.gc();						wait(500); System.gc();					}					catch (InterruptedException e) {						notifyAll();					}				}			}		});		gcThread.start();	}}	

⌨️ 快捷键说明

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