/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.jrh3k5.mojo.flume;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.maven.artifact.Artifact;

/**
 * Definition of a Flume plugin that's to be used with the installation of Flume.
 * 
 * @author Joshua Hyde
 */

public class FlumePlugin {
    private String groupId;
    private String artifactId;
    private String classifier = "flume-plugin";
    private String type = "tar.gz";

    /**
     * Get the artifact ID of the Flume plugin.
     * 
     * @return The artifact ID of the Flume plugin.
     */
    public String getArtifactId() {
        return artifactId;
    }

    /**
     * Get the group ID of the Flume plugin.
     * 
     * @return The group ID of the Flume plugin.
     */
    public String getGroupId() {
        return groupId;
    }

    /**
     * Determine whether or not the given artifact represents this Flume plugin.
     * 
     * @param artifact
     *            The {@link Artifact} to be matched.
     * @return {@code true} if the given artifact is judged to be a representation of this Flume plugin; {@code false} if not.
     */
    public boolean matches(Artifact artifact) {
        boolean matches = getGroupId().equals(artifact.getGroupId());
        matches &= getArtifactId().equals(artifact.getArtifactId());
        matches &= classifier.matches(artifact.getClassifier());
        matches &= type.equals(artifact.getType());
        return matches;
    }

    /**
     * Set the artifact ID of the Flume plugin.
     * 
     * @param artifactId
     *            The artifact ID of the Flume plugin.
     */
    public void setArtifactId(String artifactId) {
        this.artifactId = artifactId;
    }

    /**
     * Set the group ID of the Flume plugin.
     * 
     * @param groupId
     *            The group ID of the Flume plugin.
     */
    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}

@@ -1448,158 +1448,494 @@
 the 
-group ID of the Flume plugin.%0A     * %0A     * @return The group ID of the Flume plugin.%0A     */%0A    public String getGroupId() %7B%0A        return groupId
+classifier to be matched.%0A     * %0A     * @return The classifier to be matched.%0A     */%0A    public String getClassifier() %7B%0A        return classifier;%0A    %7D%0A%0A    /**%0A     * Get the group ID of the Flume plugin.%0A     * %0A     * @return The group ID of the Flume plugin.%0A     */%0A    public String getGroupId() %7B%0A        return groupId;%0A    %7D%0A%0A    /**%0A     * Get the type to be matched.%0A     * %0A     * @return The type to be matched.%0A     */%0A    public String getType() %7B%0A        return type
 ;%0A  
@@ -2823,32 +2823,266 @@
 ifactId;%0A    %7D%0A%0A
+    /**%0A     * Set the classifier to be matched.%0A     * %0A     * @param classifier%0A     *            The classifier to be matched.%0A     */%0A    public void setClassifier(String classifier) %7B%0A        this.classifier = classifier;%0A    %7D%0A%0A
     /**%0A     * S
@@ -3288,24 +3288,216 @@
 pId;%0A    %7D%0A%0A
+    /**%0A     * Set the type to be matched.%0A     * %0A     * @param type%0A     *            The type to be matched.%0A     */%0A    public void setType(String type) %7B%0A        this.type = type;%0A    %7D%0A%0A
     @Overrid

Allow the classifier and type to be specified when matching Flume plugins.