| /** |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.preferences; |
| |
| import org.eclipse.core.runtime.IBundleGroup; |
| import org.eclipse.core.runtime.IBundleGroupProvider; |
| import org.eclipse.core.runtime.Platform; |
| import org.eclipse.osbp.preferences.EnumDatabaseVendor; |
| import org.eclipse.osbp.preferences.ProductConfigurationPrefs; |
| import org.eclipse.osbp.preferences.ProductFileBase; |
| import org.eclipse.xtend2.lib.StringConcatenation; |
| |
| /** |
| * <plugins> dependencies for the OSBP product bundle <code>*.product</code> file. |
| */ |
| @SuppressWarnings("all") |
| public class ProductFileFeatures extends ProductFileBase { |
| public ProductFileFeatures(final ProductConfigurationPrefs prefs) { |
| super(prefs); |
| } |
| |
| public ProductFileFeatures(final ProductConfigurationPrefs prefs, final String... jndiNames) { |
| super(prefs, jndiNames); |
| } |
| |
| @Override |
| public String getDeprecatedAsString() { |
| return null; |
| } |
| |
| /** |
| * Creates the list of used plugins for the .product file in the product targetbundle. |
| */ |
| @Override |
| public String getRequiredAsString() { |
| StringConcatenation _builder = new StringConcatenation(); |
| _builder.append("${{DATA_BASE_VENDOR_FEATURES}}"); |
| _builder.newLine(); |
| String _runtimeSoftwareFeature = this.getRuntimeSoftwareFeature(); |
| _builder.append(_runtimeSoftwareFeature); |
| _builder.newLineIfNotEmpty(); |
| return this.prepareSerialized(_builder.toString()); |
| } |
| |
| @Override |
| public String getRecommendedAsString() { |
| return null; |
| } |
| |
| @Override |
| public String prepareSerialized(final String asString) { |
| return this.removeDuplicates( |
| asString.replace( |
| "${{DATA_BASE_VENDOR_FEATURES}}", |
| EnumDatabaseVendor.getDatabaseFeatures(this.dataBaseVendors))); |
| } |
| |
| private String getRuntimeSoftwareFeature() { |
| boolean netOsbee = false; |
| boolean orgOsbee = false; |
| IBundleGroupProvider[] _bundleGroupProviders = Platform.getBundleGroupProviders(); |
| for (final IBundleGroupProvider provider : _bundleGroupProviders) { |
| IBundleGroup[] _bundleGroups = provider.getBundleGroups(); |
| for (final IBundleGroup feature : _bundleGroups) { |
| { |
| String featureId = feature.getIdentifier(); |
| if ((featureId != null)) { |
| boolean _startsWith = featureId.startsWith("net.osbee"); |
| if (_startsWith) { |
| netOsbee = true; |
| } else { |
| boolean _startsWith_1 = featureId.startsWith("org.osbee"); |
| if (_startsWith_1) { |
| orgOsbee = true; |
| } |
| } |
| } |
| } |
| } |
| } |
| if (netOsbee) { |
| return "\t<feature id=\"net.osbee.softwarefactory.runtime.feature\"/>"; |
| } else { |
| if (orgOsbee) { |
| return "\t<feature id=\"org.osbee.softwarefactory.runtime.feature\"/>"; |
| } |
| } |
| return "\t<feature id=\"org.eclipse.osbp.softwarefactory.runtime.feature\"/>"; |
| } |
| } |