org.springframework.roo.project
Class ProjectMetadata

java.lang.Object
  extended by org.springframework.roo.metadata.AbstractMetadataItem
      extended by org.springframework.roo.project.ProjectMetadata
All Implemented Interfaces:
org.springframework.roo.metadata.MetadataItem

public class ProjectMetadata
extends org.springframework.roo.metadata.AbstractMetadataItem

Represents a project.

Each ROO instance has a single project active at any time. Different project add-ons are expected to subclass this ProjectMetadata and implement the abstract methods.

The ProjectMetadata offers convenience methods for acquiring the project name, top level project package name, registered dependencies and path name resolution services.

Concrete subclasses should register the correct dependencies the particular project build system requires, plus read those files whenever they change. Subclasses should also provide a valid PathResolver implementation that understands the target project layout.

Since:
1.0
Author:
Ben Alex, Stefan Schmidt, Alan Stewart

Field Summary
 
Fields inherited from class org.springframework.roo.metadata.AbstractMetadataItem
valid
 
Constructor Summary
ProjectMetadata(org.springframework.roo.model.JavaPackage topLevelPackage, String projectName, Set<Dependency> dependencies, Set<Plugin> buildPlugins, Set<Repository> repositories, Set<Repository> pluginRepositories, Set<Property> pomProperties, PathResolver pathResolver)
           
 
Method Summary
 Set<Plugin> getBuildPlugin()
           
 Set<Plugin> getBuildPluginsExcludingVersion(Plugin plugin)
          Locates any build plugins which match the presented plugin, excluding the version number.
 Set<Dependency> getDependencies()
           
 Set<Dependency> getDependenciesExcludingVersion(Dependency dependency)
          Locates any dependencies which match the presented dependency, excluding the version number.
 PathResolver getPathResolver()
           
static String getProjectIdentifier()
           
 String getProjectName()
           
 Set<Property> getPropertiesExcludingValue(Property property)
          Locates any properties which match the presented property, excluding the value.
 org.springframework.roo.model.JavaPackage getTopLevelPackage()
           
 boolean isBuildPluginRegistered(Plugin plugin)
          Convenience method for determining whether a particular build plugin is registered.
 boolean isDependencyRegistered(Dependency dependency)
          Convenience method for determining whether a particular dependency is registered.
 boolean isPluginRepositoryRegistered(Repository repository)
          Convenience method for determining whether a particular plugin repository is registered.
 boolean isPropertyRegistered(Property property)
          Convenience method for determining whether a particular pom property is registered.
 boolean isRepositoryRegistered(Repository repository)
          Convenience method for determining whether a particular repository is registered.
 String toString()
           
 
Methods inherited from class org.springframework.roo.metadata.AbstractMetadataItem
getId, isValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProjectMetadata

public ProjectMetadata(org.springframework.roo.model.JavaPackage topLevelPackage,
                       String projectName,
                       Set<Dependency> dependencies,
                       Set<Plugin> buildPlugins,
                       Set<Repository> repositories,
                       Set<Repository> pluginRepositories,
                       Set<Property> pomProperties,
                       PathResolver pathResolver)
Method Detail

getProjectIdentifier

public static final String getProjectIdentifier()

isDependencyRegistered

public boolean isDependencyRegistered(Dependency dependency)
Convenience method for determining whether a particular dependency is registered.

Parameters:
dependency - to check (required)
Returns:
whether the dependency is currently registered or not

isRepositoryRegistered

public boolean isRepositoryRegistered(Repository repository)
Convenience method for determining whether a particular repository is registered.

Parameters:
repository - to check (required)
Returns:
whether the repository is currently registered or not

isPluginRepositoryRegistered

public boolean isPluginRepositoryRegistered(Repository repository)
Convenience method for determining whether a particular plugin repository is registered.

Parameters:
plugin - repository to check (required)
Returns:
whether the plugin repository is currently registered or not

isBuildPluginRegistered

public boolean isBuildPluginRegistered(Plugin plugin)
Convenience method for determining whether a particular build plugin is registered.

Parameters:
plugin - to check (required)
Returns:
whether the build plugin is currently registered or not

isPropertyRegistered

public boolean isPropertyRegistered(Property property)
Convenience method for determining whether a particular pom property is registered.

Parameters:
property - to check (required)
Returns:
whether the property is currently registered or not

getTopLevelPackage

public org.springframework.roo.model.JavaPackage getTopLevelPackage()

getProjectName

public String getProjectName()

getPathResolver

public PathResolver getPathResolver()

getDependencies

public Set<Dependency> getDependencies()
Returns:
an unmodifiable representation of the dependencies (never null, but may be empty)

getDependenciesExcludingVersion

public Set<Dependency> getDependenciesExcludingVersion(Dependency dependency)
Locates any dependencies which match the presented dependency, excluding the version number. This is useful for upgrade use cases, where it is necessary to locate any dependencies with the same group, artifact and type identifications so that they can be removed.

Parameters:
dependency - to locate (required; note the version number is ignored in comparisons)
Returns:
any matching dependencies (never returns null, but may return an empty Set)

getBuildPlugin

public Set<Plugin> getBuildPlugin()
Returns:
an unmodifiable collection of the build plugins (never null, but may be empty).

getBuildPluginsExcludingVersion

public Set<Plugin> getBuildPluginsExcludingVersion(Plugin plugin)
Locates any build plugins which match the presented plugin, excluding the version number. This is useful for upgrade use cases, where it is necessary to locate any build plugins with the same group and artifact identifications so that they can be removed.

Parameters:
plugin - to locate (required; note the version number is ignored in comparisons)
Returns:
any matching plugins (never returns null, but may return an empty Set)

getPropertiesExcludingValue

public Set<Property> getPropertiesExcludingValue(Property property)
Locates any properties which match the presented property, excluding the value. This is useful for upgrade use cases, where it is necessary to locate any properties with the name so that they can be removed.

Parameters:
property - to locate (required; note the value is ignored in comparisons)
Returns:
any matching properties (never returns null, but may return an empty Set)

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.