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.management.internal;
 
 import java.util.Map;
 import java.util.Set;
 
 
Implementation of org.eclipse.virgo.kernel.model.management.ManageableArtifact that delegates to an org.eclipse.virgo.kernel.model.Artifact for all methods and translates types that are JMX-unfriendly to types that are JMX-friendly

Concurrent Semantics
Threadsafe

 
 
     private static final String USER_REGION_NAME = "org.eclipse.virgo.region.user";
 
     private static final String GLOBAL_REGION_NAME = "global";
     
 
     private final Artifact artifact;
 
     private final boolean newModel;
 
     public DelegatingManageableArtifact(@NonNull RuntimeArtifactModelObjectNameCreator artifactObjectNameCreator, @NonNull Artifact artifactboolean newModel) {
         this. = artifactObjectNameCreator;
         this. = artifact;
         this. = newModel;
     }

    
 
     public final ObjectName[] getDependents() {
         return convertToObjectNames(this..getDependents());
     }

    
 
     public final String getName() {
         return this..getName();
     }

    
 
     public final String getState() {
         return this..getState().toString();
     }

    
 
     public final String getType() {
         return this..getType();
     }

    
 
     public final String getVersion() {
         return this..getVersion().toString();
     }

    
 
     public String getRegion() {
         return this..getRegion().getName();
     }

    
 
    public final boolean refresh() {
        return this..refresh();
    }

    
    public final void start() {
        this..start();
    }

    
    public final void stop() {
        this..stop();
    }

    
    public final void uninstall() {
        this..uninstall();
    }

    
    public final Map<StringStringgetProperties() {
        return this..getProperties();
    }

    
Convert a collection of org.eclipse.virgo.kernel.model.Artifacts to a collection of javax.management.ObjectNames

Parameters:
artifacts The org.eclipse.virgo.kernel.model.Artifacts to convert
Returns:
The javax.management.ObjectNames converted to
    private final ObjectName[] convertToObjectNames(Set<Artifactartifacts) {
        Set<ObjectNameobjectNames = new HashSet<ObjectName>(artifacts.size());
        String regionName;
        for (Artifact artifact : artifacts) {
            regionName = artifact.getRegion().getName();
            if( || (!.equals(regionName) && !.equals(regionName)) ){
                objectNames.add(.createArtifactModel(artifact));
            } else {
                objectNames.add(.createModel(artifact));
            }
        }
        return objectNames.toArray(new ObjectName[objectNames.size()]);
    }
New to GrepCode? Check out our FAQ X