public void removeMetaData(MutableMetaDataRepository repository, ControllerContext context) { ScopeKey mutableScope = getMutableScope(); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(mutableScope); if (retrieval != null) { MutableMetaDataLoader mutable = getMutableMetaDataLoader(retrieval); if (mutable != null) updateMetaData(repository, context, mutable, false); } for (ScopeKey scope : addedScopes) { try { repository.removeMetaDataRetrieval(scope); } catch (Exception e) { log.trace("Ignored", e); } } addedScopes.clear(); if (context != null && context.getScopeInfo() == this) this.context = null; this.repository = null; }
public void addMetaData(MutableMetaDataRepository repository, ControllerContext context) { this.repository = repository; // only keep ref on the owning context if (context != null && context.getScopeInfo() == this) this.context = context; ScopeKey scope = getMutableScope(); MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(scope); MutableMetaDataLoader mutable; if (retrieval == null) { mutable = initMutableMetaDataRetrieval(repository, context, scope); repository.addMetaDataRetrieval(mutable); addedScopes.add(scope); } else { mutable = getMutableMetaDataLoader(retrieval); } if (mutable == null) { log.warn("MetaData context is not mutable: " + retrieval + " for " + context.toShortString()); return; } updateMetaData(repository, context, mutable, true); }