Class AnahataUcUtils
java.lang.Object
uno.anahata.asi.nb.uc.AnahataUcUtils
Universal utility class for managing NetBeans version detection, Anahata ASI Update Centers
(Universal, Stable, and Dev Snapshot), URL connectivity checks, legacy update center cleanup,
and automated installation of Anahata ASI Studio and JavaFX runtimes.
- Author:
- anahata
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDTO capturing detailed version metadata for an installed NetBeans module.static enumIdentification enum for supported Anahata Update Centers. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringCategory display name rendered for the development snapshot provider source.static final StringCategory display name rendered for the provider sources.static final StringResource path on classpath for the Anahata 16x16 icon displayed in the Plugins manager.static final StringCode name base for JavaFX runtime kit module.private static final LoggerLogger instance for update center operations.static final StringMaven Central search URL for Anahata ASI Studio NetBeans module.static final StringMaven Central search URL for Anahata ASI Update Center module.static final StringUnique internal provider code name for the development snapshot update center.static final StringUnique internal provider code name for the official stable update center.static final StringUnique provider code name for the universal cross-version update center.static final StringCode name base for the core NetBeans plugin module.static final StringCode name base for the standalone update center plugin module.static final StringUniversal update center catalog URL. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor to prevent direct instantiation. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcheckUrlConnectivity(String urlStr) Performs a lightweight HTTP network connectivity check against a remote URL.static org.netbeans.api.autoupdate.UpdateUnitProviderfindProvider(List<org.netbeans.api.autoupdate.UpdateUnitProvider> providers, String codeName, String urlStr) Searches a list of update unit providers for a matching code name or URL.static StringformatDownloadSize(int bytes) Formats a byte size into a human-readable string (e.g. "137.0 MB" or "450 KB").static org.netbeans.api.autoupdate.UpdateElementLocates the newest availableUpdateElementfor the Anahata ASI Studio plugin across all active update centers.static org.netbeans.api.autoupdate.UpdateElementLocates any available update or install element for the Anahata ASI Studio plugin that originates from a specific update center provider.Retrieves detailed version metadata for the installed Anahata ASI Studio module.static StringGets the installed specification version of the Anahata ASI Studio plugin.Retrieves detailed version metadata for the standalone Anahata Update Center module itself.static StringResolves the formatted JavaFX status string for NetBeans environment display.static StringGets the JavaFX version string and origin descriptor if available.static StringRetrieves a comprehensive, human-readable description of the host Java runtime platform.static List<org.netbeans.api.autoupdate.UpdateUnitProvider> Detects any legacy/obsolete Anahata update unit providers registered from previous or different NetBeans major versions that can be safely cleaned up.static StringDetects the active NetBeans IDE major version (e.g., "30", "31") using a robust multi-tiered detection strategy.private static StringResolves the version of JavaFX if bundled in the host JDK.static StringResolves the internal provider code name for the given update center type.static StringResolves the description for the given update center type.static StringResolves the default display name for the given update center type.static StringResolves the catalog URL for the given update center type.static org.netbeans.api.autoupdate.UpdateUnitProviderRetrieves the specified AnahataUpdateUnitProviderif registered.static StringInstalls or activates the NetBeans JavaFX runtime support module.static StringinstallOrUpdateStudio(org.netbeans.api.autoupdate.UpdateElement element) Installs or updates the Anahata ASI Studio module using NetBeans Autoupdate API.static booleanChecks whether JavaFX runtime support is active anywhere in the runtime (System JDK or NetBeans Module).static booleanChecks whether JavaFX runtime support is installed and enabled in NetBeans via plugin modules.static booleanChecks whether the Anahata ASI Studio plugin is installed and enabled.static booleanChecks whether the Anahata ASI Studio plugin is installed on disk.static booleanChecks whether JavaFX is bundled directly in the host system JDK (e.g., Liberica Full JDK or Azul Zulu FX).static booleanChecks whether the specified Anahata Update Center is registered and enabled.static booleanChecks whether the specified Anahata Update Center is registered in the IDE.static voidRefreshes all active Anahata update unit providers against remote catalogs.static voidRegisters all standard Anahata Update Centers in NetBeans if not already registered.static voidremoveProvider(org.netbeans.api.autoupdate.UpdateUnitProvider provider) Removes anUpdateUnitProviderfrom NetBeans Autoupdate.static voidsetUpdateCenterEnabled(AnahataUcUtils.UpdateCenterType type, boolean enabled) Sets the enabled state of the specified Anahata Update Center.static voidsetUpdateCenterTrusted(AnahataUcUtils.UpdateCenterType type, boolean trusted) Sets the trusted state of the specified Anahata Update Center.
-
Field Details
-
LOG
Logger instance for update center operations. -
PROVIDER_CODENAME_UNIVERSAL
Unique provider code name for the universal cross-version update center.- See Also:
-
PROVIDER_CODENAME_STABLE
Unique internal provider code name for the official stable update center.- See Also:
-
PROVIDER_CODENAME_DEV
Unique internal provider code name for the development snapshot update center.- See Also:
-
ICON_BASE
Resource path on classpath for the Anahata 16x16 icon displayed in the Plugins manager.- See Also:
-
CATEGORY_DISPLAY_NAME
Category display name rendered for the provider sources.- See Also:
-
CATEGORY_DEV_DISPLAY_NAME
Category display name rendered for the development snapshot provider source.- See Also:
-
STUDIO_CODE_NAME
Code name base for the core NetBeans plugin module.- See Also:
-
UC_CODE_NAME
Code name base for the standalone update center plugin module.- See Also:
-
JAVAFX_KIT_CODE_NAME
Code name base for JavaFX runtime kit module.- See Also:
-
UNIVERSAL_UPDATE_URL
-
MAVEN_STUDIO_URL
Maven Central search URL for Anahata ASI Studio NetBeans module.- See Also:
-
MAVEN_UC_URL
Maven Central search URL for Anahata ASI Update Center module.- See Also:
-
-
Constructor Details
-
AnahataUcUtils
private AnahataUcUtils()Private constructor to prevent direct instantiation.
-
-
Method Details
-
getNetBeansMajorVersion
Detects the active NetBeans IDE major version (e.g., "30", "31") using a robust multi-tiered detection strategy.- Returns:
- The detected major NetBeans version string (e.g. "30"), or
nullif running in an unrecognized environment.
-
getUpdateCenterUrl
Resolves the catalog URL for the given update center type.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
- The URL string.
-
getUpdateCenterDisplayName
Resolves the default display name for the given update center type.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
- The display name string.
-
getUpdateCenterCodeName
Resolves the internal provider code name for the given update center type.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
- The code name string.
-
getUpdateCenterDescription
Resolves the description for the given update center type.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
- The descriptive text.
-
registerDefaultUpdateCenters
public static void registerDefaultUpdateCenters()Registers all standard Anahata Update Centers in NetBeans if not already registered.- Universal Update Center: Registered and enabled by default. - Stable Update Center: Registered and enabled by default. - Dev Snapshot Update Center: Registered in a disabled state by default.
-
findProvider
public static org.netbeans.api.autoupdate.UpdateUnitProvider findProvider(List<org.netbeans.api.autoupdate.UpdateUnitProvider> providers, String codeName, String urlStr) Searches a list of update unit providers for a matching code name or URL.- Parameters:
providers- The list of providers to search.codeName- The provider code name to look for.urlStr- The provider URL string to look for.- Returns:
- The matching provider, or
nullif not found.
-
getUpdateUnitProvider
public static org.netbeans.api.autoupdate.UpdateUnitProvider getUpdateUnitProvider(AnahataUcUtils.UpdateCenterType type) Retrieves the specified AnahataUpdateUnitProviderif registered.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
- The registered
UpdateUnitProvider, ornullif not registered.
-
getLegacyAnahataProviders
Detects any legacy/obsolete Anahata update unit providers registered from previous or different NetBeans major versions that can be safely cleaned up.- Returns:
- A list of legacy
UpdateUnitProviderinstances.
-
removeProvider
public static void removeProvider(org.netbeans.api.autoupdate.UpdateUnitProvider provider) Removes anUpdateUnitProviderfrom NetBeans Autoupdate.- Parameters:
provider- The provider to remove.
-
isUpdateCenterRegistered
Checks whether the specified Anahata Update Center is registered in the IDE.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
trueif registered,falseotherwise.
-
isUpdateCenterEnabled
Checks whether the specified Anahata Update Center is registered and enabled.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.- Returns:
trueif enabled,falseotherwise.
-
setUpdateCenterEnabled
Sets the enabled state of the specified Anahata Update Center.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.enabled- The desired enabled state.
-
setUpdateCenterTrusted
Sets the trusted state of the specified Anahata Update Center.- Parameters:
type- TheAnahataUcUtils.UpdateCenterType.trusted- The desired trusted state.
-
checkUrlConnectivity
-
getInstalledStudioDetails
Retrieves detailed version metadata for the installed Anahata ASI Studio module.- Returns:
- The
AnahataUcUtils.InstalledModuleDetails, ornullif not installed on disk.
-
getInstalledUcDetails
Retrieves detailed version metadata for the standalone Anahata Update Center module itself.- Returns:
- The
AnahataUcUtils.InstalledModuleDetails, ornullif not found.
-
formatDownloadSize
Formats a byte size into a human-readable string (e.g. "137.0 MB" or "450 KB").- Parameters:
bytes- The size in bytes.- Returns:
- The formatted string, or
nullif size is zero or unknown.
-
getInstalledStudioVersion
Gets the installed specification version of the Anahata ASI Studio plugin.- Returns:
- The version string (e.g., "1.1.2"), or
nullif not installed.
-
isStudioInstalled
public static boolean isStudioInstalled()Checks whether the Anahata ASI Studio plugin is installed on disk.- Returns:
trueif installed,falseotherwise.
-
isStudioEnabled
public static boolean isStudioEnabled()Checks whether the Anahata ASI Studio plugin is installed and enabled.- Returns:
trueif installed and active,falseotherwise.
-
getAvailableStudioElementForProvider
public static org.netbeans.api.autoupdate.UpdateElement getAvailableStudioElementForProvider(AnahataUcUtils.UpdateCenterType type) Locates any available update or install element for the Anahata ASI Studio plugin that originates from a specific update center provider.- Parameters:
type- TheAnahataUcUtils.UpdateCenterTypeto check.- Returns:
- The matching
UpdateElement, ornullif none found in this provider.
-
getAvailableStudioElement
public static org.netbeans.api.autoupdate.UpdateElement getAvailableStudioElement()Locates the newest availableUpdateElementfor the Anahata ASI Studio plugin across all active update centers.- Returns:
- The latest update element, or
nullif no updates/install elements are available.
-
refreshAnahataProviders
public static void refreshAnahataProviders()Refreshes all active Anahata update unit providers against remote catalogs. -
installOrUpdateStudio
public static String installOrUpdateStudio(org.netbeans.api.autoupdate.UpdateElement element) throws Exception Installs or updates the Anahata ASI Studio module using NetBeans Autoupdate API.- Parameters:
element- TheUpdateElementto install.- Returns:
- A status message describing the outcome of the operation.
- Throws:
Exception- if installation fails.
-
getJavaPlatformDescription
Retrieves a comprehensive, human-readable description of the host Java runtime platform.- Returns:
- The formatted Java platform string (e.g. "OpenJDK Runtime Environment 26.0.1 (Eclipse Adoptium)").
-
getJavaFxFormattedStatus
Resolves the formatted JavaFX status string for NetBeans environment display.Returns "Version (JDK)" if provided by the host JVM, "Version (NB Module)" if provided by a NetBeans module, or "Not available" if absent.
- Returns:
- The formatted JavaFX status string.
-
isSystemJdkJavaFx
public static boolean isSystemJdkJavaFx()Checks whether JavaFX is bundled directly in the host system JDK (e.g., Liberica Full JDK or Azul Zulu FX).Because this module does not declare a module dependency on NetBeans' JavaFX module, standard
Class.forName("javafx.application.Platform")will ONLY find JavaFX if it is provided by the underlying JDK.- Returns:
trueif JavaFX classes are available directly from the host JDK.
-
getSystemJdkJavaFxVersion
Resolves the version of JavaFX if bundled in the host JDK.- Returns:
- The JavaFX version string, or
nullif not found.
-
isNetBeansJavaFxModuleActive
public static boolean isNetBeansJavaFxModuleActive()Checks whether JavaFX runtime support is installed and enabled in NetBeans via plugin modules.- Returns:
trueif a NetBeans module providingorg.openide.modules.jre.JavaFXis active.
-
isJavaFxActive
public static boolean isJavaFxActive()Checks whether JavaFX runtime support is active anywhere in the runtime (System JDK or NetBeans Module).- Returns:
trueif active,falseotherwise.
-
getJavaFxVersion
Gets the JavaFX version string and origin descriptor if available.- Returns:
- The JavaFX version (e.g., "21.0.9 (System JDK)" or "21.0.9 (org.netbeans.modules.javafx2.kit)"), or null.
-
installOrActivateJavaFx
-

