org.vfny.geoserver.config.NameSpaceConfig Maven / Gradle / Ivy
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.vfny.geoserver.config;
import org.vfny.geoserver.global.dto.NameSpaceInfoDTO;
/**
* NameSpaceConfig purpose.
*
*
* Represents the portion of a namespace required for the configuration of
* geoserver. Defines namespaces to be used by the datastores.
*
*
*
*
* @author dzwiers, Refractions Research, Inc.
* @version $Id: NameSpaceConfig.java 6326 2007-03-15 18:36:40Z jdeolive $
*/
public class NameSpaceConfig {
//public static final String PREFIX_DELIMITER = ":";
/** The namespace prefix. */
private String prefix;
/** The URI for this namespace. */
private String uri;
/** Whether this is the default namespace. */
private boolean _default;
/**
* NameSpaceConfig constructor.
*
*
* Creates a NameSpaceConfig to represent an instance with default data.
*
*
* @see defaultSettings()
*/
public NameSpaceConfig() {
prefix = "";
uri = "";
_default = false;
}
/**
* NameSpaceConfig constructor.
*
*
* Creates a copy of the NameSpaceConfig provided. If the NameSpaceConfig
* provided is null then default values are used. All the data structures
* are cloned.
*
*
* @param ns The namespace to copy.
*
* @throws NullPointerException DOCUMENT ME!
*/
public NameSpaceConfig(NameSpaceInfoDTO ns) {
if (ns == null) {
throw new NullPointerException("");
}
prefix = ns.getPrefix();
uri = ns.getUri();
_default = ns.isDefault();
}
/**
* Implement loadDTO.
*
*
* Imports the data contained in the NameSpaceInfoDTO object provided.
*
*
* @param dto An NameSpaceInfoDTO object
*
* @throws NullPointerException DOCUMENT ME!
*
* @see org.vfny.geoserver.config.DataStructure#loadDTO(java.lang.Object)
*/
public void update(NameSpaceInfoDTO dto) {
if (dto == null) {
throw new NullPointerException("NameSpace Data Transfer Object required");
}
NameSpaceInfoDTO ns = (NameSpaceInfoDTO) dto;
prefix = ns.getPrefix();
uri = ns.getUri();
_default = ns.isDefault();
}
/**
* Implement toDTO.
*
*
* Creates a DTO representation of this Object as a NameSpaceInfoDTO
*
*
* @return a NameSpaceInfoDTO which representts the data in this class.
*
* @see org.vfny.geoserver.config.DataStructure#toDTO()
*/
public NameSpaceInfoDTO toDTO() {
NameSpaceInfoDTO nsDto = new NameSpaceInfoDTO();
nsDto.setDefault(_default);
nsDto.setPrefix(prefix);
nsDto.setUri(uri);
return nsDto;
}
/**
* isDefault purpose.
*
*
* Description ...
*
*
* @return
*/
public boolean isDefault() {
return _default;
}
/**
* getPrefix purpose.
*
*
* Description ...
*
*
* @return
*/
public String getPrefix() {
return prefix;
}
/**
* getUri purpose.
*
*
* Description ...
*
*
* @return
*/
public String getUri() {
return uri;
}
/**
* setDdefault purpose.
*
*
* Description ...
*
*
* @param b
*/
public void setDefault(boolean b) {
_default = b;
}
/**
* setPrefix purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setPrefix(String string) {
prefix = string;
}
/**
* setUri purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setUri(String string) {
uri = string;
}
}