+++ /dev/null
-/**
- * Copyright 2017 BOCO Corporation.  CMCC Technologies Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.vfc.nfvo.emsdriver;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
-import org.onap.vfc.nfvo.emsdriver.commons.utils.DriverThread;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-
-
-public class EMSDriverApp {
-
-       private static Log log = LogFactory.getLog(DriverThread.class);
-       private static ApplicationContext context = null;
-       static {
-               try {
-                       /** spring bean applicationContext **/
-                       context = new FileSystemXmlApplicationContext("file:" + Constant.SYS_CFG+ "spring.xml");
-                       
-               } catch (BeansException e) {
-                       log.error("spring.xml is fail ", e);
-                       System.exit(1);
-               } catch (Exception e) {
-                       log.error("spring.xml is fail", e);
-                       System.exit(1);
-               }
-       }
-       
-       
-       /**
-        * @param args
-        */
-       public static void main(String[] args) {
-               String[] allThreadName = context.getBeanNamesForType(DriverThread.class);
-
-               log.info("worker num :" + allThreadName.length);
-
-               for (String threadName : allThreadName) {
-                       DriverThread thread = (DriverThread) context.getBean(threadName);
-                       if (thread == null) {
-                               log.error(threadName + "Thread start error,system exit");
-                               System.exit(1);
-                       }else{
-                               thread.setName(threadName);
-                               thread.start();
-                       }
-                       
-               }
-               
-               try {
-                       new EmsDriverApplication().run(args);
-               } catch (Exception e) {
-                       log.error("EmsDriverApplication.run is fail", e);
-                       System.exit(1);
-               }
-               log.info("the workerThreads start sucess" );
-       }
-
-}
 
                        if("ems-resource".equalsIgnoreCase(collectVo.getType())){
                                parseResult = processCMXml(tempfile, nename,"CM");
                        }else{
-                               parseResult = processPMCsv(tempfile);
-                               
+                               if(unfileName.indexOf(".csv") > 0){
+                                       parseResult = processPMCsv(tempfile);
+                               }else{
+                                       parseResult = processPMCsv(tempfile);
+                               }
                        }
                        
                        if (parseResult){
 
                                                Thread.sleep(60*1000);
                                        }
                                } catch (Exception e) {
+                                       try {
+                                               Thread.sleep(60*1000);
+                                       } catch (InterruptedException e1) {
+                                               e1.printStackTrace();
+                                       }
                                        log.error("ReceiveSource exception",e);
                                }
                        }
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.HttpEntity;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.BasicCredentialsProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 
+import org.apache.commons.codec.binary.Base64;
+
 /*
  * HttpClient post request
  */
         HttpGet httpGet = null;
         String result = null;
         try{
-            httpClient = HttpClientFactory.getSSLClientFactory();
+            httpClient = HttpClients.createDefault();
             httpGet = new HttpGet(url);
-            
+            Base64 token = new Base64();
+            String authenticationEncoding = new String(token.encode(("AAI:AAI").getBytes()));
+
+            httpGet.setHeader("Authorization", "Basic " + authenticationEncoding);
             CloseableHttpResponse response = httpClient.execute(httpGet);
-            
+            log.info("doGet sucess url ="+url);
             try {
                                if(response != null){
                                    HttpEntity resEntity = response.getEntity();
         return result;
     }
     
+    public static CloseableHttpClient createCloseableHttpClientWithBasicAuth(){  
+         // 创建HttpClientBuilder  
+       HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();  
+        // 设置BasicAuth  
+        CredentialsProvider provider = new BasicCredentialsProvider();  
+        // Create the authentication scope  
+        AuthScope scope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM);  
+        // Create credential pair,username and password
+        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("AAI", "AAI");  
+        // Inject the credentials  
+        provider.setCredentials(scope, credentials);  
+        // Set the default credentials provider  
+        httpClientBuilder.setDefaultCredentialsProvider(provider);  
+        // HttpClient  
+        CloseableHttpClient closeableHttpClient = httpClientBuilder.build(); 
+        
+        return closeableHttpClient;
+    }  
+    
 }
\ No newline at end of file
 
                                        username,
                                        password,
                                        level);
+                       log.info("AgentMain.evel_initialize sucess ");
                } catch( Exception e ){
                        log.error("AgentMain.evel_initialize fail ",e);
                }
 
 
 #microservice Bus address
 msbAddress: 10.74.205.123:80
-autoServiceRegister: true
+autoServiceRegister: false
 server:
   type: simple
   rootPath: '/api/emsdriver/v1/*'