Search in sources :

Example 1 with MissingParametersException

use of com.quickutil.platform.exception.MissingParametersException in project quickutil by quickutil.

the class GAUtil method addGaClient.

public static void addGaClient(Properties properties) {
    Enumeration<?> keys = properties.propertyNames();
    List<String> keyList = new ArrayList<String>();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        key = key.split("\\.")[0];
        if (!keyList.contains(key)) {
            keyList.add(key);
        }
    }
    for (String key : keyList) {
        try {
            String clientID = properties.getProperty(key + ".clientID");
            String p12Path = properties.getProperty(key + ".p12Path");
            String applicationName = properties.getProperty(key + ".applicationName");
            String ids = properties.getProperty(key + ".ids");
            if (clientID == null || p12Path == null || applicationName == null || ids == null)
                throw new MissingParametersException("init requires clientID, p12Path, applicationName, ids");
            gaIdsMap.put(key, ids);
            addGaClient(key, clientID, PropertiesUtil.getInputStream(p12Path), applicationName);
            addGaRTClient(key, clientID, PropertiesUtil.getInputStream(p12Path), applicationName);
        } catch (Exception e) {
            LOGGER.error(Symbol.BLANK, e);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) MissingParametersException(com.quickutil.platform.exception.MissingParametersException) MissingParametersException(com.quickutil.platform.exception.MissingParametersException)

Aggregations

MissingParametersException (com.quickutil.platform.exception.MissingParametersException)1 ArrayList (java.util.ArrayList)1