private void addImports(OpenLBuilderImpl builder, Collection<String> imports) {
   Collection<String> packageNames = new HashSet<String>();
   Collection<String> classNames = new HashSet<String>();
   Collection<String> libraries = new HashSet<String>();
   for (String singleImport : imports) {
     if (singleImport.endsWith(".*")) {
       try {
         String libraryClassName = singleImport.substring(0, singleImport.length() - 2);
         userContext.getUserClassLoader().loadClass(libraryClassName); // try
         // load
         // class
         libraries.add(libraryClassName);
       } catch (Exception e) {
         packageNames.add(singleImport.substring(0, singleImport.length() - 2));
       }
     } else {
       try {
         userContext.getUserClassLoader().loadClass(singleImport); // try
         // load
         // class
         classNames.add(singleImport);
       } catch (Exception e) {
         packageNames.add(singleImport);
       }
     }
   }
   builder.setPackageImports(packageNames);
   builder.setClassImports(classNames);
   builder.setLibraries(libraries);
 }
  private OpenL makeOpenL(XlsModuleSyntaxNode moduleNode) {

    String openlName = getOpenLName(moduleNode.getOpenlNode());
    Collection<String> imports = moduleNode.getImports();

    if (imports == null) {
      return OpenL.getInstance(openlName, userContext);
    }

    OpenLBuilderImpl builder = new OpenLBuilderImpl();

    builder.setExtendsCategory(openlName);

    String category = openlName + "::" + moduleNode.getModule().getUri();
    builder.setCategory(category);

    addImports(builder, imports);

    builder.setContexts(null, userContext);
    builder.setInheritExtendedConfigurationLoader(true);

    return OpenL.getInstance(category, userContext, builder);
  }