⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servicelistcreator.java

📁 Rapla是一个灵活的多用户资源管理系统。它提供的一些功能有:日历GUI
💻 JAVA
字号:
/*--------------------------------------------------------------------------*
| Copyright (C) 2006 Christopher Kohlhaas                                  |
|                                                                          |
| This program is free software; you can redistribute it and/or modify     |
| it under the terms of the GNU General Public License as published by the |
| Free Software Foundation. A copy of the license has been included with   |
| these distribution in the COPYING file, if not go to www.fsf.org         |
|                                                                          |
| As a special exception, you are granted the permissions to link this     |
| program with every library, which license fulfills the Open Source       |
| Definition as published by the Open Source Initiative (OSI).             |
*--------------------------------------------------------------------------*/
package org.rapla.framework;


import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Stack;



/** Helper Class for automated creation of the rapla-plugin.list in the
 * META-INF directory. Can be used in the build environment.
 */
public class ServiceListCreator {
    public static void main (String[] args) {
        try {
            String sourceDir = args[0];
            String destDir = (args.length>1) ? args[1] : sourceDir;
            processDir(sourceDir,destDir);
        } catch (IOException e) {
            throw new RuntimeException( e.getMessage());
        } catch (ClassNotFoundException e) {
            throw new RuntimeException( e.getMessage());
        }
    }

    public static void processDir(String srcDir,String destFile)
    throws ClassNotFoundException, IOException
    {
        Stack stack = new Stack();
        File topDir = new File(srcDir);
        stack.push(topDir);
        Writer writer = new BufferedWriter(new FileWriter( destFile ));
        try {
            while (!stack.empty()) {
            File file = (File) stack.pop();
            if (file.isDirectory()) {
                File[] files = file.listFiles();
                for (int i=0;i<files.length;i++)
                    stack.push(files[i]);
            } else {
                if (file.getName().endsWith("Plugin.class")) {
                    String absolut = file.getAbsolutePath();
                    String relativePath = absolut.substring(topDir.getAbsolutePath().length());
                    String pathName = relativePath.substring(1,relativePath.length()-".class".length());
                    String className = pathName.replace(File.separatorChar,'.');
                    Class pluginClass = Class.forName( className );
                    if (!pluginClass.isInterface() ) {
                        if (  PluginDescriptor.class.isAssignableFrom(pluginClass)) {
                            System.out.println("Found PluginDescriptor for " + className);
                            writer.write( className  );
                            writer.write( "\n" );
                        } else {
                            System.out.println("No PluginDescritor found for Class " + className );
                        }
                    }
                }
            }
            }
        } finally {
            writer.close();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -