EdgeConfig - Only showing factories for instantiating components - expected behaviour? Missing factoryPid

Hello,

I have recently updated my OpenEMS instance to a recent version from a version that was >1 year old.

Previously when I looked at the EdgeConfig JSON (either over backend websocket or fetched via REST-API, it contained entries under factories for every factory - i.e

  1. Factories corresponding to my actual components (the ESS, controllers etc that I was actually using)
    AND
  2. Factories corresponding to bundles that I had not instantiated into components (e.g components such as controllers that are available for creation).

Since the version update, I am only receiving the factories in category 1 in the EdgeConfig JSON.

This is problematic as our custom backend was using the JSON to understand which components were available on the Edge to be created - e.g which controllers, devices etc are available.

The issue appears to be related to the factoryPid.
EdgeConfigWorker has the following function for getting the factories:

/**
	 * Read Factories.
	 *
	 * @param builder the {@link EdgeConfig} builder
	 */
	private void readFactories(EdgeConfig.ActualEdgeConfig.Builder builder) {
		var bundleContext = this.parent.bundleContext;
		if (bundleContext == null) {
			// Can be null in JUnit tests
			return;
		}
		final var bundles = bundleContext.getBundles();
		for (Bundle bundle : bundles) {
			final var mti = this.parent.metaTypeService.getMetaTypeInformation(bundle);
			if (mti == null) {
				continue;
			}

			// read Bundle Manifest
			var manifestUrl = bundle.getResource("META-INF/MANIFEST.MF");
			Manifest manifest;
			try {
				manifest = new Manifest(manifestUrl.openStream());
			} catch (IOException e) {
				// unable to read manifest
				continue;
			}

			// get Factory-PIDs in this Bundle
			var factoryPids = mti.getFactoryPids();
			for (String factoryPid : factoryPids) {
				switch (factoryPid) {
				case "osgi.executor.provider":
					// ignore these Factory-PIDs
					break;
				default:
					// Get ObjectClassDefinition (i.e. the main annotation on the Config class)
					var objectClassDefinition = mti.getObjectClassDefinition(factoryPid, null);
					// Get Natures implemented by this Factory-PID
					var natures = this.getNatures(bundle, manifest, factoryPid);
					// Add Factory to config
					builder.addFactory(factoryPid,
							EdgeConfig.Factory.create(factoryPid, objectClassDefinition, natures));
				}
			}

			// get Singleton PIDs in this Bundle
			for (String pid : mti.getPids()) {
				switch (pid) {
				default:
					// Get ObjectClassDefinition (i.e. the main annotation on the Config class)
					var objectClassDefinition = mti.getObjectClassDefinition(pid, null);
					// Get Natures implemented by this Factory-PID
					var natures = this.getNatures(bundle, manifest, pid);
					// Add Factory to config
					builder.addFactory(pid, EdgeConfig.Factory.create(pid, objectClassDefinition, natures));
				}
			}
		}
	}

When I look in the Felix console under hostname:8080/system/console/bundles - I only see a factoryPid for the bundles that have actually been instantiated into components - i.e there is no factoryPid for the other devices and controllers.
Therefore these would be missed by the EdgeConfigWorker.

Strangely I can see a factoryPid for each of these when I look on the OSGi configuration page hostname:8080/system/console/configMgr.

Very confused by this issue! All help appreciated!

Thanks
Thomas

I am getting this issue both when I run the latest develop branch and the 2025.1.0 release tag. Therefore I feel that this may be intended behaviour?

If EdgeConfig no longer provides all factories, how is the backend to know about all the available components that can be created?

I also discovered some Strange behaviour with activation of some components - i replaced the .jar file for another one and the Config in the UI still had the “old” Parameters in it. For example:

  1. Added a capacity() integer
  2. Uploaded the .jar to the Device
  3. Restarted openems
  4. Configured the new Implementation
  5. Saw that i do not need the capacity()
  6. Removed it
  7. Uploaded new Version of it to the Edge
  8. Restarted
  9. In the UI the capacity() integer still wanted to be configured and the Log showed Errors over Errors if i removed the Config manually in /etc/openems.d/
  10. Rebooted
  11. Still had the Issue
  12. Stopped OpenEMS, made the Service (Systemd) File corrupt and make it intentionally fail
  13. fixed the File
  14. Restarted - WORKS!!!

Do not know it this relates to the Issue.

Greetings