public void add(BrooklynObject instance) { BrooklynObjectType type = BrooklynObjectType.of(instance); getUnsafeCollectionOfType(type).add(instance); if (type==BrooklynObjectType.CATALOG_ITEM) { removedCatalogItemIds.remove(instance.getId()); } }
public void addIfNotRemoved(BrooklynObject instance) { BrooklynObjectType type = BrooklynObjectType.of(instance); if (!getRemovedIdsOfType(type).contains(instance.getId())) { getUnsafeCollectionOfType(type).add(instance); } }
public void remove(BrooklynObject instance) { BrooklynObjectType type = BrooklynObjectType.of(instance); getUnsafeCollectionOfType(type).remove(instance); getRemovedIdsOfType(type).add(instance.getId()); }
@SuppressWarnings("unchecked") @VisibleForTesting public LookupContextImpl add(BrooklynObject object) { if (object!=null) { ((Map<String,BrooklynObject>) getMapFor(BrooklynObjectType.of(object))).put(object.getId(), object); } return this; } };
BrooklynMementoPersister p = rebindManager.getPersister(); String mr = ((BrooklynMementoPersisterToObjectStore)p).getMementoSerializer().toString(m); mementoRawBuilder.put(BrooklynObjectType.of(bo), bo.getId(), mr);
@Override public BrooklynObject lookup(BrooklynObjectType type, String id) { if (type==null) { BrooklynObject result = peek(null, id); if (result==null) { exceptionHandler.onDanglingUntypedItemRef(id); } type = BrooklynObjectType.of(result); } switch (type) { case CATALOG_ITEM: return lookupCatalogItem(id); case MANAGED_BUNDLE: return lookupBundle(id); case ENRICHER: return lookupEnricher(id); case ENTITY: return lookupEntity(id); case FEED: return lookupFeed(id); case LOCATION: return lookupLocation(id); case POLICY: return lookupPolicy(id); case UNKNOWN: return null; } throw new IllegalStateException("Unexpected type "+type+" / id "+id); }
for (Object superI: supers) { BrooklynObjectType boTypeI = null; if (superI instanceof BrooklynObject) boTypeI = BrooklynObjectType.of((BrooklynObject)superI); else if (superI instanceof Class) boTypeI = BrooklynObjectType.of((Class<?>)superI); if (boTypeI!=null && boTypeI!=BrooklynObjectType.UNKNOWN) { if (boType==null) boType = boTypeI; if (boType==null) { boType = BrooklynObjectType.of(ciType); if (boType!=null) { supers = MutableSet.copyOf(supers); } else if (Objects.equal(boType, BrooklynObjectType.of(ciType))) { if (specError==null) { throw new IllegalStateException("Guesser resolved but TypeRegistry couldn't create"); supers.add(BrooklynObjectType.of(resultO.getClass()).getInterfaceType()); RegisteredTypes.addSuperTypes(resultT, supers);
@Override public BrooklynObject lookup(BrooklynObjectType type, String id) { if (type==null) { BrooklynObject result = peek(null, id); if (result==null) { if (failOnDangling) { throw new NoSuchElementException("no brooklyn object with id "+id+"; type not specified"); } } type = BrooklynObjectType.of(result); } switch (type) { case CATALOG_ITEM: return lookupCatalogItem(id); case MANAGED_BUNDLE: return lookupBundle(id); case ENRICHER: return lookupEnricher(id); case ENTITY: return lookupEntity(id); case FEED: return lookupFeed(id); case LOCATION: return lookupLocation(id); case POLICY: return lookupPolicy(id); case UNKNOWN: return null; } throw new IllegalStateException("Unexpected type "+type+" / id "+id); }
superTypes.appendIfNotNull(BrooklynObjectType.of(itemType).getInterfaceType());