Package org.apache.sling.maven.projectsupport.bundlelist.v1_0_0

Examples of org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle


    public List<Bundle> toBundleList() {
        ArrayList<Bundle> bundleList = new ArrayList<Bundle>();

        if (bundles == null) {
            Bundle bnd = new Bundle();
            bnd.setArtifactId(artifactId);
            bnd.setGroupId(groupId);
            bnd.setVersion(version);
            if (type != null) {
                bnd.setType(type);
            }
            bnd.setClassifier(classifier);
            bnd.setStartLevel(startLevel);
            bundleList.add(bnd);
        } else {
            for (ArtifactDefinition bundle : bundles) {
                bundleList.addAll(bundle.toBundleList());
            }
View Full Code Here


    public abstract List<StartLevel> getStartLevels();

    public Bundle get(Bundle bundle, boolean compareVersions) {
        for (StartLevel sl : getStartLevels()) {
            Bundle foundBundle = sl.getBundle(bundle, compareVersions);
            if (foundBundle != null) {
                return foundBundle;
            }
        }
        return null;
View Full Code Here

     * Merge bundle into a start level using the supplied level if present.
     * @param mergeStartLevel
     * @param newBnd
     */
    private void add(StartLevel mergeStartLevel, Bundle newBnd) {
        Bundle current = get(newBnd, false);
        if (current != null) {
            final Maven2OsgiConverter converter = new DefaultMaven2OsgiConverter();

            // compare versions, the highest will be used
            final Version newVersion = new Version(converter.getVersion(newBnd.getVersion()));
            final Version oldVersion = new Version(converter.getVersion(current.getVersion()));
            if ( newVersion.compareTo(oldVersion) > 0 ) {
                current.setVersion(newBnd.getVersion());
            }
        } else {
            StartLevel startLevel = null;
            if ( mergeStartLevel == null || newBnd.getStartLevel() != 0) {
                startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
View Full Code Here

        log.info("Getting bundle list {}", paxUrl);
        File tmp = null;
        final Collection<String> testRunModes = getTestRunModes();
        try {
            tmp = dumpMvnUrlToTmpFile(paxUrl);
            final BundleList list = BundleListUtils.readBundleList(tmp);
            int counter = 0;
            for(StartLevel s : list.getStartLevels()) {
               
                // Start level < 0 means bootstrap in our bundle lists
                final int startLevel = s.getStartLevel() < 0 ? 1 : s.getStartLevel();
               
                for(Bundle b : s.getBundles()) {
View Full Code Here

        Element feature = new Element("feature");
        features.addContent(feature);
        feature.setAttribute("name", featureName);
        feature.setAttribute("version", featureVersion);

        BundleList bundleList = getInitializedBundleList();
        for (StartLevel level : bundleList.getStartLevels()) {
            for (Bundle bundle : level.getBundles()) {
                String bundleRef = String.format("mvn:%s/%s/%s", bundle.getGroupId(), bundle.getArtifactId(), bundle
                        .getVersion());
                feature.addContent(new Element("bundle").setText(bundleRef));
            }
View Full Code Here

    private boolean failOnSnapshot;

    @Override
    protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
        List<Bundle> snapshots = new ArrayList<Bundle>();
        BundleList bundleList = getInitializedBundleList();
        for (StartLevel level : bundleList.getStartLevels()) {
            for (Bundle bundle : level.getBundles()) {
                if (isSnapshot(bundle)) {
                    snapshots.add(bundle);
                }
            }
View Full Code Here

    private static final String CLASSIFIER = "bundles";

    public static final String[] DEFAULT_INCLUDES = { "**/**" };

    private void addBundles() throws MojoExecutionException {
        BundleList bundles = getInitializedBundleList();

        for (StartLevel level : bundles.getStartLevels()) {
            for (Bundle bundle : level.getBundles()) {
                Artifact artifact = getArtifact(new ArtifactDefinition(bundle,
                        level.getStartLevel()));
                final String destFileName = getPathForArtifact(level.getStartLevel(), bundle.getRunModes(), artifact.getFile().getName());
                try {
View Full Code Here

    protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
        FileWriter out = null;
        try {
            out = new FileWriter(outputFile);

            BundleList bundleList = getInitializedBundleList();
            for (StartLevel level : bundleList.getStartLevels()) {
                for (Bundle bundle : level.getBundles()) {
                    String line = String.format("mvn:%s/%s/%s@%d\n", bundle.getGroupId(), bundle.getArtifactId(),
                            bundle.getVersion(), level.getStartLevel());
                    out.write(line);
                }
View Full Code Here

    private VersionsHelper helper;

    @SuppressWarnings("unchecked")
    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            BundleList bundleList = readBundleList(bundleListFile);

            Set<Dependency> bundlesAsDependencies = new HashSet<Dependency>();

            for (StartLevel startLevel : bundleList.getStartLevels()) {
                for (Bundle bundle : startLevel.getBundles()) {
                    bundlesAsDependencies.add(asDependency(bundle));
                }
            }
View Full Code Here

                }
            }
        }

        private void addBundleListDependencies() throws IOException, XmlPullParserException, MojoExecutionException {
            BundleList bundleList;

            if (bundleListFile.exists()) {
                bundleList = readBundleList(bundleListFile);
            } else {
                bundleList = new BundleList();
            }

            if (additionalBundles != null) {
                for (ArtifactDefinition def : additionalBundles) {
                    bundleList.add(def.toBundleList());
                }
            }

            interpolateProperties(bundleList, project, session);

            for (StartLevel startLevel : bundleList.getStartLevels()) {
                for (Bundle bundle : startLevel.getBundles()) {
                    log.debug(String.format("adding bundle (%s) from bundle list to dependencies of project %s", bundle, project));
                    project.getDependencies().addAll(ArtifactDefinition.toDependencyList(bundle, PROVIDED));
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.