/** * Create an instance of {@link Features} * * @return the features. */ public Features createFeaturesRoot() { return new Features(); }
@Override public String getFeatureXml(Feature feature) { try { StringWriter sw = new StringWriter(); Features r = new Features(); r.getFeature().add((org.apache.karaf.features.internal.model.Feature) feature); JaxbUtil.marshal(r, sw); String[] strs = sw.toString().split("\n"); StringJoiner joiner = new StringJoiner("\n"); for (int i = 2; i < strs.length - 1; i++) { joiner.add(strs[i]); } return joiner.toString(); } catch (JAXBException e) { return null; } }
public void execute() throws MojoExecutionException, MojoFailureException { Set<Feature> featuresSet = resolveFeatures(); if (mergedFeature) { Feature feature = oneVersion ? mergeFeatureOneVersion(featuresSet) : mergeFeature(featuresSet); featuresSet = new HashSet<>(); featuresSet.add(feature); } try { metaDataFile.getParentFile().mkdirs(); Features features = new Features(); features.getFeature().addAll(featuresSet); try (OutputStream os = new FileOutputStream(metaDataFile)) { JaxbUtil.marshal(features, os); } } catch (Exception e) { throw new RuntimeException("Error writing feature meta data to " + metaDataFile + ": " + e.getMessage(), e); } }
public void execute() throws MojoExecutionException, MojoFailureException { Set<Feature> featuresSet = resolveFeatures(); if (mergedFeature) { Feature feature = oneVersion ? mergeFeatureOneVersion(featuresSet) : mergeFeature(featuresSet); featuresSet = new HashSet<>(); featuresSet.add(feature); } try { metaDataFile.getParentFile().mkdirs(); Features features = new Features(); features.getFeature().addAll(featuresSet); try (OutputStream os = new FileOutputStream(metaDataFile)) { JaxbUtil.marshal(features, os); } } catch (Exception e) { throw new RuntimeException("Error writing feature meta data to " + metaDataFile + ": " + e.getMessage(), e); } }
@Override public void register(String url) throws Exception { File storage = new File(STORAGE); Features features = new Features(); if (storage.exists()) { features = JaxbUtil.unmarshal(storage.getAbsolutePath(), true); } else { storage.getParentFile().mkdirs(); storage.createNewFile(); } features.setName("cave-gateway"); if (isFeaturesRepositoryRegistered(url, features.getRepository())) { throw new IllegalArgumentException("Features repository " + url + " already registered in the gateway"); } features.getRepository().add(url); marshalStorageFile(storage, features); }
@Override public Repository create(URI uri, boolean validate) { if (featuresProcessor != null && featuresProcessor.isRepositoryBlacklisted(uri.toString())) { return new RepositoryImpl(uri, new Features(), true); } RepositoryImpl repository = new RepositoryImpl(uri, validate); if (featuresProcessor != null) { // maybe it could be done better - first we have to set if entire repo is blacklisted repository.setBlacklisted(featuresProcessor.isRepositoryBlacklisted(uri.toString())); // processing features will take the above flag into account to blacklist (if needed) the features repository.processFeatures(featuresProcessor); } return repository; }
List<String> bundles, List<org.apache.karaf.cave.deployer.api.Config> configs) throws Exception { Features featuresModel = new Features(); featuresModel.setName(feature);
generated.getBundle().add(bun); Features rep = new Features(); rep.setName(UUID.randomUUID().toString()); rep.getRepository().addAll(bootEffective.getRepositories());
generated.getBundle().add(bun); Features rep = new Features(); rep.setName(UUID.randomUUID().toString()); rep.getRepository().addAll(bootEffective.getRepositories());