Subversion Repositories XServices

Rev

Rev 198 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 198 Rev 199
Line 7... Line 7...
7
import java.io.BufferedReader;
7
import java.io.BufferedReader;
8
import java.io.IOException;
8
import java.io.IOException;
9
import java.io.InputStreamReader;
9
import java.io.InputStreamReader;
10
import java.net.URL;
10
import java.net.URL;
Line -... Line 11...
-
 
11
 
11
 
12
import lombok.extern.slf4j.Slf4j;
12
import org.apache.commons.configuration2.ex.ConfigurationException;
13
import org.apache.commons.configuration2.ex.ConfigurationException;
13
import org.apache.commons.configuration2.PropertiesConfiguration;
14
import org.apache.commons.configuration2.PropertiesConfiguration;
14
import org.apache.commons.jcs.JCS;
15
import org.apache.commons.jcs.JCS;
15
import org.apache.commons.jcs.access.exception.CacheException;
-
 
16
import org.apache.logging.log4j.LogManager;
-
 
-
 
16
import org.apache.commons.jcs.access.exception.CacheException;
Line 17... Line 17...
17
import org.apache.logging.log4j.Logger;
17
 
Line 18... Line 18...
18
 
18
 
19
import net.brutex.mgmt.openair.OpenAirRestConnection;
19
import net.brutex.mgmt.openair.OpenAirRestConnection;
20
 
20
 
21
/**
21
/**
-
 
22
 * @author brosenberger
22
 * @author brosenberger
23
 *
23
 *
-
 
-
 
24
 */
Line 24... Line 25...
24
 */
25
@Slf4j
25
public final class OpenAirConnection {
26
public final class OpenAirConnection {
26
	private final static Logger logger = LogManager.getLogger();
27
 
27
	
28
	
28
	public static OpenAirRestConnection getOpenAirConnection() {
29
	public static OpenAirRestConnection getOpenAirConnection() {
29
		final PropertiesConfiguration props;
30
		final PropertiesConfiguration props;
30
		try {
31
		try {
Line 31... Line 32...
31
			final String config = "../openair.properties";
32
			final String config = "../openair.properties";
32
			logger.info("Loading Open Air connection details from {}", config.toString());
33
			log.info("Loading Open Air connection details from {}", config.toString());
Line 33... Line 34...
33
			final URL configloc = OpenAirConnection.class.getClassLoader().getResource(config);
34
			final URL configloc = OpenAirConnection.class.getClassLoader().getResource(config);
Line 44... Line 45...
44
 
45
 
Line 45... Line 46...
45
			final OpenAirRestConnection con;
46
			final OpenAirRestConnection con;
46
 
47
 
47
			con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password);
-
 
48
			return con;
-
 
49
		} catch (CacheException e) {
-
 
50
			logger.error(e.getMessage(), e);
48
			con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password);
51
			e.printStackTrace();
49
			return con;
52
		} catch (ConfigurationException e) {
50
		} catch (CacheException | ConfigurationException e) {
53
			logger.error(e.getMessage(), e);
51
			log.error(e.getMessage(), e);
54
			e.printStackTrace();
52
			e.printStackTrace();
55
		} catch (IOException e) {
53
		} catch (IOException e) {