public void assembleFeature()

in deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/DeployerServiceImpl.java [420:477]


    public void assembleFeature(String groupId,
                                String artifactId,
                                String version,
                                String repositoryUrl,
                                String feature,
                                List<String> featuresRepositoryUrls,
                                List<String> features,
                                List<String> bundles,
                                List<org.apache.karaf.cave.deployer.Config> configs) throws Exception {
        Features featuresModel = new Features();
        featuresModel.setName(feature);
        // add features repository
        if (featuresRepositoryUrls != null) {
            for (String featuresRepositoryUrl : featuresRepositoryUrls) {
                featuresModel.getRepository().add(featuresRepositoryUrl);
            }
        }
        // add wrap feature
        Feature wrapFeature = new Feature();
        wrapFeature.setName(feature);
        wrapFeature.setVersion(version);
        // add inner features
        if (features != null) {
            for (String innerFeature : features) {
                Dependency dependency = new Dependency();
                dependency.setName(innerFeature);
                wrapFeature.getFeature().add(dependency);
            }
        }
        // add bundles
        if (bundles != null) {
            for (String innerBundle : bundles) {
                Bundle bundle = new Bundle();
                bundle.setLocation(innerBundle);
                wrapFeature.getBundle().add(bundle);
            }
        }
        // add config
        if (configs != null) {
            for (org.apache.karaf.cave.deployer.Config config : configs) {
                Config modelConfig = new Config();
                modelConfig.setName(config.getPid());
                StringBuilder builder = new StringBuilder();
                if (config.getProperties() != null) {
                    for (String key : config.getProperties().keySet()) {
                        builder.append(key).append("=").append(config.getProperties().get(key)).append('\n');
                    }
                }
                modelConfig.setValue(builder.toString());
                wrapFeature.getConfig().add(modelConfig);
            }
        }
        featuresModel.getFeature().add(wrapFeature);
        File featuresFile = File.createTempFile(artifactId, "xml");
        FileOutputStream os = new FileOutputStream(featuresFile);
        JaxbUtil.marshal(featuresModel, os);
        uploadArtifact(groupId, artifactId, version, "xml", "features", featuresFile, repositoryUrl);
    }