~ubuntu-branches/ubuntu/utopic/maven-enforcer/utopic

« back to all changes in this revision

Viewing changes to enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-12 22:30:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: package-import@ubuntu.com-20110912223016-e2pk04avoq8bur7t
Tags: 1.0-1
* Team upload
* New upstream release.
* Add more Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.apache.maven.plugins.enforcer.utils;
 
2
 
1
3
/*
2
4
 * Licensed to the Apache Software Foundation (ASF) under one
3
5
 * or more contributor license agreements.  See the NOTICE file
16
18
 * specific language governing permissions and limitations
17
19
 * under the License.
18
20
 */
19
 
package org.apache.maven.plugins.enforcer.utils;
20
21
 
21
22
import java.io.File;
22
23
import java.io.IOException;
45
46
// TODO: Auto-generated Javadoc
46
47
/**
47
48
 * The Class EnforcerRuleUtils.
48
 
 * 
 
49
 *
49
50
 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
50
51
 */
51
52
public class EnforcerRuleUtils
52
53
{
53
 
    
 
54
 
54
55
    /** The factory. */
55
56
    ArtifactFactory factory;
56
57
 
73
74
 
74
75
    /**
75
76
     * Instantiates a new enforcer rule utils.
76
 
     * 
 
77
     *
77
78
     * @param theFactory the the factory
78
79
     * @param theResolver the the resolver
79
80
     * @param theLocal the the local
95
96
 
96
97
    /**
97
98
     * Instantiates a new enforcer rule utils.
98
 
     * 
 
99
     *
99
100
     * @param helper the helper
100
101
     */
101
102
    public EnforcerRuleUtils( EnforcerRuleHelper helper )
102
103
    {
103
 
     
 
104
 
104
105
        this.helper = helper;
105
106
        // get the various expressions out of the
106
107
        // helper.
126
127
 
127
128
    /**
128
129
     * Gets the pom model for this file.
129
 
     * 
 
130
     *
130
131
     * @param pom the pom
131
 
     * 
 
132
     *
132
133
     * @return the model
133
 
     * 
 
134
     *
134
135
     * @throws IOException Signals that an I/O exception has occurred.
135
136
     * @throws XmlPullParserException the xml pull parser exception
136
137
     */
156
157
     * This method gets the model for the defined artifact.
157
158
     * Looks first in the filesystem, then tries to get it
158
159
     * from the repo.
159
 
     * 
 
160
     *
160
161
     * @param groupId the group id
161
162
     * @param artifactId the artifact id
162
163
     * @param version the version
163
164
     * @param pom the pom
164
 
     * 
 
165
     *
165
166
     * @return the pom model
166
 
     * 
 
167
     *
167
168
     * @throws ArtifactResolutionException the artifact resolution exception
168
169
     * @throws ArtifactNotFoundException the artifact not found exception
169
170
     * @throws XmlPullParserException the xml pull parser exception
217
218
    /**
218
219
     * This method loops through all the parents, getting
219
220
     * each pom model and then its parent.
220
 
     * 
 
221
     *
221
222
     * @param groupId the group id
222
223
     * @param artifactId the artifact id
223
224
     * @param version the version
224
225
     * @param pom the pom
225
 
     * 
 
226
     *
226
227
     * @return the models recursively
227
 
     * 
 
228
     *
228
229
     * @throws ArtifactResolutionException the artifact resolution exception
229
230
     * @throws ArtifactNotFoundException the artifact not found exception
230
231
     * @throws IOException Signals that an I/O exception has occurred.
249
250
            }
250
251
            // calculate the recursive path
251
252
            File parentPom = new File( pom.getParent(), relativePath );
252
 
            
 
253
 
253
254
            // if relative path is a directory, append pom.xml
254
255
            if ( parentPom.isDirectory() )
255
256
            {
270
271
 
271
272
    /**
272
273
     * Make sure the model is the one I'm expecting.
273
 
     * 
 
274
     *
274
275
     * @param groupId the group id
275
276
     * @param artifactId the artifact id
276
277
     * @param version the version
277
278
     * @param model Model being checked.
278
 
     * 
 
279
     *
279
280
     * @return true, if check if model matches
280
281
     */
281
282
    protected boolean checkIfModelMatches ( String groupId, String artifactId, String version, Model model )