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 java.util.Map;
 import java.util.Set;
 
 import  org.eclipse.equinox.region.Region;
Implementation of Artifact that delegates to a Kernel InstallArtifact

Concurrent Semantics
Threadsafe

 
 class DeployerArtifact extends AbstractArtifact {
 
     private final InstallArtifact installArtifact;
     
     public DeployerArtifact(@NonNull BundleContext bundleContext, @NonNull InstallArtifact installArtifact, Region region) {
         super(bundleContextinstallArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), region);
         this. = installArtifact;
     }

    
 
     public final ArtifactState getState() {
         return mapInstallArtifactState(this..getState());
     }

    
 
     public final void start() {
         try {
             BlockingAbortableSignal signal = new BlockingAbortableSignal();
             this..start(signal);
             try {
                 if (!signal.awaitCompletion(5, .)) {
                 	if(signal.isAborted()){
                 		throw new RuntimeException("Started aborted");
                 	} else {
                 		throw new RuntimeException("Started failed");
                 	}
                 }
             } catch (FailureSignalledException fse) {
                 throw new RuntimeException(fse.getCause());
             }
         } catch (DeploymentException e) {
             throw new RuntimeException(e);
         }
     }

    
 
     public final void stop() {
         try {
             this..stop();
         } catch (DeploymentException e) {
             throw new RuntimeException(e);
         }
     }

    
 
     public final void uninstall() {
         try {
             this..uninstall();
         } catch (DeploymentException e) {
             throw new RuntimeException(e);
         }
    }

    
    public final boolean refresh() {
        try {
            return this..refresh();
        } catch (DeploymentException e) {
            throw new RuntimeException(e);
        }
    }

    
    public Map<StringStringgetProperties() {
        Set<StringpropertyNames = this..getPropertyNames();
        Map<StringStringresult = new HashMap<StringString>(propertyNames.size());
        for (String propertyName : propertyNames) {
            String propertyValue = this..getProperty(propertyName);
            // The property may have been deleted concurrently.
            if (propertyValue != null) {
                result.put(propertyNamepropertyValue);
            }
        }
        return Collections.unmodifiableMap(result);
    }
    private ArtifactState mapInstallArtifactState(State state) {
        if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else if (. == state) {
            return .;
        } else {
            return .;
        }
    }
New to GrepCode? Check out our FAQ X