0,0 → 1,56 |
/** |
* |
*/ |
package net.brutex.xservices.util; |
|
import java.net.URL; |
|
import org.apache.commons.configuration.ConfigurationException; |
import org.apache.commons.configuration.PropertiesConfiguration; |
import org.apache.commons.jcs.JCS; |
import org.apache.commons.jcs.access.exception.CacheException; |
import org.apache.logging.log4j.LogManager; |
import org.apache.logging.log4j.Logger; |
|
import net.brutex.mgmt.openair.OpenAirRestConnection; |
|
/** |
* @author brosenberger |
* |
*/ |
public final class OpenAirConnection { |
private final static Logger logger = LogManager.getLogger(); |
|
public static OpenAirRestConnection getOpenAirConnection() { |
final PropertiesConfiguration props; |
try { |
final String config = "../openair.properties"; |
logger.info("Loading Open Air connection details from {}", config.toString()); |
final URL configloc = OpenAirConnection.class.getClassLoader().getResource(config); |
logger.debug("Loading Open Air connection details from {}", configloc.toString()); |
|
props = new PropertiesConfiguration(configloc); |
final String user = props.getString("user"); |
final String password = props.getString("password"); |
final String company = props.getString("company"); |
final String apikey = props.getString("apikey", "_PUT_HERE_"); |
final String namespace = props.getString("namespace", ""); |
|
final OpenAirRestConnection con; |
|
con = new OpenAirRestConnection(JCS.getInstance("OACache"), company, user, password); |
return con; |
} catch (CacheException e) { |
logger.error(e.getMessage(), e); |
e.printStackTrace(); |
} catch (ConfigurationException e) { |
logger.error(e.getMessage(), e); |
e.printStackTrace(); |
} finally { |
|
} |
return null; |
} |
|
|
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |