001package org.apache.turbine.services.urlmapper.model; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.List; 023import java.util.concurrent.CopyOnWriteArrayList; 024 025import javax.xml.bind.annotation.XmlAccessType; 026import javax.xml.bind.annotation.XmlAccessorType; 027import javax.xml.bind.annotation.XmlAttribute; 028import javax.xml.bind.annotation.XmlElement; 029import javax.xml.bind.annotation.XmlElementWrapper; 030import javax.xml.bind.annotation.XmlRootElement; 031 032import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 033import com.fasterxml.jackson.annotation.JsonProperty; 034 035/** 036 * URL Map Container Model Class 037 * 038 * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a> 039 */ 040@XmlRootElement(name="url-mapping") 041@XmlAccessorType(XmlAccessType.NONE) 042@JsonIgnoreProperties(ignoreUnknown = true) 043public class URLMappingContainer 044{ 045 046 /** 047 * Name of this map. 048 */ 049 @XmlAttribute 050 private String name; 051 052 /** 053 * The list of map entries 054 */ 055 @JsonProperty("maps") 056 private List<URLMapEntry> urlMapEntries = new CopyOnWriteArrayList<>(); 057 058 /** 059 * Set the name of this map. 060 * 061 * @param name 062 * Name of this map. 063 */ 064 protected void setName(String name) 065 { 066 this.name = name; 067 } 068 069 /** 070 * Get the name of this map. 071 * 072 * @return String Name of this map. 073 */ 074 public String getName() 075 { 076 return name; 077 } 078 079 /** 080 * Get the list of map entries 081 */ 082 @XmlElementWrapper(name="maps") 083 @XmlElement(name="map") 084 public List<URLMapEntry> getMapEntries() 085 { 086 return urlMapEntries; 087 } 088 089 /** 090 * Set new map entries during deserialization 091 * 092 * @param newURLMapEntries the newURLMapEntries to set 093 */ 094 protected void setMapEntries(List<URLMapEntry> newURLMapEntries) 095 { 096 this.urlMapEntries = new CopyOnWriteArrayList<>(newURLMapEntries); 097 } 098}