3333
3434public class MetaManager extends AbstractManager {
3535
36+ private final MetaMongoDBAdaptor metaDBAdaptor ;
37+
3638 public MetaManager (CellBaseConfiguration configuration ) throws CellBaseException {
3739 super ("Homo sapiens" , null , configuration );
40+ this .metaDBAdaptor = dbAdaptorFactory .getMetaDBAdaptor ();
3841 }
3942
4043 @ Deprecated
4144 public CellBaseDataResult getVersions (String species , String assembly ) {
42- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
45+
4346 return metaDBAdaptor .getAll ();
4447 }
4548
4649 public CellBaseDataResult getVersions () {
47- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
50+
4851 return metaDBAdaptor .getAll ();
4952 }
5053
@@ -61,18 +64,18 @@ public Map<String, DatastoreStatus> getDatabaseStatus(String species, String ass
6164 }
6265
6366 public CellBaseDataResult <ApiKeyStats > getApiKeyStats (String apiKey , String date ) {
64- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
67+
6568 return metaDBAdaptor .getApiKeyStats (apiKey , date );
6669 }
6770
6871 public CellBaseDataResult <ApiKeyStats > getApiKeyStats (List <String > apiKeys , String startDate , String endDate ) {
69- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
72+
7073 return metaDBAdaptor .getApiKeyStats (apiKeys , startDate , endDate );
7174 }
7275
7376 public CellBaseDataResult <ApiKeyStats > getApiKeys () {
7477 long dbTimeStart = System .currentTimeMillis ();
75- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
78+
7679 CellBaseIterator <ApiKeyStats > iterator = metaDBAdaptor .apiKeyStatsIterator ();
7780 System .out .println ("API Key Stats:" );
7881 Map <String , ApiKeyStats > apiKeyStatsMap = new HashMap <>();
@@ -98,7 +101,7 @@ public CellBaseDataResult<ApiKeyStats> getApiKeys() {
98101 public void checkQuota (String apiKey , ApiKeyJwtPayload payload ) throws CellBaseException {
99102 String date = getApiKeyStatsDate ();
100103
101- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
104+
102105 CellBaseDataResult <ApiKeyStats > quotaResult = metaDBAdaptor .getApiKeyStats (apiKey , date );
103106
104107 // If no stats exist yet for this period, treat all counters as 0 (incApiKeyStats will upsert on first write)
@@ -125,7 +128,7 @@ public CellBaseDataResult incApiKeyStats(String apiKey, long incNumQueries, long
125128 long incOutputBytes ) {
126129 String date = getApiKeyStatsDate ();
127130
128- MetaMongoDBAdaptor metaDBAdaptor = dbAdaptorFactory . getMetaDBAdaptor ();
131+
129132 return metaDBAdaptor .incApiKeyStats (apiKey , date , incNumQueries , incNumAnnotatedVariants , incDuration , incOutputBytes );
130133 }
131134
0 commit comments