03fcbf26cea83c895568bd2b42c97a04a07e7fa9
[controller.git] / opendaylight / commons / filter-valve / src / main / java / org / opendaylight / controller / filtervalve / cors / jaxb / FilterMapping.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.filtervalve.cors.jaxb;
10
11 import static com.google.common.base.Preconditions.checkArgument;
12
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 @XmlRootElement
17 public class FilterMapping {
18     private String filterName;
19     private String urlPattern;
20     private boolean initialized;
21
22     @XmlElement(name = "filter-name")
23     public String getFilterName() {
24         return filterName;
25     }
26
27     public void setFilterName(String filterName) {
28         checkArgument(initialized == false, "Already initialized");
29         this.filterName = filterName;
30     }
31
32     @XmlElement(name = "url-pattern")
33     public String getUrlPattern() {
34         return urlPattern;
35     }
36
37     public void setUrlPattern(String urlPattern) {
38         checkArgument(initialized == false, "Already initialized");
39         this.urlPattern = urlPattern;
40     }
41
42     public synchronized void initialize() {
43         checkArgument(initialized == false, "Already initialized");
44         initialized = true;
45     }
46
47     public boolean isInitialized() {
48         return initialized;
49     }
50 }