@Test public void testGetMetaClasses() { MetadataContext metaContext = new MetadataContext(); IMetadataService ms = repositoryService.getRepository("raptor-paas").getMetadataService(); List<MetaClass> metas = ms.getMetaClasses(metaContext); Assert.assertEquals(34, metas.size()); ms = repositoryService.getRepository("software-deployment").getMetadataService(); metas = ms.getMetaClasses(metaContext); Assert.assertEquals(16, metas.size()); ms = repositoryService.createRepository(new Repository("newCreatedForGetMetaClasses")).getMetadataService(); metas = ms.getMetaClasses(metaContext); Assert.assertEquals(2, metas.size()); }
@Override public final List<MetaClass> getMetaClasses(MetadataContext ctx) { MetadataContext context = ctx != null ? ctx : new MetadataContext(); ArrayList<MetaClass> result = new ArrayList<MetaClass>(); if (!context.isRefreshMetadata()) { return cacheManager.getMetaClassesFromCache(); } DBCursor cursor = collection.find(); while(cursor.hasNext()) { DBObject o = cursor.next(); MetaClass m = converter.fromBson(o, MetaClass.class); result.add(m); } MetaClassGraph newGraph = new MetaClassGraph(result); ExpirableCache<MetaClass> newNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); ExpirableCache<MetaClass> pluralNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); for (MetaClass m : result) { setUpMetaClass(m, newGraph); cacheManager.addMetaClassToCache(m, newNameCache, pluralNameCache); newGraph.updateMetaClass(m); } this.graph = newGraph; cacheManager.refreshCache(newNameCache, pluralNameCache); return result; }
MongoMetadataServiceImpl implements IMetadataService { @Override public final List<MetaClass> getMetaClasses(MetadataContext ctx) { MetadataContext context = ctx != null ? ctx : new MetadataContext(); ArrayList<MetaClass> result = new ArrayList<MetaClass>(); if (!context.isRefreshMetadata()) { return cacheManager.getMetaClassesFromCache(); } DBCursor cursor = collection.find(); while(cursor.hasNext()) { DBObject o = cursor.next(); MetaClass m = converter.fromBson(o, MetaClass.class); result.add(m); } MetaClassGraph newGraph = new MetaClassGraph(result); ExpirableCache<MetaClass> newNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); ExpirableCache<MetaClass> pluralNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); for (MetaClass m : result) { setUpMetaClass(m, newGraph); cacheManager.addMetaClassToCache(m, newNameCache, pluralNameCache); newGraph.updateMetaClass(m); } this.graph = newGraph; cacheManager.refreshCache(newNameCache, pluralNameCache); return result; } }
MongoMetadataServiceImpl implements IMetadataService { @Override public final List<MetaClass> getMetaClasses(MetadataContext ctx) { MetadataContext context = ctx != null ? ctx : new MetadataContext(); ArrayList<MetaClass> result = new ArrayList<MetaClass>(); if (!context.isRefreshMetadata()) { return cacheManager.getMetaClassesFromCache(); } DBCursor cursor = collection.find(); while(cursor.hasNext()) { DBObject o = cursor.next(); MetaClass m = converter.fromBson(o, MetaClass.class); result.add(m); } MetaClassGraph newGraph = new MetaClassGraph(result); ExpirableCache<MetaClass> newNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); ExpirableCache<MetaClass> pluralNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); for (MetaClass m : result) { setUpMetaClass(m, newGraph); cacheManager.addMetaClassToCache(m, newNameCache, pluralNameCache); newGraph.updateMetaClass(m); } this.graph = newGraph; cacheManager.refreshCache(newNameCache, pluralNameCache); return result; } MongoMetadataServiceImpl(Mongo mongo, int maxCacheSize,
            int cacheExpiredTime, int collectionCountCacheSize, int collectionCountCacheExpiredTime,
            Repository repo, ICMSLock metadataLock); }
MongoMetadataServiceImpl implements IMetadataService { @Override public final List<MetaClass> getMetaClasses(MetadataContext ctx) { MetadataContext context = ctx != null ? ctx : new MetadataContext(); ArrayList<MetaClass> result = new ArrayList<MetaClass>(); if (!context.isRefreshMetadata()) { return cacheManager.getMetaClassesFromCache(); } DBCursor cursor = collection.find(); while(cursor.hasNext()) { DBObject o = cursor.next(); MetaClass m = converter.fromBson(o, MetaClass.class); result.add(m); } MetaClassGraph newGraph = new MetaClassGraph(result); ExpirableCache<MetaClass> newNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); ExpirableCache<MetaClass> pluralNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); for (MetaClass m : result) { setUpMetaClass(m, newGraph); cacheManager.addMetaClassToCache(m, newNameCache, pluralNameCache); newGraph.updateMetaClass(m); } this.graph = newGraph; cacheManager.refreshCache(newNameCache, pluralNameCache); return result; } MongoMetadataServiceImpl(Mongo mongo, int maxCacheSize,
            int cacheExpiredTime, int collectionCountCacheSize, int collectionCountCacheExpiredTime,
            Repository repo, ICMSLock metadataLock); @Override Repository getRepository(); @Override MetaClass getMetaClass(String className); @Override MetaClass getMetaClass(String className, int version, MetadataContext context); @Override MetaClass createMetaClass(MetaClass metaClass, MetadataContext context); @Override void deleteMetaClass(String className, MetadataContext metaContext); @Override MetaClass deleteMetaField(String className, String fieldName, MetadataContext metaContext); @Override MetaClass updateMetaClass(MetaClass metaClass, MetadataContext context); @Override List<MetaClass> batchUpsert(List<MetaClass> metaClasses, MetadataContext context); @Override final List<MetaClass> getMetaClasses(MetadataContext ctx); @Override void updateMetaOption(String className, MetaOption options, MetadataContext context); @Override int getCollectionCount(String dbCollectionName); @Override MetaClass updateMetaField(MetaClass metaClass, String fieldName, MetadataContext context); @Override void validateMetaClass(String className); @Override void setMetaHistoryService(IMetadataHistoryService historyService); }
MongoMetadataServiceImpl implements IMetadataService { @Override public final List<MetaClass> getMetaClasses(MetadataContext ctx) { MetadataContext context = ctx != null ? ctx : new MetadataContext(); ArrayList<MetaClass> result = new ArrayList<MetaClass>(); if (!context.isRefreshMetadata()) { return cacheManager.getMetaClassesFromCache(); } DBCursor cursor = collection.find(); while(cursor.hasNext()) { DBObject o = cursor.next(); MetaClass m = converter.fromBson(o, MetaClass.class); result.add(m); } MetaClassGraph newGraph = new MetaClassGraph(result); ExpirableCache<MetaClass> newNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); ExpirableCache<MetaClass> pluralNameCache = new ExpirableCache<MetaClass>(maxCacheSize, cacheExpiredTime); for (MetaClass m : result) { setUpMetaClass(m, newGraph); cacheManager.addMetaClassToCache(m, newNameCache, pluralNameCache); newGraph.updateMetaClass(m); } this.graph = newGraph; cacheManager.refreshCache(newNameCache, pluralNameCache); return result; } MongoMetadataServiceImpl(Mongo mongo, int maxCacheSize,
            int cacheExpiredTime, int collectionCountCacheSize, int collectionCountCacheExpiredTime,
            Repository repo, ICMSLock metadataLock); @Override Repository getRepository(); @Override MetaClass getMetaClass(String className); @Override MetaClass getMetaClass(String className, int version, MetadataContext context); @Override MetaClass createMetaClass(MetaClass metaClass, MetadataContext context); @Override void deleteMetaClass(String className, MetadataContext metaContext); @Override MetaClass deleteMetaField(String className, String fieldName, MetadataContext metaContext); @Override MetaClass updateMetaClass(MetaClass metaClass, MetadataContext context); @Override List<MetaClass> batchUpsert(List<MetaClass> metaClasses, MetadataContext context); @Override final List<MetaClass> getMetaClasses(MetadataContext ctx); @Override void updateMetaOption(String className, MetaOption options, MetadataContext context); @Override int getCollectionCount(String dbCollectionName); @Override MetaClass updateMetaField(MetaClass metaClass, String fieldName, MetadataContext context); @Override void validateMetaClass(String className); @Override void setMetaHistoryService(IMetadataHistoryService historyService); static final Logger logger; }