@Override
  public void initContextData(Session session, Context uiSharedContext) {
    selectedMethod = uiSharedContext.getSessionManagementMethod();
    if (log.isDebugEnabled())
      log.debug(
          "Initializing configuration panel for session management method: "
              + selectedMethod
              + " for context "
              + uiSharedContext.getName());

    // If something was already configured, find the type and set the UI accordingly
    if (selectedMethod != null) {
      // If the proper type is already selected, just rebind the data
      if (shownMethodType != null && shownMethodType.isTypeForMethod(selectedMethod)) {
        if (shownMethodType.hasOptionsPanel()) shownConfigPanel.bindMethod(selectedMethod);
        return;
      }

      // Select what needs to be selected
      for (SessionManagementMethodType type : extension.getSessionManagementMethodTypes())
        if (type.isTypeForMethod(selectedMethod)) {
          // Selecting the type here will also force the selection listener to run and
          // change the config panel accordingly
          getSessionManagementMethodsComboBox().setSelectedItem(type);
          break;
        }
    }
  }
 @Override
 public void validateContextData(Session session) throws IllegalStateException {
   if (selectedMethod == null)
     throw new IllegalStateException(
         "A valid session management method has to be selected for Context "
             + getUISharedContext().getName());
   if (shownConfigPanel != null) shownConfigPanel.validateFields();
 }
 @Override
 public void saveTemporaryContextData(Context uiSharedContext) {
   if (shownConfigPanel != null) shownConfigPanel.saveMethod();
   uiSharedContext.setSessionManagementMethod(selectedMethod);
 }
 @Override
 public void saveContextData(Session session) throws Exception {
   if (shownConfigPanel != null) shownConfigPanel.saveMethod();
   session.getContext(getContextIndex()).setSessionManagementMethod(selectedMethod);
 }