Moving OA Soap Wrapper into current trunk version
git-svn-id: https://brutex.net/svn/xservices/trunk@187 e7e49efb-446e-492e-b9ec-fcafc1997a86master
parent
8db4a1a60a
commit
1acb30d0ed
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue