/** @deprecated since 0.11.0 because there is a private superclass method with the same signature; * use {@link #registerClass(Class)} instead to avoid confusion */ @Deprecated public void addClass(Class<?> clazz) { registerClass(clazz); }
@Override protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class<?> result = loadedClasses.get(name); if (result==null) throw new ClassNotFoundException(""+name+" not known here"); if (resolve) resolveClass(result); return result; }
private synchronized void loadManualAdditionsCatalog() { if (manualAdditionsCatalog!=null) return; CatalogDto manualAdditionsCatalogDto = CatalogDto.newNamedInstance( "Manual Catalog Additions", "User-additions to the catalog while Brooklyn is running, " + "created "+Time.makeDateString(), "manual-additions"); CatalogDo manualAdditionsCatalog = catalog.addCatalog(manualAdditionsCatalogDto); if (manualAdditionsCatalog==null) { // not hard to support, but slightly messy -- probably have to use ID's to retrieve the loaded instance // for now block once, then retry log.warn("Blocking until catalog is loaded before changing it"); boolean loaded = blockIfNotLoaded(Duration.TEN_SECONDS); if (!loaded) log.warn("Catalog still not loaded after delay; subsequent operations may fail"); manualAdditionsCatalog = catalog.addCatalog(manualAdditionsCatalogDto); if (manualAdditionsCatalog==null) { throw new UnsupportedOperationException("Catalogs cannot be added until the base catalog is loaded, and catalog is taking a while to load!"); } } log.debug("Creating manual additions catalog for "+mgmt+": "+manualAdditionsCatalog); manualAdditionsClasses = new LoadedClassLoader(); ((AggregateClassLoader)manualAdditionsCatalog.classpath.getLocalClassLoader()).addFirst(manualAdditionsClasses); // expose when we're all done this.manualAdditionsCatalog = manualAdditionsCatalog; }
@Override @Deprecated /** @deprecated see super */ public CatalogItem<?,?> addItem(Class<?> type) { //assume forceUpdate for backwards compatibility log.debug("Adding manual catalog item to "+mgmt+": "+type); checkNotNull(type, "type"); if (manualAdditionsCatalog==null) loadManualAdditionsCatalog(); manualAdditionsClasses.registerClass(type); CatalogItem<?, ?> result = manualAdditionsCatalog.classpath.addCatalogEntry(type); // Clear spec-cache (in-case overwriting) specCache.invalidate(); return result; }