コード例 #1
0
 protected Data getExtensionData(ServiceExtensionDescriptionType desc, ServiceInformation info)
     throws CodegenExtensionException {
   ExtensionTypeExtensionData extData = ExtensionTools.getExtensionData(desc, info);
   Data data = null;
   try {
     data = ExtensionDataUtils.getExtensionData(extData);
   } catch (Exception ex) {
     throw new CodegenExtensionException("Error getting extension data: " + ex.getMessage(), ex);
   }
   return data;
 }
コード例 #2
0
 protected void modifyEclipseClasspath(
     ServiceExtensionDescriptionType desc, ServiceInformation info)
     throws CodegenExtensionException {
   // get the eclipse classpath document
   File classpathFile = new File(info.getBaseDirectory(), ".classpath");
   if (classpathFile.exists()) {
     logger.info("Modifying eclipse .classpath file");
     Set<File> libs = new HashSet<File>();
     ExtensionTypeExtensionData data = ExtensionTools.getExtensionData(desc, info);
     AdditionalLibraries additionalLibs = null;
     try {
       additionalLibs = ExtensionDataUtils.getExtensionData(data).getAdditionalLibraries();
     } catch (Exception ex) {
       throw new CodegenExtensionException("Error retrieving extension data");
     }
     if (additionalLibs != null && additionalLibs.getJarName() != null) {
       for (int i = 0; i < additionalLibs.getJarName().length; i++) {
         String jarFilename = additionalLibs.getJarName(i);
         libs.add(new File(info.getBaseDirectory(), "lib" + File.separator + jarFilename));
       }
     }
     File[] libFiles = new File[libs.size()];
     libs.toArray(libFiles);
     try {
       logger.info("Adding libraries to classpath file:");
       for (int i = 0; i < libFiles.length; i++) {
         logger.info("\t" + libFiles[i].getAbsolutePath());
       }
       ExtensionUtilities.syncEclipseClasspath(classpathFile, libFiles);
     } catch (Exception ex) {
       throw new CodegenExtensionException(
           "Error modifying Eclipse .classpath file: " + ex.getMessage(), ex);
     }
   } else {
     logger.warn("Eclipse .classpath file " + classpathFile.getAbsolutePath() + " not found!");
   }
 }