88import ch .qos .logback .core .model .InsertFromJNDIModel ;
99import ch .qos .logback .core .model .Model ;
1010import ch .qos .logback .core .model .util .PropertyModelHandlerHelper ;
11+ import ch .qos .logback .core .spi .ContextAwarePropertyContainer ;
1112import ch .qos .logback .core .util .JNDIUtil ;
1213import ch .qos .logback .core .util .OptionHelper ;
1314
@@ -28,14 +29,22 @@ protected Class<InsertFromJNDIModel> getSupportedModelClass() {
2829
2930 @ Override
3031 public void handle (ModelInterpretationContext mic , Model model ) throws ModelHandlerException {
31- int errorCount = 0 ;
32-
3332 InsertFromJNDIModel ifjm = (InsertFromJNDIModel ) model ;
33+ detachedHandle (mic , ifjm );
34+ }
3435
35- String envEntryName = mic .subst (ifjm .getEnvEntryName ());
36- String asKey = mic .subst (ifjm .getAs ());
36+ /**
37+ *
38+ * @param capc
39+ * @param ifjm
40+ * @since 1.5.11
41+ */
42+ public void detachedHandle (ContextAwarePropertyContainer capc , InsertFromJNDIModel ifjm ) {
43+ int errorCount = 0 ;
44+ String envEntryName = capc .subst (ifjm .getEnvEntryName ());
45+ String asKey = capc .subst (ifjm .getAs ());
3746
38- String scopeStr = mic .subst (ifjm .getScopeStr ());
47+ String scopeStr = capc .subst (ifjm .getScopeStr ());
3948 Scope scope = ActionUtil .stringToScope (scopeStr );
4049
4150 String envEntryValue ;
@@ -61,7 +70,7 @@ public void handle(ModelInterpretationContext mic, Model model) throws ModelHand
6170 addError ("[" + envEntryName + "] has null or empty value" );
6271 } else {
6372 addInfo ("Setting variable [" + asKey + "] to [" + envEntryValue + "] in [" + scope + "] scope" );
64- PropertyModelHandlerHelper .setProperty (mic , asKey , envEntryValue , scope );
73+ PropertyModelHandlerHelper .setProperty (capc , asKey , envEntryValue , scope );
6574 }
6675 } catch (NamingException e ) {
6776 addError ("Failed to lookup JNDI env-entry [" + envEntryName + "]" );
0 commit comments