org.wildfly.plugin.deployment.resource.Resource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wildfly-maven-plugin Show documentation
Show all versions of wildfly-maven-plugin Show documentation
A maven plugin that allows various management operations to be executed on WildFly Application
Server.
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.wildfly.plugin.deployment.resource;
import java.util.Collections;
import java.util.Map;
import org.apache.maven.plugins.annotations.Parameter;
/**
* Defines a resource.
*
* @author James R. Perkins
*/
public class Resource {
/**
* The operation address.
*/
@Parameter
private String address;
/**
* Only adds the resource if the resource does not already exist. If the resource already exists, the resource is
* skipped.
*/
@Parameter
private boolean addIfAbsent;
/**
* The operation properties for the resource.
*/
@Parameter
private Map properties;
/**
* An array of resources that rely on this resource.
*
* Note all resources will be ignored if the {@code } is defined and his resource is already defined.
*/
@Parameter
private Resource[] resources;
/**
* Default constructor.
*/
public Resource() {
}
/**
* The address for the resource.
*
* @return the address.
*/
public String getAddress() {
return address;
}
/**
* Whether or not we should add only if the resource is absent.
*
* @return {@code true} if the resource should only be added if it does not already exist, otherwise {@code false}.
*/
public boolean isAddIfAbsent() {
return addIfAbsent;
}
/**
* The properties for the resource. If no properties were defined an empty map is returned.
*
* @return the properties.
*/
public Map getProperties() {
if (properties == null) {
return Collections.emptyMap();
}
return properties;
}
/**
* Returns an array of resources that depend on this resource.
*
* Note all sub-resources will be ignored if the {@link #isAddIfAbsent()} is defined and his resource is already
* defined.
*
* @return an array of resources that depend on this resource or {@code null} if there are no child resources.
*/
public Resource[] getResources() {
return resources;
}
}