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).
This commit is contained in:
parent
001080515d
commit
f4da72ef50
|
@ -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"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.columncallout.factory.default">
|
||||
<implementation class="org.adempiere.base.DefaultColumnCalloutFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IColumnCalloutFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.modelvalidator.factory.default">
|
||||
<implementation class="org.adempiere.base.DefaultModelValidatorFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IModelValidatorFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.paymentprocessor.factory.default">
|
||||
<implementation class="org.adempiere.base.DefaultPaymentProcessorFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IPaymentProcessorFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.process.factory.default">
|
||||
<implementation class="org.adempiere.base.DefaultProcessFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IProcessFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.shipmentprocessor.factory.default">
|
||||
<implementation class="org.adempiere.base.DefaultShipmentProcessorFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IShipmentProcessorFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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/
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.base.IResourceFinder" name="ResourceFinder" schema="schema/org.adempiere.base.IResourceFinder.exsd"/>
|
||||
<extension-point id="org.adempiere.base.IColumnCallout" name="Callout" schema="schema/org.adempiere.base.Callout.exsd"/>
|
||||
<extension-point id="org.adempiere.base.IDictionaryService" name="DictionaryService" schema="schema/org.adempiere.base.IDictionaryService.exsd"/>
|
||||
<extension-point id="org.adempiere.base.Process" name="Process" schema="schema/org.adempiere.base.Process.exsd"/>
|
||||
<extension-point id="org.adempiere.base.ModelValidator" name="Model Validator" schema="schema/org.adempiere.base.ModelValidator.exsd"/>
|
||||
<extension-point id="org.compiere.db.AdempiereDatabase" name="Adempiere Database Interface" schema="schema/org.compiere.db.AdempiereDatabase.exsd"/>
|
||||
<extension-point id="org.compiere.interfaces.Server" name="Server Interface" schema="schema/org.compiere.interfaces.Server.exsd"/>
|
||||
<extension-point id="org.compiere.interfaces.Status" name="Status interface" schema="schema/org.compiere.interfaces.Status.exsd"/>
|
||||
<extension-point id="org.adempiere.base.IModelFactory" name="Model Factory" schema="schema/org.adempiere.base.IModelFactory.exsd"/>
|
||||
<extension-point id="org.adempiere.base.IDocFactory" name="Financial Document Factory" schema="schema/org.adempiere.base.IDocFactory.exsd"/>
|
||||
<extension-point id="org.adempiere.base.IGridTabExporter" name="Grid data export extension" schema="schema/org.adempiere.base.IGridTabExporter.exsd"/>
|
||||
<extension-point id="org.adempiere.base.IGridTabImporter" name="Grid data import extension" schema="schema/org.adempiere.base.IGridTabImporter.exsd"/>
|
||||
<extension-point id="org.compiere.model.PaymentProcessor" name="Payment Processor" schema="schema/org.compiere.model.PaymentProcessor.exsd"/>
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.adempiere.base.IDictionaryService" name="DictionaryService"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Extension point to update the Adempiere dictionary ( AD_* tables ) when a bundle is activated for the first time.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="client"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="client">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class for the org.adempiere.base.IDictionaryService interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.base.IDictionaryService"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.adempiere.base.IDictionaryService">
|
||||
<client
|
||||
class="org.adempiere.pipo.srv.PipoDictionaryService">
|
||||
</client>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.base.IDictionaryService
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,149 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.adempiere.base.IDocFactory" name="Financial Document Factory"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="gaap" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
gaap to match c_acctschema.gaap. you can use * to match everything
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="priority" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value, higher value is of higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class for the org.adempiere.base.IDocFactory
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.base.IDocFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.base.IDocFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Default document factory in the org.adempiere.base bundle.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.adempiere.base.IModelFactory" name="Model Factory"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value, higher value is of higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.adempiere.base.IModelFactory interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.base.IModelFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.base.IModelFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Default model class factory in org.adempiere.base bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,132 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.adempiere.base.IResourceFinder" name="Resource Finder"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The core classes will query all available resource finder to load resources like image, properties file, etc ( First non-null result will be used ).
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="finder"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="finder">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.compiere.util.IResourceFinder interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.util.IResourceFinder"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
id="RF"
|
||||
name="RF"
|
||||
point="org.adempiere.base.IResourceFinder">
|
||||
<finder
|
||||
class="org.compiere.util.ResourceFinder">
|
||||
</finder>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.base.IResourceFinder
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
extension at the org.adempiere.ui.swing and org.adempiere.ui.zk bundle.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.compiere.db.AdempiereDatabase" name="Adempiere Database Interface"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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 ).
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="database"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="database">
|
||||
<complexType>
|
||||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Oracle, PostgreSQL, etc
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.compiere.db.AdempiereDatabase interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.db.AdempiereDatabase"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.compiere.db.AdempiereDatabase">
|
||||
<database
|
||||
class="org.compiere.db.DB_PostgreSQL"
|
||||
id="PostgreSQL">
|
||||
</database>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.compiere.db.AdempiereDatabase
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
org.adempiere.db.oracle.provider and org.adempiere.db.postgresql.provider
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,130 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.compiere.interfaces.Server" name="Server Interface"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Extension point to provide client interface (org.compiere.interfaces.Server ) to execute remote server command
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="interface"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="interface">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.compiere.interfaces.Server interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.interfaces.Server"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.compiere.interfaces.Server">
|
||||
<interface
|
||||
class="org.adempiere.client.ServerInterface">
|
||||
</interface>
|
||||
</extension>
|
||||
</Pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.compiere.interfaces.Server
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The restlet base swing client interface at org.adempiere.ui.swing bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,130 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.base" id="org.compiere.interfaces.Status" name="Status interface"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Extension point to provide implementation for client interface ( org.compiere.interfaces.Status ) to query remote server info and status
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="interface"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="interface">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.compiere.interfaces.Status interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.interfaces.Status"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.compiere.interfaces.Status">
|
||||
<interface
|
||||
class="org.adempiere.client.StatusInterface">
|
||||
</interface>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.compiere.interfaces.Status
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The default restlet base implementation at the org.adempiere.ui.swing bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -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<IColumnCallout> 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<IColumnCallout> list = new ArrayList<IColumnCallout>();
|
||||
List<IColumnCalloutFactory> 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<IProcessFactory> 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<IModelValidatorFactory> 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<IPaymentProcessorFactory> 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<IShipmentProcessorFactory> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<IColumnCallout> list = EquinoxExtensionLocator.instance().list(IColumnCallout.class, query).getExtensions();
|
||||
return list != null ? list.toArray(new IColumnCallout[0]) : new IColumnCallout[0];
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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<T> implements IServiceHolder<T>,
|
||||
IServicesHolder<T> {
|
||||
|
||||
private List<IServiceHolder<T>> serviceHolder = new ArrayList<IServiceHolder<T>>();
|
||||
private List<IServicesHolder<T>> servicesHolder = new ArrayList<IServicesHolder<T>>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public DelegatingServiceHolder() {
|
||||
}
|
||||
|
||||
public void addServiceHolder(IServiceHolder<T> holder) {
|
||||
serviceHolder.add(holder);
|
||||
}
|
||||
|
||||
public void addServicesHolder(IServicesHolder<T> holder) {
|
||||
servicesHolder.add(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getServices() {
|
||||
List<T> list = new ArrayList<T>();
|
||||
for(IServicesHolder<T> holder : servicesHolder) {
|
||||
List<T> t = holder.getServices();
|
||||
if (t != null && !t.isEmpty())
|
||||
list.addAll(t);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getService() {
|
||||
T t = null;
|
||||
for(IServiceHolder<T> holder : serviceHolder) {
|
||||
t = holder.getService();
|
||||
if (t != null) break;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
}
|
|
@ -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<IServiceLocator> locatorsHolder;
|
||||
|
||||
public DelegatingServiceLocator() {
|
||||
DynamicServiceLocator serviceLocator = new DynamicServiceLocator();
|
||||
locatorsHolder = serviceLocator.list(IServiceLocator.class);
|
||||
}
|
||||
|
||||
private IServiceLocator[] getLocators() {
|
||||
List<IServiceLocator> locators = locatorsHolder.getServices();
|
||||
return locators.toArray(new IServiceLocator[0]);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.adempiere.base.IServiceLocator#locate(java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> type) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServiceHolder<T> 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 <T> IServiceHolder<T> locate(Class<T> type, String serviceType) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServiceHolder<T> 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 <T> IServiceHolder<T> locate(Class<T> type, ServiceQuery query) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServiceHolder<T> 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 <T> IServiceHolder<T> locate(Class<T> type, String serviceId, ServiceQuery query) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServiceHolder<T> 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 <T> IServiceHolder<T> locate(Class<T> type, String serviceType,
|
||||
String serviceId, ServiceQuery query) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServiceHolder<T> 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 <T> IServicesHolder<T> list(Class<T> type) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServicesHolder<T> 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 <T> IServicesHolder<T> list(Class<T> type, String serviceType) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServicesHolder<T> 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 <T> IServicesHolder<T> list(Class<T> type, ServiceQuery query) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServicesHolder<T> 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 <T> IServicesHolder<T> list(Class<T> type, String serviceId, ServiceQuery query) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServicesHolder<T> 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 <T> IServicesHolder<T> list(Class<T> type, String serviceType,
|
||||
String serviceId, ServiceQuery query) {
|
||||
DelegatingServiceHolder<T> holder = new DelegatingServiceHolder<T>();
|
||||
for(IServiceLocator locator : getLocators()) {
|
||||
IServicesHolder<T> t = locator.list(type, serviceType, serviceId, query);
|
||||
if (t != null)
|
||||
holder.addServicesHolder(t);
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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 {
|
|||
*/
|
||||
<T> IServiceHolder<T> locate(Class<T> type);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param serviceType equinox extension point id, ignore by osgi service locator
|
||||
* type.getName
|
||||
* @return holder for dynamic service
|
||||
*/
|
||||
<T> IServiceHolder<T> locate(Class<T> 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
|
||||
*/
|
||||
<T> IServiceHolder<T> locate(Class<T> 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
|
||||
*/
|
||||
<T> IServiceHolder<T> locate(Class<T> type, String serviceType, String serviceId, ServiceQuery query);
|
||||
<T> IServiceHolder<T> locate(Class<T> type, String componentName, ServiceQuery query);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -77,14 +58,6 @@ public interface IServiceLocator {
|
|||
*/
|
||||
<T> IServicesHolder<T> list(Class<T> type);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param serviceType equinox extension point id, ignore by osgi service locator
|
||||
* @return holder for list of dynamic service
|
||||
*/
|
||||
<T> IServicesHolder<T> list(Class<T> 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
|
||||
*/
|
||||
<T> IServicesHolder<T> list(Class<T> 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
|
||||
*/
|
||||
<T> IServicesHolder<T> list(Class<T> type, String serviceType, String serviceId, ServiceQuery query);
|
||||
<T> IServicesHolder<T> list(Class<T> type, String componentName, ServiceQuery query);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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();
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -45,14 +45,6 @@ public class DynamicServiceLocator implements IServiceLocator {
|
|||
return new DynamicServiceHolder<T>(tracker);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> 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<T>(tracker);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.adempiere.base.IServiceLocator#locate(java.lang.Class, java.lang.String, java.lang.String, org.adempiere.base.ServiceQuery)
|
||||
*/
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> 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<T>(tracker);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public <T> IServicesHolder<T> list(Class<T> 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<T>(tracker);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.adempiere.base.IServiceLocator#list(java.lang.Class, java.lang.String, java.lang.String, org.adempiere.base.ServiceQuery)
|
||||
*/
|
||||
@Override
|
||||
public <T> IServicesHolder<T> list(Class<T> 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(")");
|
||||
|
|
|
@ -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<T> implements IServiceHolder<T>, IServicesHolder<T> {
|
||||
public class EquinoxExtensionHolder<T> {
|
||||
|
||||
private ExtensionList<T> extensionList;
|
||||
|
||||
/**
|
||||
* @param list
|
||||
*/
|
||||
public EquinoxServiceHolder(ExtensionList<T> list) {
|
||||
public EquinoxExtensionHolder(ExtensionList<T> list) {
|
||||
extensionList = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getService() {
|
||||
/**
|
||||
* @return new extension instance
|
||||
*/
|
||||
public T getExtension() {
|
||||
return extensionList.first();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getServices() {
|
||||
/**
|
||||
* @return list of matching extensions
|
||||
*/
|
||||
public List<T> getExtensions() {
|
||||
return extensionList.asList();
|
||||
}
|
||||
|
|
@ -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 <T> EquinoxExtensionHolder<T> list(Class<T> type) {
|
||||
return list(type, type.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> list(Class<T> type, String extensionPointId) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId);
|
||||
return new EquinoxExtensionHolder<T>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> list(Class<T> type, ServiceQuery query) {
|
||||
return list(type, type.getName(), null, query);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionId
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> list(Class<T> type, String extensionId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, null, extensionId, query);
|
||||
return new EquinoxExtensionHolder<T>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @param extensionId
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> list(Class<T> type, String extensionPointId, String extensionId,
|
||||
ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId, extensionId, query);
|
||||
return new EquinoxExtensionHolder<T>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> locate(Class<T> type) {
|
||||
return locate(type, type.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> locate(Class<T> type, String extensionPointId) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId);
|
||||
return new EquinoxExtensionHolder<T>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> locate(Class<T> type, ServiceQuery query) {
|
||||
return locate(type, type.getName(), null, query);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionId
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> locate(Class<T> type, String extensionId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, null, extensionId, query);
|
||||
return new EquinoxExtensionHolder<T>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @param extensionId
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
public <T> EquinoxExtensionHolder<T> locate(Class<T> type, String extensionPointId, String extensionId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, extensionPointId, extensionId, query);
|
||||
return new EquinoxExtensionHolder<T>(list);
|
||||
}
|
||||
}
|
|
@ -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 <T> IServicesHolder<T> list(Class<T> type) {
|
||||
return list(type, type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServicesHolder<T> list(Class<T> type, String serviceType) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, serviceType);
|
||||
return new EquinoxServiceHolder<T>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServicesHolder<T> list(Class<T> type, ServiceQuery query) {
|
||||
return list(type, type.getName(), null, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServicesHolder<T> list(Class<T> type, String serviceId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, null, serviceId, query);
|
||||
return new EquinoxServiceHolder<T>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServicesHolder<T> list(Class<T> type, String serviceType, String serviceId,
|
||||
ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, serviceType, serviceId, query);
|
||||
return new EquinoxServiceHolder<T>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> type) {
|
||||
return locate(type, type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> type, String serviceType) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, serviceType);
|
||||
return new EquinoxServiceHolder<T>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> type, ServiceQuery query) {
|
||||
return locate(type, type.getName(), null, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> type, String serviceId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, null, serviceId, query);
|
||||
return new EquinoxServiceHolder<T>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IServiceHolder<T> locate(Class<T> type, String serviceType, String serviceId, ServiceQuery query) {
|
||||
ExtensionList<T> list = new ExtensionList<T>(type, serviceType, serviceId, query);
|
||||
return new EquinoxServiceHolder<T>(list);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<IDatabaseConfig> configList = Service.locator().list(IDatabaseConfig.class).getServices();
|
||||
List<IDatabaseConfig> 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++)
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.pipo.dictionary.service">
|
||||
<implementation class="org.adempiere.pipo.srv.PipoDictionaryService"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IDictionaryService"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -1,5 +1,7 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
plugin.xml,\
|
||||
OSGI-INF/dictionaryservice.xml,\
|
||||
OSGI-INF/
|
||||
source.. = src/
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.pipo.Handlers" name="Element Handlers" schema="schema/org.adempiere.pipo.Handlers.exsd"/>
|
||||
<extension
|
||||
point="org.adempiere.base.IDictionaryService">
|
||||
<client
|
||||
class="org.adempiere.pipo.srv.PipoDictionaryService">
|
||||
</client>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.pipo2.GridTab2PackExporter"
|
||||
name="2Pack Exporter"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*/
|
||||
package org.adempiere.pipo2;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.adempiere.base.ServiceQuery;
|
||||
import org.adempiere.base.equinox.EquinoxExtensionLocator;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
|
@ -12,12 +12,11 @@ import org.adempiere.base.ServiceQuery;
|
|||
*/
|
||||
public class OSGiHandlerRegistry implements IHandlerRegistry {
|
||||
|
||||
private final static String SERVICE_ID = "org.adempiere.pipo.Handlers";
|
||||
private final static String EXTENSION_POINT_ID = "org.adempiere.pipo.Handlers";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public OSGiHandlerRegistry() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -36,11 +35,11 @@ public class OSGiHandlerRegistry implements IHandlerRegistry {
|
|||
|
||||
ServiceQuery query = new ServiceQuery();
|
||||
query.put("id", id);
|
||||
handler = Service.locator().locate(ElementHandler.class, SERVICE_ID, null, query).getService();
|
||||
handler = EquinoxExtensionLocator.instance().locate(ElementHandler.class, EXTENSION_POINT_ID, null, query).getExtension();
|
||||
if (handler == null) {
|
||||
id = TABLE_GENERIC_HANDLER;
|
||||
query.put("id", id);
|
||||
handler = Service.locator().locate(ElementHandler.class, SERVICE_ID, null, query).getService();
|
||||
handler = EquinoxExtensionLocator.instance().locate(ElementHandler.class, EXTENSION_POINT_ID, null, query).getExtension();
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
@ -53,7 +52,7 @@ public class OSGiHandlerRegistry implements IHandlerRegistry {
|
|||
ElementHandler handler = null;
|
||||
ServiceQuery query = new ServiceQuery();
|
||||
query.put("id", name);
|
||||
handler = Service.locator().locate(ElementHandler.class, SERVICE_ID, null, query).getService();
|
||||
handler = EquinoxExtensionLocator.instance().locate(ElementHandler.class, EXTENSION_POINT_ID, null, query).getExtension();
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.report.jasper.swing.viewer.provider">
|
||||
<implementation class="org.compiere.report.SwingJRViewerProvider"/>
|
||||
<service>
|
||||
<provide interface="org.compiere.report.JRViewerProvider"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -1,5 +1,6 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
||||
OSGI-INF/jrviewerprovider.xml,\
|
||||
OSGI-INF/
|
||||
source.. = src/
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension
|
||||
point="org.compiere.report.JRViewerProvider">
|
||||
<provider
|
||||
class="org.compiere.report.SwingJRViewerProvider">
|
||||
</provider>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
|
@ -1,5 +1,4 @@
|
|||
source.JasperReports.jar = src/
|
||||
output.JasperReports.jar = build/
|
||||
bin.includes = META-INF/,\
|
||||
JasperReports.jar,\
|
||||
plugin.xml
|
||||
JasperReports.jar
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.compiere.report.JRViewerProvider" name="Jasper Report Viewer Provider" schema="schema/org.compiere.report.JRViewerProvider.exsd"/>
|
||||
|
||||
</plugin>
|
|
@ -1,131 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.JasperReports" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.JasperReports" id="org.compiere.report.JRViewerProvider" name="Jasper Report Viewer Provider"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Extension point to provide jasper report viewer implementation
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="provider"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="provider">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.compiere.report.JRViewerProvider interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.report.JRViewerProvider"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.compiere.report.JRViewerProvider">
|
||||
<provider
|
||||
class="org.adempiere.webui.window.ZkJRViewerProvider">
|
||||
</provider>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of JRViewerProvider
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
org.adempiere.report.jasper.swing and org.adempiere.ui.zk bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.server.IServerFactory" name="Adempiere Server Factory" schema="schema/org.adempiere.server.IServerFactory.exsd"/>
|
||||
<extension
|
||||
id="org.adempiere.server.application"
|
||||
point="org.eclipse.core.runtime.applications">
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.server" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.server" id="org.adempiere.server.IServerFactory" name="Adempiere Server Factory"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice minOccurs="1" maxOccurs="unbounded">
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="class" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.adempiere.server.IServerFactory interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.server.IServerFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.adempiere.server.IServerFactory">
|
||||
<factory
|
||||
class="org.adempiere.server.rpl.imp.ReplicationServerFactory">
|
||||
</factory>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.server.IServerFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
replication server factory at the org.adempiere.replication.server bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.editor.factory.default">
|
||||
<implementation class="org.adempiere.ui.swing.factory.DefaultEditorFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.ui.swing.factory.IEditorFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.form.factory.default">
|
||||
<implementation class="org.adempiere.ui.swing.factory.DefaultFormFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.ui.swing.factory.IFormFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.info.factory.default">
|
||||
<implementation class="org.adempiere.ui.swing.factory.DefaultInfoFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.ui.swing.factory.IInfoFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.report.viewer.provider">
|
||||
<implementation class="org.compiere.print.SwingViewerProvider"/>
|
||||
<service>
|
||||
<provide interface="org.compiere.print.ReportViewerProvider"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.swing.resource.finder">
|
||||
<implementation class="org.compiere.util.ResourceFinder"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.base.IResourceFinder"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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/
|
||||
|
|
|
@ -2,16 +2,6 @@
|
|||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.apps.Form" name="Form" schema="schema/org.adempiere.apps.Form.exsd"/>
|
||||
<extension-point id="org.adempiere.ui.swing.factory.IInfoFactory" name="Info Factory extension" schema="schema/org.adempiere.ui.swing.factory.IInfoFactory.exsd"/>
|
||||
<extension-point id="org.adempiere.ui.swing.factory.IEditorFactory" name="Field editor factory" schema="schema/org.adempiere.ui.swing.factory.IEditorFactory.exsd"/>
|
||||
<extension
|
||||
id="RF"
|
||||
name="RF"
|
||||
point="org.adempiere.base.IResourceFinder">
|
||||
<finder
|
||||
class="org.compiere.util.ResourceFinder">
|
||||
</finder>
|
||||
</extension>
|
||||
<extension
|
||||
id="org.adempiere.ui.swing.client"
|
||||
name="Adempiere Swing Client"
|
||||
|
@ -20,12 +10,6 @@
|
|||
<run class="org.adempiere.client.Application" />
|
||||
</application>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.compiere.print.ReportViewerProvider">
|
||||
<provider
|
||||
class="org.compiere.print.SwingViewerProvider">
|
||||
</provider>
|
||||
</extension>
|
||||
<extension
|
||||
id="client_product"
|
||||
point="org.eclipse.core.runtime.products">
|
||||
|
@ -38,23 +22,5 @@
|
|||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.swing" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.swing" id="org.adempiere.osgi.IEditorFactory" name="Field editor factory"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value, higher value is of higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.adempiere.osgi.IEditorFactory
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.osgi.IEditorFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.ui.swing.factory.IEditorFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The default implementation at the or.adempiere.ui.swing bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,140 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.swing" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.swing" id="org.adempiere.osgi.IInfoFactory" name="Info Factory extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value. bigger number have higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.adempiere.osgi.IInfoFactory interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.osgi.IInfoFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.ui.swing.factory.IInfoFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The default implementation at the org.adempiere.ui.swing bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -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<IFormFactory> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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<String, IGridTabExporter>();
|
||||
extensionMap = new HashMap<String, String>();
|
||||
List<IGridTabExporter> exporterList = Service.locator().list(IGridTabExporter.class).getServices();
|
||||
List<IGridTabExporter> exporterList = EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions();
|
||||
for(IGridTabExporter exporter : exporterList)
|
||||
{
|
||||
String extension = exporter.getFileExtension();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.ui.zk.form.factory.default">
|
||||
<implementation class="org.adempiere.webui.factory.DefaultFormFactory"/>
|
||||
<service>
|
||||
<provide interface="org.adempiere.webui.factory.IFormFactory"/>
|
||||
</service>
|
||||
</scr:component>
|
|
@ -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<IFormFactory> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.<classname>"
|
||||
*/
|
||||
final String zkPackage = "org.adempiere.webui.";
|
||||
/*
|
||||
* replacement string to translate custom form class name from
|
||||
* "V<name>" to "W<name>"
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -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<Event>
|
|||
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.<classname>"
|
||||
*/
|
||||
final String zkPackage = "org.adempiere.webui.";
|
||||
/*
|
||||
* replacement string to translate custom form class name from
|
||||
* "V<name>" to "W<name>"
|
||||
*/
|
||||
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<Event>
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -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<Event>
|
|||
{
|
||||
exporterMap = new HashMap<String, IGridTabExporter>();
|
||||
extensionMap = new HashMap<String, String>();
|
||||
List<IGridTabExporter> exporterList = Service.locator().list(IGridTabExporter.class).getServices();
|
||||
List<IGridTabExporter> exporterList = EquinoxExtensionLocator.instance().list(IGridTabExporter.class).getExtensions();
|
||||
for(IGridTabExporter exporter : exporterList)
|
||||
{
|
||||
String extension = exporter.getFileExtension();
|
||||
|
|
|
@ -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<Event>
|
|||
|
||||
importerMap = new HashMap<String, IGridTabImporter>();
|
||||
extensionMap = new HashMap<String, String>();
|
||||
List<IGridTabImporter> importerList = Service.locator().list(IGridTabImporter.class).getServices();
|
||||
List<IGridTabImporter> importerList = EquinoxExtensionLocator.instance().list(IGridTabImporter.class).getExtensions();
|
||||
for(IGridTabImporter importer : importerList)
|
||||
{
|
||||
String extension = importer.getFileExtension();
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -2,7 +2,5 @@
|
|||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.adempiere.webui.Form" name="Web Form" schema="schema/org.adempiere.webui.Form.exsd"/>
|
||||
<extension-point id="org.adempiere.webui.factory.IInfoFactory" name="Info Factory extension" schema="schema/org.adempiere.webui.factory.IInfoFactory.exsd"/>
|
||||
<extension-point id="org.adempiere.webui.factory.IEditorFactory" name="Field editor factory" schema="schema/org.adempiere.webui.factory.IEditorFactory.exsd"/>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.zk" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.zk" id="org.adempiere.webui.factory.IEditorFactory" name="Field editor factory"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value, higher value is of higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.adempiere.webui.factory.IEditorFactory interface.
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.webui.factory.IEditorFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.webui.factory.IEditorFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The default implementation at the org.adempiere.ui.zk bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.zk" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.zk" id="org.adempiere.webui.factory.IInfoFactory" name="Info Factory extension"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="factory"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="factory">
|
||||
<complexType>
|
||||
<attribute name="priority" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
numeric priority value. bigger number have higher priority.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name for the org.adempiere.webui.factory.IInfoFactory interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.adempiere.webui.factory.IInfoFactory"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<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>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.adempiere.webui.factory.IInfoFactory
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The default implementation at the org.adempiere.ui.zk bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -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/
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
<extension-point id="org.compiere.print.ReportViewerProvider" name="Report Viewer Provider" schema="schema/org.compiere.print.ReportViewerProvider.exsd"/>
|
||||
|
||||
</plugin>
|
|
@ -1,131 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.adempiere.ui.base" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.adempiere.ui.base" id="org.compiere.print.ReportViewerProvider" name="Report Viewer Provider"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
Extension point to provide report viewer implementation for the build in adempiere report engine.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<choice>
|
||||
<element ref="provider"/>
|
||||
</choice>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="provider">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
Implementation class name of the org.compiere.print.ReportViewerProvider interface
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.compiere.print.ReportViewerProvider"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
1.0.0
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
<pre>
|
||||
<extension
|
||||
point="org.compiere.print.ReportViewerProvider">
|
||||
<provider
|
||||
class="org.adempiere.webui.window.ZkReportViewerProvider">
|
||||
</provider>
|
||||
</extension>
|
||||
</pre>
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
The class attribute must represent an implementor of org.compiere.print.ReportViewerProvider
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
org.adempiere.ui.swing and org.adempiere.ui.zk bundle
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="copyright"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
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.
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
</schema>
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue