📄 adminmanager.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: AdminManager.java,v 1.6 2002/12/29 11:15:56 per_nyfelt Exp $
package org.ozoneDB.core.admin;
import org.ozoneDB.OzoneInterface;
import org.ozoneDB.core.*;
import org.ozoneDB.util.LogWriter;
/**
* This class does nothing than handling the initialization of the admin
* system.
*
* @version $Revision: 1.6 $ $Date: 2002/12/29 11:15:56 $
* @author <a href="http://www.smb-tec.com">SMB</a>
* @see Admin
*/
public final class AdminManager extends ServerComponent {
public AdminManager( Env _env) {
super( _env );
}
public void startup() throws Exception {
env.logWriter.newEntry( this, "startup...", LogWriter.INFO );
User user = env.userManager.userForID( 0 );
// happens if db was not initialized by proper version of install tool
if (user == null) {
env.userManager.newUser( "root", 0 );
user = env.userManager.userForID( 0 );
if (user == null) {
throw new UserManagerException( "Unable to create root user account." );
}
}
Transaction ta = env.transactionManager.newTransaction( user );
ObjectContainer adminContainer = env.storeManager.containerForID( ta, new ObjectID( AdminImpl.OBJECT_ID ));
try {
if (adminContainer == null) {
env.logWriter.newEntry( this, "No admin object found. Initializing...", LogWriter.INFO );
ObjectContainer container = ta.createObject( AdminImpl.class.getName(), OzoneInterface.GroupRead | OzoneInterface.GroupLock, AdminImpl.OBJECT_NAME, null, null, new ObjectID( AdminImpl.OBJECT_ID ) );
try {
ta.prepareCommit();
ta.commit();
env.logWriter.newEntry( this, "Admin object created.", LogWriter.INFO );
} finally {
container.unpin();
}
}
} finally {
if (adminContainer!=null) {
adminContainer.unpin();
}
}
env.transactionManager.deleteTransaction();
}
public void shutdown() throws Exception {
env.logWriter.newEntry( this, "shutdown...", LogWriter.INFO );
}
public void save() throws Exception {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -