org.wildfly.galleon.maven.ExternalArtifact Maven / Gradle / Ivy
/*
* Copyright 2016-2018 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed 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 org.wildfly.galleon.maven;
import org.codehaus.plexus.util.StringUtils;
/**
*
* @author Emmanuel Hugonnet (c) 2017 Red Hat, inc.
*/
public class ExternalArtifact {
private ArtifactItem artifact;
private String toLocation;
private boolean extract;
private String includes;
private String excludes;
public ExternalArtifact() {
}
public ArtifactItem getArtifactItem() {
return artifact;
}
public void setArtifactItem(ArtifactItem artifact) {
this.artifact = artifact;
}
public String getToLocation() {
return toLocation;
}
public void setToLocation(String toLocation) {
this.toLocation = toLocation;
}
public boolean isExtract() {
return extract;
}
public void setExtract(boolean extract) {
this.extract = extract;
}
public String getIncludes() {
return includes;
}
public void setIncludes(String includes) {
this.includes = cleanToBeTokenizedString(includes);
}
public String getExcludes() {
return excludes;
}
public void setExcludes(String excludes) {
this.excludes = cleanToBeTokenizedString(excludes);
}
private static String cleanToBeTokenizedString(String str) {
String ret = "";
if (!StringUtils.isEmpty(str)) {
// remove initial and ending spaces, plus all spaces next to commas
ret = str.trim().replaceAll("[\\s]*,[\\s]*", ",");
}
return ret;
}
}