Example usage for org.apache.commons.configuration JNDIConfiguration setContext

List of usage examples for org.apache.commons.configuration JNDIConfiguration setContext

Introduction

In this page you can find the example usage for org.apache.commons.configuration JNDIConfiguration setContext.

Prototype

public void setContext(Context context) 

Source Link

Document

Set the initial context of the configuration.

Usage

From source file:marshalsec.gadgets.CommonsConfiguration.java

@Args(minArgs = 2, args = { "codebase", "class" }, defaultArgs = { MarshallerBase.defaultCodebase,
        MarshallerBase.defaultCodebaseClass })
default Object makeConfiguration(UtilFactory uf, String[] args)
        throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException,
        InvocationTargetException, NamingException, Exception {
    DirContext ctx = JDKUtil.makeContinuationContext(args[0], args[1]);

    JNDIConfiguration jc = new JNDIConfiguration();
    jc.setContext(ctx);
    jc.setPrefix("foo");

    Reflections.setFieldValue(jc, "errorListeners", Collections.EMPTY_LIST);
    Reflections.setFieldValue(jc, "listeners", Collections.EMPTY_LIST);
    Reflections.setFieldValue(jc, "log", new NoOpLog());
    return jc;/*  w w w .j  a v  a 2 s  .c om*/
}