Example usage for org.apache.commons.logging Log debug

List of usage examples for org.apache.commons.logging Log debug

Introduction

In this page you can find the example usage for org.apache.commons.logging Log debug.

Prototype

void debug(Object message);

Source Link

Document

Logs a message with debug log level.

Usage

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This will add an additional security provider.</p>
 *
 * @param  provider  <code>Provider</code>
 * @param  name  <code>String</code>
 *///w  w w.  j ava  2 s .  com
public static void addProvider(final Provider provider, final String name) {
    java.security.Security.addProvider(provider);

    final String[] tmp = new String[providers.length + 1];
    for (int i = 0; i < providers.length; i++) {
        tmp[i] = providers[i];
    }
    tmp[providers.length] = name;
    providers = tmp;

    final Log logger = LogFactory.getLog(CryptProvider.class);
    if (logger.isDebugEnabled()) {
        logger.debug("Added new security provider " + name);
    }
}

From source file:com.activegrid.runtime.data.util.DataServiceUtils.java

public static Object loadById(Object originalInstance, Session session, DataServiceMetaData metaData,
        Log logger) {

    if (originalInstance == null) {
        throw new IllegalArgumentException("instance to reload cannot be null");
    }//from  w w w  .  j  a  va 2s .c om

    Class<?> clazz = originalInstance.getClass();

    String s = metaData.getIdPropertyName(clazz);

    Serializable id = (Serializable) objectAccess.getProperty(originalInstance, s);

    Object rtn = session.get(getEntityClass(clazz), id);

    if (logger != null && logger.isDebugEnabled()) {
        logger.debug("reloadById: " + ObjectUtils.getId(originalInstance) + " " + s + ":" + id);
    }

    return rtn;
}

From source file:architecture.ee.web.util.ParamUtils.java

/**
* request String //w  w w. j a v a2 s . co m
* @param request
* @return
*/
public static void printParameter(HttpServletRequest request, Log log) {
    StringBuilder sb = new StringBuilder();
    Enumeration e = request.getParameterNames();

    sb.append("\n ==================== printParameter ====================");
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        String value = request.getParameter(key);
        sb.append("\n ==== " + key + " : " + value + " ");
    }
    sb.append("\n ==================== printParameter ====================\n");

    //return sb.toString();
    log.debug(sb);
}

From source file:com.ibm.bi.dml.runtime.controlprogram.parfor.RemoteParForUtils.java

/**
 * //from   w  ww  .ja  va  2s  .c  om
 * @param out
 * @return
 * @throws DMLRuntimeException
 * @throws IOException
 */
public static LocalVariableMap[] getResults(List<Tuple2<Long, String>> out, Log LOG)
        throws DMLRuntimeException {
    HashMap<Long, LocalVariableMap> tmp = new HashMap<Long, LocalVariableMap>();

    int countAll = 0;
    for (Tuple2<Long, String> entry : out) {
        Long key = entry._1();
        String val = entry._2();
        if (!tmp.containsKey(key))
            tmp.put(key, new LocalVariableMap());
        Object[] dat = ProgramConverter.parseDataObject(val);
        tmp.get(key).put((String) dat[0], (Data) dat[1]);
        countAll++;
    }

    if (LOG != null) {
        LOG.debug("Num remote worker results (before deduplication): " + countAll);
        LOG.debug("Num remote worker results: " + tmp.size());
    }

    //create return array
    return tmp.values().toArray(new LocalVariableMap[0]);
}

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This finds a <code>KeyFactory</code> using the known providers and the
 * supplied algorithm parameter.</p>
 *
 * @param  algorithm  <code>String</code> name
 *
 * @return  <code>KeyFactory</code>
 *
 * @throws  CryptException  if the algorithm is not available from any
 * provider or if the provider is not available in the environment
 *//*from   ww w  .  j a va2s. c om*/
public static KeyFactory getKeyFactory(final String algorithm) throws CryptException {
    final Log logger = LogFactory.getLog(CryptProvider.class);
    KeyFactory kf = null;
    for (int i = 0; i < providers.length; i++) {
        try {
            kf = KeyFactory.getInstance(algorithm, providers[i]);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm + " in " + providers[i]);
            }
        } catch (NoSuchProviderException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find provider " + providers[i]);
            }
        } finally {
            if (kf != null) {
                break;
            }
        }
    }
    if (kf == null) {
        try {
            kf = KeyFactory.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm);
            }
            throw new CryptException(e.getMessage());
        }
    }
    return kf;
}

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This creates a <code>CertificateFactory</code> using the supplied type
 * name.</p>/*ww w. ja va  2s . co m*/
 *
 * @param  type  <code>String</code>
 *
 * @return  <code>CertificateFactory</code>
 *
 * @throws  CryptException  if the type is not available from any provider or
 * the provider is not available in the environment
 */
public static CertificateFactory getCertificateFactory(final String type) throws CryptException {
    final Log logger = LogFactory.getLog(CryptProvider.class);
    CertificateFactory cf = null;
    for (int i = 0; i < providers.length; i++) {
        try {
            cf = CertificateFactory.getInstance(type, providers[i]);
        } catch (CertificateException e) {
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "Could not get instance of certificate factory type " + type + " from " + providers[i]);
            }
        } catch (NoSuchProviderException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find provider " + providers[i]);
            }
        } finally {
            if (cf != null) {
                break;
            }
        }
    }
    if (cf == null) {
        try {
            cf = CertificateFactory.getInstance(type);
        } catch (CertificateException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not get instance of certificate factory type " + type);
            }
            throw new CryptException(e.getMessage());
        }
    }
    return cf;
}

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This finds a <code>SecretKeyFactory</code> using the known providers and
 * the supplied algorithm parameter.</p>
 *
 * @param  algorithm  <code>String</code> name
 *
 * @return  <code>SecretKeyFactory</code>
 *
 * @throws  CryptException  if the algorithm is not available from any
 * provider or if the provider is not available in the environment
 */// w  w w.j ava  2  s  . c om
public static SecretKeyFactory getSecretKeyFactory(final String algorithm) throws CryptException {
    final Log logger = LogFactory.getLog(CryptProvider.class);
    SecretKeyFactory kf = null;
    for (int i = 0; i < providers.length; i++) {
        try {
            kf = SecretKeyFactory.getInstance(algorithm, providers[i]);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm + " in " + providers[i]);
            }
        } catch (NoSuchProviderException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find provider " + providers[i]);
            }
        } finally {
            if (kf != null) {
                break;
            }
        }
    }
    if (kf == null) {
        try {
            kf = SecretKeyFactory.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm);
            }
            throw new CryptException(e.getMessage());
        }
    }
    return kf;
}

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This creates a <code>MessageDigest</code> using the supplied algorithm
 * name.</p>//from ww  w  .ja  v a2 s . co m
 *
 * @param  algorithm  <code>String</code> name
 *
 * @return  <code>MessageDigest</code>
 *
 * @throws  CryptException  if the algorithm is not available from any
 * provider or the provider is not available in the environment
 */
public static MessageDigest getMessageDigest(final String algorithm) throws CryptException {
    final Log logger = LogFactory.getLog(CryptProvider.class);
    MessageDigest digest = null;
    for (int i = 0; i < providers.length; i++) {
        try {
            digest = MessageDigest.getInstance(algorithm, providers[i]);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm + " in " + providers[i]);
            }
        } catch (NoSuchProviderException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find provider " + providers[i]);
            }
        } finally {
            if (digest != null) {
                break;
            }
        }
    }
    if (digest == null) {
        try {
            digest = MessageDigest.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm);
            }
            throw new CryptException(e.getMessage());
        }
    }
    return digest;
}

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This finds a <code>KeyGenerator</code> using the known providers and the
 * supplied algorithm parameter.</p>
 *
 * @param  algorithm  <code>String</code> name
 *
 * @return  <code>KeyGenerator</code>
 *
 * @throws  CryptException  if the algorithm is not available from any
 * provider or if the provider is not available in the environment
 *//*w w w .  j av  a  2  s. com*/
public static KeyGenerator getKeyGenerator(final String algorithm) throws CryptException {
    final Log logger = LogFactory.getLog(CryptProvider.class);
    KeyGenerator generator = null;
    for (int i = 0; i < providers.length; i++) {
        try {
            generator = KeyGenerator.getInstance(algorithm, providers[i]);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm + " in " + providers[i]);
            }
        } catch (NoSuchProviderException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find provider " + providers[i]);
            }
        } finally {
            if (generator != null) {
                break;
            }
        }
    }
    if (generator == null) {
        try {
            generator = KeyGenerator.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm);
            }
            throw new CryptException(e.getMessage());
        }
    }
    return generator;
}

From source file:edu.vt.middleware.crypt.CryptProvider.java

/**
 * <p>This finds a <code>KeyPairGenerator</code> using the known providers and
 * the supplied algorithm parameter.</p>
 *
 * @param  algorithm  <code>String</code> name
 *
 * @return  <code>KeyPairGenerator</code>
 *
 * @throws  CryptException  if the algorithm is not available from any
 * provider or if the provider is not available in the environment
 *///www  .  ja  v  a 2  s .  c o m
public static KeyPairGenerator getKeyPairGenerator(final String algorithm) throws CryptException {
    final Log logger = LogFactory.getLog(CryptProvider.class);
    KeyPairGenerator generator = null;
    for (int i = 0; i < providers.length; i++) {
        try {
            generator = KeyPairGenerator.getInstance(algorithm, providers[i]);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm + " in " + providers[i]);
            }
        } catch (NoSuchProviderException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find provider " + providers[i]);
            }
        } finally {
            if (generator != null) {
                break;
            }
        }
    }
    if (generator == null) {
        try {
            generator = KeyPairGenerator.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
            if (logger.isDebugEnabled()) {
                logger.debug("Could not find algorithm " + algorithm);
            }
            throw new CryptException(e.getMessage());
        }
    }
    return generator;
}