1 package jp.sourceforge.stigmata.utils;
4 import java.io.IOException;
5 import java.util.ArrayList;
7 import java.util.jar.JarEntry;
8 import java.util.jar.JarFile;
9 import java.util.jar.Manifest;
13 * no instance is created
18 public static void deleteDirectory(File dir){
19 File[] files = dir.listFiles();
20 for(File file: files){
21 if(file.isDirectory()){
22 deleteDirectory(file);
31 public static String array2String(String[] values){
32 StringBuilder builder = new StringBuilder();
33 for(int i = 0; i < values.length; i++){
36 builder.append(values[i]);
38 return new String(builder);
41 public static String[] getDependencies(File source){
42 JarFile jarfile = null;
44 jarfile = new JarFile(source);
45 Manifest manifest = jarfile.getManifest();
46 String classPath = manifest.getMainAttributes().getValue("Class-Path");
47 if(classPath != null && !classPath.equals("")){
48 return classPath.split("[ \t]");
50 } catch(IOException e){
55 } catch(IOException e){
62 public static boolean isStigmataPluginJarFile(File pluginFile, List<String> messages){
64 if(pluginFile == null){
67 if(!pluginFile.getName().endsWith(".jar")){
68 messages.add("install.error.notjarfile");
71 if(!pluginFile.exists()){
72 messages.add("install.error.file.missing");
76 // check service descriptor.
79 JarFile jarfile = new JarFile(pluginFile);
80 JarEntry entry = jarfile.getJarEntry("META-INF/services/jp.sourceforge.stigmata.spi.BirthmarkService");
82 messages.add("install.error.servicedescriptor.missing");
86 } catch(IOException e){