descriptor = this.serverPluginsOnFilesystem.get(pluginFile).descriptor;
String pluginName = descriptor.getName();
String displayName = descriptor.getDisplayName();
ComparableVersion version; // this must be non-null, the next line ensures this
version = ServerPluginDescriptorUtil.getPluginVersion(pluginFile, descriptor);
log.debug("Registering server plugin [" + pluginName + "], version " + version);
ServerPlugin plugin = new ServerPlugin(pluginName, pluginFile.getName());
plugin.setDisplayName((displayName != null) ? displayName : pluginName);
plugin.setEnabled(!descriptor.isDisabledOnDiscovery());
plugin.setDescription(descriptor.getDescription());
plugin.setMtime(pluginFile.lastModified());
plugin.setVersion(version.toString());
plugin.setAmpsVersion(descriptor.getApiVersion());
plugin.setMD5(MessageDigestGenerator.getDigestString(pluginFile));
plugin.setPluginConfiguration(getDefaultPluginConfiguration(descriptor));
plugin.setScheduledJobsConfiguration(getDefaultScheduledJobsConfiguration(descriptor));
plugin.setType(new ServerPluginType(descriptor).stringify());