Update the dependencies to use project version
[aai/sparky-be.git] / src / main / java / org / onap / aai / sparky / config / oxm / OxmModelLoaderFilter.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 package org.onap.aai.sparky.config.oxm;
24
25 import java.io.IOException;
26 import java.net.UnknownHostException;
27
28 import javax.servlet.Filter;
29 import javax.servlet.FilterChain;
30 import javax.servlet.FilterConfig;
31 import javax.servlet.ServletException;
32 import javax.servlet.ServletRequest;
33 import javax.servlet.ServletResponse;
34
35 import org.onap.aai.sparky.util.NodeUtils;
36 import org.onap.aai.cl.mdc.MdcContext;
37
38 /**
39  * The Class OxmModelLoaderFilter.
40  */
41 public class OxmModelLoaderFilter implements Filter {
42   /*
43    * (non-Javadoc)
44    * 
45    * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
46    * javax.servlet.FilterChain)
47    */
48   @Override
49   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
50       throws IOException, ServletException {
51
52     /*
53      * However, we will setup the filtermap with a url that should never get it, so we shouldn't
54      * ever be in here.
55      */
56
57     chain.doFilter(request, response);
58   }
59
60   /*
61    * (non-Javadoc)
62    * 
63    * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
64    */
65   @Override
66   public void init(FilterConfig filterConfig) throws ServletException {
67     String txnID = NodeUtils.getRandomTxnId();
68     MdcContext.initialize(txnID, "OxmModelLoaderFilter", "", "Init", "");
69
70     try {
71       OxmModelLoader.getInstance();
72     } catch (Exception exc) {
73       throw new ServletException("Caught an exception while initializing OXM model loader filter",
74           exc);
75     }
76
77   }
78
79   /*
80    * (non-Javadoc)
81    * 
82    * @see javax.servlet.Filter#destroy()
83    */
84   @Override
85   public void destroy() {
86     // TODO Auto-generated method stub
87
88   }
89
90 }