// Add Framework's ClassLoader by default ClassLoaderdubboClassLoader= ScopeModel.class.getClassLoader(); if (dubboClassLoader != null) { this.addClassLoader(dubboClassLoader); } }
//FrameworkModel.java publicFrameworkModel() { super(null, ExtensionScope.FRAMEWORK); this.setInternalId(String.valueOf(index.getAndIncrement())); // register FrameworkModel instance early synchronized (globalLock) { allInstances.add(this); resetDefaultFrameworkModel(); } if (LOGGER.isInfoEnabled()) { LOGGER.info(getDesc() + " is created"); } initialize(); }
//ApplicationModel.java publicApplicationModel(FrameworkModel frameworkModel, boolean isInternal) { super(frameworkModel, ExtensionScope.APPLICATION); Assert.notNull(frameworkModel, "FrameworkModel can not be null"); this.isInternal = isInternal; this.frameworkModel = frameworkModel; frameworkModel.addApplication(this); if (LOGGER.isInfoEnabled()) { LOGGER.info(getDesc() + " is created"); } initialize(); }
//ModuleModel.java publicModuleModel(ApplicationModel applicationModel, boolean isInternal) { super(applicationModel, ExtensionScope.MODULE); Assert.notNull(applicationModel, "ApplicationModel can not be null"); this.applicationModel = applicationModel; applicationModel.addModule(this, isInternal); if (LOGGER.isInfoEnabled()) { LOGGER.info(getDesc() + " is created"); }
initialize(); Assert.notNull(serviceRepository, "ModuleServiceRepository can not be null"); Assert.notNull(moduleConfigManager, "ModuleConfigManager can not be null"); Assert.assertTrue(moduleConfigManager.isInitialized(), "ModuleConfigManager can not be initialized");
// notify application check state ApplicationDeployerapplicationDeployer= applicationModel.getDeployer(); if (applicationDeployer != null) { applicationDeployer.notifyModuleChanged(this, DeployState.PENDING); } }
//ExtensionDirector.java public <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { checkDestroyed(); if (type == null) { thrownewIllegalArgumentException("Extension type == null"); } if (!type.isInterface()) { thrownewIllegalArgumentException("Extension type (" + type + ") is not an interface!"); } if (!withExtensionAnnotation(type)) { thrownewIllegalArgumentException("Extension type (" + type + ") is not an extension, because it is NOT annotated with @" + SPI.class.getSimpleName() + "!"); }
// 1. find in local cache ExtensionLoader<T> loader = (ExtensionLoader<T>) extensionLoadersMap.get(type);