/** * Creates a Closeable object that can be used to to switch to current class * loader to the framework class loader and will automatically set the * ClassLoader back to the previous class loader when closed * * @return a NarCloseable */ public static NarCloseable withFrameworkNar() { final ClassLoader frameworkClassLoader; try { frameworkClassLoader = NarClassLoadersHolder.getInstance().getFrameworkBundle().getClassLoader(); } catch (final Exception e) { // This should never happen in a running instance, but it will occur in unit tests logger.error("Unable to access Framework ClassLoader due to " + e + ". Will continue without changing ClassLoaders."); if (logger.isDebugEnabled()) { logger.error("", e); } return new NarCloseable(null); } final ClassLoader current = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(frameworkClassLoader); return new NarCloseable(current); }
ClassLoader currentCl = null; final Bundle frameworkBundle = NarClassLoadersHolder.getInstance().getFrameworkBundle(); if (frameworkBundle != null) { currentCl = Thread.currentThread().getContextClassLoader();
NarClassLoaders narClassLoaders = NarClassLoadersHolder.getInstance();
public SystemDiagnosticsSnapshotDTO.VersionInfoDTO createVersionInfoDTO() { final SystemDiagnosticsSnapshotDTO.VersionInfoDTO dto = new SystemDiagnosticsSnapshotDTO.VersionInfoDTO(); dto.setJavaVendor(System.getProperty("java.vendor")); dto.setJavaVersion(System.getProperty("java.version")); dto.setOsName(System.getProperty("os.name")); dto.setOsVersion(System.getProperty("os.version")); dto.setOsArchitecture(System.getProperty("os.arch")); final Bundle frameworkBundle = NarClassLoadersHolder.getInstance().getFrameworkBundle(); if (frameworkBundle != null) { final BundleDetails frameworkDetails = frameworkBundle.getBundleDetails(); dto.setNiFiVersion(frameworkDetails.getCoordinate().getVersion()); // Get build info dto.setBuildTag(frameworkDetails.getBuildTag()); dto.setBuildRevision(frameworkDetails.getBuildRevision()); dto.setBuildBranch(frameworkDetails.getBuildBranch()); dto.setBuildTimestamp(frameworkDetails.getBuildTimestampDate()); } return dto; }
aboutDTO.setContentViewerUrl(properties.getProperty(NiFiProperties.CONTENT_VIEWER_URL)); final Bundle frameworkBundle = NarClassLoadersHolder.getInstance().getFrameworkBundle(); if (frameworkBundle != null) { final BundleDetails frameworkDetails = frameworkBundle.getBundleDetails();
props.getExtensionsWorkingDirectory(), props.getComponentDocumentationWorkingDirectory(), NarClassLoadersHolder.getInstance(), extensionManager, extensionMapping,