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  org.eclipse.equinox.region.Region;
The default implementation of RuntimeArtifactModelObjectNameCreator. This implementation creates names based on the following pattern:

<domain>:type=ArtifactModel,artifact-type=<type>,name=<name>,version=<version>,region=<region> and <domain>:type=Model,artifact-type=<type>,name=<name>,version=<version> Concurrent Semantics
Threadsafe

 
 
     private static final String ARTIFACTS_FORMAT = "%s:type=Model,*";
 
     private static final String ALL_ARTIFACTS_FORMAT = "%s:type=*Model,*";
 
     private static final String ARTIFACTS_OF_TYPE_FORMAT = "%s:type=Model,artifact-type=%s,*";
 
     private static final String ARTIFACTS_OF_TYPE_AND_NAME_FORMAT = "%s:type=Model,artifact-type=%s,name=%s,*";
 
     private static final String ARTIFACT_FORMAT = "%s:type=Model,artifact-type=%s,name=%s,version=%s";
     
     private static final String EXTENDED_ARTIFACT_FORMAT = "%s:type=ArtifactModel,artifact-type=%s,name=%s,version=%s,region=%s";
 
     private static final String KEY_TYPE = "artifact-type";
 
     private static final String KEY_NAME = "name";
 
     private static final String KEY_VERSION = "version";
 
     private final String domain;
 
         this. = domain;
     }

    
 
     public ObjectName createModel(@NonNull Artifact artifact) {
         return createModel(artifact.getType(), artifact.getName(), artifact.getVersion());
     }

    
 
     public ObjectName createArtifactModel(@NonNull Artifact artifact) {
         return createArtifactModel(artifact.getType(), artifact.getName(), artifact.getVersion(), artifact.getRegion());
     }

    
 
     public ObjectName createModel(String typeString nameVersion version) {
         return createObjectName(String.format(this.typenameversion));
     }

    
 
     public ObjectName createArtifactModel(String typeString nameVersion version, Region region) {
         return createObjectName(String.format(this.typenameversionregion.getName()));
     }

    
 
     public ObjectName createArtifactsOfTypeQuery(String type) {
         return createObjectName(String.format(this.type));
     }

    
 
    public ObjectName createArtifactVersionsQuery(String typeString name) {
        return createObjectName(String.format(this.typename));
    }

    
    public ObjectName createArtifactsQuery() {
        return createObjectName(String.format(this.));
    }

    
        return createObjectName(String.format(this.));
    }

    
    public String getType(ObjectName objectName) {
        return objectName.getKeyProperty();
    }

    
    public String getName(ObjectName objectName) {
        return objectName.getKeyProperty();
    }

    
    public String getVersion(ObjectName objectName) {
        return objectName.getKeyProperty();
    }
    private ObjectName createObjectName(String objectName) {
        try {
            return new ObjectName(objectName);
        } catch (MalformedObjectNameException e) {
            throw new RuntimeException(String.format("Unable to create object name '%s'"objectName), e);
        } catch (NullPointerException e) {
            throw new RuntimeException(String.format("Unable to create object name '%s'"objectName), e);
        }
    }
New to GrepCode? Check out our FAQ X