📄 hellomanager.java
字号:
package cli;import db.Hello;import db.HelloImpl;import org.ozoneDB.ExternalDatabase;import org.ozoneDB.OzoneInterface;import web.HelloServlet;public class HelloManager { private static Hello hello; private static ExternalDatabase db; public static void main(String[] args) { try { buildObject(); } catch (Exception e) { e.printStackTrace(); } } /** makes sure there is a Hello object in Ozone * we keep it extremely simple to show the idea, things could be * easily parameterized. */ private static void buildObject() throws Exception { System.out.println("Trying to connect to ozone..."); db = ExternalDatabase.openDatabase("ozonedb:remote://localhost:3333"); System.out.println("....Connected to ozone"); db.reloadClasses(); System.out.println("....Classes reloaded"); hello = (Hello) db.objectForName(HelloServlet.OBJ_NAME); if (hello == null) { System.out.println("Storing new Hello object"); hello = (Hello) db.createObject(HelloImpl.class.getName(), OzoneInterface.Public, HelloServlet.OBJ_NAME); } else { System.out.println("Found existing Hello object"); } System.out.println("db.Hello has the following greeting: " + hello.getGreeting()); db.close(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -