From e92f647b61659e44ea6f51bebce7b2db00754ed4 Mon Sep 17 00:00:00 2001 From: joergviola Date: Wed, 17 Mar 2010 19:48:19 +0000 Subject: [PATCH] Extension Point FormPanel Some fixes on 2pack integration https://sourceforge.net/tracker/?func=detail&aid=2700937&group_id=176962&atid=879334 --- base/plugin.xml | 1 + .../org.compiere.apps.form.FormPanel.exsd | 102 ++++++++++++++++++ base/src/org/adempiere/base/Core.java | 6 ++ .../src/org/adempiere/client/Activator.java | 25 ++++- client/src/org/adempiere/client/Client.java | 18 ++++ .../src/org/compiere/apps/form/FormFrame.java | 7 +- .../src/org/compiere/apps/form/FormPanel.java | 4 +- plugins/pipo/META-INF/MANIFEST.MF | 3 + plugins/pipo/plugin.xml | 2 +- .../pipo/{ => srv}/PipoDictionaryService.java | 4 +- tools/.classpath | 1 + tools/META-INF/MANIFEST.MF | 46 +++++++- tools/build.properties | 6 +- 13 files changed, 215 insertions(+), 10 deletions(-) create mode 100644 base/schema/org.compiere.apps.form.FormPanel.exsd create mode 100644 client/src/org/adempiere/client/Client.java rename plugins/pipo/src/org/adempiere/pipo/{ => srv}/PipoDictionaryService.java (94%) diff --git a/base/plugin.xml b/base/plugin.xml index d960b2b036..e956db1f4d 100644 --- a/base/plugin.xml +++ b/base/plugin.xml @@ -4,5 +4,6 @@ + diff --git a/base/schema/org.compiere.apps.form.FormPanel.exsd b/base/schema/org.compiere.apps.form.FormPanel.exsd new file mode 100644 index 0000000000..9cd2b89745 --- /dev/null +++ b/base/schema/org.compiere.apps.form.FormPanel.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/base/src/org/adempiere/base/Core.java b/base/src/org/adempiere/base/Core.java index c5e5431ada..2b204f7d71 100644 --- a/base/src/org/adempiere/base/Core.java +++ b/base/src/org/adempiere/base/Core.java @@ -11,6 +11,8 @@ import java.util.List; */ public class Core { + public static final String OSGI_PREFIX = "osgi://"; + public static IResourceFinder getResourceFinder() { return new IResourceFinder() { @@ -34,5 +36,9 @@ public class Core { return Service.list(IColumnCallout.class, query); } + public static boolean isExtension(String className) { + return className.startsWith(OSGI_PREFIX); + } + } diff --git a/client/src/org/adempiere/client/Activator.java b/client/src/org/adempiere/client/Activator.java index fb5fec09f0..36e34f5279 100644 --- a/client/src/org/adempiere/client/Activator.java +++ b/client/src/org/adempiere/client/Activator.java @@ -1,12 +1,35 @@ package org.adempiere.client; +import org.compiere.util.CLogger; import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; public class Activator extends Plugin { + private static final String ADMEPIERE_PREFIX = "org.adempiere"; + private static CLogger log = CLogger.getCLogger(Activator.class); + @Override public void start(BundleContext context) throws Exception { - System.out.println("Starting client"); + log.info("Starting client"); org.compiere.AdempiereClient.main(new String[]{}); + activateAll(context.getBundles()); + } + + private void activateAll(Bundle[] bundles) { + for (Bundle bundle : bundles) { + if (shouldStart(bundle)) + try { + bundle.start(); + log.info("Started "+bundle.getSymbolicName()); + } catch (BundleException e) { + log.warning("Could not start "+bundle.getSymbolicName()); + } + } + } + + private boolean shouldStart(Bundle bundle) { + return bundle.getSymbolicName().startsWith(ADMEPIERE_PREFIX); } } diff --git a/client/src/org/adempiere/client/Client.java b/client/src/org/adempiere/client/Client.java new file mode 100644 index 0000000000..0fd064200e --- /dev/null +++ b/client/src/org/adempiere/client/Client.java @@ -0,0 +1,18 @@ +package org.adempiere.client; + +import org.adempiere.base.Core; +import org.adempiere.base.Service; +import org.adempiere.base.ServiceQuery; +import org.compiere.apps.form.FormPanel; + +public class Client { + + public static FormPanel getFormPanel(String className) { + if (Core.isExtension(className)) + className = className.substring(Core.OSGI_PREFIX.length()); + ServiceQuery query = new ServiceQuery(); + query.put("class", className); + return Service.locate(FormPanel.class, query ); + } + +} diff --git a/client/src/org/compiere/apps/form/FormFrame.java b/client/src/org/compiere/apps/form/FormFrame.java index fa741e19e0..bfed07e3b1 100644 --- a/client/src/org/compiere/apps/form/FormFrame.java +++ b/client/src/org/compiere/apps/form/FormFrame.java @@ -32,6 +32,8 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.KeyStroke; +import org.adempiere.base.Core; +import org.adempiere.client.Client; import org.compiere.apps.AEnv; import org.compiere.apps.AGlassPane; import org.compiere.apps.AMenu; @@ -303,7 +305,10 @@ public class FormFrame extends CFrame try { // Create instance w/o parameters - m_panel = (FormPanel)Class.forName(className).newInstance(); + if (Core.isExtension(className)) + m_panel = Client.getFormPanel(className); + else + m_panel = (FormPanel)Class.forName(className).newInstance(); } catch (Exception e) { diff --git a/client/src/org/compiere/apps/form/FormPanel.java b/client/src/org/compiere/apps/form/FormPanel.java index 443ac21be5..f0adf52f76 100644 --- a/client/src/org/compiere/apps/form/FormPanel.java +++ b/client/src/org/compiere/apps/form/FormPanel.java @@ -16,13 +16,15 @@ *****************************************************************************/ package org.compiere.apps.form; +import org.adempiere.base.IService; + /** * Form Panel Interface. * for communicating between FormFrame and JPanel * @author Jorg Janke * @version $Id: FormPanel.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $ */ -public interface FormPanel +public interface FormPanel extends IService { /** * Initialize Panel diff --git a/plugins/pipo/META-INF/MANIFEST.MF b/plugins/pipo/META-INF/MANIFEST.MF index 7614ebbee9..8908263f8d 100644 --- a/plugins/pipo/META-INF/MANIFEST.MF +++ b/plugins/pipo/META-INF/MANIFEST.MF @@ -8,3 +8,6 @@ Import-Package: org.adempiere.base, org.adempiere.pipo, org.compiere, org.compiere.util +Export-Package: org.adempiere.pipo.srv +Require-Bundle: org.adempiere.base;bundle-version="0.0.0", + org.adempiere.tools;bundle-version="0.0.0" diff --git a/plugins/pipo/plugin.xml b/plugins/pipo/plugin.xml index 61312c4cbb..5ac7a83ec5 100644 --- a/plugins/pipo/plugin.xml +++ b/plugins/pipo/plugin.xml @@ -4,7 +4,7 @@ + class="org.adempiere.pipo.srv.PipoDictionaryService"> diff --git a/plugins/pipo/src/org/adempiere/pipo/PipoDictionaryService.java b/plugins/pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java similarity index 94% rename from plugins/pipo/src/org/adempiere/pipo/PipoDictionaryService.java rename to plugins/pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java index 300fc164a6..c955dd4457 100644 --- a/plugins/pipo/src/org/adempiere/pipo/PipoDictionaryService.java +++ b/plugins/pipo/src/org/adempiere/pipo/srv/PipoDictionaryService.java @@ -1,4 +1,4 @@ -package org.adempiere.pipo; +package org.adempiere.pipo.srv; import java.io.File; import java.io.InputStream; @@ -9,6 +9,8 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.adempiere.base.IDictionaryService; +import org.adempiere.pipo.PackIn; +import org.adempiere.pipo.PackInHandler; import org.compiere.Adempiere; import org.compiere.util.DB; import org.compiere.util.Trx; diff --git a/tools/.classpath b/tools/.classpath index 3d9be19ad1..e69130761d 100644 --- a/tools/.classpath +++ b/tools/.classpath @@ -1,6 +1,7 @@ + diff --git a/tools/META-INF/MANIFEST.MF b/tools/META-INF/MANIFEST.MF index dc79ccc1b6..cb19c49b15 100644 --- a/tools/META-INF/MANIFEST.MF +++ b/tools/META-INF/MANIFEST.MF @@ -50,9 +50,11 @@ Bundle-ClassPath: tools.jar, lib/ojdbc14.jar, lib/postgresql.jar, lib/wizard.jar, - lib/xercesImpl.jar, lib/xjavadoc-1.1.jar, - lib/xml-apis.jar + lib/xml-apis.jar, + lib/cron4j-2.2.1.jar, + lib/payflow.jar, + lib/xercesImpl.jar Export-Package: Lib, Lib.email, Lib.encodings, @@ -707,6 +709,7 @@ Export-Package: Lib, org.apache.ecs.storage, org.apache.ecs.xhtml;uses:="org.apache.ecs", org.apache.ecs.xml;uses:="org.apache.ecs", + org.apache.html.dom, org.apache.log4j;uses:="org.apache.log4j.or,org.apache.log4j.spi,org.apache.log4j.helpers", org.apache.log4j.chainsaw; uses:="javax.swing.event, @@ -863,6 +866,42 @@ Export-Package: Lib, org.apache.taglibs.standard.tag.rt.xml;uses:="org.xml.sax,org.apache.taglibs.standard.tag.common.xml,javax.xml.transform", org.apache.taglibs.standard.tei;uses:="javax.servlet.jsp.tagext", org.apache.taglibs.standard.tlv;uses:="org.xml.sax,javax.servlet.jsp.tagext,org.xml.sax.helpers", + org.apache.wml, + org.apache.wml.dom, + org.apache.xerces.dom, + org.apache.xerces.dom.events, + org.apache.xerces.dom3.as, + org.apache.xerces.impl, + org.apache.xerces.impl.dtd, + org.apache.xerces.impl.dtd.models, + org.apache.xerces.impl.dv, + org.apache.xerces.impl.dv.dtd, + org.apache.xerces.impl.dv.util, + org.apache.xerces.impl.dv.xs, + org.apache.xerces.impl.io, + org.apache.xerces.impl.msg, + org.apache.xerces.impl.validation, + org.apache.xerces.impl.xpath, + org.apache.xerces.impl.xpath.regex, + org.apache.xerces.impl.xs, + org.apache.xerces.impl.xs.identity, + org.apache.xerces.impl.xs.models, + org.apache.xerces.impl.xs.opti, + org.apache.xerces.impl.xs.traversers, + org.apache.xerces.impl.xs.util, + org.apache.xerces.jaxp, + org.apache.xerces.jaxp.datatype, + org.apache.xerces.jaxp.validation, + org.apache.xerces.parsers, + org.apache.xerces.util, + org.apache.xerces.xinclude, + org.apache.xerces.xni, + org.apache.xerces.xni.grammars, + org.apache.xerces.xni.parser, + org.apache.xerces.xpointer, + org.apache.xerces.xs, + org.apache.xerces.xs.datatypes, + org.apache.xml.serialize, org.codehaus.groovy, org.codehaus.groovy.ant; uses:="groovyjarjarasm.asm.tree, @@ -1431,4 +1470,5 @@ Export-Package: Lib, org.apache.tools.ant.taskdefs, org.apache.tools.ant.types, org.python.core, - jline" + jline", + org.w3c.dom.html diff --git a/tools/build.properties b/tools/build.properties index db996bc655..96b9a4dc42 100644 --- a/tools/build.properties +++ b/tools/build.properties @@ -47,6 +47,8 @@ bin.includes = META-INF/,\ lib/ojdbc14.jar,\ lib/postgresql.jar,\ lib/wizard.jar,\ - lib/xercesImpl.jar,\ lib/xjavadoc-1.1.jar,\ - lib/xml-apis.jar + lib/xml-apis.jar,\ + lib/cron4j-2.2.1.jar,\ + lib/payflow.jar,\ + lib/xercesImpl.jar