📄 adminremote.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: AdminRemote.java,v 1.16 2000/10/28 16:55:20 daniela Exp $package org.ozoneDB.tools;import org.ozoneDB.DxLib.*;import org.ozoneDB.DxLib.net.DxClient;import org.ozoneDB.core.*;import org.ozoneDB.util.*;import java.io.IOException;/** * Remote interface of all admin functions. * * * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.16 $Date: 2000/10/28 16:55:20 $ */class AdminRemote extends DxClient { public AdminRemote( String _host, int _port ) throws IOException{ super( _host, _port ); } public void onConnect() throws IOException { send( "Command" ); } public void onDeconnect() throws IOException { send( new AdminCommand( AdminCommand.CLOSE ) ); } private Object send2( Object com, boolean answer ) throws Exception { send( com ); if (answer) { Object ret = receive(); if (ret instanceof Exception) { throw (Exception)ret; } else { return ret; } } return null; } public void close() throws IOException { try { send2( new AdminCommand( AdminCommand.CLOSE ), false ); } catch (IOException e) { throw e; } catch (Exception e) { } super.close(); } public void newGroup( String groupName, Integer id ) throws Exception { send2( new AdminCommand( AdminCommand.NG, groupName, id ), true ); } public void newUser( String userName, Integer id ) throws Exception { send2( new AdminCommand( AdminCommand.NU, userName, id ), true ); } public void addUserToGroup( String userName, String groupName ) throws Exception { send2( new AdminCommand( AdminCommand.U2G, userName, groupName ), true ); } public void removeUserFromGroup( String userName, String groupName ) throws Exception { send2( new AdminCommand( AdminCommand.RUG, userName, groupName ), true ); } public DxCollection allGroups() throws Exception { return (DxCollection)send2( new AdminCommand( AdminCommand.AG ), true ); } public DxCollection allUsers() throws Exception { return (DxCollection)send2( new AdminCommand( AdminCommand.AU ), true ); } public Group groupForName( String groupName ) throws Exception { return (Group)send2( new AdminCommand( AdminCommand.GfN, groupName ), true ); } public User userForName( String userName ) throws Exception { return (User)send2( new AdminCommand( AdminCommand.UfN, userName ), true ); } public void removeGroup( String groupName ) throws Exception { send2( new AdminCommand( AdminCommand.RG, groupName ), true ); } public void removeUser( String userName ) throws Exception { send2( new AdminCommand( AdminCommand.RU, userName ), true ); } public void provideMessage( AdminMessage msg ) throws Exception { System.out.println( "ozone message from " + msg.sender + ": " + msg.msg ); } public void shutdown() throws Exception { send2( new AdminCommand( AdminCommand.SHUTDOWN ), false ); } public void setCSSizes( Integer csSize, Integer clSize ) throws Exception { send2( new AdminCommand( AdminCommand.CS, csSize, clSize ), false ); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -