org.kuali.maven.common
Class UrlBuilder

java.lang.Object
  extended by org.kuali.maven.common.UrlBuilder

public class UrlBuilder
extends Object

Utility class for working with URL's related to Maven web site generation


Constructor Summary
UrlBuilder()
           
 
Method Summary
protected  void addProjectTokens(org.apache.maven.project.MavenProject project, SiteContext context, List<String> tokens)
          Add appropriate values to the list of tokens
protected  void buildPath(org.apache.maven.project.MavenProject project, List<org.apache.maven.project.MavenProject> projects)
          Traverse the hierarchy of projects and flatten it into a List
 boolean containsUnresolvedProperty(String s)
          Return true if the string contains "${", false otherwise.
 boolean determineMatch(String generatedUrl, String mavenUrl, SiteContext context, org.apache.maven.project.MavenProject project)
           
protected  String getDownloadPath(org.apache.maven.project.MavenProject project, SiteContext context)
          Decide between "snapshot", "release", and "external"
 String getDownloadUrl(org.apache.maven.project.MavenProject project, SiteContext context)
          Return the fully qualified URL for downloading a Kuali artifact from Kuali's Maven repo.
protected  String getGroupIdPath(String groupId)
          Replace any dots with backslashes for the groupId passed in.
 org.apache.maven.project.MavenProject getMavenProject(String gav)
          Given a GAV in the form [groupId]:[artifactId]:[version] return a MavenProject object that has groupId, artifactId, and version set
 List<org.apache.maven.project.MavenProject> getMavenProjects(List<String> gavs)
          Given a list of GAV's in the form [groupId]:[artifactId]:[version] return MavenProject objects with groupId, artifactId, and version set
protected  List<org.apache.maven.project.MavenProject> getProjectPath(org.apache.maven.project.MavenProject project)
          Return a List representing the complete hierarchy for this project.
 String getPublicUrl(org.apache.maven.project.MavenProject project, SiteContext context)
          Return the fully qualified url for public access to the web site
 String getPublishUrl(org.apache.maven.project.MavenProject project, SiteContext context)
          Return the fully qualified url for publishing the web site
 String getSitePath(org.apache.maven.project.MavenProject project, SiteContext context)
          Return the portion of the url to the right of the hostname
protected  String getSiteUrl(org.apache.maven.project.MavenProject project, SiteContext context, String urlBase)
          Return a fully qualified url
protected  List<String> getTopLevelTokens(org.apache.maven.project.MavenProject project, SiteContext context)
          Return the appropriate tokens for this top level project
protected  String getTrimmedGroupId(org.apache.maven.project.MavenProject project, String organizationGroupId)
          Return the non-redundant portion of the group id.
protected  List<String> getUrlTokens(List<org.apache.maven.project.MavenProject> projects, SiteContext context)
          Return appropriate url tokens for the list of projects representing the path of projects from the highest level pom to our current project
protected  List<String> getUrlTokens(org.apache.maven.project.MavenProject project, SiteContext context)
          Return a list of tokens representing url paths for this project
protected  boolean isAppendArtifactId(org.apache.maven.project.MavenProject project, String trimmedGroupId)
          Return true if the artifact id should be appended to the url for site publication.
protected  boolean isEmpty(Collection<?> c)
          Return true if the Collection passed in is null or size zero, false otherwise
protected  boolean isMatch(org.apache.maven.project.MavenProject project, List<org.apache.maven.project.MavenProject> targetProjects)
          Return true if groupId + artifactId of "project" matches a groupId + artifactId from "targetProjects"
protected  boolean isMatch(org.apache.maven.project.MavenProject project1, org.apache.maven.project.MavenProject project2)
          Return true if the groupId's and artifactId's match
protected  boolean isOrganizationProject(org.apache.maven.project.MavenProject project, String organizationGroupId)
          Return true if the group id of the project matches organization group id, false otherwise.
protected  boolean isSnapshot(String version, String snapshotSnippet)
          Return true if version contains snapshotSnippet (case insensitive)
protected  boolean isTargetGroupId(org.apache.maven.project.MavenProject project, String groupId)
          Return true if the groupId of the project positively matches the groupId passed in.
protected  boolean isTopLevelProject(org.apache.maven.project.MavenProject project, List<org.apache.maven.project.MavenProject> orgPoms)
          Return true if the project has no parent, OR is one of the official org POM's.
 boolean isUnresolved(String s)
          Return true if the string is, null, empty, or contains an unresolved property
 boolean isUrlMatch(String generatedUrl, String mavenUrl)
          Return true if the 2 urls are exactly the same or if the only thing different about them is a trailing slash
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlBuilder

public UrlBuilder()
Method Detail

getPublishUrl

public String getPublishUrl(org.apache.maven.project.MavenProject project,
                            SiteContext context)
Return the fully qualified url for publishing the web site


getPublicUrl

public String getPublicUrl(org.apache.maven.project.MavenProject project,
                           SiteContext context)
Return the fully qualified url for public access to the web site


isTargetGroupId

protected boolean isTargetGroupId(org.apache.maven.project.MavenProject project,
                                  String groupId)
Return true if the groupId of the project positively matches the groupId passed in. False otherwise.


getTrimmedGroupId

protected String getTrimmedGroupId(org.apache.maven.project.MavenProject project,
                                   String organizationGroupId)
Return the non-redundant portion of the group id. Given a project with a groupId of "org.kuali.maven.plugins" and an organizationGroupId of "org.kuali" return "maven.plugins"


getGroupIdPath

protected String getGroupIdPath(String groupId)
Replace any dots with backslashes for the groupId passed in.


isTopLevelProject

protected boolean isTopLevelProject(org.apache.maven.project.MavenProject project,
                                    List<org.apache.maven.project.MavenProject> orgPoms)
Return true if the project has no parent, OR is one of the official org POM's. False otherwise.


isMatch

protected boolean isMatch(org.apache.maven.project.MavenProject project,
                          List<org.apache.maven.project.MavenProject> targetProjects)
Return true if groupId + artifactId of "project" matches a groupId + artifactId from "targetProjects"


isMatch

protected boolean isMatch(org.apache.maven.project.MavenProject project1,
                          org.apache.maven.project.MavenProject project2)
Return true if the groupId's and artifactId's match


isAppendArtifactId

protected boolean isAppendArtifactId(org.apache.maven.project.MavenProject project,
                                     String trimmedGroupId)
Return true if the artifact id should be appended to the url for site publication. This method returns true, unless we have a multi-module project where the top level project's artifact id matches the final portion of the groupId. For example, the Kuali Student top level pom has the groupId "org.kuali.student" and the artifactId "student". We want to translate that groupId + artifactId into "site.kuali.org/student" NOT "site.kuali.org/student/student"


getSiteUrl

protected String getSiteUrl(org.apache.maven.project.MavenProject project,
                            SiteContext context,
                            String urlBase)
Return a fully qualified url


getSitePath

public String getSitePath(org.apache.maven.project.MavenProject project,
                          SiteContext context)
Return the portion of the url to the right of the hostname


getUrlTokens

protected List<String> getUrlTokens(org.apache.maven.project.MavenProject project,
                                    SiteContext context)
Return a list of tokens representing url paths for this project


getUrlTokens

protected List<String> getUrlTokens(List<org.apache.maven.project.MavenProject> projects,
                                    SiteContext context)
Return appropriate url tokens for the list of projects representing the path of projects from the highest level pom to our current project


addProjectTokens

protected void addProjectTokens(org.apache.maven.project.MavenProject project,
                                SiteContext context,
                                List<String> tokens)
Add appropriate values to the list of tokens


getTopLevelTokens

protected List<String> getTopLevelTokens(org.apache.maven.project.MavenProject project,
                                         SiteContext context)
Return the appropriate tokens for this top level project


getProjectPath

protected List<org.apache.maven.project.MavenProject> getProjectPath(org.apache.maven.project.MavenProject project)
Return a List representing the complete hierarchy for this project. The list is ordered where the top level pom is first, and the current project is last


buildPath

protected void buildPath(org.apache.maven.project.MavenProject project,
                         List<org.apache.maven.project.MavenProject> projects)
Traverse the hierarchy of projects and flatten it into a List


getDownloadUrl

public String getDownloadUrl(org.apache.maven.project.MavenProject project,
                             SiteContext context)
Return the fully qualified URL for downloading a Kuali artifact from Kuali's Maven repo.


getDownloadPath

protected String getDownloadPath(org.apache.maven.project.MavenProject project,
                                 SiteContext context)
Decide between "snapshot", "release", and "external"


isOrganizationProject

protected boolean isOrganizationProject(org.apache.maven.project.MavenProject project,
                                        String organizationGroupId)
Return true if the group id of the project matches organization group id, false otherwise.


isSnapshot

protected boolean isSnapshot(String version,
                             String snapshotSnippet)
Return true if version contains snapshotSnippet (case insensitive)


isEmpty

protected boolean isEmpty(Collection<?> c)
Return true if the Collection passed in is null or size zero, false otherwise


containsUnresolvedProperty

public boolean containsUnresolvedProperty(String s)
Return true if the string contains "${", false otherwise.


isUnresolved

public boolean isUnresolved(String s)
Return true if the string is, null, empty, or contains an unresolved property


determineMatch

public boolean determineMatch(String generatedUrl,
                              String mavenUrl,
                              SiteContext context,
                              org.apache.maven.project.MavenProject project)

isUrlMatch

public boolean isUrlMatch(String generatedUrl,
                          String mavenUrl)
Return true if the 2 urls are exactly the same or if the only thing different about them is a trailing slash


getMavenProjects

public List<org.apache.maven.project.MavenProject> getMavenProjects(List<String> gavs)
Given a list of GAV's in the form [groupId]:[artifactId]:[version] return MavenProject objects with groupId, artifactId, and version set


getMavenProject

public org.apache.maven.project.MavenProject getMavenProject(String gav)
Given a GAV in the form [groupId]:[artifactId]:[version] return a MavenProject object that has groupId, artifactId, and version set



Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.