libjpfcodegen-0.4+dfsg1.orig/0000775000175000017500000000000012271544631015410 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/0000775000175000017500000000000012271544631016177 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/net/0000775000175000017500000000000012271544631016765 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/net/sf/0000775000175000017500000000000012271544631017375 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/0000775000175000017500000000000012271544631020626 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/0000775000175000017500000000000012271544631022124 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/util/0000775000175000017500000000000012271544631023101 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/util/Util.java0000664000175000017500000000777711106543275024702 0ustar gregoagregoapackage net.sf.jabref.plugin.util; import java.net.MalformedURLException; import java.net.URL; import java.util.Date; import org.java.plugin.Plugin; import org.java.plugin.PluginClassLoader; import org.java.plugin.registry.Extension.Parameter; import org.java.plugin.registry.ExtensionPoint.ParameterDefinition; /** * Some useful helper methods. * */ public class Util { /** * Concatenate all strings in the array from index 'from' to 'to' (excluding * to) with the given separator. * * Example: * * String[] s = "ab/cd/ed".split("/"); join(s, "\\", 0, s.length) -> * "ab\\cd\\ed" * * @param strings * @param separator * @param from * @param to * Excluding strings[to] * @return */ public static String join(String[] strings, String separator, int from, int to) { if (strings.length == 0 || from >= to) return ""; from = Math.max(from, 0); to = Math.min(strings.length, to); StringBuffer sb = new StringBuffer(); for (int i = from; i < to - 1; i++) { sb.append(strings[i]).append(separator); } return sb.append(strings[to - 1]).toString(); } /** * Returns the given string but with the first character turned into an * upper case character. * * Example: testTest becomes TestTest * * @param string * The string to change the first character to upper case to. * @return A string has the first character turned to upper case and the * rest unchanged from the given one. */ public static String toUpperFirstLetter(String string) { if (string == null) throw new IllegalArgumentException(); if (string.length() == 0) return string; return Character.toUpperCase(string.charAt(0)) + string.substring(1); } public static Number parameter2Number(String id, Parameter parameter) { if (parameter == null) { return null; } try { return parameter.valueAsNumber(); } catch (UnsupportedOperationException e) { ParameterDefinition definition = parameter.getDefinition(); if (definition == null) { throw new IllegalArgumentException("Parameter " + id + " is not valid."); } return Double.parseDouble(definition.getDefaultValue()); } } public static boolean parameter2Boolean(String id, Parameter parameter) { if (parameter == null) { return false; } try { return parameter.valueAsBoolean(); } catch (UnsupportedOperationException e) { ParameterDefinition definition = parameter.getDefinition(); if (definition == null) { throw new IllegalArgumentException("Parameter " + id + " is not valid."); } return Boolean.parseBoolean(definition.getDefaultValue()); } } public static Date parameter2Date(String id, Parameter parameter) { if (parameter == null) { return null; } try { return parameter.valueAsDate(); } catch (UnsupportedOperationException e) { return null; } } public static URL parameter2URL(Parameter parameter, Plugin plugin) { if (parameter == null || plugin == null) { return null; } try { return parameter.valueAsUrl(plugin.getManager().getPathResolver()); } catch (UnsupportedOperationException e) { return null; } } /* * This method will assume that the given parameter is a directory and * append the relative string to it. */ public static URL parameter2URL(Parameter parameter, String relative, Plugin plugin) { URL baseURL = parameter2URL(parameter, plugin); if (relative == null) return baseURL; try { return new URL(joinPath(baseURL.toExternalForm(), relative)); } catch (MalformedURLException e) { return baseURL; } } public static String joinPath(String one, String two) { return one.replaceFirst("/$", "") + "/" + two.replaceFirst("^/", ""); } public static PluginClassLoader getClassLoader(Plugin plugin) { if (plugin == null) return null; return plugin.getManager().getPluginClassLoader(plugin.getDescriptor()); } } libjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/util/ParameterAccessor.java0000664000175000017500000002437011106543275027354 0ustar gregoagregoapackage net.sf.jabref.plugin.util; import java.net.URL; import java.util.*; import org.java.plugin.Plugin; import org.java.plugin.PluginManager; import org.java.plugin.registry.Extension.Parameter; /** * Abstract base class that provides methods for access parameters of different * types. * * This base class is needed since both extensions and parameters offer access * to parameters (sub-parameters in the case of a parameter). * */ public abstract class ParameterAccessor { /** * If subclasses extend ParameterAccessor they should provide the plugin * instance here from which to query the parameter. * * @return The plugin that this parameter belongs to. */ public abstract Plugin getDeclaringPlugin(); /** * Should return the parameter for this accessor with the given id. * * @param id * @return * * Will throw an exception if more than parameter is found with the given * id. Use getParameters then. * */ public abstract Parameter getParameter(String id); /** * Should get all parameters for this accessor. * * @return */ public abstract Collection getParameters(); /** * Should return all parameters for this accessor with the given id. * * @param id * @return */ public abstract Collection getParameters(String id); public abstract String getId(); /** * Return the Number stored in the given parameter. * * Will return null on error. */ public Number getNumberParameter(String id) { return Util.parameter2Number(id, getParameter(id)); } /** * Return all numbers stored for the given id. * * Will always return a collection, which might be empty. */ public Collection getNumberParameters(String id) { Collection parameters = getParameters(id); Collection result = new ArrayList(parameters.size()); for (Parameter para : parameters) { result.add(Util.parameter2Number(id, para)); } return result; } /** * Return the given parameter as a boolean. * * @param id * Id for which to return a boolean parameter. * @return Will return the value stored under the given string or false on * error. */ public boolean getBooleanParameter(String id) { return Util.parameter2Boolean(id, getParameter(id)); } /** * Return all booleans stored for the given id in no particular order. * * Will always return a collection, which might be empty. */ public Collection getBooleanParameters(String id) { Collection parameters = getParameters(id); Collection result = new ArrayList(parameters.size()); for (Parameter para : parameters) { result.add(Util.parameter2Boolean(id, para)); } return result; } /** * Return the string parameter for the given id using the rawValue() * function of the parameter with the given id. * * @param id * The id for which to retrieve the string value. * @return might return null on error. */ public String getStringParameter(String id) { Parameter para = getParameter(id); if (para != null) { return para.rawValue(); } return null; } /** * Return all string values for the given id. * * @param id * The id for which to retrieve the string values. * * @return Will always return a collection, which might be empty. */ public Collection getStringParameters(String id) { Collection parameters = getParameters(id); Collection result = new ArrayList(parameters.size()); for (Parameter para : parameters) { result.add(para.rawValue()); } return result; } /** * Will return the resource URL stored in the parameter with the given id. * * If this URL is relative it will be resolved relative to the plug-in root. * * @param id * The id of the parameter from which to retrieve a resource URL. * @return A resource URL for the given id or null on error. */ public URL getResourceParameter(String id) { return getResourceParameter(id, null); } /** * Will return all resource URLs stored in parameters with the given id. * * If any or these URLs are relative they will be resolved relative to the * plug-in root. * * @param id * The id of the parameters from which to retrieve resource URLs. * @return Will always a collection of URLs which might be empty. */ public Collection getResourceParameters(String id) { return getResourceParameters(id, null); } /** * Will return the resource URL stored in the parameter with the given id. * In contrast to {@link #getResourceParameter(String)} this method will * append the given relative path component to the end of the URL. * * This is useful if the resource URL points to a directory from which you * want to load a specific file. * * If the stored URL is relative it will be resolved relative to the plug-in * root. * * @param id * The id of the parameter from which to retrieve a resource URL. * @param relative * A relative path component to append to the end of the stored * URL. * * The method will take care to put a path separator between stored URL and * given relative path. * * @return A resource URL for the given id or null on error. */ public URL getResourceParameter(String id, String relative) { return Util.parameter2URL(getParameter(id), relative, getDeclaringPlugin()); } /** * Will return the resource URLs stored in the parameter with the given id. * In contrast to {@link #getResourceParameters(String)} this method will * append the given relative path component to the end of each URL. * * This is useful if the resource URLs points to directories from which you * want to load specific (albeit identically named) files . * * If the stored URLs are relative they will be resolved relative to the * plug-in root. * * @param id * The id of the parameters from which to retrieve resource URLs. * @param relative * A relative path component to append to the end of the stored * URLs. * * The method will take care to put a path separator between each stored URL * and the given relative path. * * @return Will always return a collection which might be empty. */ public Collection getResourceParameters(String id, String relative) { Collection parameters = getParameters(id); Collection result = new ArrayList(parameters.size()); Plugin plugin = getDeclaringPlugin(); for (Parameter para : parameters) { result.add(Util.parameter2URL(para, relative, plugin)); } return result; } /** * Return the Date stored in the given parameter. * * Will return null on error. */ public Date getDateParameter(String id) { return Util.parameter2Date(id, getParameter(id)); } /** * Return all dates stored for the given id. * * Will always return a collection, which might be empty. */ public Collection getDateParameters(String id) { Collection parameters = getParameters(id); Collection result = new ArrayList(parameters.size()); for (Parameter para : parameters) { result.add(Util.parameter2Date(id, para)); } return result; } HashMap singletonMap = new HashMap(); /** * Will return an singleton instance for the given class parameter. * * A class parameter is essentially a string parameter that has been marked * using a custom-data attribute in the extension point. The string value * provided by the extension of the plugin will be used as a class name to * create the instance from. * * The instance will be created on the first call to this method using the * ClassLoader of the declaring plugin. * * A call to this method will activate the plug-in if not already activated. * * @param id * @return */ public Object getClassParameter(String id) { if (!singletonMap.containsKey(id)) { // Activate plug-in that declares extension. PluginManager manager = getDeclaringPlugin().getManager(); try { manager.activatePlugin(getDeclaringPlugin().getDescriptor() .getId()); // Get plug-in class loader. ClassLoader classLoader = manager .getPluginClassLoader(getDeclaringPlugin() .getDescriptor()); // Load class. Class classToInstantiate = classLoader .loadClass(getParameter(id).valueAsString()); singletonMap.put(id, classToInstantiate.newInstance()); } catch (Exception e) { return null; } } return singletonMap.get(id); } HashMap> singletonCollectionMap = new HashMap>(); /** * See {@link #getClassParameter(String)} for details how singleton * instances are created. * * This method will create a singleton instance for each parameter with the * given id. * * @param id * The id for which to retrieve parameters. * @return A unmodifyable collection containing all singleton instances * created. */ public Collection getClassParameters(String id) { if (!singletonCollectionMap.containsKey(id)) { // Activate plug-in that declares extension. PluginManager manager = getDeclaringPlugin().getManager(); try { manager.activatePlugin(getDeclaringPlugin().getDescriptor() .getId()); // Get plug-in class loader. ClassLoader classLoader = manager .getPluginClassLoader(getDeclaringPlugin() .getDescriptor()); Collection instances = new LinkedList(); for (String classNamesToLoad : getStringParameters(id)) { // Load class. Class classToInstantiate = classLoader .loadClass(classNamesToLoad); instances.add(classToInstantiate.newInstance()); } singletonCollectionMap.put(id, Collections .unmodifiableCollection(instances)); } catch (Exception e) { return null; } } return singletonCollectionMap.get(id); } } libjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/util/SubParameterAccessor.java0000664000175000017500000000357611106543275030033 0ustar gregoagregoa/* * JPFCodeGenerator * Copyright (C) 2007 Christopher Oezbek - oezi[at]oezi.de * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3.0 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.sf.jabref.plugin.util; import java.util.Collection; import org.java.plugin.Plugin; import org.java.plugin.registry.Extension.Parameter; /** * Helper class to wrap a parameter for use in the generated code. * * Generated plug-in code will extend this class and put all calls through to * the wrapped parameter instance. * */ public class SubParameterAccessor extends ParameterAccessor { Plugin declaringPlugin; Parameter parameter; public SubParameterAccessor(Plugin declaringPlugin, Parameter parameter) { this.declaringPlugin = declaringPlugin; this.parameter = parameter; } public Plugin getDeclaringPlugin() { return this.declaringPlugin; } public Parameter getParameter(String id) { return parameter.getSubParameter(id); } public Collection getParameters() { return parameter.getSubParameters(); } public Collection getParameters(String id) { return parameter.getSubParameters(id); } public String getId() { return parameter.getId(); } } libjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/util/CodeGenerator.java0000664000175000017500000002415711106543275026475 0ustar gregoagregoa/* * JPFCodeGenerator * Copyright (C) 2007 Christopher Oezbek - oezi[at]oezi.de * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3.0 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.sf.jabref.plugin.util; import java.io.File; import java.io.PrintWriter; import java.util.*; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.java.plugin.ObjectFactory; import org.java.plugin.PluginManager; import org.java.plugin.PluginManager.PluginLocation; import org.java.plugin.boot.DefaultPluginsCollector; import org.java.plugin.registry.*; import org.java.plugin.registry.ExtensionPoint.ParameterDefinition; import org.java.plugin.util.ExtendedProperties; /** * Generate plug-in code from plugin.xml. * */ public class CodeGenerator { /** * Generate Plug-ins from plugin.xml files. * * @param args * Pass a comma separated list of plug-in directories and a * boolean indicating whether to overwrite existing Plugin files * or not. Defaults are ./plugins and false */ public static void main(String args[]) { String directory = (args.length < 1 ? "./plugins" : args[0]); boolean overwrite = (args.length < 2 ? false : Boolean .parseBoolean(args[1])); generatePlugins(directory, overwrite); } /** * * @param pluginLocations * Comma separated list of plug-in location. * * @param overwrite * Whether to overwrite existing main plug-in classes. * _Plugin-class will be overwritten any way. */ public static void generatePlugins(String pluginLocations, boolean overwrite) { ObjectFactory objectFactory = ObjectFactory.newInstance(); PluginManager manager = objectFactory.createManager(); try { DefaultPluginsCollector collector = new DefaultPluginsCollector(); ExtendedProperties ep = new ExtendedProperties(); ep.setProperty("org.java.plugin.boot.pluginsRepositories", pluginLocations); collector.configure(ep); Collection plugins = collector .collectPluginLocations(); if (plugins.size() <= 0) { System.out.println("No plugins found."); System.exit(0); } manager.publishPlugins(collector.collectPluginLocations().toArray( new PluginLocation[] {})); for (PluginDescriptor desc : manager.getRegistry() .getPluginDescriptors()) { boolean doPlugin = false; System.out.println("\nCreating Classes for " + desc.getId()); File pluginBaseFolder = new File(desc.getLocation().getFile()) .getParentFile(); String targetDir = "src/"; String helperClassName = null; PluginAttribute jpfCodeGenAttribute = desc .getAttribute("jpfcodegen"); if (jpfCodeGenAttribute != null) { PluginAttribute helperAttribute = jpfCodeGenAttribute .getSubAttribute("helperClassName"); if (helperAttribute != null) { helperClassName = helperAttribute.getValue(); } PluginAttribute targetDirAttribute = jpfCodeGenAttribute .getSubAttribute("targetDir"); if (targetDirAttribute != null) { targetDir = targetDirAttribute.getValue(); if (targetDir.length() == 0) { System.err.println("targetDir attribute in " + desc.getId() + " is invalid. Proceeding with 'src/'"); targetDir = "src/"; } } } String className = null; if (helperClassName == null) { String pluginClassName = desc.getPluginClassName(); if (pluginClassName != null) { doPlugin = true; className = pluginClassName; } } else { doPlugin = false; className = helperClassName; } if (className == null) { System.out .println(" Code Generator can only generate code for plugins that either have...\n" + " ...the class attribute set in the plugin or\n" + " ...the plugin-attribute 'jpfcodegen' -> 'helperClassName' set to the classname to generate\n" + " See the documentation for details."); continue; // Next Plugin } int lastDot = className.lastIndexOf('.'); String pluginClassName = className.substring(lastDot + 1); String pluginPackageName = className.substring(0, lastDot); String[] parts = pluginPackageName.split("\\."); StringBuilder path = new StringBuilder(); for (String part : parts) { path.append(part).append("/"); } File pluginFolder = new File(new File(pluginBaseFolder, targetDir), path.toString()); File pluginClassFile = new File(pluginFolder, pluginClassName + ".java"); Properties p = new Properties(); p.setProperty("velocimacro.library", "resources/templates/macro.vm"); p.setProperty("resource.loader", "class, file"); p .setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); Velocity.init(p); VelocityContext context = new VelocityContext(); context.put("packageName", pluginPackageName); context.put("className", pluginClassName); context.put("id", desc.getId()); context.put("doPlugin", doPlugin); // Create Plugin file if it does not already exist if (!pluginClassFile.exists() || overwrite) { pluginClassFile.getParentFile().mkdirs(); Template template = Velocity .getTemplate("resources/templates/Plugin.vm"); PrintWriter writer = new PrintWriter(pluginClassFile); template.merge(context, writer); writer.close(); } // Now do the main work File generatedFile = new File(pluginFolder, "generated/_" + pluginClassName + ".java"); generatedFile.getParentFile().mkdirs(); PrintWriter writer = new PrintWriter(generatedFile); Set imports = new TreeSet(); context.put("imports", imports); imports.add("org.java.plugin.Plugin"); if (!doPlugin) { imports.add("org.java.plugin.PluginManager"); imports.add("org.java.plugin.PluginLifecycleException"); } LinkedList> exts = new LinkedList>(); for (ExtensionPoint ext : desc.getExtensionPoints()) { HashMap map = new HashMap(); exts.add(map); map.put("id", ext.getId()); map.put("name", Util.toUpperFirstLetter(ext.getId())); recurseParameters(map, ext.getParameterDefinitions(), imports); } context.put("extensions", exts); Template template = Velocity .getTemplate("resources/templates/_Plugin.vm"); template.merge(context, writer); writer.close(); } } catch (Exception e) { throw new RuntimeException(e); } } private static void recurseParameters(HashMap map, Collection parameterDefinitions, Set imports) { LinkedList> parameters = new LinkedList>(); map.put("paras", parameters); if (parameterDefinitions.size() > 0) { imports.add("java.util.ArrayList"); imports.add("java.util.List"); imports.add("net.sf.jabref.plugin.util.RuntimeExtension"); imports.add("org.java.plugin.registry.Extension"); imports.add("org.java.plugin.registry.ExtensionPoint"); imports.add("org.java.plugin.PluginLifecycleException"); } for (ExtensionPoint.ParameterDefinition pd : parameterDefinitions) { HashMap para = new HashMap(); String pid = pd.getId(); String cleanedId = Util.toUpperFirstLetter(pid); if (pid.equals("class")) { cleanedId += "_"; } para.put("id", pid); para.put("name", cleanedId); para.put("type", pd.getType().toCode()); Collection subDefs = pd .getSubDefinitions(); // Is this a parameter with nested sub parameters? if (subDefs.size() > 0) { // if so, then create a container class for the parameters // and... para.put("subclass", true); para.put("subclassname", cleanedId); para.put("name", "Value"); // add imports imports.add("net.sf.jabref.plugin.util.SubParameterAccessor"); // populate the sub field with information about these: recurseParameters(para, subDefs, imports); } else { para.put("subclass", false); } if (pd.getMultiplicity() == ParameterMultiplicity.ANY || pd.getMultiplicity() == ParameterMultiplicity.ONE_OR_MORE) { imports.add("java.util.Collection"); if (pd.getType() == ParameterType.FIXED || (subDefs.size() > 0)) { imports.add("java.util.ArrayList"); } para.put("multiplicity", true); } else { para.put("multiplicity", false); } String customData; switch (pd.getType()) { case STRING: if ((customData = pd.getCustomData()) != null) { para.put("type", "class"); para.put("className", customData); } break; case FIXED: if ((customData = pd.getCustomData()) != null) { para.put("enumValues", Util.join(customData.toUpperCase() .split("\\|"), ", ", 0, Integer.MAX_VALUE)); } else { continue; } break; case RESOURCE: imports.add("java.net.URL"); break; case DATE: case DATE_TIME: case TIME: imports.add("java.util.Date"); break; } parameters.add(para); } } enum Bla { A, B, C; } } libjpfcodegen-0.4+dfsg1.orig/src/net/sf/jabref/plugin/util/RuntimeExtension.java0000664000175000017500000000527211106542262027264 0ustar gregoagregoa/* * JPFCodeGenerator * Copyright (C) 2007 Christopher Oezbek - oezi[at]oezi.de * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3.0 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.sf.jabref.plugin.util; import java.util.Collection; import org.java.plugin.Plugin; import org.java.plugin.registry.Documentation; import org.java.plugin.registry.Extension; import org.java.plugin.registry.PluginDescriptor; import org.java.plugin.registry.PluginFragment; /** * Helper class to wrap an existing extension for use in a plugin. * * Generated plug-in code will extend this class and put all calls through to * the wrapped extension instance. * */ public class RuntimeExtension extends ParameterAccessor implements Extension { Plugin declaringPlugin; Extension wrapped; public RuntimeExtension(Plugin declaringPlugin, Extension wrapped) { this.declaringPlugin = declaringPlugin; this.wrapped = wrapped; } public Plugin getDeclaringPlugin() { return this.declaringPlugin; } public String getExtendedPluginId() { return wrapped.getExtendedPluginId(); } public String getExtendedPointId() { return wrapped.getExtendedPointId(); } public Parameter getParameter(String id) { return wrapped.getParameter(id); } public Collection getParameters() { return wrapped.getParameters(); } public Collection getParameters(String id) { return wrapped.getParameters(id); } public boolean isValid() { return wrapped.isValid(); } public String getUniqueId() { return wrapped.getUniqueId(); } public String getId() { return wrapped.getId(); } public PluginDescriptor getDeclaringPluginDescriptor() { return wrapped.getDeclaringPluginDescriptor(); } public PluginFragment getDeclaringPluginFragment() { return wrapped.getDeclaringPluginFragment(); } public String getDocsPath() { return wrapped.getDocsPath(); } public Documentation getDocumentation() { return wrapped.getDocumentation(); } } libjpfcodegen-0.4+dfsg1.orig/lgpl-3.0.txt0000664000175000017500000001672711106542262017414 0ustar gregoagregoa GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. libjpfcodegen-0.4+dfsg1.orig/tutorials/0000775000175000017500000000000012271544631017436 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/0000775000175000017500000000000012271544631020517 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/src/0000775000175000017500000000000012271544631021306 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/src/com/0000775000175000017500000000000012271544631022064 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/src/com/example/0000775000175000017500000000000012271544631023517 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/src/com/example/Main.java0000664000175000017500000000500611106542262025241 0ustar gregoagregoapackage com.example; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; import org.java.plugin.ObjectFactory; import org.java.plugin.PluginManager; import org.java.plugin.PluginManager.PluginLocation; import org.java.plugin.boot.DefaultPluginsCollector; import org.java.plugin.util.ExtendedProperties; import com.example.core.CorePlugin; import com.example.core.generated._CorePlugin.PanelExtension; public class Main { public static void main(final String[] args) { // Move to non-static and swing-thread. SwingUtilities.invokeLater(new Runnable(){ public void run() { new Main().start(args); } }); } PluginManager manager; public void start(String[] args) { // Create Plugin Manager manager = ObjectFactory.newInstance().createManager(); // Find plugins and add to registry DefaultPluginsCollector collector = new DefaultPluginsCollector(); ExtendedProperties ep = new ExtendedProperties(); ep.setProperty("org.java.plugin.boot.pluginsRepositories", "./plugins"); try { collector.configure(ep); manager.publishPlugins(collector.collectPluginLocations().toArray( new PluginLocation[] {})); } catch (Exception e) { e.printStackTrace(); System.exit(0); } // Plugin system is now ready to use... // Start the application JFrame frame = new JFrame("JPF Code Generator Basic Tutorial"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 300); frame.setLocation(300, 200); JTabbedPane tabbedPane = new JTabbedPane(); frame.add(tabbedPane); // Use the plugin system to find panels to add to the tabbed pane CorePlugin corePlugin = CorePlugin.getInstance(manager); // corePlugin might be null here (for instance if the plug-in is missing) if (corePlugin != null){ // Now we can get all extensions for the Panel extension point for (PanelExtension extension : corePlugin.getPanelExtensions()){ // The PanelExtension class then allows easy access to the parameters defined // for this extension-point. JPanel panel = extension.getPanel(); String name = extension.getName(); // panel might be null if an error occurred while creating the object if (panel == null){ System.out.println("Error loading panel from extension " + extension.getId()); continue; } tabbedPane.addTab(name, panel); } } frame.setVisible(true); } } libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/build.xml0000664000175000017500000000477711106542262022351 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/0000775000175000017500000000000012271544631022200 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/0000775000175000017500000000000012271544631023557 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/src/0000775000175000017500000000000012271544631024346 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/src/com/0000775000175000017500000000000012271544631025124 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/src/com/example/0000775000175000017500000000000012271544631026557 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/src/com/example/plugin1/0000775000175000017500000000000012271544631030136 5ustar gregoagregoa././@LongLink0000644000000000000000000000014712271544631011651 Lustar rootrootlibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/src/com/example/plugin1/Plugin1Panel.javalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/src/com/example/plugin1/Plugin1Panel.ja0000664000175000017500000000042711106542262032746 0ustar gregoagregoapackage com.example.plugin1; import java.awt.Label; import javax.swing.JPanel; public class Plugin1Panel extends JPanel { private static final long serialVersionUID = -6420919219685347035L; public Plugin1Panel(){ this.add(new Label("I am Panel 1!")); } } libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/plugin.xml0000664000175000017500000000115211106542262025570 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin1/build.xml0000664000175000017500000000224711106542262025377 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/core/0000775000175000017500000000000012271544631023130 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/core/src/0000775000175000017500000000000012271544631023717 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/core/plugin.xml0000664000175000017500000000176111106542262025147 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/core/build.xml0000664000175000017500000000256211106542262024750 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/0000775000175000017500000000000012271544631023560 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/src/0000775000175000017500000000000012271544631024347 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/src/com/0000775000175000017500000000000012271544631025125 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/src/com/example/0000775000175000017500000000000012271544631026560 5ustar gregoagregoalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/src/com/example/plugin2/0000775000175000017500000000000012271544631030140 5ustar gregoagregoa././@LongLink0000644000000000000000000000014712271544631011651 Lustar rootrootlibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/src/com/example/plugin2/Plugin2Panel.javalibjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/src/com/example/plugin2/Plugin2Panel.ja0000664000175000017500000000042711106542262032751 0ustar gregoagregoapackage com.example.plugin2; import java.awt.Label; import javax.swing.JPanel; public class Plugin2Panel extends JPanel { private static final long serialVersionUID = -7872548230704172959L; public Plugin2Panel(){ this.add(new Label("I am Panel 2!")); } } libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/plugin.xml0000664000175000017500000000112411106542262025570 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/plugins/plugin2/build.xml0000664000175000017500000000224711106542262025400 0ustar gregoagregoa libjpfcodegen-0.4+dfsg1.orig/tutorials/basic/index.html0000664000175000017500000004200011106542262022502 0ustar gregoagregoa JPF Code Generator - Basic Tutorial