📄 adminimpl.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-@year@ by SMB GmbH. All rights reserved.//// $Id: AdminImpl.java,v 1.2 2002/06/08 00:49:39 mediumnet Exp $package org.ozoneDB.core.admin;import java.io.*;import org.ozoneDB.core.*;import org.ozoneDB.DxLib.*;/** * <p>This is the server side implementation of the ozone admin system. Some of * the admin functions are directly provided by this class. For other functions * this class serves as a facade for the actual implementation classes.</p> * * @version $Revision: 1.2 $ $Date: 2002/06/08 00:49:39 $ * @author <a href="http://www.smb-tec.com">SMB</a> * @see Admin */public class AdminImpl extends OzoneSupportObject implements Admin, Externalizable { protected final static long serialVersionUID = 1; /** * The object ID of the admin object in the database. */ public final static long OBJECT_ID = 1; /** * The name of the admin object in the database. */ public final static String OBJECT_NAME = "ozonedb.admin"; protected transient Env env; protected transient BackupRestore backupRestore; public AdminImpl() { init(); } protected void init() { env = Env.currentEnv(); backupRestore = new BackupRestore(env); } public void writeExternal(ObjectOutput out) throws IOException { } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { init(); } public void newUser(String _name, int _id) throws Exception { if (_id < 100) { throw new UserManagerException("IDs <100 are reserved by the system."); } env.userManager.newUser(_name, _id); } public void newUser(String _name, String _passwd, int _id) throws Exception { if (_id < 100) { throw new UserManagerException("IDs <100 are reserved by the system."); } env.userManager.newUser(_name, _passwd, _id); } public void removeUser(String _name) throws Exception { env.userManager.removeUser(_name); } public void newGroup(String _name, int _id) throws Exception { if (_id < 100) { throw new UserManagerException("IDs <100 are reserved by the system."); } env.userManager.newGroup(_name, _id); } public void removeGroup(String _name) throws Exception { env.userManager.removeGroup(_name); } public void addUser2Group(String _username, String _groupname) throws Exception { env.userManager.addUserToGroup(_username, _groupname); } public void removeUserFromGroup(String _username, String _groupname) throws Exception { env.userManager.removeUserFromGroup(_username, _groupname); } public DxCollection allUsers() throws Exception { return env.userManager.allUsers(); } public DxCollection allGroups() throws Exception { return env.userManager.allGroups(); } public User userForName(String _name) throws Exception { return env.userManager.userForName(_name); } public Group groupForName(String _name) throws Exception { return env.userManager.groupForName(_name); } public User userForId(int _id) throws Exception { return env.userManager.userForID(_id); } public Group groupForId(int _id) throws Exception { return env.userManager.groupForID(_id); } public void shutdown() throws Exception { Server.stop = true; } public void beginRestore() throws Exception { backupRestore.beginRestore(); } public void processRestoreChunk(byte[] chunk) throws Exception { backupRestore.processRestoreChunk(chunk); } public void beginBackup() throws Exception { backupRestore.beginBackup(); } public byte[] nextBackupChunk() throws Exception { return backupRestore.nextBackupChunk(); } public int numberOfTxs() throws Exception { return Env.currentEnv().transactionManager.taTableCount(); } public void startGarbageCollection() { env.getGarbageCollector().start(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -