From f4da72ef506f12f65776fea705e34f67f5c559b5 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 13 Feb 2013 16:15:43 +0800 Subject: [PATCH] IDEMPIERE-359 Add OSGi Service support for existing extension point. 1) Separate osgi service and equinox extension locator API. Service.locator() for OSGi service and EquinoxExtensionLocator.instance() for equinox extension. 2) Use OSGi service for all singleton component ( all factories and most services ) and equinox extension for others ( UI object, Process instance and PIPO handlers). --- org.adempiere.base/META-INF/MANIFEST.MF | 3 +- .../OSGI-INF/defaultcolumncalloutfactory.xml | 7 + .../OSGI-INF/defaultmodelvalidatorfactory.xml | 7 + .../defaultpaymentprocessorfactory.xml | 7 + .../OSGI-INF/defaultprocessfactory.xml | 7 + .../defaultshipmentprocessorfactory.xml | 7 + org.adempiere.base/build.properties | 7 +- org.adempiere.base/plugin.xml | 7 - ...org.adempiere.base.IDictionaryService.exsd | 131 --------- .../org.adempiere.base.IDocFactory.exsd | 149 ---------- .../org.adempiere.base.IModelFactory.exsd | 141 --------- .../org.adempiere.base.IResourceFinder.exsd | 132 --------- .../org.compiere.db.AdempiereDatabase.exsd | 141 --------- .../org.compiere.interfaces.Server.exsd | 130 --------- .../org.compiere.interfaces.Status.exsd | 130 --------- .../src/org/adempiere/base/Core.java | 108 +++---- .../base/DefaultColumnCalloutFactory.java | 46 +++ .../base/DefaultModelValidatorFactory.java | 71 +++++ .../base/DefaultPaymentProcessorFactory.java | 61 ++++ .../adempiere/base/DefaultProcessFactory.java | 91 ++++++ .../base/DefaultShipmentProcessorFactory.java | 68 +++++ .../base/DelegatingServiceHolder.java | 64 ---- .../base/DelegatingServiceLocator.java | 181 ------------ .../adempiere/base/IColumnCalloutFactory.java | 31 ++ .../base/IModelValidatorFactory.java | 30 ++ .../base/IPaymentProcessorFactory.java | 30 ++ .../org/adempiere/base/IServiceLocator.java | 47 +-- .../base/IShipmentProcessorFactory.java | 31 ++ .../src/org/adempiere/base/Service.java | 4 +- .../base/ds/DynamicServiceLocator.java | 34 --- ...older.java => EquinoxExtensionHolder.java} | 19 +- .../base/equinox/EquinoxExtensionLocator.java | 150 ++++++++++ .../base/equinox/EquinoxServiceLocator.java | 91 ------ .../src/org/adempiere/util/ProcessUtil.java | 48 +-- .../src/org/compiere/model/GridTab.java | 4 +- .../compiere/model/ModelValidationEngine.java | 12 +- .../compiere/install/ConfigurationData.java | 4 +- org.adempiere.pipo/.project | 5 + org.adempiere.pipo/META-INF/MANIFEST.MF | 1 + .../OSGI-INF/dictionaryservice.xml | 7 + org.adempiere.pipo/build.properties | 6 +- org.adempiere.pipo/plugin.xml | 6 - .../adempiere/pipo2/OSGiHandlerRegistry.java | 11 +- org.adempiere.report.jasper.swing/.project | 5 + .../META-INF/MANIFEST.MF | 1 + .../OSGI-INF/jrviewerprovider.xml | 7 + .../build.properties | 5 +- org.adempiere.report.jasper.swing/plugin.xml | 11 - org.adempiere.report.jasper/build.properties | 3 +- org.adempiere.report.jasper/plugin.xml | 6 - .../org.compiere.report.JRViewerProvider.exsd | 131 --------- org.adempiere.server/plugin.xml | 1 - .../org.adempiere.server.IServerFactory.exsd | 131 --------- org.adempiere.ui.swing/META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/defaulteditorfactory.xml | 7 + .../OSGI-INF/defaultformfactory.xml | 7 + .../OSGI-INF/defaultinfofactory.xml | 7 + .../OSGI-INF/reportviewerprovider.xml | 7 + .../OSGI-INF/resourcefinder.xml | 7 + org.adempiere.ui.swing/build.properties | 31 +- org.adempiere.ui.swing/plugin.xml | 34 --- ...piere.ui.swing.factory.IEditorFactory.exsd | 140 --------- ...empiere.ui.swing.factory.IInfoFactory.exsd | 140 --------- .../src/org/adempiere/client/Client.java | 20 +- .../ui/swing/factory/DefaultFormFactory.java | 77 +++++ .../ui/swing/factory/IFormFactory.java | 30 ++ .../src/org/compiere/apps/AExport.java | 4 +- .../src/org/compiere/apps/form/FormFrame.java | 2 - org.adempiere.ui.zk/META-INF/MANIFEST.MF | 2 +- .../OSGI-INF/defaultformfactory.xml | 7 + .../src/org/adempiere/webui/Extensions.java | 21 +- .../webui/factory/DefaultFormFactory.java | 274 ++++++++++++++++++ .../adempiere/webui/factory/IFormFactory.java | 32 ++ .../src/org/adempiere/webui/panel/ADForm.java | 237 +-------------- .../webui/panel/action/ExportAction.java | 4 +- .../webui/panel/action/FileImportAction.java | 4 +- org.adempiere.ui.zk/build.properties | 105 +++---- org.adempiere.ui.zk/plugin.xml | 2 - ...dempiere.webui.factory.IEditorFactory.exsd | 141 --------- ....adempiere.webui.factory.IInfoFactory.exsd | 141 --------- org.adempiere.ui/build.properties | 3 +- org.adempiere.ui/plugin.xml | 6 - ...g.compiere.print.ReportViewerProvider.exsd | 131 --------- .../webservices/AbstractService.java | 4 +- 84 files changed, 1358 insertions(+), 2839 deletions(-) create mode 100644 org.adempiere.base/OSGI-INF/defaultcolumncalloutfactory.xml create mode 100644 org.adempiere.base/OSGI-INF/defaultmodelvalidatorfactory.xml create mode 100644 org.adempiere.base/OSGI-INF/defaultpaymentprocessorfactory.xml create mode 100644 org.adempiere.base/OSGI-INF/defaultprocessfactory.xml create mode 100644 org.adempiere.base/OSGI-INF/defaultshipmentprocessorfactory.xml delete mode 100644 org.adempiere.base/schema/org.adempiere.base.IDictionaryService.exsd delete mode 100644 org.adempiere.base/schema/org.adempiere.base.IDocFactory.exsd delete mode 100644 org.adempiere.base/schema/org.adempiere.base.IModelFactory.exsd delete mode 100644 org.adempiere.base/schema/org.adempiere.base.IResourceFinder.exsd delete mode 100644 org.adempiere.base/schema/org.compiere.db.AdempiereDatabase.exsd delete mode 100644 org.adempiere.base/schema/org.compiere.interfaces.Server.exsd delete mode 100644 org.adempiere.base/schema/org.compiere.interfaces.Status.exsd create mode 100644 org.adempiere.base/src/org/adempiere/base/DefaultColumnCalloutFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/DefaultModelValidatorFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/DefaultPaymentProcessorFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/DefaultProcessFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/DefaultShipmentProcessorFactory.java delete mode 100644 org.adempiere.base/src/org/adempiere/base/DelegatingServiceHolder.java delete mode 100644 org.adempiere.base/src/org/adempiere/base/DelegatingServiceLocator.java create mode 100644 org.adempiere.base/src/org/adempiere/base/IColumnCalloutFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/IModelValidatorFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/IPaymentProcessorFactory.java create mode 100644 org.adempiere.base/src/org/adempiere/base/IShipmentProcessorFactory.java rename org.adempiere.base/src/org/adempiere/base/equinox/{EquinoxServiceHolder.java => EquinoxExtensionHolder.java} (80%) create mode 100644 org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionLocator.java delete mode 100644 org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceLocator.java create mode 100644 org.adempiere.pipo/OSGI-INF/dictionaryservice.xml create mode 100644 org.adempiere.report.jasper.swing/OSGI-INF/jrviewerprovider.xml delete mode 100644 org.adempiere.report.jasper.swing/plugin.xml delete mode 100644 org.adempiere.report.jasper/plugin.xml delete mode 100644 org.adempiere.report.jasper/schema/org.compiere.report.JRViewerProvider.exsd delete mode 100644 org.adempiere.server/schema/org.adempiere.server.IServerFactory.exsd create mode 100644 org.adempiere.ui.swing/OSGI-INF/defaulteditorfactory.xml create mode 100644 org.adempiere.ui.swing/OSGI-INF/defaultformfactory.xml create mode 100644 org.adempiere.ui.swing/OSGI-INF/defaultinfofactory.xml create mode 100644 org.adempiere.ui.swing/OSGI-INF/reportviewerprovider.xml create mode 100644 org.adempiere.ui.swing/OSGI-INF/resourcefinder.xml delete mode 100644 org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IEditorFactory.exsd delete mode 100644 org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IInfoFactory.exsd create mode 100644 org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/DefaultFormFactory.java create mode 100644 org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/IFormFactory.java create mode 100644 org.adempiere.ui.zk/OSGI-INF/defaultformfactory.xml create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFormFactory.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IFormFactory.java delete mode 100644 org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IEditorFactory.exsd delete mode 100644 org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IInfoFactory.exsd delete mode 100644 org.adempiere.ui/plugin.xml delete mode 100644 org.adempiere.ui/schema/org.compiere.print.ReportViewerProvider.exsd diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index 266ab82c21..7da5699e0e 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -112,6 +112,7 @@ Export-Package: bsh, net.sourceforge.barbecue.twod.pdf417, org.adempiere.apps.graph, org.adempiere.base, + org.adempiere.base.equinox, org.adempiere.base.event, org.adempiere.exceptions, org.adempiere.impexp, @@ -291,6 +292,6 @@ Import-Package: com.sun.mail.auth;version="1.4.5", Eclipse-BuddyPolicy: registered Eclipse-ExtensibleAPI: true Bundle-Activator: org.adempiere.base.BaseActivator -Service-Component: OSGI-INF/eventmanager.xml, OSGI-INF/dslocator.xml, OSGI-INF/extensionlocator.xml, OSGI-INF/serverbean.xml, OSGI-INF/statusbean.xml, OSGI-INF/defaultmodelfactory.xml, OSGI-INF/defaultdocfactory.xml, OSGI-INF/attachmentfile.xml, OSGI-INF/attachmentdb.xml,OSGI-INF/archivedb.xml,OSGI-INF/archivefile.xml +Service-Component: OSGI-INF/*.xml Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.equinox.app;bundle-version="1.3.1" diff --git a/org.adempiere.base/OSGI-INF/defaultcolumncalloutfactory.xml b/org.adempiere.base/OSGI-INF/defaultcolumncalloutfactory.xml new file mode 100644 index 0000000000..3ed6c19f65 --- /dev/null +++ b/org.adempiere.base/OSGI-INF/defaultcolumncalloutfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base/OSGI-INF/defaultmodelvalidatorfactory.xml b/org.adempiere.base/OSGI-INF/defaultmodelvalidatorfactory.xml new file mode 100644 index 0000000000..f41c401212 --- /dev/null +++ b/org.adempiere.base/OSGI-INF/defaultmodelvalidatorfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base/OSGI-INF/defaultpaymentprocessorfactory.xml b/org.adempiere.base/OSGI-INF/defaultpaymentprocessorfactory.xml new file mode 100644 index 0000000000..a45ade46f8 --- /dev/null +++ b/org.adempiere.base/OSGI-INF/defaultpaymentprocessorfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base/OSGI-INF/defaultprocessfactory.xml b/org.adempiere.base/OSGI-INF/defaultprocessfactory.xml new file mode 100644 index 0000000000..9d9028fd00 --- /dev/null +++ b/org.adempiere.base/OSGI-INF/defaultprocessfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base/OSGI-INF/defaultshipmentprocessorfactory.xml b/org.adempiere.base/OSGI-INF/defaultshipmentprocessorfactory.xml new file mode 100644 index 0000000000..6605feb4a3 --- /dev/null +++ b/org.adempiere.base/OSGI-INF/defaultshipmentprocessorfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.base/build.properties b/org.adempiere.base/build.properties index c923eec5c3..140574a5f4 100644 --- a/org.adempiere.base/build.properties +++ b/org.adempiere.base/build.properties @@ -22,7 +22,12 @@ bin.includes = META-INF/,\ OSGI-INF/serverbean.xml,\ OSGI-INF/statusbean.xml,\ OSGI-INF/defaultmodelfactory.xml,\ - OSGI-INF/defaultdocfactory.xml + OSGI-INF/defaultdocfactory.xml,\ + OSGI-INF/defaultcolumncalloutfactory.xml,\ + OSGI-INF/defaultmodelvalidatorfactory.xml,\ + OSGI-INF/defaultprocessfactory.xml,\ + OSGI-INF/defaultshipmentprocessorfactory.xml,\ + OSGI-INF/defaultpaymentprocessorfactory.xml output.base.jar = build/ src.includes = schema/ source.base.jar = src/ diff --git a/org.adempiere.base/plugin.xml b/org.adempiere.base/plugin.xml index 59e1eb219a..124c80768b 100644 --- a/org.adempiere.base/plugin.xml +++ b/org.adempiere.base/plugin.xml @@ -1,16 +1,9 @@ - - - - - - - diff --git a/org.adempiere.base/schema/org.adempiere.base.IDictionaryService.exsd b/org.adempiere.base/schema/org.adempiere.base.IDictionaryService.exsd deleted file mode 100644 index ab7e92c496..0000000000 --- a/org.adempiere.base/schema/org.adempiere.base.IDictionaryService.exsd +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - Extension point to update the Adempiere dictionary ( AD_* tables ) when a bundle is activated for the first time. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class for the org.adempiere.base.IDictionaryService interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.adempiere.base.IDictionaryService"> - <client - class="org.adempiere.pipo.srv.PipoDictionaryService"> - </client> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.base.IDictionaryService - - - - - - - - - Used by the 2pack (pipo) bundle to implement loading of 2pack archive when a bundle that have 2pack resources is activated for the first time. - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Jorg Viola. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.base/schema/org.adempiere.base.IDocFactory.exsd b/org.adempiere.base/schema/org.adempiere.base.IDocFactory.exsd deleted file mode 100644 index 383f81f3a4..0000000000 --- a/org.adempiere.base/schema/org.adempiere.base.IDocFactory.exsd +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - Extension point for accounting document factory. Matching is done against the gaap attribute following the priority sequence ( start from larger number ). Extension is only expected to provide document instance for document type that it intents to support and can return null for others. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - gaap to match c_acctschema.gaap. you can use * to match everything - - - - - - - numeric priority value, higher value is of higher priority. - - - - - - - Implementation class for the org.adempiere.base.IDocFactory - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="org.adempiere.base.DefaultDocFactory" - name="Default Document Factory" - point="org.adempiere.base.IDocFactory"> - <factory - class="org.adempiere.base.DefaultDocumentFactory" - gaap="*" - priority="0"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.base.IDocFactory - - - - - - - - - Default document factory in the org.adempiere.base bundle. - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.base/schema/org.adempiere.base.IModelFactory.exsd b/org.adempiere.base/schema/org.adempiere.base.IModelFactory.exsd deleted file mode 100644 index 01f9f63760..0000000000 --- a/org.adempiere.base/schema/org.adempiere.base.IModelFactory.exsd +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Extension point to provide model factory. Extension is expected to provide model instance only for the table that it intends to support and can return null for other. The persistence framework will query all the available model factory extension following the priority sequence and will use the first model instance available. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - numeric priority value, higher value is of higher priority. - - - - - - - Implementation class name for the org.adempiere.base.IModelFactory interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="org.adempiere.base.DefaultModelFactory" - name="Default model factory" - point="org.adempiere.base.IModelFactory"> - <factory - class="org.adempiere.base.DefaultModelFactory" - priority="0"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.base.IModelFactory - - - - - - - - - Default model class factory in org.adempiere.base bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.base/schema/org.adempiere.base.IResourceFinder.exsd b/org.adempiere.base/schema/org.adempiere.base.IResourceFinder.exsd deleted file mode 100644 index 0626aaa694..0000000000 --- a/org.adempiere.base/schema/org.adempiere.base.IResourceFinder.exsd +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - The core classes will query all available resource finder to load resources like image, properties file, etc ( First non-null result will be used ). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class name for the org.compiere.util.IResourceFinder interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="RF" - name="RF" - point="org.adempiere.base.IResourceFinder"> - <finder - class="org.compiere.util.ResourceFinder"> - </finder> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.base.IResourceFinder - - - - - - - - - extension at the org.adempiere.ui.swing and org.adempiere.ui.zk bundle. - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Jorg Viola. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - diff --git a/org.adempiere.base/schema/org.compiere.db.AdempiereDatabase.exsd b/org.adempiere.base/schema/org.compiere.db.AdempiereDatabase.exsd deleted file mode 100644 index eb1cc7170c..0000000000 --- a/org.adempiere.base/schema/org.compiere.db.AdempiereDatabase.exsd +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Extension point for persistence framework to database interface. The id attribute of the database element in your extension definition must match the database type stored in idempiere.properties . - -To support a database in adempiere, you need to extend this extension point and the org.adempiere.install.IDatabaseConfig extension point from the org.adempiere.install bundle. The id attribute of the two extension must match ( case sensitive ). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Oracle, PostgreSQL, etc - - - - - - - Implementation class name for the org.compiere.db.AdempiereDatabase interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.compiere.db.AdempiereDatabase"> - <database - class="org.compiere.db.DB_PostgreSQL" - id="PostgreSQL"> - </database> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.compiere.db.AdempiereDatabase - - - - - - - - - org.adempiere.db.oracle.provider and org.adempiere.db.postgresql.provider - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.base/schema/org.compiere.interfaces.Server.exsd b/org.adempiere.base/schema/org.compiere.interfaces.Server.exsd deleted file mode 100644 index 3024d691b4..0000000000 --- a/org.adempiere.base/schema/org.compiere.interfaces.Server.exsd +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - Extension point to provide client interface (org.compiere.interfaces.Server ) to execute remote server command - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class name for the org.compiere.interfaces.Server interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.compiere.interfaces.Server"> - <interface - class="org.adempiere.client.ServerInterface"> - </interface> -</extension> -</Pre> - - - - - - - - - The class attribute must represent an implementor of org.compiere.interfaces.Server - - - - - - - - - The restlet base swing client interface at org.adempiere.ui.swing bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Jorg Viola. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - diff --git a/org.adempiere.base/schema/org.compiere.interfaces.Status.exsd b/org.adempiere.base/schema/org.compiere.interfaces.Status.exsd deleted file mode 100644 index 01c1737403..0000000000 --- a/org.adempiere.base/schema/org.compiere.interfaces.Status.exsd +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - Extension point to provide implementation for client interface ( org.compiere.interfaces.Status ) to query remote server info and status - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class name for the org.compiere.interfaces.Status interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.compiere.interfaces.Status"> - <interface - class="org.adempiere.client.StatusInterface"> - </interface> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.compiere.interfaces.Status - - - - - - - - - The default restlet base implementation at the org.adempiere.ui.swing bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Jorg Viola. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - diff --git a/org.adempiere.base/src/org/adempiere/base/Core.java b/org.adempiere.base/src/org/adempiere/base/Core.java index 14302b9757..c15d03777b 100644 --- a/org.adempiere.base/src/org/adempiere/base/Core.java +++ b/org.adempiere.base/src/org/adempiere/base/Core.java @@ -21,6 +21,7 @@ package org.adempiere.base; import java.net.URL; +import java.util.ArrayList; import java.util.List; import java.util.logging.Level; @@ -70,38 +71,54 @@ public class Core { * @return list of callout register for tableName.columnName */ public static List findCallout(String tableName, String columnName) { - ServiceQuery query = new ServiceQuery(); - query.put("tableName", tableName); - query.put("columnName", columnName); - - return Service.locator().list(IColumnCallout.class, query).getServices(); + List list = new ArrayList(); + List factories = Service.locator().list(IColumnCalloutFactory.class).getServices(); + if (factories != null) { + for(IColumnCalloutFactory factory : factories) { + IColumnCallout[] callouts = factory.getColumnCallouts(tableName, columnName); + if (callouts != null && callouts.length > 0) { + for(IColumnCallout callout : callouts) { + list.add(callout); + } + } + } + } + return list; } /** * - * @param serviceId - * @return ProcessCall instance or null if serviceId not found + * @param processId Java class name or equinox extension id + * @return ProcessCall instance or null if processId not found */ - public static ProcessCall getProcess(String serviceId) { - ProcessCall process = null; + public static ProcessCall getProcess(String processId) { List factories = Service.locator().list(IProcessFactory.class).getServices(); if (factories != null && !factories.isEmpty()) { for(IProcessFactory factory : factories) { - process = factory.newProcessInstance(serviceId); + ProcessCall process = factory.newProcessInstance(processId); if (process != null) return process; } } - return Service.locator().locate(ProcessCall.class, "org.adempiere.base.Process", serviceId, null).getService(); + return null; } /** * - * @param serviceId - * @return ModelValidator instance of null if serviceId not found + * @param validatorId Java class name or equinox extension Id + * @return ModelValidator instance of null if validatorId not found */ - public static ModelValidator getModelValidator(String serviceId) { - return Service.locator().locate(ModelValidator.class, "org.adempiere.base.ModelValidator", serviceId, null).getService(); + public static ModelValidator getModelValidator(String validatorId) { + List factoryList = Service.locator().list(IModelValidatorFactory.class).getServices(); + if (factoryList != null) { + for(IModelValidatorFactory factory : factoryList) { + ModelValidator validator = factory.newModelValidatorInstance(validatorId); + if (validator != null) + return validator; + } + } + + return null; } /** @@ -130,21 +147,18 @@ public class Core { } // PaymentProcessor myProcessor = null; - myProcessor = Service.locator().locate(PaymentProcessor.class, className, null).getService(); - if (myProcessor == null) { - //fall back to dynamic java class loadup - try { - Class ppClass = Class.forName(className); - if (ppClass != null) - myProcessor = (PaymentProcessor)ppClass.newInstance(); - } catch (Error e1) { // NoClassDefFound - s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage()); - return null; - } catch (Exception e2) { - s_log.log(Level.SEVERE, className, e2); - return null; + + List factoryList = Service.locator().list(IPaymentProcessorFactory.class).getServices(); + if (factoryList != null) { + for(IPaymentProcessorFactory factory : factoryList) { + PaymentProcessor processor = factory.newPaymentProcessorInstance(className); + if (processor != null) { + myProcessor = processor; + break; + } } } + if (myProcessor == null) { s_log.log(Level.SEVERE, "Not found in service/extension registry and classpath"); return null; @@ -156,6 +170,11 @@ public class Core { return myProcessor; } + /** + * + * @param sf + * @return shipment process instance or null if not found + */ public static IShipmentProcessor getShipmentProcessor(MShipperFacade sf) { if (s_log.isLoggable(Level.FINE)) @@ -168,33 +187,16 @@ public class Core { return null; } - IShipmentProcessor myProcessor = Service.locator().locate(IShipmentProcessor.class, className, null).getService(); - if (myProcessor == null) - { - //fall back to dynamic java class loadup - try - { - Class ppClass = Class.forName(className); - if (ppClass != null) - myProcessor = (IShipmentProcessor) ppClass.newInstance(); - } - catch (Error e1) - { // NoClassDefFound - s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage()); - return null; - } - catch (Exception e2) - { - s_log.log(Level.SEVERE, className, e2); - return null; - } - } - if (myProcessor == null) - { - s_log.log(Level.SEVERE, "Not found in service/extension registry and classpath"); + List factoryList = Service.locator().list(IShipmentProcessorFactory.class).getServices(); + if (factoryList == null) return null; + for (IShipmentProcessorFactory factory : factoryList) + { + IShipmentProcessor processor = factory.newShipmentProcessorInstance(className); + if (processor != null) + return processor; } - return myProcessor; + return null; } } diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultColumnCalloutFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultColumnCalloutFactory.java new file mode 100644 index 0000000000..6bc7fe1969 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/DefaultColumnCalloutFactory.java @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import java.util.List; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; + +/** + * @author hengsin + * + */ +public class DefaultColumnCalloutFactory implements IColumnCalloutFactory { + + /** + * default constructor + */ + public DefaultColumnCalloutFactory() { + } + + /* (non-Javadoc) + * @see org.adempiere.base.IColumnCalloutFactory#getColumnCallouts(java.lang.String, java.lang.String) + */ + @Override + public IColumnCallout[] getColumnCallouts(String tableName, + String columnName) { + ServiceQuery query = new ServiceQuery(); + query.put("tableName", tableName); + query.put("columnName", columnName); + + List list = EquinoxExtensionLocator.instance().list(IColumnCallout.class, query).getExtensions(); + return list != null ? list.toArray(new IColumnCallout[0]) : new IColumnCallout[0]; + } + +} diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultModelValidatorFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultModelValidatorFactory.java new file mode 100644 index 0000000000..d8af7d0f93 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/DefaultModelValidatorFactory.java @@ -0,0 +1,71 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; +import org.compiere.model.ModelValidator; + +/** + * @author hengsin + * + */ +public class DefaultModelValidatorFactory implements IModelValidatorFactory { + + /** + * default constructor + */ + public DefaultModelValidatorFactory() { + } + + /* (non-Javadoc) + * @see org.adempiere.base.IModelValidatorFactory#newModelValidatorInstance(java.lang.String) + */ + @Override + public ModelValidator newModelValidatorInstance(String className) { + ModelValidator validator = EquinoxExtensionLocator.instance().locate(ModelValidator.class, "org.adempiere.base.ModelValidator", className, null).getExtension(); + if (validator == null) { + Class clazz = null; + + //use context classloader if available + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + if (classLoader != null) { + try { + clazz = classLoader.loadClass(className); + } + catch (ClassNotFoundException ex) { + } + } + if (clazz == null) { + classLoader = this.getClass().getClassLoader(); + try { + clazz = classLoader.loadClass(className); + } + catch (ClassNotFoundException ex) { + } + } + if (clazz != null) { + try { + validator = (ModelValidator)clazz.newInstance(); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + new Exception("Failed to load model validator class " + className).printStackTrace(); + } + } + + return validator; + } + +} diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultPaymentProcessorFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultPaymentProcessorFactory.java new file mode 100644 index 0000000000..644f66aef8 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/DefaultPaymentProcessorFactory.java @@ -0,0 +1,61 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import java.util.logging.Level; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; +import org.compiere.model.PaymentProcessor; +import org.compiere.util.CLogger; + +/** + * @author hengsin + * + */ +public class DefaultPaymentProcessorFactory implements IPaymentProcessorFactory { + + private final static CLogger s_log = CLogger.getCLogger(IPaymentProcessorFactory.class); + + /** + * default constructor + */ + public DefaultPaymentProcessorFactory() { + } + + /* (non-Javadoc) + * @see org.adempiere.base.IPaymentProcessorFactory#newPaymentProcessorInstance(java.lang.String) + */ + @Override + public PaymentProcessor newPaymentProcessorInstance(String className) { + PaymentProcessor myProcessor = null; + myProcessor = EquinoxExtensionLocator.instance().locate(PaymentProcessor.class, className, null).getExtension(); + if (myProcessor == null) { + //fall back to dynamic java class loadup + try { + Class ppClass = Class.forName(className); + if (ppClass != null) + myProcessor = (PaymentProcessor)ppClass.newInstance(); + } catch (Error e1) { // NoClassDefFound + s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage()); + return null; + } catch (Exception e2) { + s_log.log(Level.SEVERE, className, e2); + return null; + } + } + + return myProcessor; + } + +} diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultProcessFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultProcessFactory.java new file mode 100644 index 0000000000..5ed1648752 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/DefaultProcessFactory.java @@ -0,0 +1,91 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import java.util.logging.Level; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; +import org.compiere.process.ProcessCall; +import org.compiere.util.CLogger; + +/** + * @author hengsin + * + */ +public class DefaultProcessFactory implements IProcessFactory { + + private final static CLogger log = CLogger.getCLogger(DefaultProcessFactory.class); + + /** + * default constructor + */ + public DefaultProcessFactory() { + } + + /* (non-Javadoc) + * @see org.adempiere.base.IProcessFactory#newProcessInstance(java.lang.String) + */ + @Override + public ProcessCall newProcessInstance(String className) { + ProcessCall process = null; + process = EquinoxExtensionLocator.instance().locate(ProcessCall.class, "org.adempiere.base.Process", className, null).getExtension(); + if (process == null) { + //Get Class + Class processClass = null; + //use context classloader if available + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + if (classLoader != null) + { + try + { + processClass = classLoader.loadClass(className); + } + catch (ClassNotFoundException ex) + { + log.log(Level.FINE, className, ex); + } + } + if (processClass == null) + { + classLoader = this.getClass().getClassLoader(); + try + { + processClass = classLoader.loadClass(className); + } + catch (ClassNotFoundException ex) + { + log.log(Level.WARNING, className, ex); + return null; + } + } + + if (processClass == null) { + return null; + } + + //Get Process + try + { + process = (ProcessCall)processClass.newInstance(); + } + catch (Exception ex) + { + log.log(Level.WARNING, "Instance for " + className, ex); + return null; + } + } + return process; + } + +} diff --git a/org.adempiere.base/src/org/adempiere/base/DefaultShipmentProcessorFactory.java b/org.adempiere.base/src/org/adempiere/base/DefaultShipmentProcessorFactory.java new file mode 100644 index 0000000000..63e3a13adb --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/DefaultShipmentProcessorFactory.java @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import java.util.logging.Level; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; +import org.adempiere.model.IShipmentProcessor; +import org.compiere.util.CLogger; + +/** + * @author hengsin + * + */ +public class DefaultShipmentProcessorFactory implements IShipmentProcessorFactory { + + private final static CLogger s_log = CLogger.getCLogger(DefaultShipmentProcessorFactory.class); + + /** + * default constructor + */ + public DefaultShipmentProcessorFactory() { + } + + @Override + public IShipmentProcessor newShipmentProcessorInstance(String className) { + IShipmentProcessor myProcessor = EquinoxExtensionLocator.instance().locate(IShipmentProcessor.class, className, null).getExtension(); + if (myProcessor == null) + { + //fall back to dynamic java class loading + try + { + Class ppClass = Class.forName(className); + if (ppClass != null) + myProcessor = (IShipmentProcessor) ppClass.newInstance(); + } + catch (Error e1) + { // NoClassDefFound + s_log.log(Level.SEVERE, className + " - Error=" + e1.getMessage()); + return null; + } + catch (Exception e2) + { + s_log.log(Level.SEVERE, className, e2); + return null; + } + } + if (myProcessor == null) + { + s_log.log(Level.SEVERE, "Not found in extension registry and classpath"); + return null; + } + + return myProcessor; + } + +} diff --git a/org.adempiere.base/src/org/adempiere/base/DelegatingServiceHolder.java b/org.adempiere.base/src/org/adempiere/base/DelegatingServiceHolder.java deleted file mode 100644 index 7f085ea393..0000000000 --- a/org.adempiere.base/src/org/adempiere/base/DelegatingServiceHolder.java +++ /dev/null @@ -1,64 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2012 Heng Sin Low * - * Copyright (C) 2012 Trek Global * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program 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 General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package org.adempiere.base; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author hengsin - * - */ -public class DelegatingServiceHolder implements IServiceHolder, - IServicesHolder { - - private List> serviceHolder = new ArrayList>(); - private List> servicesHolder = new ArrayList>(); - - /** - * - */ - public DelegatingServiceHolder() { - } - - public void addServiceHolder(IServiceHolder holder) { - serviceHolder.add(holder); - } - - public void addServicesHolder(IServicesHolder holder) { - servicesHolder.add(holder); - } - - @Override - public List getServices() { - List list = new ArrayList(); - for(IServicesHolder holder : servicesHolder) { - List t = holder.getServices(); - if (t != null && !t.isEmpty()) - list.addAll(t); - } - return list; - } - - @Override - public T getService() { - T t = null; - for(IServiceHolder holder : serviceHolder) { - t = holder.getService(); - if (t != null) break; - } - return t; - } - -} diff --git a/org.adempiere.base/src/org/adempiere/base/DelegatingServiceLocator.java b/org.adempiere.base/src/org/adempiere/base/DelegatingServiceLocator.java deleted file mode 100644 index 8375376036..0000000000 --- a/org.adempiere.base/src/org/adempiere/base/DelegatingServiceLocator.java +++ /dev/null @@ -1,181 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2012 Heng Sin Low * - * Copyright (C) 2012 Trek Global * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program 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 General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package org.adempiere.base; - -import java.util.List; - -import org.adempiere.base.ds.DynamicServiceLocator; - -/** - * Delegate to available service locator - * @author hengsin - * - */ -public class DelegatingServiceLocator implements IServiceLocator { - - private IServicesHolder locatorsHolder; - - public DelegatingServiceLocator() { - DynamicServiceLocator serviceLocator = new DynamicServiceLocator(); - locatorsHolder = serviceLocator.list(IServiceLocator.class); - } - - private IServiceLocator[] getLocators() { - List locators = locatorsHolder.getServices(); - return locators.toArray(new IServiceLocator[0]); - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class) - */ - @Override - public IServiceHolder locate(Class type) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServiceHolder t = locator.locate(type); - if (t != null) - holder.addServiceHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String) - */ - @Override - public IServiceHolder locate(Class type, String serviceType) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServiceHolder t = locator.locate(type, serviceType); - if (t != null) - holder.addServiceHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, org.adempiere.base.ServiceQuery) - */ - @Override - public IServiceHolder locate(Class type, ServiceQuery query) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServiceHolder t = locator.locate(type, query); - if (t != null) - holder.addServiceHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String, org.adempiere.base.ServiceQuery) - */ - @Override - public IServiceHolder locate(Class type, String serviceId, ServiceQuery query) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServiceHolder t = locator.locate(type, serviceId, query); - if (t != null) - holder.addServiceHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String, java.lang.String, org.adempiere.base.ServiceQuery) - */ - @Override - public IServiceHolder locate(Class type, String serviceType, - String serviceId, ServiceQuery query) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServiceHolder t = locator.locate(type, serviceType, serviceId, query); - if (t != null) - holder.addServiceHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class) - */ - @Override - public IServicesHolder list(Class type) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServicesHolder t = locator.list(type); - if (t != null) - holder.addServicesHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String) - */ - @Override - public IServicesHolder list(Class type, String serviceType) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServicesHolder t = locator.list(type, serviceType); - if (t != null) - holder.addServicesHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, org.adempiere.base.ServiceQuery) - */ - @Override - public IServicesHolder list(Class type, ServiceQuery query) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServicesHolder t = locator.list(type, query); - if (t != null) - holder.addServicesHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String, org.adempiere.base.ServiceQuery) - */ - @Override - public IServicesHolder list(Class type, String serviceId, ServiceQuery query) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServicesHolder t = locator.list(type, serviceId, query); - if (t != null) - holder.addServicesHolder(t); - } - return holder; - } - - /* (non-Javadoc) - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String, java.lang.String, org.adempiere.base.ServiceQuery) - */ - @Override - public IServicesHolder list(Class type, String serviceType, - String serviceId, ServiceQuery query) { - DelegatingServiceHolder holder = new DelegatingServiceHolder(); - for(IServiceLocator locator : getLocators()) { - IServicesHolder t = locator.list(type, serviceType, serviceId, query); - if (t != null) - holder.addServicesHolder(t); - } - return holder; - } - -} diff --git a/org.adempiere.base/src/org/adempiere/base/IColumnCalloutFactory.java b/org.adempiere.base/src/org/adempiere/base/IColumnCalloutFactory.java new file mode 100644 index 0000000000..b8f63459d6 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IColumnCalloutFactory.java @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +/** + * + * @author hengsin + * + */ +public interface IColumnCalloutFactory { + + /** + * + * @param tableName + * @param columnName + * @return array of matching callouts + */ + public IColumnCallout[] getColumnCallouts(String tableName, String columnName); + +} diff --git a/org.adempiere.base/src/org/adempiere/base/IModelValidatorFactory.java b/org.adempiere.base/src/org/adempiere/base/IModelValidatorFactory.java new file mode 100644 index 0000000000..b887332e12 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IModelValidatorFactory.java @@ -0,0 +1,30 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import org.compiere.model.ModelValidator; + +/** + * + * @author hengsin + * + */ +public interface IModelValidatorFactory { + + /** + * @param className + * @return new modelvalidator intance + */ + public ModelValidator newModelValidatorInstance(String className); +} diff --git a/org.adempiere.base/src/org/adempiere/base/IPaymentProcessorFactory.java b/org.adempiere.base/src/org/adempiere/base/IPaymentProcessorFactory.java new file mode 100644 index 0000000000..30cc7c9f42 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IPaymentProcessorFactory.java @@ -0,0 +1,30 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import org.compiere.model.PaymentProcessor; + +/** + * + * @author hengsin + * + */ +public interface IPaymentProcessorFactory { + + /** + * @param className + * @return payment processor instance + */ + public PaymentProcessor newPaymentProcessorInstance(String className); +} diff --git a/org.adempiere.base/src/org/adempiere/base/IServiceLocator.java b/org.adempiere.base/src/org/adempiere/base/IServiceLocator.java index 7941a4bca1..9ca8d48daa 100644 --- a/org.adempiere.base/src/org/adempiere/base/IServiceLocator.java +++ b/org.adempiere.base/src/org/adempiere/base/IServiceLocator.java @@ -21,7 +21,7 @@ package org.adempiere.base; * This is the central authority for adempiere service definition, * because each service defined has to be looked up via this interface. * - * A service in adempiere is an implementation for the registered interface, expose through osgi service registry or equinox extension registry + * A service in adempiere is an implementation for the registered interface, expose through osgi service registry * * @author viola * @@ -34,15 +34,6 @@ public interface IServiceLocator { */ IServiceHolder locate(Class type); - /** - * - * @param type - * @param serviceType equinox extension point id, ignore by osgi service locator - * type.getName - * @return holder for dynamic service - */ - IServiceHolder locate(Class type, String serviceType); - /** * * @param type @@ -54,21 +45,11 @@ public interface IServiceLocator { /** * * @param type - * @param serviceId component name or extension id + * @param componentName service component name * @param query * @return holder for dynamic service */ - IServiceHolder locate(Class type, String serviceId, ServiceQuery query); - - /** - * - * @param type - * @param serviceType equinox extension point id, ignore by osgi service locator - * @param serviceId component name or extension id - * @param query - * @return holder for dynamic service - */ - IServiceHolder locate(Class type, String serviceType, String serviceId, ServiceQuery query); + IServiceHolder locate(Class type, String componentName, ServiceQuery query); /** * @@ -77,14 +58,6 @@ public interface IServiceLocator { */ IServicesHolder list(Class type); - /** - * - * @param type - * @param serviceType equinox extension point id, ignore by osgi service locator - * @return holder for list of dynamic service - */ - IServicesHolder list(Class type, String serviceType); - /** * * @param type @@ -96,19 +69,9 @@ public interface IServiceLocator { /** * * @param type - * @param serviceId component name or extension id + * @param componentName osgi service component name * @param query * @return holder for list of dynamic service */ - IServicesHolder list(Class type, String serviceId, ServiceQuery query); - - /** - * - * @param type - * @param serviceType equinox extension point id, ignore by osgi service locator - * @param serviceId component name or extension id - * @param query - * @return holder for list of dynamic service - */ - IServicesHolder list(Class type, String serviceType, String serviceId, ServiceQuery query); + IServicesHolder list(Class type, String componentName, ServiceQuery query); } diff --git a/org.adempiere.base/src/org/adempiere/base/IShipmentProcessorFactory.java b/org.adempiere.base/src/org/adempiere/base/IShipmentProcessorFactory.java new file mode 100644 index 0000000000..f874d9c9d9 --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/IShipmentProcessorFactory.java @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.base; + +import org.adempiere.model.IShipmentProcessor; + +/** + * + * @author hengsin + * + */ +public interface IShipmentProcessorFactory { + + /** + * Create new shipment processor instance + * @param className + * @return shipment processor instance + */ + public IShipmentProcessor newShipmentProcessorInstance(String className); +} diff --git a/org.adempiere.base/src/org/adempiere/base/Service.java b/org.adempiere.base/src/org/adempiere/base/Service.java index 65a65c0b64..9a5af7d723 100644 --- a/org.adempiere.base/src/org/adempiere/base/Service.java +++ b/org.adempiere.base/src/org/adempiere/base/Service.java @@ -16,6 +16,8 @@ *****************************************************************************/ package org.adempiere.base; +import org.adempiere.base.ds.DynamicServiceLocator; + /** * This is a very simple factory for service locators * @@ -24,7 +26,7 @@ package org.adempiere.base; */ public class Service { - private static IServiceLocator theLocator = new DelegatingServiceLocator(); + private static IServiceLocator theLocator = new DynamicServiceLocator(); /** * diff --git a/org.adempiere.base/src/org/adempiere/base/ds/DynamicServiceLocator.java b/org.adempiere.base/src/org/adempiere/base/ds/DynamicServiceLocator.java index 7f2dfae0af..3690d9527e 100644 --- a/org.adempiere.base/src/org/adempiere/base/ds/DynamicServiceLocator.java +++ b/org.adempiere.base/src/org/adempiere/base/ds/DynamicServiceLocator.java @@ -45,14 +45,6 @@ public class DynamicServiceLocator implements IServiceLocator { return new DynamicServiceHolder(tracker); } - /** - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String) - */ - @Override - public IServiceHolder locate(Class type, String serviceType) { - return locate(type); - } - /** * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, org.adempiere.base.ServiceQuery) */ @@ -80,15 +72,6 @@ public class DynamicServiceLocator implements IServiceLocator { return new DynamicServiceHolder(tracker); } - /** - * @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String, java.lang.String, org.adempiere.base.ServiceQuery) - */ - @Override - public IServiceHolder locate(Class type, String serviceType, String serviceId, - ServiceQuery query) { - return locate(type, serviceId, query); - } - /** * @see org.adempiere.base.IServiceLocator#list(java.lang.Class) */ @@ -100,14 +83,6 @@ public class DynamicServiceLocator implements IServiceLocator { return new DynamicServiceHolder(tracker); } - /** - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String) - */ - @Override - public IServicesHolder list(Class type, String serviceType) { - return list(type); - } - /** * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, org.adempiere.base.ServiceQuery) */ @@ -134,15 +109,6 @@ public class DynamicServiceLocator implements IServiceLocator { return new DynamicServiceHolder(tracker); } - /** - * @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String, java.lang.String, org.adempiere.base.ServiceQuery) - */ - @Override - public IServicesHolder list(Class type, String serviceType, - String serviceId, ServiceQuery query) { - return list(type, serviceId, query); - } - private Filter filter(Class type, String serviceId, ServiceQuery query) { StringBuilder builder = new StringBuilder("(&(objectclass="); builder.append(type.getName()).append(")"); diff --git a/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceHolder.java b/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionHolder.java similarity index 80% rename from org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceHolder.java rename to org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionHolder.java index d7e501e00f..3a92956ed8 100644 --- a/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceHolder.java +++ b/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionHolder.java @@ -15,31 +15,32 @@ package org.adempiere.base.equinox; import java.util.List; -import org.adempiere.base.IServiceHolder; -import org.adempiere.base.IServicesHolder; - /** * @author hengsin * */ -public class EquinoxServiceHolder implements IServiceHolder, IServicesHolder { +public class EquinoxExtensionHolder { private ExtensionList extensionList; /** * @param list */ - public EquinoxServiceHolder(ExtensionList list) { + public EquinoxExtensionHolder(ExtensionList list) { extensionList = list; } - @Override - public T getService() { + /** + * @return new extension instance + */ + public T getExtension() { return extensionList.first(); } - @Override - public List getServices() { + /** + * @return list of matching extensions + */ + public List getExtensions() { return extensionList.asList(); } diff --git a/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionLocator.java b/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionLocator.java new file mode 100644 index 0000000000..7abb64cb4f --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxExtensionLocator.java @@ -0,0 +1,150 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * + * or via info@compiere.org or http://www.compiere.org/license.html * + *****************************************************************************/ +package org.adempiere.base.equinox; + +import org.adempiere.base.ServiceQuery; + + +/** + * This is the Equinox implementation of extension Locator. + * It delegates work to the ExtensionList that lookups up extensions. + * Usually, the ids of extension points correspond to the interface names of the services. + * + * @author viola + * + */ +public class EquinoxExtensionLocator { + + private final static EquinoxExtensionLocator INSTANCE = new EquinoxExtensionLocator(); + + private EquinoxExtensionLocator() {} + + public static EquinoxExtensionLocator instance() { + return INSTANCE; + } + + /** + * + * @param type + * @return equinox extension holder + */ + public EquinoxExtensionHolder list(Class type) { + return list(type, type.getName()); + } + + /** + * + * @param type + * @param extensionPointId + * @return equinox extension holder + */ + public EquinoxExtensionHolder list(Class type, String extensionPointId) { + ExtensionList list = new ExtensionList(type, extensionPointId); + return new EquinoxExtensionHolder(list); + } + + /** + * + * @param type + * @param query + * @return equinox extension holder + */ + public EquinoxExtensionHolder list(Class type, ServiceQuery query) { + return list(type, type.getName(), null, query); + } + + /** + * + * @param type + * @param extensionId + * @param query + * @return equinox extension holder + */ + public EquinoxExtensionHolder list(Class type, String extensionId, ServiceQuery query) { + ExtensionList list = new ExtensionList(type, null, extensionId, query); + return new EquinoxExtensionHolder(list); + } + + /** + * + * @param type + * @param extensionPointId + * @param extensionId + * @param query + * @return equinox extension holder + */ + public EquinoxExtensionHolder list(Class type, String extensionPointId, String extensionId, + ServiceQuery query) { + ExtensionList list = new ExtensionList(type, extensionPointId, extensionId, query); + return new EquinoxExtensionHolder(list); + } + + /** + * + * @param type + * @return equinox extension holder + */ + public EquinoxExtensionHolder locate(Class type) { + return locate(type, type.getName()); + } + + /** + * + * @param type + * @param extensionPointId + * @return equinox extension holder + */ + public EquinoxExtensionHolder locate(Class type, String extensionPointId) { + ExtensionList list = new ExtensionList(type, extensionPointId); + return new EquinoxExtensionHolder(list); + } + + /** + * + * @param type + * @param query + * @return equinox extension holder + */ + public EquinoxExtensionHolder locate(Class type, ServiceQuery query) { + return locate(type, type.getName(), null, query); + } + + /** + * + * @param type + * @param extensionId + * @param query + * @return equinox extension holder + */ + public EquinoxExtensionHolder locate(Class type, String extensionId, ServiceQuery query) { + ExtensionList list = new ExtensionList(type, null, extensionId, query); + return new EquinoxExtensionHolder(list); + } + + /** + * + * @param type + * @param extensionPointId + * @param extensionId + * @param query + * @return equinox extension holder + */ + public EquinoxExtensionHolder locate(Class type, String extensionPointId, String extensionId, ServiceQuery query) { + ExtensionList list = new ExtensionList(type, extensionPointId, extensionId, query); + return new EquinoxExtensionHolder(list); + } +} diff --git a/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceLocator.java b/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceLocator.java deleted file mode 100644 index c706c8387c..0000000000 --- a/org.adempiere.base/src/org/adempiere/base/equinox/EquinoxServiceLocator.java +++ /dev/null @@ -1,91 +0,0 @@ -/****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * - * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program 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 General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - * For the text or an alternative of this public license, you may reach us * - * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * - * or via info@compiere.org or http://www.compiere.org/license.html * - *****************************************************************************/ -package org.adempiere.base.equinox; - -import org.adempiere.base.IServiceHolder; -import org.adempiere.base.IServiceLocator; -import org.adempiere.base.IServicesHolder; -import org.adempiere.base.ServiceQuery; - - -/** - * This is the Equinox implementation of the ADempiere Service Locator. - * It delegates work to the ExtensionList that lookups up services as extensions. - * The ids of extension points have to correspond to the interface names of the services. - * - * @author viola - * - */ -public class EquinoxServiceLocator implements IServiceLocator { - - @Override - public IServicesHolder list(Class type) { - return list(type, type.getName()); - } - - @Override - public IServicesHolder list(Class type, String serviceType) { - ExtensionList list = new ExtensionList(type, serviceType); - return new EquinoxServiceHolder(list); - } - - @Override - public IServicesHolder list(Class type, ServiceQuery query) { - return list(type, type.getName(), null, query); - } - - @Override - public IServicesHolder list(Class type, String serviceId, ServiceQuery query) { - ExtensionList list = new ExtensionList(type, null, serviceId, query); - return new EquinoxServiceHolder(list); - } - - @Override - public IServicesHolder list(Class type, String serviceType, String serviceId, - ServiceQuery query) { - ExtensionList list = new ExtensionList(type, serviceType, serviceId, query); - return new EquinoxServiceHolder(list); - } - - @Override - public IServiceHolder locate(Class type) { - return locate(type, type.getName()); - } - - @Override - public IServiceHolder locate(Class type, String serviceType) { - ExtensionList list = new ExtensionList(type, serviceType); - return new EquinoxServiceHolder(list); - } - - @Override - public IServiceHolder locate(Class type, ServiceQuery query) { - return locate(type, type.getName(), null, query); - } - - @Override - public IServiceHolder locate(Class type, String serviceId, ServiceQuery query) { - ExtensionList list = new ExtensionList(type, null, serviceId, query); - return new EquinoxServiceHolder(list); - } - - @Override - public IServiceHolder locate(Class type, String serviceType, String serviceId, ServiceQuery query) { - ExtensionList list = new ExtensionList(type, serviceType, serviceId, query); - return new EquinoxServiceHolder(list); - } -} diff --git a/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java b/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java index c26e3d1c4b..ef30ef1b9b 100644 --- a/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java +++ b/org.adempiere.base/src/org/adempiere/util/ProcessUtil.java @@ -157,52 +157,8 @@ public final class ProcessUtil { process = Core.getProcess(className); if (process == null) { - //Get Class - Class processClass = null; - //use context classloader if available - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - if (classLoader != null) - { - try - { - processClass = classLoader.loadClass(className); - } - catch (ClassNotFoundException ex) - { - log.log(Level.FINE, className, ex); - } - } - if (processClass == null) - { - classLoader = ProcessUtil.class.getClassLoader(); - try - { - processClass = classLoader.loadClass(className); - } - catch (ClassNotFoundException ex) - { - log.log(Level.WARNING, className, ex); - pi.setSummary ("ClassNotFound", true); - return false; - } - } - - if (processClass == null) { - pi.setSummary("No Instance for " + pi.getClassName(), true); - return false; - } - - //Get Process - try - { - process = (ProcessCall)processClass.newInstance(); - } - catch (Exception ex) - { - log.log(Level.WARNING, "Instance for " + className, ex); - pi.setSummary ("InstanceError", true); - return false; - } + pi.setSummary("Failed to create new process instance for " + className, true); + return false; } boolean success = false; diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 482539456a..e7d383a1c4 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -40,8 +40,8 @@ import javax.swing.event.EventListenerList; import org.adempiere.base.Core; import org.adempiere.base.IColumnCallout; -import org.adempiere.base.Service; import org.adempiere.base.ServiceQuery; +import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.adempiere.util.ContextRunnable; import org.compiere.Adempiere; import org.compiere.util.CLogMgt; @@ -2801,7 +2801,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable { String className = cmd.substring(0,methodStart); //first, check matching extension id in extension registry - call = Service.locator().locate(Callout.class, className, (ServiceQuery)null).getService(); + call = EquinoxExtensionLocator.instance().locate(Callout.class, Callout.class.getName(), className, (ServiceQuery)null).getExtension(); if (call == null) { //no match from extension registry, check java classpath Class cClass = Class.forName(className); diff --git a/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java b/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java index b8899fe390..68fc8cdf45 100644 --- a/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java +++ b/org.adempiere.base/src/org/compiere/model/ModelValidationEngine.java @@ -155,22 +155,24 @@ public class ModelValidationEngine { // ModelValidator validator = null; - //always query equinox extension first validator = Core.getModelValidator(className); if (validator == null) { - Class clazz = Class.forName(className); - validator = (ModelValidator)clazz.newInstance(); + missingModelValidationMessage = missingModelValidationMessage + + (client != null ? (" on client " + client.getName()) : " global") + '\n'; + } + else + { + initialize(validator, client); } - initialize(validator, client); } catch (Exception e) { //logging to db will try to init ModelValidationEngine again! e.printStackTrace(); missingModelValidationMessage = missingModelValidationMessage + e.toString() + - (client != null ? (" on client " + client.getName()) : " global") + '\n'; + (client != null ? (" on client " + client.getName()) : " global") + '\n'; } } diff --git a/org.adempiere.install/src/org/compiere/install/ConfigurationData.java b/org.adempiere.install/src/org/compiere/install/ConfigurationData.java index 80cde82ec7..5f8b89974b 100644 --- a/org.adempiere.install/src/org/compiere/install/ConfigurationData.java +++ b/org.adempiere.install/src/org/compiere/install/ConfigurationData.java @@ -44,7 +44,7 @@ import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; -import org.adempiere.base.Service; +import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.adempiere.install.IDBConfigMonitor; import org.adempiere.install.IDatabaseConfig; import org.compiere.Adempiere; @@ -79,7 +79,7 @@ public class ConfigurationData private void initDatabaseConfig() { - List configList = Service.locator().list(IDatabaseConfig.class).getServices(); + List configList = EquinoxExtensionLocator.instance().list(IDatabaseConfig.class).getExtensions(); m_databaseConfig = new IDatabaseConfig[configList.size()]; DBTYPE = new String[m_databaseConfig.length]; for(int i = 0; i < configList.size(); i++) diff --git a/org.adempiere.pipo/.project b/org.adempiere.pipo/.project index f59bcd9621..bfafde61c6 100644 --- a/org.adempiere.pipo/.project +++ b/org.adempiere.pipo/.project @@ -20,6 +20,11 @@ + + org.eclipse.pde.ds.core.builder + + + org.eclipse.pde.PluginNature diff --git a/org.adempiere.pipo/META-INF/MANIFEST.MF b/org.adempiere.pipo/META-INF/MANIFEST.MF index 36df9e1497..b8f40bec8e 100644 --- a/org.adempiere.pipo/META-INF/MANIFEST.MF +++ b/org.adempiere.pipo/META-INF/MANIFEST.MF @@ -14,3 +14,4 @@ Export-Package: org.adempiere.pipo.srv, org.adempiere.pipo2, org.adempiere.pipo2.exception Require-Bundle: org.adempiere.base;bundle-version="1.0.0" +Service-Component: OSGI-INF/dictionaryservice.xml diff --git a/org.adempiere.pipo/OSGI-INF/dictionaryservice.xml b/org.adempiere.pipo/OSGI-INF/dictionaryservice.xml new file mode 100644 index 0000000000..5ae14e2897 --- /dev/null +++ b/org.adempiere.pipo/OSGI-INF/dictionaryservice.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.pipo/build.properties b/org.adempiere.pipo/build.properties index e9863e281e..b79d13b91a 100644 --- a/org.adempiere.pipo/build.properties +++ b/org.adempiere.pipo/build.properties @@ -1,5 +1,7 @@ -source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + plugin.xml,\ + OSGI-INF/dictionaryservice.xml,\ + OSGI-INF/ +source.. = src/ diff --git a/org.adempiere.pipo/plugin.xml b/org.adempiere.pipo/plugin.xml index e50b536b92..8152421f9b 100644 --- a/org.adempiere.pipo/plugin.xml +++ b/org.adempiere.pipo/plugin.xml @@ -2,12 +2,6 @@ - - - - + + org.eclipse.pde.ds.core.builder + + + org.eclipse.pde.PluginNature diff --git a/org.adempiere.report.jasper.swing/META-INF/MANIFEST.MF b/org.adempiere.report.jasper.swing/META-INF/MANIFEST.MF index b8ed2d3089..22f4aad463 100644 --- a/org.adempiere.report.jasper.swing/META-INF/MANIFEST.MF +++ b/org.adempiere.report.jasper.swing/META-INF/MANIFEST.MF @@ -9,3 +9,4 @@ Require-Bundle: org.adempiere.base;bundle-version="1.0.0", org.adempiere.report.jasper;bundle-version="1.0.0", org.adempiere.report.jasper.library;bundle-version="1.0.0" Import-Package: org.osgi.framework +Service-Component: OSGI-INF/jrviewerprovider.xml diff --git a/org.adempiere.report.jasper.swing/OSGI-INF/jrviewerprovider.xml b/org.adempiere.report.jasper.swing/OSGI-INF/jrviewerprovider.xml new file mode 100644 index 0000000000..413fa59b41 --- /dev/null +++ b/org.adempiere.report.jasper.swing/OSGI-INF/jrviewerprovider.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.report.jasper.swing/build.properties b/org.adempiere.report.jasper.swing/build.properties index e9863e281e..ac81f3b55d 100644 --- a/org.adempiere.report.jasper.swing/build.properties +++ b/org.adempiere.report.jasper.swing/build.properties @@ -1,5 +1,6 @@ -source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml + OSGI-INF/jrviewerprovider.xml,\ + OSGI-INF/ +source.. = src/ diff --git a/org.adempiere.report.jasper.swing/plugin.xml b/org.adempiere.report.jasper.swing/plugin.xml deleted file mode 100644 index fd7d2d83e4..0000000000 --- a/org.adempiere.report.jasper.swing/plugin.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/org.adempiere.report.jasper/build.properties b/org.adempiere.report.jasper/build.properties index a6dea0a54a..fbee266820 100644 --- a/org.adempiere.report.jasper/build.properties +++ b/org.adempiere.report.jasper/build.properties @@ -1,5 +1,4 @@ source.JasperReports.jar = src/ output.JasperReports.jar = build/ bin.includes = META-INF/,\ - JasperReports.jar,\ - plugin.xml + JasperReports.jar diff --git a/org.adempiere.report.jasper/plugin.xml b/org.adempiere.report.jasper/plugin.xml deleted file mode 100644 index a605b3e2ec..0000000000 --- a/org.adempiere.report.jasper/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/org.adempiere.report.jasper/schema/org.compiere.report.JRViewerProvider.exsd b/org.adempiere.report.jasper/schema/org.compiere.report.JRViewerProvider.exsd deleted file mode 100644 index bf7389fb1b..0000000000 --- a/org.adempiere.report.jasper/schema/org.compiere.report.JRViewerProvider.exsd +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - Extension point to provide jasper report viewer implementation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class name for the org.compiere.report.JRViewerProvider interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.compiere.report.JRViewerProvider"> - <provider - class="org.adempiere.webui.window.ZkJRViewerProvider"> - </provider> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of JRViewerProvider - - - - - - - - - org.adempiere.report.jasper.swing and org.adempiere.ui.zk bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.server/plugin.xml b/org.adempiere.server/plugin.xml index c5a7c2b58a..91b1c33d57 100644 --- a/org.adempiere.server/plugin.xml +++ b/org.adempiere.server/plugin.xml @@ -1,7 +1,6 @@ - diff --git a/org.adempiere.server/schema/org.adempiere.server.IServerFactory.exsd b/org.adempiere.server/schema/org.adempiere.server.IServerFactory.exsd deleted file mode 100644 index 096876bac1..0000000000 --- a/org.adempiere.server/schema/org.adempiere.server.IServerFactory.exsd +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - Extension point to provide adempiere server factory implementation. An adempiere server factory extension provide a list of AdempiereServer instance that should be started when the adempiere server container is started. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class name for the org.adempiere.server.IServerFactory interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.adempiere.server.IServerFactory"> - <factory - class="org.adempiere.server.rpl.imp.ReplicationServerFactory"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.server.IServerFactory - - - - - - - - - replication server factory at the org.adempiere.replication.server bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.ui.swing/META-INF/MANIFEST.MF b/org.adempiere.ui.swing/META-INF/MANIFEST.MF index eee6d481fa..fc10d24455 100644 --- a/org.adempiere.ui.swing/META-INF/MANIFEST.MF +++ b/org.adempiere.ui.swing/META-INF/MANIFEST.MF @@ -87,5 +87,5 @@ Import-Package: javax.net.ssl, org.restlet.security, org.restlet.service, org.restlet.util -Service-Component: OSGI-INF/defaultpaymentformfactory.xml, OSGI-INF/serverinterface.xml, OSGI-INF/statusinterface.xml, OSGI-INF/defaultprintshippinglabel.xml, OSGI-INF/defaultcreatefromfactory.xml +Service-Component: OSGI-INF/*.xml Bundle-ActivationPolicy: lazy diff --git a/org.adempiere.ui.swing/OSGI-INF/defaulteditorfactory.xml b/org.adempiere.ui.swing/OSGI-INF/defaulteditorfactory.xml new file mode 100644 index 0000000000..056127c492 --- /dev/null +++ b/org.adempiere.ui.swing/OSGI-INF/defaulteditorfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.ui.swing/OSGI-INF/defaultformfactory.xml b/org.adempiere.ui.swing/OSGI-INF/defaultformfactory.xml new file mode 100644 index 0000000000..fda641665f --- /dev/null +++ b/org.adempiere.ui.swing/OSGI-INF/defaultformfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.ui.swing/OSGI-INF/defaultinfofactory.xml b/org.adempiere.ui.swing/OSGI-INF/defaultinfofactory.xml new file mode 100644 index 0000000000..996086f617 --- /dev/null +++ b/org.adempiere.ui.swing/OSGI-INF/defaultinfofactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.ui.swing/OSGI-INF/reportviewerprovider.xml b/org.adempiere.ui.swing/OSGI-INF/reportviewerprovider.xml new file mode 100644 index 0000000000..2ccca5a51e --- /dev/null +++ b/org.adempiere.ui.swing/OSGI-INF/reportviewerprovider.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.ui.swing/OSGI-INF/resourcefinder.xml b/org.adempiere.ui.swing/OSGI-INF/resourcefinder.xml new file mode 100644 index 0000000000..1c6d4d1522 --- /dev/null +++ b/org.adempiere.ui.swing/OSGI-INF/resourcefinder.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.ui.swing/build.properties b/org.adempiere.ui.swing/build.properties index bf2bd422c8..3d5f086139 100644 --- a/org.adempiere.ui.swing/build.properties +++ b/org.adempiere.ui.swing/build.properties @@ -1,13 +1,18 @@ -bin.includes = META-INF/,\ - client.jar,\ - plugin.xml,\ - swingx-1.6.jar,\ - looks-2.0.4.jar,\ - miglayout-3.7.1-swing.jar,\ - jpedal.jar,\ - OSGI-INF/,\ - OSGI-INF/defaultpaymentformfactory.xml,\ - OSGI-INF/defaultprintshippinglabel.xml,\ - OSGI-INF/defaultcreatefromfactory.xml -source.client.jar = src/ -output.client.jar = build/ +bin.includes = META-INF/,\ + client.jar,\ + plugin.xml,\ + swingx-1.6.jar,\ + looks-2.0.4.jar,\ + miglayout-3.7.1-swing.jar,\ + jpedal.jar,\ + OSGI-INF/,\ + OSGI-INF/defaultpaymentformfactory.xml,\ + OSGI-INF/defaultprintshippinglabel.xml,\ + OSGI-INF/defaultcreatefromfactory.xml,\ + OSGI-INF/resourcefinder.xml,\ + OSGI-INF/defaultinfofactory.xml,\ + OSGI-INF/defaulteditorfactory.xml,\ + OSGI-INF/reportviewerprovider.xml,\ + OSGI-INF/defaultformfactory.xml +source.client.jar = src/ +output.client.jar = build/ diff --git a/org.adempiere.ui.swing/plugin.xml b/org.adempiere.ui.swing/plugin.xml index a6bcf1910b..84669800d9 100644 --- a/org.adempiere.ui.swing/plugin.xml +++ b/org.adempiere.ui.swing/plugin.xml @@ -2,16 +2,6 @@ - - - - - - - - - - @@ -38,23 +22,5 @@ - - - - - - - - diff --git a/org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IEditorFactory.exsd b/org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IEditorFactory.exsd deleted file mode 100644 index cea33696c3..0000000000 --- a/org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IEditorFactory.exsd +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - Extension point to provide field editor factory. The UI framework will query all available editor factory following the priority sequence. The first available editor instance will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - numeric priority value, higher value is of higher priority. - - - - - - - Implementation class name for the org.adempiere.osgi.IEditorFactory - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="org.adempiere.ui.swing.factory.DefaultEditorFactory" - name="Default field editor factory" - point="org.adempiere.ui.swing.factory.IEditorFactory"> - <factory - class="org.adempiere.ui.swing.factory.DefaultEditorFactory" - priority="0"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.ui.swing.factory.IEditorFactory - - - - - - - - - The default implementation at the or.adempiere.ui.swing bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - diff --git a/org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IInfoFactory.exsd b/org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IInfoFactory.exsd deleted file mode 100644 index e733ca4b52..0000000000 --- a/org.adempiere.ui.swing/schema/org.adempiere.ui.swing.factory.IInfoFactory.exsd +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - Extension point to provide Info window factory. The UI framework will query all the info factory extension available following the priority sequence and the first available Info instance will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - numeric priority value. bigger number have higher priority. - - - - - - - Implementation class name for the org.adempiere.osgi.IInfoFactory interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="org.adempiere.ui.swing.factory.DefaultInfoFactory" - name="Default Info Factory" - point="org.adempiere.ui.swing.factory.IInfoFactory"> - <factory - class="org.adempiere.ui.swing.factory.DefaultInfoFactory" - priority="0"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.ui.swing.factory.IInfoFactory - - - - - - - - - The default implementation at the org.adempiere.ui.swing bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - diff --git a/org.adempiere.ui.swing/src/org/adempiere/client/Client.java b/org.adempiere.ui.swing/src/org/adempiere/client/Client.java index 7fd0fe916b..28ccc0ec37 100644 --- a/org.adempiere.ui.swing/src/org/adempiere/client/Client.java +++ b/org.adempiere.ui.swing/src/org/adempiere/client/Client.java @@ -20,7 +20,10 @@ *****************************************************************************/ package org.adempiere.client; +import java.util.List; + import org.adempiere.base.Service; +import org.adempiere.ui.swing.factory.IFormFactory; import org.compiere.apps.form.FormPanel; /** @@ -31,12 +34,19 @@ import org.compiere.apps.form.FormPanel; public class Client { /** - * - * @param extensionId - * @return + * @param formId + * @return new form instance */ - public static FormPanel getFormPanel(String extensionId) { - return Service.locator().locate(FormPanel.class, "org.adempiere.apps.Form", extensionId, null).getService(); + public static FormPanel getFormPanel(String formId) { + List factories = Service.locator().list(IFormFactory.class).getServices(); + if (factories != null) { + for(IFormFactory factory : factories) { + FormPanel form = factory.newFormInstance(formId); + if (form != null) + return form; + } + } + return null; } } diff --git a/org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/DefaultFormFactory.java b/org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/DefaultFormFactory.java new file mode 100644 index 0000000000..855b99e767 --- /dev/null +++ b/org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/DefaultFormFactory.java @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.ui.swing.factory; + +import java.util.logging.Level; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; +import org.compiere.apps.form.FormPanel; +import org.compiere.util.CLogger; + +/** + * @author hengsin + * + */ +public class DefaultFormFactory implements IFormFactory { + + private final static CLogger log = CLogger.getCLogger(DefaultFormFactory.class); + + /** + * default constructor + */ + public DefaultFormFactory() { + } + + /* (non-Javadoc) + * @see org.adempiere.ui.swing.factory.IFormFactory#newFormInstance(java.lang.String) + */ + @Override + public FormPanel newFormInstance(String formName) { + FormPanel form = EquinoxExtensionLocator.instance().locate(FormPanel.class, "org.adempiere.apps.Form", formName, null).getExtension(); + if (form == null) { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + Class clazz = null; + if (loader != null) { + try { + clazz = loader.loadClass(formName); + } catch (Exception e) { + if (log.isLoggable(Level.INFO)) { + log.log(Level.INFO, e.getLocalizedMessage(), e); + } + } + } + if (clazz == null) { + loader = this.getClass().getClassLoader(); + try { + clazz = loader.loadClass(formName); + } catch (Exception e) { + if (log.isLoggable(Level.INFO)) { + log.log(Level.INFO, e.getLocalizedMessage(), e); + } + } + } + if (clazz != null) { + try { + form = (FormPanel) clazz.newInstance(); + } catch (Exception e) { + if (log.isLoggable(Level.WARNING)) { + log.log(Level.WARNING, e.getLocalizedMessage(), e); + } + } + } + } + return form; + } + +} diff --git a/org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/IFormFactory.java b/org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/IFormFactory.java new file mode 100644 index 0000000000..90613f53e1 --- /dev/null +++ b/org.adempiere.ui.swing/src/org/adempiere/ui/swing/factory/IFormFactory.java @@ -0,0 +1,30 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.ui.swing.factory; + +import org.compiere.apps.form.FormPanel; + +/** + * + * @author hengsin + * + */ +public interface IFormFactory { + + /** + * @param formName + * @return new form instance + */ + public FormPanel newFormInstance(String formName); +} diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/AExport.java b/org.adempiere.ui.swing/src/org/compiere/apps/AExport.java index d68fa15bd6..4b0a5952f7 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/AExport.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/AExport.java @@ -28,7 +28,7 @@ import java.util.logging.Level; import javax.swing.JFileChooser; import org.adempiere.base.IGridTabExporter; -import org.adempiere.base.Service; +import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.compiere.grid.GridController; import org.compiere.grid.VTabbedPane; import org.compiere.model.GridTab; @@ -55,7 +55,7 @@ public class AExport // exporterMap = new HashMap(); extensionMap = new HashMap(); - List exporterList = Service.locator().list(IGridTabExporter.class).getServices(); + List exporterList = EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions(); for(IGridTabExporter exporter : exporterList) { String extension = exporter.getFileExtension(); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java index eadbaadadf..14331cac38 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java @@ -330,8 +330,6 @@ public class FormFrame extends CFrame // Create instance w/o parameters // Try equinox extension then java classpath m_panel = Client.getFormPanel(className); - if (m_panel == null) - m_panel = (FormPanel)Class.forName(className).newInstance(); } catch (Exception e) { diff --git a/org.adempiere.ui.zk/META-INF/MANIFEST.MF b/org.adempiere.ui.zk/META-INF/MANIFEST.MF index 975ea00a98..5dae697633 100644 --- a/org.adempiere.ui.zk/META-INF/MANIFEST.MF +++ b/org.adempiere.ui.zk/META-INF/MANIFEST.MF @@ -58,4 +58,4 @@ Bundle-Activator: org.adempiere.webui.WebUIActivator Eclipse-ExtensibleAPI: true Eclipse-RegisterBuddy: org.zkoss.zk.library Web-ContextPath: webui -Service-Component: OSGI-INF/reportviewerprovider.xml, OSGI-INF/defaultinfofactory.xml, OSGI-INF/defaulteditorfactory.xml, OSGI-INF/jrviewerprovider.xml, OSGI-INF/resourcefinder.xml, OSGI-INF/defaultpaymentformfactory.xml, OSGI-INF/processfactory.xml, OSGI-INF/defaultprintshippinglabel.xml, OSGI-INF/defaultcreatefromfactory.xml +Service-Component: OSGI-INF/reportviewerprovider.xml, OSGI-INF/defaultinfofactory.xml, OSGI-INF/defaulteditorfactory.xml, OSGI-INF/jrviewerprovider.xml, OSGI-INF/resourcefinder.xml, OSGI-INF/defaultpaymentformfactory.xml, OSGI-INF/processfactory.xml, OSGI-INF/defaultprintshippinglabel.xml, OSGI-INF/defaultcreatefromfactory.xml, OSGI-INF/defaultformfactory.xml diff --git a/org.adempiere.ui.zk/OSGI-INF/defaultformfactory.xml b/org.adempiere.ui.zk/OSGI-INF/defaultformfactory.xml new file mode 100644 index 0000000000..1ce0229c2e --- /dev/null +++ b/org.adempiere.ui.zk/OSGI-INF/defaultformfactory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java index f47b3ac17e..be445df53f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/Extensions.java @@ -20,8 +20,11 @@ *****************************************************************************/ package org.adempiere.webui; +import java.util.List; + import org.adempiere.base.Service; -import org.adempiere.webui.panel.IFormController; +import org.adempiere.webui.factory.IFormFactory; +import org.adempiere.webui.panel.ADForm; /** * @@ -33,10 +36,18 @@ public class Extensions { /** * - * @param extensionId - * @return IFormController instance or null if extensionId not found + * @param formId Java class name or equinox extension Id + * @return IFormController instance or null if formId not found */ - public static IFormController getForm(String extensionId) { - return Service.locator().locate(IFormController.class, "org.adempiere.webui.Form", extensionId, null).getService(); + public static ADForm getForm(String formId) { + List factories = Service.locator().list(IFormFactory.class).getServices(); + if (factories != null) { + for(IFormFactory factory : factories) { + ADForm form = factory.newFormInstance(formId); + if (form != null) + return form; + } + } + return null; } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFormFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFormFactory.java new file mode 100644 index 0000000000..b444cc18f8 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultFormFactory.java @@ -0,0 +1,274 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.factory; + +import java.util.logging.Level; + +import org.adempiere.base.equinox.EquinoxExtensionLocator; +import org.adempiere.webui.panel.ADForm; +import org.adempiere.webui.panel.IFormController; +import org.adempiere.webui.util.ADClassNameMap; +import org.compiere.util.CLogger; +import org.zkoss.zk.ui.Component; + +/** + * @author hengsin + * + */ +public class DefaultFormFactory implements IFormFactory { + + private static final CLogger log = CLogger.getCLogger(DefaultFormFactory.class); + + /** + * default constructor + */ + public DefaultFormFactory() { + } + + /* (non-Javadoc) + * @see org.adempiere.webui.factory.IFormFactory#newFormInstance(java.lang.String) + */ + @Override + public ADForm newFormInstance(String formName) { + Object form = EquinoxExtensionLocator.instance().locate(Object.class, "org.adempiere.webui.Form", formName, null).getExtension(); + if (form == null) { + //static lookup + String webClassName = ADClassNameMap.get(formName); + //fallback to dynamic translation + if (webClassName == null || webClassName.trim().length() == 0) + { + webClassName = translateFormClassName(formName); + } + + if (webClassName == null) + { + log.warning("Web UI form not implemented for the swing form " + formName); + } + else + { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + Class clazz = null; + if (loader != null) { + try + { + clazz = loader.loadClass(webClassName); + } + catch (Exception e) + { + if (log.isLoggable(Level.INFO)) + log.log(Level.INFO, e.getLocalizedMessage(), e); + } + } + if (clazz == null) { + loader = this.getClass().getClassLoader(); + try + { + // Create instance w/o parameters + clazz = loader.loadClass(webClassName); + } + catch (Exception e) + { + if (log.isLoggable(Level.INFO)) + log.log(Level.INFO, e.getLocalizedMessage(), e); + } + } + if (clazz != null) { + try + { + form = clazz.newInstance(); + } + catch (Exception e) + { + if (log.isLoggable(Level.WARNING)) + log.log(Level.WARNING, e.getLocalizedMessage(), e); + } + } + } + } + + if (form != null) { + if (form instanceof ADForm) { + return (ADForm)form; + } else if (form instanceof IFormController) { + IFormController controller = (IFormController) form; + ADForm adForm = controller.getForm(); + adForm.setICustomForm(controller); + return adForm; + } + } + + if (log.isLoggable(Level.INFO)) + log.info(formName + " not found at extension registry and classpath"); + return null; + } + + /** + * Convert the rich client class name for a form to its web UI equivalent + * + * @param originalName The full class path to convert + * @return the converted class name + */ + private static String translateFormClassName(String originalName) + { + String zkName = null; + /* + * replacement string to translate class paths to the form + * "org.adempiere.webui.apps.form." + */ + final String zkPackage = "org.adempiere.webui."; + /* + * replacement string to translate custom form class name from + * "V" to "W" + */ + final String zkPrefix = "W"; + final String swingPrefix = "V"; + + String tail = null; + //first, try replace package + if (originalName.startsWith("org.compiere.")) + { + tail = originalName.substring("org.compiere.".length()); + } + else if(originalName.startsWith("org.adempiere.")) + { + tail = originalName.substring("org.adempiere.".length()); + } + if (tail != null) + { + zkName = zkPackage + tail; + + try { + Class clazz = ADForm.class.getClassLoader().loadClass(zkName); + if (!isZkFormClass(clazz)) + { + zkName = null; + } + } catch (ClassNotFoundException e) { + zkName = null; + } + + //try replace package and add W prefix to class name + if (zkName == null) + { + String packageName = zkPackage; + int lastdot = tail.lastIndexOf("."); + String className = null; + if (lastdot >= 0) + { + if (lastdot > 0) + packageName = packageName + tail.substring(0, lastdot+1); + className = tail.substring(lastdot+1); + } + else + { + className = tail; + } + + //try convert V* to W* + if (className.startsWith(swingPrefix)) + { + zkName = packageName + zkPrefix + className.substring(1); + try { + Class clazz = ADForm.class.getClassLoader().loadClass(zkName); + if (!isZkFormClass(clazz)) + { + zkName = null; + } + } catch (ClassNotFoundException e) { + zkName = null; + } + } + + //try append W prefix to original class name + if (zkName == null) + { + zkName = packageName + zkPrefix + className; + try { + Class clazz = ADForm.class.getClassLoader().loadClass(zkName); + if (!isZkFormClass(clazz)) + { + zkName = null; + } + } catch (ClassNotFoundException e) { + zkName = null; + } + } + } + } + + /* + * not found, try changing only the class name + */ + if (zkName == null) + { + int lastdot = originalName.lastIndexOf("."); + String packageName = originalName.substring(0, lastdot); + String className = originalName.substring(lastdot+1); + //try convert V* to W* + if (className.startsWith(swingPrefix)) + { + String zkClassName = zkPrefix + className.substring(1); + zkName = packageName + "." + zkClassName; + try { + Class clazz = ADForm.class.getClassLoader().loadClass(zkName); + if (!isZkFormClass(clazz)) + { + zkName = null; + } + } catch (ClassNotFoundException e) { + zkName = null; + } + } + + //try just append W to the original class name + if (zkName == null) + { + String zkClassName = zkPrefix + className; + zkName = packageName + "." + zkClassName; + try { + Class clazz = ADForm.class.getClassLoader().loadClass(zkName); + if (!isZkFormClass(clazz)) + { + zkName = null; + } + } catch (ClassNotFoundException e) { + zkName = null; + } + } + + if (zkName == null) + { + //finally try whether same name is used for zk + zkName = originalName; + try { + Class clazz = ADForm.class.getClassLoader().loadClass(zkName); + if (!isZkFormClass(clazz)) + { + zkName = null; + } + } catch (ClassNotFoundException e) { + zkName = null; + } + } + } + + return zkName; + } + + private static boolean isZkFormClass(Class clazz) { + return IFormController.class.isAssignableFrom(clazz) || Component.class.isAssignableFrom(clazz); + } + + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IFormFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IFormFactory.java new file mode 100644 index 0000000000..a993b9c5f0 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/IFormFactory.java @@ -0,0 +1,32 @@ +/****************************************************************************** + * Copyright (C) 2013 Heng Sin Low * + * Copyright (C) 2013 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program 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 General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.factory; + +import org.adempiere.webui.panel.ADForm; + +/** + * + * @author hengsin + * + */ +public interface IFormFactory { + + /** + * + * @param formName + * @return new form instance + */ + public ADForm newFormInstance(String formName); + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADForm.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADForm.java index ef12718df6..fc2d9b5349 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADForm.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADForm.java @@ -24,14 +24,12 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.util.ADClassNameMap; import org.compiere.model.GridTab; import org.compiere.model.MForm; import org.compiere.model.X_AD_CtxHelp; import org.compiere.process.ProcessInfo; import org.compiere.util.CLogger; import org.compiere.util.Env; -import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -127,163 +125,6 @@ public abstract class ADForm extends Window implements EventListener return m_name; } - /** - * Convert the rich client class name for a form to its web UI equivalent - * - * @param originalName The full class path to convert - * @return the converted class name - */ - private static String translateFormClassName(String originalName) - { - String zkName = null; - /* - * replacement string to translate class paths to the form - * "org.adempiere.webui.apps.form." - */ - final String zkPackage = "org.adempiere.webui."; - /* - * replacement string to translate custom form class name from - * "V" to "W" - */ - final String zkPrefix = "W"; - final String swingPrefix = "V"; - - String tail = null; - //first, try replace package - if (originalName.startsWith("org.compiere.")) - { - tail = originalName.substring("org.compiere.".length()); - } - else if(originalName.startsWith("org.adempiere.")) - { - tail = originalName.substring("org.adempiere.".length()); - } - if (tail != null) - { - zkName = zkPackage + tail; - - try { - Class clazz = ADForm.class.getClassLoader().loadClass(zkName); - if (!isZkFormClass(clazz)) - { - zkName = null; - } - } catch (ClassNotFoundException e) { - zkName = null; - } - - //try replace package and add W prefix to class name - if (zkName == null) - { - String packageName = zkPackage; - int lastdot = tail.lastIndexOf("."); - String className = null; - if (lastdot >= 0) - { - if (lastdot > 0) - packageName = packageName + tail.substring(0, lastdot+1); - className = tail.substring(lastdot+1); - } - else - { - className = tail; - } - - //try convert V* to W* - if (className.startsWith(swingPrefix)) - { - zkName = packageName + zkPrefix + className.substring(1); - try { - Class clazz = ADForm.class.getClassLoader().loadClass(zkName); - if (!isZkFormClass(clazz)) - { - zkName = null; - } - } catch (ClassNotFoundException e) { - zkName = null; - } - } - - //try append W prefix to original class name - if (zkName == null) - { - zkName = packageName + zkPrefix + className; - try { - Class clazz = ADForm.class.getClassLoader().loadClass(zkName); - if (!isZkFormClass(clazz)) - { - zkName = null; - } - } catch (ClassNotFoundException e) { - zkName = null; - } - } - } - } - - /* - * not found, try changing only the class name - */ - if (zkName == null) - { - int lastdot = originalName.lastIndexOf("."); - String packageName = originalName.substring(0, lastdot); - String className = originalName.substring(lastdot+1); - //try convert V* to W* - if (className.startsWith(swingPrefix)) - { - String zkClassName = zkPrefix + className.substring(1); - zkName = packageName + "." + zkClassName; - try { - Class clazz = ADForm.class.getClassLoader().loadClass(zkName); - if (!isZkFormClass(clazz)) - { - zkName = null; - } - } catch (ClassNotFoundException e) { - zkName = null; - } - } - - //try just append W to the original class name - if (zkName == null) - { - String zkClassName = zkPrefix + className; - zkName = packageName + "." + zkClassName; - try { - Class clazz = ADForm.class.getClassLoader().loadClass(zkName); - if (!isZkFormClass(clazz)) - { - zkName = null; - } - } catch (ClassNotFoundException e) { - zkName = null; - } - } - - if (zkName == null) - { - //finally try whether same name is used for zk - zkName = originalName; - try { - Class clazz = ADForm.class.getClassLoader().loadClass(zkName); - if (!isZkFormClass(clazz)) - { - zkName = null; - } - } catch (ClassNotFoundException e) { - zkName = null; - } - } - } - - return zkName; - } - - private static boolean isZkFormClass(Class clazz) { - return IFormController.class.isAssignableFrom(clazz) || Component.class.isAssignableFrom(clazz); - } - /** * Create a new form corresponding to the specified identifier * @@ -297,83 +138,31 @@ public abstract class ADForm extends Window implements EventListener public static ADForm openForm (int adFormID, GridTab gridTab) { - Object obj = null; ADForm form; - String webClassName = ""; MForm mform = new MForm(Env.getCtx(), adFormID, null); - String richClassName = mform.getClassname(); + String formName = mform.getClassname(); String name = mform.get_Translation(MForm.COLUMNNAME_Name); - if (mform.get_ID() == 0 || richClassName == null) + if (mform.get_ID() == 0 || formName == null) { throw new ApplicationException("There is no form associated with the specified selection"); } else { - logger.info("AD_Form_ID=" + adFormID + " - Class=" + richClassName); + if (logger.isLoggable(Level.INFO)) + logger.info("AD_Form_ID=" + adFormID + " - Class=" + formName); - obj = Extensions.getForm(richClassName); - if (obj == null) + form = Extensions.getForm(formName); + if (form != null) { - //static lookup - webClassName = ADClassNameMap.get(richClassName); - //fallback to dynamic translation - if (webClassName == null || webClassName.trim().length() == 0) - { - webClassName = translateFormClassName(richClassName); - } - - if (webClassName == null) - { - throw new ApplicationException("Web UI form not implemented for the swing form " + - richClassName); - } - - try - { - // Create instance w/o parameters - obj = ADForm.class.getClassLoader().loadClass(webClassName).newInstance(); - } - catch (Exception e) - { - throw new ApplicationException("The selected web user interface custom form '" + - webClassName + - "' is not accessible.", e); - } + form.gridTab = gridTab; + form.init(adFormID, name); + return form; + } + else + { + throw new ApplicationException("Failed to open " + formName); } - - try - { - if (obj instanceof ADForm) - { - form = (ADForm)obj; - form.gridTab = gridTab; - form.init(adFormID, name); - return form; - } - else if (obj instanceof IFormController) - { - IFormController customForm = (IFormController)obj; - form = customForm.getForm(); - form.gridTab = gridTab; - form.setICustomForm(customForm); - form.init(adFormID, name); - return form; - } - else - { - throw new ApplicationException("The web user interface custom form '" + - webClassName + - "' cannot be displayed in the web user interface."); - } - } - catch (Exception ex) - { - logger.log(Level.SEVERE, "Class=" + webClassName + ", AD_Form_ID=" + adFormID, ex); - throw new ApplicationException("The web user interface custom form '" + - webClassName + - "' failed to initialise:" + ex); - } } } // openForm diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java index 0bde89a57f..2e5e6659b6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.Set; import org.adempiere.base.IGridTabExporter; -import org.adempiere.base.Service; +import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.adempiere.exceptions.AdempiereException; import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.LayoutUtils; @@ -80,7 +80,7 @@ public class ExportAction implements EventListener { exporterMap = new HashMap(); extensionMap = new HashMap(); - List exporterList = Service.locator().list(IGridTabExporter.class).getServices(); + List exporterList = EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions(); for(IGridTabExporter exporter : exporterList) { String extension = exporter.getFileExtension(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java index 166d321256..1f20709592 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/FileImportAction.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; import org.adempiere.base.IGridTabImporter; -import org.adempiere.base.Service; +import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.adempiere.exceptions.AdempiereException; import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.LayoutUtils; @@ -116,7 +116,7 @@ public class FileImportAction implements EventListener importerMap = new HashMap(); extensionMap = new HashMap(); - List importerList = Service.locator().list(IGridTabImporter.class).getServices(); + List importerList = EquinoxExtensionLocator.instance().list(IGridTabImporter.class).getExtensions(); for(IGridTabImporter importer : importerList) { String extension = importer.getFileExtension(); diff --git a/org.adempiere.ui.zk/build.properties b/org.adempiere.ui.zk/build.properties index 05f96947e9..c483da351d 100644 --- a/org.adempiere.ui.zk/build.properties +++ b/org.adempiere.ui.zk/build.properties @@ -1,52 +1,53 @@ -output.. = WEB-INF/classes/ -bin.includes = META-INF/,\ - WEB-INF/,\ - css/,\ - images/,\ - index.zul,\ - js/,\ - theme/,\ - theme.zs,\ - zul/,\ - timeout.zul,\ - plugin.xml,\ - calendar.css,\ - calendar.zul,\ - calendar_mini.zul,\ - divarrow.zul,\ - divtab.zul,\ - OSGI-INF/,\ - OSGI-INF/reportviewerprovider.xml,\ - OSGI-INF/defaultinfofactory.xml,\ - OSGI-INF/defaulteditorfactory.xml,\ - OSGI-INF/jrviewerprovider.xml,\ - OSGI-INF/resourcefinder.xml,\ - OSGI-INF/defaultpaymentformfactory.xml,\ - OSGI-INF/processfactory.xml,\ - OSGI-INF/defaultprintshippinglabel.xml,\ - WEB-INF/lib/atmosphere-compat-jbossweb-1.0.4.jar,\ - WEB-INF/lib/atmosphere-compat-tomcat-1.0.4.jar,\ - WEB-INF/lib/atmosphere-compat-tomcat7-1.0.4.jar,\ - WEB-INF/lib/atmosphere-runtime-1.0.4.jar,\ - OSGI-INF/defaultcreatefromfactory.xml -src.includes = WEB-INF/classes/,\ - WEB-INF/tld/,\ - WEB-INF/web.xml,\ - WEB-INF/xsd/,\ - WEB-INF/zk.xml,\ - css/,\ - images/,\ - index.zul,\ - js/,\ - theme/,\ - theme.zs,\ - zul/,\ - calendar.css,\ - calendar.zul,\ - calendar_mini.zul,\ - divarrow.zul,\ - divtab.zul -source.. = WEB-INF/src/ -bin.excludes = WEB-INF/src/,\ - WEB-INF/web-2.5.xml,\ - WEB-INF/classes/ +output.. = WEB-INF/classes/ +bin.includes = META-INF/,\ + WEB-INF/,\ + css/,\ + images/,\ + index.zul,\ + js/,\ + theme/,\ + theme.zs,\ + zul/,\ + timeout.zul,\ + plugin.xml,\ + calendar.css,\ + calendar.zul,\ + calendar_mini.zul,\ + divarrow.zul,\ + divtab.zul,\ + OSGI-INF/,\ + OSGI-INF/reportviewerprovider.xml,\ + OSGI-INF/defaultinfofactory.xml,\ + OSGI-INF/defaulteditorfactory.xml,\ + OSGI-INF/jrviewerprovider.xml,\ + OSGI-INF/resourcefinder.xml,\ + OSGI-INF/defaultpaymentformfactory.xml,\ + OSGI-INF/processfactory.xml,\ + OSGI-INF/defaultprintshippinglabel.xml,\ + WEB-INF/lib/atmosphere-compat-jbossweb-1.0.4.jar,\ + WEB-INF/lib/atmosphere-compat-tomcat-1.0.4.jar,\ + WEB-INF/lib/atmosphere-compat-tomcat7-1.0.4.jar,\ + WEB-INF/lib/atmosphere-runtime-1.0.4.jar,\ + OSGI-INF/defaultcreatefromfactory.xml,\ + OSGI-INF/defaultformfactory.xml +src.includes = WEB-INF/classes/,\ + WEB-INF/tld/,\ + WEB-INF/web.xml,\ + WEB-INF/xsd/,\ + WEB-INF/zk.xml,\ + css/,\ + images/,\ + index.zul,\ + js/,\ + theme/,\ + theme.zs,\ + zul/,\ + calendar.css,\ + calendar.zul,\ + calendar_mini.zul,\ + divarrow.zul,\ + divtab.zul +source.. = WEB-INF/src/ +bin.excludes = WEB-INF/src/,\ + WEB-INF/web-2.5.xml,\ + WEB-INF/classes/ diff --git a/org.adempiere.ui.zk/plugin.xml b/org.adempiere.ui.zk/plugin.xml index 9bf9c34dce..d4f09ef2fd 100644 --- a/org.adempiere.ui.zk/plugin.xml +++ b/org.adempiere.ui.zk/plugin.xml @@ -2,7 +2,5 @@ - - diff --git a/org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IEditorFactory.exsd b/org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IEditorFactory.exsd deleted file mode 100644 index bca5f34ca2..0000000000 --- a/org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IEditorFactory.exsd +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Extension point to provide field editor factory implementation. The UI framework will query all the editor factory extension available following the priority sequence and the first available editor instance will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - numeric priority value, higher value is of higher priority. - - - - - - - Implementation class name for the org.adempiere.webui.factory.IEditorFactory interface. - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="org.adempiere.webui.factory.DefaultEditorFactory" - name="Default field editor factory" - point="org.adempiere.webui.factory.IEditorFactory"> - <factory - class="org.adempiere.webui.factory.DefaultEditorFactory" - priority="0"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.webui.factory.IEditorFactory - - - - - - - - - The default implementation at the org.adempiere.ui.zk bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IInfoFactory.exsd b/org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IInfoFactory.exsd deleted file mode 100644 index 1c85a1d735..0000000000 --- a/org.adempiere.ui.zk/schema/org.adempiere.webui.factory.IInfoFactory.exsd +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - Extension point to provide Info factory implementation. The UI framework will query all the info factory extension available and the first available InfoPanel instance will be used. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - numeric priority value. bigger number have higher priority. - - - - - - - Implementation class name for the org.adempiere.webui.factory.IInfoFactory interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - id="org.adempiere.webui.factory.DefaultInfoFactory" - name="Default Info Factory" - point="org.adempiere.webui.factory.IInfoFactory"> - <factory - class="org.adempiere.webui.factory.DefaultInfoFactory" - priority="0"> - </factory> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.adempiere.webui.factory.IInfoFactory - - - - - - - - - The default implementation at the org.adempiere.ui.zk bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.adempiere.ui/build.properties b/org.adempiere.ui/build.properties index 03b6e34ea0..972223bfbc 100644 --- a/org.adempiere.ui/build.properties +++ b/org.adempiere.ui/build.properties @@ -2,6 +2,5 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ org-netbeans-api-visual.jar,\ - org-openide-util.jar,\ - plugin.xml + org-openide-util.jar source.. = src/ diff --git a/org.adempiere.ui/plugin.xml b/org.adempiere.ui/plugin.xml deleted file mode 100644 index 2124941648..0000000000 --- a/org.adempiere.ui/plugin.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/org.adempiere.ui/schema/org.compiere.print.ReportViewerProvider.exsd b/org.adempiere.ui/schema/org.compiere.print.ReportViewerProvider.exsd deleted file mode 100644 index ce7db23fd4..0000000000 --- a/org.adempiere.ui/schema/org.compiere.print.ReportViewerProvider.exsd +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - Extension point to provide report viewer implementation for the build in adempiere report engine. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Implementation class name of the org.compiere.print.ReportViewerProvider interface - - - - - - - - - - - - - - - 1.0.0 - - - - - - - - - <pre> -<extension - point="org.compiere.print.ReportViewerProvider"> - <provider - class="org.adempiere.webui.window.ZkReportViewerProvider"> - </provider> -</extension> -</pre> - - - - - - - - - The class attribute must represent an implementor of org.compiere.print.ReportViewerProvider - - - - - - - - - org.adempiere.ui.swing and org.adempiere.ui.zk bundle - - - - - - - - - This file is part of Adempiere ERP Bazaar http://www.adempiere.org. - - Copyright (C) Heng Sin Low. - Copyright (C) Contributors. - - This program is free software; you can redistribute it and/or modify it - under the terms version 2 of the GNU General Public License as published - by the Free Software Foundation. This program 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 General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - - - - - diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java index 972e20e9d1..8a4130913a 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java @@ -30,8 +30,8 @@ import javax.xml.namespace.QName; import javax.xml.ws.WebServiceContext; import javax.xml.ws.handler.MessageContext; -import org.adempiere.base.Service; import org.adempiere.base.ServiceQuery; +import org.adempiere.base.equinox.EquinoxExtensionLocator; import org.adempiere.exceptions.AdempiereException; import org.compiere.model.Lookup; import org.compiere.model.MWebService; @@ -526,7 +526,7 @@ public class AbstractService { ServiceQuery query = new ServiceQuery(); query.put("WSType",serviceType); - return Service.locator().list(IWSValidator.class, query).getServices(); + return EquinoxExtensionLocator.instance().list(IWSValidator.class, query).getExtensions(); } /**