private void setupLinks(InstallableUnitDescription iu, FileSetDescriptor descriptor) { String[] links = getArrayFromString(descriptor.getLinks(), ","); //$NON-NLS-1$ StringBuffer linkActions = new StringBuffer(); int i = 0; while (i < links.length) { //format is [target,name]* String target = links[i++]; if (i < links.length) { String name = links[i++]; linkActions.append("ln(linkTarget:" + target); //$NON-NLS-1$ linkActions.append(",targetDir:${installFolder},linkName:" + name); //$NON-NLS-1$ linkActions.append(");"); //$NON-NLS-1$ } } if (linkActions.length() > 0) { Map<String, String> touchpointData = new HashMap<String, String>(); //we do ln during configure to avoid complicating branding which uses the install phase touchpointData.put("configure", linkActions.toString()); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); } }
private void setupLinks(InstallableUnitDescription iu, FileSetDescriptor descriptor) { String[] links = getArrayFromString(descriptor.getLinks(), ","); //$NON-NLS-1$ StringBuffer linkActions = new StringBuffer(); int i = 0; while (i < links.length) { //format is [target,name]* String target = links[i++]; if (i < links.length) { String name = links[i++]; linkActions.append("ln(linkTarget:" + target); //$NON-NLS-1$ linkActions.append(",targetDir:${installFolder},linkName:" + name); //$NON-NLS-1$ linkActions.append(");"); //$NON-NLS-1$ } } if (linkActions.length() > 0) { Map<String, String> touchpointData = new HashMap<String, String>(); //we do ln during configure to avoid complicating branding which uses the install phase touchpointData.put("configure", linkActions.toString()); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); } }
private void setupLinks(InstallableUnitDescription iu, FileSetDescriptor descriptor) { String[] links = getArrayFromString(descriptor.getLinks(), ","); //$NON-NLS-1$ StringBuffer linkActions = new StringBuffer(); int i = 0; while (i < links.length) { //format is [target,name]* String target = links[i++]; if (i < links.length) { String name = links[i++]; linkActions.append("ln(linkTarget:" + target); //$NON-NLS-1$ linkActions.append(",targetDir:${installFolder},linkName:" + name); //$NON-NLS-1$ linkActions.append(");"); //$NON-NLS-1$ } } if (linkActions.length() > 0) { Map<String, String> touchpointData = new HashMap<>(); //we do ln during configure to avoid complicating branding which uses the install phase touchpointData.put("configure", linkActions.toString()); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); } }
iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
protected IInstallableUnit createFeatureRootFileIU(String featureId, String featureVersion, File location, FileSetDescriptor descriptor) { InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); iu.setSingleton(true); String id = featureId + '_' + descriptor.getKey(); iu.setId(id); Version version = Version.parseVersion(featureVersion); iu.setVersion(version); iu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(id, version)}); iu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); String configSpec = descriptor.getConfigSpec(); if (configSpec != null && configSpec.length() > 0) iu.setFilter(createFilterSpec(configSpec)); Map<String, String> touchpointData = new HashMap<String, String>(2); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("install", configurationData); //$NON-NLS-1$ String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); // prime the IU with an artifact key that will correspond to the zipped up root files. IArtifactKey key = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, iu.getId(), iu.getVersion()); iu.setArtifacts(new IArtifactKey[] {key}); setupLinks(iu, descriptor); setupPermissions(iu, descriptor); IInstallableUnit iuResult = MetadataFactory.createInstallableUnit(iu); // need to return both the iu and any files. return iuResult; }
protected IInstallableUnit createFeatureRootFileIU(String featureId, String featureVersion, File location, FileSetDescriptor descriptor) { InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); iu.setSingleton(true); String id = featureId + '_' + descriptor.getKey(); iu.setId(id); Version version = Version.parseVersion(featureVersion); iu.setVersion(version); iu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(id, version)}); iu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); String configSpec = descriptor.getConfigSpec(); if (configSpec != null && configSpec.length() > 0) iu.setFilter(createFilterSpec(configSpec)); Map<String, String> touchpointData = new HashMap<String, String>(2); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("install", configurationData); //$NON-NLS-1$ String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); // prime the IU with an artifact key that will correspond to the zipped up root files. IArtifactKey key = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, iu.getId(), iu.getVersion()); iu.setArtifacts(new IArtifactKey[] {key}); setupLinks(iu, descriptor); setupPermissions(iu, descriptor); IInstallableUnit iuResult = MetadataFactory.createInstallableUnit(iu); // need to return both the iu and any files. return iuResult; }
protected IInstallableUnit createFeatureRootFileIU(String featureId, String featureVersion, File location, FileSetDescriptor descriptor) { InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); iu.setSingleton(true); String id = featureId + '_' + descriptor.getKey(); iu.setId(id); Version version = Version.parseVersion(featureVersion); iu.setVersion(version); iu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(id, version)}); iu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); String configSpec = descriptor.getConfigSpec(); if (configSpec != null && configSpec.length() > 0) iu.setFilter(createFilterSpec(configSpec)); Map<String, String> touchpointData = new HashMap<>(2); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("install", configurationData); //$NON-NLS-1$ String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); // prime the IU with an artifact key that will correspond to the zipped up root files. IArtifactKey key = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, iu.getId(), iu.getVersion()); iu.setArtifacts(new IArtifactKey[] {key}); setupLinks(iu, descriptor); setupPermissions(iu, descriptor); IInstallableUnit iuResult = MetadataFactory.createInstallableUnit(iu); // need to return both the iu and any files. return iuResult; }
/** * Create a CU whose id is flavor+id.type.configspec with the given version. * The resultant IU has the self capability and an abstract capabilty in the flavor+id namespace * with the name id.type and the given version. This allows others to create an abstract * dependency on having one of these things around but not having to list out the configs. */ private IInstallableUnit createCU(String cuId, Version cuVersion, String cuType, String cuFlavor, String configSpec, Map<String, String> touchpointData) { InstallableUnitDescription cu = new InstallableUnitDescription(); String resultId = createCUIdString(cuId, cuType, cuFlavor, configSpec); cu.setId(resultId); cu.setVersion(cuVersion); cu.setFilter(createFilterSpec(configSpec)); IProvidedCapability selfCapability = PublisherHelper.createSelfCapability(resultId, cuVersion); String namespace = getAbstractCUCapabilityNamespace(cuId, cuType, cuFlavor, configSpec); String abstractId = getAbstractCUCapabilityId(cuId, cuType, cuFlavor, configSpec); IProvidedCapability abstractCapability = MetadataFactory.createProvidedCapability(namespace, abstractId, cuVersion); cu.setCapabilities(new IProvidedCapability[] {selfCapability, abstractCapability}); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); return MetadataFactory.createInstallableUnit(cu); }
/** * Create a CU whose id is flavor+id.type.configspec with the given version. * The resultant IU has the self capability and an abstract capabilty in the flavor+id namespace * with the name id.type and the given version. This allows others to create an abstract * dependency on having one of these things around but not having to list out the configs. */ private IInstallableUnit createCU(String cuId, Version cuVersion, String cuType, String cuFlavor, String configSpec, Map<String, String> touchpointData) { InstallableUnitDescription cu = new InstallableUnitDescription(); String resultId = createCUIdString(cuId, cuType, cuFlavor, configSpec); cu.setId(resultId); cu.setVersion(cuVersion); cu.setFilter(createFilterSpec(configSpec)); IProvidedCapability selfCapability = PublisherHelper.createSelfCapability(resultId, cuVersion); String namespace = getAbstractCUCapabilityNamespace(cuId, cuType, cuFlavor, configSpec); String abstractId = getAbstractCUCapabilityId(cuId, cuType, cuFlavor, configSpec); IProvidedCapability abstractCapability = MetadataFactory.createProvidedCapability(namespace, abstractId, cuVersion); cu.setCapabilities(new IProvidedCapability[] {selfCapability, abstractCapability}); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); return MetadataFactory.createInstallableUnit(cu); }
/** * Create a CU whose id is flavor+id.type.configspec with the given version. * The resultant IU has the self capability and an abstract capabilty in the flavor+id namespace * with the name id.type and the given version. This allows others to create an abstract * dependency on having one of these things around but not having to list out the configs. */ private IInstallableUnit createCU(String cuId, Version cuVersion, String cuType, String cuFlavor, String configSpec, Map<String, String> touchpointData) { InstallableUnitDescription cu = new InstallableUnitDescription(); String resultId = createCUIdString(cuId, cuType, cuFlavor, configSpec); cu.setId(resultId); cu.setVersion(cuVersion); cu.setFilter(createFilterSpec(configSpec)); IProvidedCapability selfCapability = PublisherHelper.createSelfCapability(resultId, cuVersion); String namespace = getAbstractCUCapabilityNamespace(cuId, cuType, cuFlavor, configSpec); String abstractId = getAbstractCUCapabilityId(cuId, cuType, cuFlavor, configSpec); IProvidedCapability abstractCapability = MetadataFactory.createProvidedCapability(namespace, abstractId, cuVersion); cu.setCapabilities(new IProvidedCapability[] {selfCapability, abstractCapability}); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); return MetadataFactory.createInstallableUnit(cu); }
/** * Publishes the IUs that cause the executable to be actually set as the launcher for * the profile */ private void publishExecutableSetter(ExecutablesDescriptor brandedExecutables, IPublisherResult result) { InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); String executableName = brandedExecutables.getExecutableName(); String id = getExecutableId() + '.' + executableName; iud.setId(id); iud.setVersion(version); iud.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); iud.setCapabilities(new IProvidedCapability[] {createSelfCapability(id, version)}); iud.setFilter(createFilterSpec(configSpec)); Map<String, String> touchpointData = new HashMap<String, String>(); touchpointData.put("configure", "setLauncherName(name:" + executableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$ iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); result.addIU(MetadataFactory.createInstallableUnit(iud), IPublisherResult.ROOT); }
/** * Publishes the IUs that cause the executable to be actually set as the launcher for * the profile */ private void publishExecutableSetter(ExecutablesDescriptor brandedExecutables, IPublisherResult result) { InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); String executableName = brandedExecutables.getExecutableName(); String id = getExecutableId() + '.' + executableName; iud.setId(id); iud.setVersion(version); iud.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); iud.setCapabilities(new IProvidedCapability[] {createSelfCapability(id, version)}); iud.setFilter(createFilterSpec(configSpec)); Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("configure", "setLauncherName(name:" + executableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$ iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); result.addIU(MetadataFactory.createInstallableUnit(iud), IPublisherResult.ROOT); }
/** * Publishes the IUs that cause the executable to be actually set as the launcher for * the profile */ private void publishExecutableSetter(ExecutablesDescriptor brandedExecutables, IPublisherResult result) { InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); String executableName = brandedExecutables.getExecutableName(); String id = getExecutableId() + '.' + executableName; iud.setId(id); iud.setVersion(version); iud.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); iud.setCapabilities(new IProvidedCapability[] {createSelfCapability(id, version)}); iud.setFilter(createFilterSpec(configSpec)); Map<String, String> touchpointData = new HashMap<String, String>(); touchpointData.put("configure", "setLauncherName(name:" + executableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$ iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); result.addIU(MetadataFactory.createInstallableUnit(iud), IPublisherResult.ROOT); }
protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) { Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class); if (currentInstructions == null) { if (advice == null || advice.isEmpty()) return; currentInstructions = CollectionUtils.emptyMap(); } ITouchpointData result = MetadataFactory.createTouchpointData(currentInstructions); if (advice != null) { for (ITouchpointAdvice entry : advice) { result = entry.getTouchpointData(result); } } iu.addTouchpointData(result); }
protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) { Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class); if (currentInstructions == null) { if (advice == null || advice.isEmpty()) return; currentInstructions = Collections.emptyMap(); } ITouchpointData result = MetadataFactory.createTouchpointData(currentInstructions); if (advice != null) { for (ITouchpointAdvice entry : advice) { result = entry.getTouchpointData(result); } } iu.addTouchpointData(result); }
protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) { Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class); if (currentInstructions == null) { if (advice == null || advice.isEmpty()) return; currentInstructions = Collections.emptyMap(); } ITouchpointData result = MetadataFactory.createTouchpointData(currentInstructions); if (advice != null) { for (ITouchpointAdvice entry : advice) { result = entry.getTouchpointData(result); } } iu.addTouchpointData(result); }
protected static void processTouchpointAdvice(InstallableUnitDescription iu, Map<String, ? extends Object> currentInstructions, IPublisherInfo info, String configSpec) { Collection<ITouchpointAdvice> advice = info.getAdvice(configSpec, false, iu.getId(), iu.getVersion(), ITouchpointAdvice.class); if (currentInstructions == null) { if (advice == null || advice.isEmpty()) return; currentInstructions = Collections.emptyMap(); } ITouchpointData result = MetadataFactory.createTouchpointData(currentInstructions); if (advice != null) { for (ITouchpointAdvice entry : advice) { result = entry.getTouchpointData(result); } } iu.addTouchpointData(result); }
private void setupPermissions(InstallableUnitDescription iu, FileSetDescriptor descriptor) { Map<String, String> touchpointData = new HashMap<String, String>(); String[][] permsList = descriptor.getPermissions(); for (int i = 0; i < permsList.length; i++) { String[] permSpec = permsList[i]; String configurationData = " chmod(targetDir:${installFolder}, targetFile:" + permSpec[1] + ", permissions:" + permSpec[0] + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("install", configurationData); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); } } }
private void setupPermissions(InstallableUnitDescription iu, FileSetDescriptor descriptor) { Map<String, String> touchpointData = new HashMap<>(); String[][] permsList = descriptor.getPermissions(); for (int i = 0; i < permsList.length; i++) { String[] permSpec = permsList[i]; String configurationData = " chmod(targetDir:${installFolder}, targetFile:" + permSpec[1] + ", permissions:" + permSpec[0] + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("install", configurationData); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); } } }
private void setupPermissions(InstallableUnitDescription iu, FileSetDescriptor descriptor) { Map<String, String> touchpointData = new HashMap<String, String>(); String[][] permsList = descriptor.getPermissions(); for (int i = 0; i < permsList.length; i++) { String[] permSpec = permsList[i]; String configurationData = " chmod(targetDir:${installFolder}, targetFile:" + permSpec[1] + ", permissions:" + permSpec[0] + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("install", configurationData); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); } } }