Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.osgi.framework.internal;
 
 /*
  * #%L
  * JBossOSGi Framework
  * %%
  * Copyright (C) 2010 - 2012 JBoss by Red Hat
  * %%
  * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 2.1 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 *
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/lgpl-2.1.html>.
 * #L%
 */
import static org.jboss.osgi.framework.FrameworkLogger.LOGGER;
A service that provides persistent bundles on framework startup.

Author(s):
thomas.diesler@jboss.com
Since:
04-Apr-2011
    }
    @Override
    protected void addServiceDependencies(ServiceBuilder<Voidbuilder) {
        super.addServiceDependencies(builder);
    }
    @Override
    public void start(StartContext contextthrows StartException {
        final DeploymentProvider deploymentPlugin = .getValue();
        final ServiceTarget serviceTarget = context.getChildTarget();
        final BundleStorage storageStatePlugin = .getValue();
        final Set<StorageStatestorageStates = new HashSet<StorageState>(storageStatePlugin.getStorageStates());
        // Reduce the set by the bundles that are already installed
        Iterator<StorageStateiterator = storageStates.iterator();
        while (iterator.hasNext()) {
            StorageState storageState = iterator.next();
            if (getBundleManager().getBundleById(storageState.getBundleId()) != null) {
                iterator.remove();
            }
        }
        List<Deploymentdeployments = new ArrayList<Deployment>();
        for (StorageState storageState : storageStates) {
            try {
                Deployment dep = deploymentPlugin.createDeployment(storageState);
                deployments.add(dep);
            } catch (BundleException ex) {
                .errorStateCannotInstallInitialBundle(exstorageState.getLocation());
            }
        }
        // Install the bundles from the given locations
        installBootstrapBundles(serviceTargetdeployments);
    }
New to GrepCode? Check out our FAQ X