Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008, 2010 VMware Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: VMware Inc. - initial contribution /
 
 
 package org.eclipse.virgo.kernel.model.internal.deployer;
 
 
 import  org.eclipse.equinox.region.RegionDigraph;
 import  org.eclipse.equinox.region.Region;
An initializer responsible for registering a ModelInstallArtifactLifecycleListener and enumerating any existing org.eclipse.virgo.kernel.install.artifact.InstallArtifact objects from the Kernel deployer

Concurrent Semantics
Thread safe.

 
 
     private static final String USER_REGION_NAME = "org.eclipse.virgo.region.user";
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
 
     private final BundleContext bundleContext;
 
     private final RuntimeArtifactModel runtimeArtifactModel;
 
 
     private final RegionDigraph regionDigraph;
 
     private final Region globalRegion;
     
 
     public ModelInstallArtifactLifecycleListenerInitializer(@NonNull RuntimeArtifactRepository artifactRepository, @NonNull BundleContext bundleContext, @NonNull RuntimeArtifactModel runtimeArtifactModel, @NonNull RegionDigraph regionDigraph, @NonNull Region globalRegion, @NonNull SpringContextAccessor springContextAccessor) {
         this. = artifactRepository;
         this. = bundleContext;
         this. = runtimeArtifactModel;
         this. = regionDigraph;
         this. = globalRegion;
         this. = springContextAccessor;
     }

    
Registers a ModelInstallArtifactLifecycleListener with the service registry. Enumerates any existing org.eclipse.virgo.kernel.install.artifact.InstallArtifact objects that exist from the Kernel deployer
 
     @PostConstruct
     public void initialize() {
         for (DeploymentIdentity deploymentIdentity : this..getDeploymentIdentities()) {
             InstallArtifact installArtifact = this..get(deploymentIdentity);
             try {
                 if (installArtifact instanceof PlanInstallArtifact) {
                     this..add(new DeployerCompositeArtifact(this., (PlanInstallArtifactinstallArtifactthis.));
                 } else if (installArtifact instanceof BundleInstallArtifact) {
                     this..remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), getRegion());
                     BundleInstallArtifact bundleInstallArtifact = (BundleInstallArtifactinstallArtifact;
                     this..add(new DeployerBundleArtifact(this.bundleInstallArtifactgetRegion(), this.));
                 } else {
                     this..remove(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), null);
                     this..add(new DeployerArtifact(this.installArtifactthis.));
                 }
             } catch (Exception e) {
                 .error(String.format("Exception adding deployer artifact '%s:%s' to the repository"installArtifact.getName(),
                     installArtifact.getVersion().toString()), e);
             }
         }
     }

    
Unregisters the listener from the service registry
    public void destroy() {
        this..unregisterAll();
    }
    
    private Region getRegion(String name){
        return this..getRegion(name);
    }
    
New to GrepCode? Check out our FAQ X