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