docs: public static A_CmsAjaxGallery createInstance(String galleryTypeName, CmsJspActionElement jsp) {
  
          if (jsp != null) {
              // must have a valid JSP in order to read from the user session
              HttpSession session = jsp.getRequest().getSession();
              // lookup the workplace settings
              CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
                  CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
              if (settings != null) {
                  if (CmsStringUtil.isEmpty(galleryTypeName)) {
                      // look up the gallery type from the settings
                      galleryTypeName = settings.getGalleryType();
                  } else {
                      // store the last used gallery type name
                      settings.setGalleryType(galleryTypeName);
                  }
              }
          }
          // get the gallery class name for the type
          A_CmsAjaxGallery template = OpenCms.getWorkplaceManager().getGalleries().get(galleryTypeName);
  
          if (template == null) {
              // requested gallery type is not configured
              CmsMessageContainer message;
              if (jsp == null) {
                  message = Messages.get().container(Messages.LOG_UNKNOWN_GALLERY_TYPE_REQ_1, galleryTypeName);
              } else {
                  message = Messages.get().container(
                      Messages.LOG_UNKNOWN_GALLERY_TYPE_REQ_JSP_2,
                      galleryTypeName,
                      jsp.info("opencms.request.element.uri"));
              }
              LOG.error(message.key());
              throw new CmsRuntimeException(message);
          }
  
          try {
              // first get the class of the gallery
              Class<?> galleryClass = Class.forName(template.getResourceType().getFolderClassName());
              // create a new instance and cast to a gallery
              A_CmsAjaxGallery galleryInstance = (A_CmsAjaxGallery)galleryClass.newInstance();
              // set the type name and id
              galleryInstance.m_resourceType = template.getResourceType();
              galleryInstance.m_galleryTypeParams = template.getResourceType().getFolderClassParams();
              // initialize the members
              galleryInstance.initWorkplaceMembers(jsp);
              // perform other initialization
              galleryInstance.init();
              // return the result
              return galleryInstance;
          } catch (Exception e) {
              // requested type is not configured
              CmsMessageContainer message;
              if (jsp == null) {
                  message = Messages.get().container(
                      Messages.LOG_CREATE_GALLERY_INSTANCE_FAILED_2,
                      template.getResourceType().getFolderClassName(),
                      galleryTypeName);
              } else {
                  message = Messages.get().container(
                      Messages.LOG_CREATE_GALLERY_INSTANCE_FAILED_JSP_3,
                      template.getResourceType().getFolderClassName(),
                      galleryTypeName,
                      jsp.info("opencms.request.element.uri"));
              }
              LOG.error(message.key());
              throw new CmsRuntimeException(message);
          }
      }