66
77import java .util .Collections ;
88import java .util .List ;
9+ import java .util .logging .Logger ;
910
1011public abstract class AbstractStorage <SK > implements Storage {
1112
13+ // protected final Logger LOG = Logger.getLogger(getClass().getName());
14+ private static final Logger LOG = Logger .getLogger (AbstractStorage .class .getName ());
15+
1216 protected abstract SK getSearchKey (String uuid );
1317
1418 protected abstract void doUpdate (Resume r , SK searchKey );
@@ -24,28 +28,33 @@ public abstract class AbstractStorage<SK> implements Storage {
2428 protected abstract List <Resume > doCopyAll ();
2529
2630 public void update (Resume r ) {
31+ LOG .info ("Update " + r );
2732 SK searchKey = getExistedSearchKey (r .getUuid ());
2833 doUpdate (r , searchKey );
2934 }
3035
3136 public void save (Resume r ) {
37+ LOG .info ("Save " + r );
3238 SK searchKey = getNotExistedSearchKey (r .getUuid ());
3339 doSave (r , searchKey );
3440 }
3541
3642 public void delete (String uuid ) {
43+ LOG .info ("Delete " + uuid );
3744 SK searchKey = getExistedSearchKey (uuid );
3845 doDelete (searchKey );
3946 }
4047
4148 public Resume get (String uuid ) {
49+ LOG .info ("Get " + uuid );
4250 SK searchKey = getExistedSearchKey (uuid );
4351 return doGet (searchKey );
4452 }
4553
4654 private SK getExistedSearchKey (String uuid ) {
4755 SK searchKey = getSearchKey (uuid );
4856 if (!isExist (searchKey )) {
57+ LOG .warning ("Resume " + uuid + " not exist" );
4958 throw new NotExistStorageException (uuid );
5059 }
5160 return searchKey ;
@@ -54,15 +63,17 @@ private SK getExistedSearchKey(String uuid) {
5463 private SK getNotExistedSearchKey (String uuid ) {
5564 SK searchKey = getSearchKey (uuid );
5665 if (isExist (searchKey )) {
66+ LOG .warning ("Resume " + uuid + " already exist" );
5767 throw new ExistStorageException (uuid );
5868 }
5969 return searchKey ;
6070 }
6171
6272 @ Override
6373 public List <Resume > getAllSorted () {
74+ LOG .info ("getAllSorted" );
6475 List <Resume > list = doCopyAll ();
6576 Collections .sort (list );
6677 return list ;
6778 }
68- }
79+ }
0 commit comments