IDEMPIERE-359 Add OSGi Service support for existing extension point. Move more core services to OSGi service.

This commit is contained in:
Heng Sin Low 2012-11-08 17:36:50 +08:00
parent fbede0b32c
commit d4e9ae0656
21 changed files with 71 additions and 56 deletions

View File

@ -289,6 +289,6 @@ Import-Package: com.sun.mail.auth;version="1.4.5",
Eclipse-BuddyPolicy: registered Eclipse-BuddyPolicy: registered
Eclipse-ExtensibleAPI: true Eclipse-ExtensibleAPI: true
Bundle-Activator: org.adempiere.base.BaseActivator 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 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
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.equinox.app;bundle-version="1.3.1" Require-Bundle: org.eclipse.equinox.app;bundle-version="1.3.1"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.adempiere.base.doc.factory">
<implementation class="org.adempiere.base.DefaultDocumentFactory"/>
<service>
<provide interface="org.adempiere.base.IDocFactory"/>
</service>
<property name="gaap" type="String" value="*"/>
</scr:component>

View File

@ -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.model.factory">
<implementation class="org.adempiere.base.DefaultModelFactory"/>
<service>
<provide interface="org.adempiere.base.IModelFactory"/>
</service>
</scr:component>

View File

@ -20,7 +20,9 @@ bin.includes = META-INF/,\
OSGI-INF/dslocator.xml,\ OSGI-INF/dslocator.xml,\
OSGI-INF/extensionlocator.xml,\ OSGI-INF/extensionlocator.xml,\
OSGI-INF/serverbean.xml,\ OSGI-INF/serverbean.xml,\
OSGI-INF/statusbean.xml OSGI-INF/statusbean.xml,\
OSGI-INF/defaultmodelfactory.xml,\
OSGI-INF/defaultdocfactory.xml
output.base.jar = build/ output.base.jar = build/
src.includes = schema/ src.includes = schema/
source.base.jar = src/ source.base.jar = src/

View File

@ -15,25 +15,6 @@
<extension-point id="org.adempiere.base.IGridTabImporter" name="Grid data import extension" schema="schema/org.adempiere.base.IGridTabImporter.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"/> <extension-point id="org.compiere.model.PaymentProcessor" name="Payment Processor" schema="schema/org.compiere.model.PaymentProcessor.exsd"/>
<extension-point id="org.compiere.model.Callout" name="Callout" schema="schema/org.compiere.model.Callout.exsd"/> <extension-point id="org.compiere.model.Callout" name="Callout" schema="schema/org.compiere.model.Callout.exsd"/>
<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>
<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>
<extension <extension
id="org.adempiere.impexp.GridTabXlsExporter" id="org.adempiere.impexp.GridTabXlsExporter"
name="Grid data excel exporter" name="Grid data excel exporter"

View File

@ -22,8 +22,6 @@ import java.util.List;
import org.adempiere.base.Service; import org.adempiere.base.Service;
import org.adempiere.base.ServiceQuery; import org.adempiere.base.ServiceQuery;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
/** /**
* General Database Constants and Utilities * General Database Constants and Utilities
@ -67,14 +65,11 @@ public class Database
public static String[] getDatabaseNames() public static String[] getDatabaseNames()
{ {
List<String> names = new ArrayList<String>(); List<String> names = new ArrayList<String>();
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(AdempiereDatabase.class.getName()); List<AdempiereDatabase> services = Service.locator().list(AdempiereDatabase.class).getServices();
for(IConfigurationElement element : elements) for (AdempiereDatabase db : services) {
{ names.add(db.getName());
String type = element.getAttribute("id");
names.add(type);
} }
String[] nameArray = names.toArray(new String[0]); return names.toArray(new String[0]);
return nameArray;
} }
/** /**

View File

@ -20,6 +20,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.pde.PluginNature</nature>

View File

@ -9,3 +9,4 @@ Require-Bundle: org.adempiere.server;bundle-version="1.0.0",
org.adempiere.base;bundle-version="1.0.0" org.adempiere.base;bundle-version="1.0.0"
Import-Package: javax.jms;version="1.1.0", Import-Package: javax.jms;version="1.1.0",
org.apache.activemq org.apache.activemq
Service-Component: OSGI-INF/serverfactory.xml

View File

@ -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.replication.server.factory">
<implementation class="org.adempiere.server.rpl.imp.ReplicationServerFactory"/>
<service>
<provide interface="org.adempiere.server.IServerFactory"/>
</service>
</scr:component>

View File

@ -1,5 +1,6 @@
source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
plugin.xml plugin.xml,\
OSGI-INF/serverfactory.xml
source.. = src/

View File

@ -1,11 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?> <?eclipse version="3.4"?>
<plugin> <plugin>
<extension
point="org.adempiere.server.IServerFactory">
<factory
class="org.adempiere.server.rpl.imp.ReplicationServerFactory">
</factory>
</extension>
</plugin> </plugin>

View File

@ -20,6 +20,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.pde.PluginNature</nature>

View File

@ -13,4 +13,5 @@ Bundle-ClassPath: .,
Import-Package: org.osgi.framework Import-Package: org.osgi.framework
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-Activator: org.adempiere.db.oracle.OracleBundleActivator Bundle-Activator: org.adempiere.db.oracle.OracleBundleActivator
Service-Component: OSGI-INF/oracleprovider.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.db.oracle.provider">
<implementation class="org.compiere.db.DB_Oracle"/>
<service>
<provide interface="org.compiere.db.AdempiereDatabase"/>
</service>
<property name="id" type="String" value="Oracle"/>
</scr:component>

View File

@ -1,9 +1,9 @@
source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
plugin.xml,\ plugin.xml,\
ojdbc6.jar,\ ojdbc6.jar,\
c3p0-0.9.1.2.jar,\ c3p0-0.9.1.2.jar,\
c3p0-oracle-thin-extras-0.9.1.2.jar c3p0-oracle-thin-extras-0.9.1.2.jar,\
OSGI-INF/oracleprovider.xml
source.. = src/ source.. = src/

View File

@ -1,13 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?> <?eclipse version="3.4"?>
<plugin> <plugin>
<extension
point="org.compiere.db.AdempiereDatabase">
<database
class="org.compiere.db.DB_Oracle"
id="Oracle">
</database>
</extension>
<extension <extension
id="org.adempiere.db.config.ConfigOracle" id="org.adempiere.db.config.ConfigOracle"
name="Oracle Database Configuration" name="Oracle Database Configuration"

View File

@ -20,6 +20,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.pde.PluginNature</nature>

View File

@ -14,3 +14,4 @@ Import-Package: junit.framework;version="3.8.2",
org.osgi.framework org.osgi.framework
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-Activator: org.adempiere.db.postgresql.PostgreSQLBundleActivator Bundle-Activator: org.adempiere.db.postgresql.PostgreSQLBundleActivator
Service-Component: OSGI-INF/pgprovider.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.db.postgresql.provider">
<implementation class="org.compiere.db.DB_PostgreSQL"/>
<service>
<provide interface="org.compiere.db.AdempiereDatabase"/>
</service>
<property name="id" type="String" value="PostgreSQL"/>
</scr:component>

View File

@ -1,8 +1,8 @@
source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
postgresql.jar,\ postgresql.jar,\
plugin.xml,\ plugin.xml,\
c3p0-0.9.1.2.jar c3p0-0.9.1.2.jar,\
OSGI-INF/pgprovider.xml
source.. = src/ source.. = src/

View File

@ -1,13 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?> <?eclipse version="3.4"?>
<plugin> <plugin>
<extension
point="org.compiere.db.AdempiereDatabase">
<database
class="org.compiere.db.DB_PostgreSQL"
id="PostgreSQL">
</database>
</extension>
<extension <extension
id="org.adempiere.db.postgresql.config.ConfigPostgreSQL" id="org.adempiere.db.postgresql.config.ConfigPostgreSQL"
name="PostgreSQL Database Configuration" name="PostgreSQL Database Configuration"