public void saveAll() throws IOException { PhotoCaseManager.getInstance().savePhotoCases(); // PhotoManager.getInstance().savePhotos(); DrumcymbalPhotoManager.getInstance().savePhotos(); UserManager.getInstance().saveClients(); GlobalsManager.getInstance().saveGlobals(); }
protected void startUp(String rootDir) throws Exception { super.startUp(rootDir); log.info("AbstractMain.startUp completed"); log.config(LogBuilder.createSystemMessage().addAction("load image storage").toString()); // GcsAdapter.Builder gcsAdapterBuilder = new GcsAdapter.Builder(); ImageStorage.setInstance(new DatastoreAdapter()); log.config(LogBuilder.createSystemMessage().addAction("load globals").toString()); GlobalsManager.getInstance().loadGlobals(); log.config(LogBuilder.createSystemMessage().addAction("load user").toString()); UserManager.getInstance().init(); log.config(LogBuilder.createSystemMessage().addAction("init PhotoFactory").toString()); DrumcymbalPhotoFactory.initialize(); CoordinateFactory.initialize(); log.config(LogBuilder.createSystemMessage().addAction("load Photos").toString()); // PhotoManager.getInstance().init(); DrumcymbalPhotoManager.getInstance().init(); }
protected void createUser(String userId, String nickName, String emailAddress, String photoDir) throws Exception { UserManager userManager = UserManager.getInstance(); new User(userId, nickName, emailAddress); // PhotoManager photoManager = PhotoManager.getInstance(); PhotoManager photoManager = DrumcymbalPhotoManager.getInstance(); File photoDirFile = new File(photoDir); FileFilter photoFileFilter = new FileFilter() { public boolean accept(File file) { // TODO: check and change return file.getName().endsWith(".jpg"); } }; File[] photoFiles = photoDirFile.listFiles(photoFileFilter); for (int i = 0; i < photoFiles.length; i++) { // TODO: change to datastore/cloud storage // Photo newPhoto = photoManager.createPhoto(photoFiles[i]); // user.addPhoto(newPhoto); } }