All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.javadpkg.plugin.impl.DataEntryNode Maven / Gradle / Ivy

The newest version!
/*
 * dpkg - Debian Package library and the Debian Package Maven plugin
 * (c) Copyright 2016 Gerrit Hohl
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package net.sourceforge.javadpkg.plugin.impl;

import java.io.File;

import net.sourceforge.javadpkg.plugin.cfg.DataEntry;
import net.sourceforge.javadpkg.plugin.io.Path;

/**
 * 

* A node of a {@link DataEntry}. *

*

* This class is part of the pre-processing / the parsing of the configuration. *

* * @author Gerrit Hohl ([email protected]) * @version 1.0, 19.05.2016 by Gerrit Hohl */ public class DataEntryNode { /** The source file. */ private File source; /** The name of the file in the target. */ private String name; /** The path of the parent in the target. */ private Path parent; /** The target file or directory of the symbolic link the target. */ private String symLink; /** The group ID. */ private Long groupId; /** The group name. */ private String groupName; /** The user ID. */ private Long userId; /** The user name. */ private String userName; /** The mode. */ private Integer mode; /** The flag if the file should be processed. */ private boolean process; /** The encoding for the processing. */ private String encoding; /** *

* Creates a node for a directory. *

* * @param name * The name of the directory in the target. * @param parent * The path of the parent in the target. * @param groupId * The group ID (optional). * @param groupName * The group name (optional). * @param userId * The user ID (optional). * @param userName * The user name (optional). * @param mode * The mode (optional). * @throws IllegalArgumentException * If any of the non-optional parameters are null. */ public DataEntryNode(String name, Path parent, Long groupId, String groupName, Long userId, String userName, Integer mode) { super(); if (name == null) throw new IllegalArgumentException("Argument name is null."); if (parent == null) throw new IllegalArgumentException("Argument parent is null."); this.source = null; this.name = name; this.parent = parent; this.symLink = null; this.groupId = groupId; this.groupName = groupName; this.userId = userId; this.userName = userName; this.mode = mode; this.process = false; this.encoding = null; } /** *

* Creates a node for a regular file. *

* * @param source * The source file. * @param name * The name of the directory in the target. * @param parent * The path of the parent in the target. * @param groupId * The group ID (optional). * @param groupName * The group name (optional). * @param userId * The user ID (optional). * @param userName * The user name (optional). * @param mode * The mode (optional). * @param process * The flag if the file should be processed. * @param encoding * The encoding for the processing (optional). * @throws IllegalArgumentException * If any of the non-optional parameters are null. */ public DataEntryNode(File source, String name, Path parent, Long groupId, String groupName, Long userId, String userName, Integer mode, boolean process, String encoding) { super(); if (source == null) throw new IllegalArgumentException("Argument source is null."); if (name == null) throw new IllegalArgumentException("Argument name is null."); if (parent == null) throw new IllegalArgumentException("Argument parent is null."); this.source = source; this.name = name; this.parent = parent; this.symLink = null; this.groupId = groupId; this.groupName = groupName; this.userId = userId; this.userName = userName; this.mode = mode; this.process = process; this.encoding = encoding; } /** *

* Creates a node for a symbolic link. *

* * @param name * The name of the symbolic link in the target. * @param parent * The path of the parent in the target. * @param symLink * The target file or directory of the symbolic link the target. * @param groupId * The group ID (optional). * @param groupName * The group name (optional). * @param userId * The user ID (optional). * @param userName * The user name (optional). * @param mode * The mode (optional). * @throws IllegalArgumentException * If any of the non-optional parameters are null. */ public DataEntryNode(String name, Path parent, String symLink, Long groupId, String groupName, Long userId, String userName, Integer mode) { super(); if (name == null) throw new IllegalArgumentException("Argument name is null."); if (parent == null) throw new IllegalArgumentException("Argument parent is null."); if (symLink == null) throw new IllegalArgumentException("Argument symLink is null."); this.source = null; this.name = name; this.parent = parent; this.symLink = symLink; this.groupId = groupId; this.groupName = groupName; this.userId = userId; this.userName = userName; this.mode = mode; this.process = false; this.encoding = null; } /** *

* Returns the source file. *

* * @return The source file or null, if this node doesn't * represent a regular file. */ public File getSource() { return this.source; } /** *

* Returns the name of the file in the target. *

* * @return The name. */ public String getName() { return this.name; } /** *

* Returns the path of the parent in the target. *

* * @return The path. */ public Path getParent() { return this.parent; } /** *

* Returns the The target file or directory of the symbolic link the target. *

* * @return The target or null, if this node doesn't represent a * symbolic link. */ public String getSymLink() { return this.symLink; } /** *

* Returns the group ID. *

* * @return The group ID or null, if the group ID is not set. */ public Long getGroupId() { return this.groupId; } /** *

* returns the group name. *

* * @return The group name or null, if the group name is not * set. */ public String getGroupName() { return this.groupName; } /** *

* Returns the user ID. *

* * @return The user ID or null, if the user ID is not set. */ public Long getUserId() { return this.userId; } /** *

* returns the user name. *

* * @return The user name or null, if the user name is not set. */ public String getUserName() { return this.userName; } /** *

* Returns the mode. *

* * @return The mode or null, if the mode is not set. */ public Integer getMode() { return this.mode; } /** *

* Returns the flag if the file should be processed. *

*

* This flag has only an effect if this node represents a regular file. *

* * @return The flag: true, if the file should be processed, * false otherwise. * @see #getSource() * @see #getEncoding() */ public boolean isProcess() { return this.process; } /** *

* Returns the encoding for the processing. *

*

* This flag has only an effect if this node should be processed. *

* * @return The encoding or null, if the default encoding should * be used. * @see #isProcess() */ public String getEncoding() { return this.encoding; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy