exclude-unlisted-classes=false in Equinox OSGI [message #554770] |
Tue, 24 August 2010 11:39 |
Filipp A. Messages: 49 Registered: February 2010 |
Member |
|
|
Hi All!
I trying to get exclude-unlisted-classes to work in equinox, but no luck.....
please have a look to my simple osgi-plugins: test.eclipselink and test.eclipselink.data (code see below)
did i something forget?
any Ideas?
Thanks in advance!!
My Environment is:
Eclipselink 2.1
Eclipse Helios
Java: Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
Plugin test.eclipselink
|-src
| |-test.eclipselink
| |-AbstractDaoActivator.java
| |-Activator.java
|-META-INF
| |-MANIFEST.MF
AbstractDaoActivator.java
package test.eclipselink;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceUnitTransactionType;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.eclipse.persistence.jpa.osgi.PersistenceProvider;
import org.osgi.framework.BundleActivator;
abstract public class AbstractDaoActivator implements BundleActivator {
private static AbstractDaoActivator plugin;
private static EntityManagerFactory entityManagerFactory;
private static EntityManager entityManager;
private ClassLoader modelClassLoader;
private String persistenceUnitName;
public AbstractDaoActivator(ClassLoader modelClassLoader, String persistenceUnitName){
plugin = this;
this.modelClassLoader = modelClassLoader;
this.persistenceUnitName = persistenceUnitName;
}
public static AbstractDaoActivator getDefault(){
return plugin;
}
protected void connect(){
initEntityManager();
}
public EntityManager getEntityManager(){
return entityManager;
}
protected void disconnect(){
if (entityManagerFactory != null){
entityManagerFactory.close();
}
}
private void initEntityManager() {
if (entityManager == null) {
entityManagerFactory = new PersistenceProvider().createEntityManagerFactory(persistenceUnitName, getEntityManagerProperties());
entityManager = entityManagerFactory.createEntityManager();
}
}
protected Map<String, Object> getEntityManagerProperties(){
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("javax.persistence.transactionType", PersistenceUnitTransactionType.RESOURCE_LOCAL.name());
// properties.put("eclipselink.target-database", TargetDatabase.MySQL);
properties.put("javax.persistence.jdbc.driver", "org.gjt.mm.mysql.Driver");
properties.put("javax.persistence.jdbc.url", "jdbc:mysql://127.0.0.1/test");
properties.put("javax.persistence.jdbc.user", "test");
properties.put("javax.persistence.jdbc.password", "test");
// properties.put("eclipselink.ddl-generation", "drop-and-create-tables");
properties.put("eclipselink.ddl-generation", "create-tables");
properties.put("eclipselink.ddl-generation.output-mode", "database");
properties.put("eclipselink.jdbc.read-connections.min", "1");
properties.put("eclipselink.jdbc.write-connections.min", "1");
// properties.put("eclipselink.cache.shared.default", "true");
// properties.put("eclipselink.jdbc.batch-writing", "JDBC");
// ClassLoader
properties.put(PersistenceUnitProperties.CLASSLOADER, this.modelClassLoader);
// Logging
properties.put("eclipselink.logging.level", "FINE"); // OFF
properties.put("eclipselink.logging.timestamp", "false");
properties.put("eclipselink.logging.session", "false");
properties.put("eclipselink.logging.thread", "false");
properties.put("eclipselink.weaving", "true");
return properties;
}
}
Activator.java
package test.eclipselink;
import org.osgi.framework.BundleContext;
import test.eclipselink.data.Data1;
public class Activator extends AbstractDaoActivator {
public Activator() {
super(Data1.class.getClassLoader(), "test.eclipselink.data");
}
private static BundleContext context;
static BundleContext getContext() {
return context;
}
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
connect();
}
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipselink
Bundle-SymbolicName: test.eclipselink
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: test.eclipselink.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0"
Require-Bundle: javax.persistence;bundle-version="2.0.1",
org.eclipse.persistence.jpa;bundle-version="2.1.0",
test.eclipselink.data;bundle-version="1.0.0"
Bundle-ClassPath: .
Plugin test.eclipselink.data
|-src
| |-test.eclipselink.data
| |-Data1.java
| |-Data2.java
| |-META-INF
| | |-MANIFEST.MF (empty)
| | |-persistence.xml
|-META-INF
| |-MANIFEST.MF
Data1.java
package test.eclipselink.data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="Data1")
public class Data1 {
@Id
private long id;
public long getId() { return id; }
public void setId(long id) { this.id = id; }
}
Data2.java
package test.eclipselink.data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="Data2")
public class Data2 {
@Id
private long id;
public long getId() { return id; }
public void setId(long id) { this.id = id; }
}
src/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path:
src/META-INF/persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="test.eclipselink.data">
<class>test.eclipselink.data.Data1</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
</persistence-unit>
</persistence>
MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Data
Bundle-SymbolicName: test.eclipselink.data
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: javax.persistence;bundle-version="2.0.1"
Export-Package: test.eclipselink.data
Bundle-ClassPath: mysql-connector-java-5.1.10-bin.jar,
.
JPA-PersistenceUnits: test.eclipselink.data
OSGI Bundles
javax.persistence : Start Level 1
org.eclipse.persistence.jpa : Start Level 2
Framework : Equinox
Default Start Level : 6
Default Auto-Start : true
OSGI Run Configuration VM arguments
-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dosgi.framework.extensions=org.eclipse.persistence.jpa.equinox.weaving
Console: (only Data1 is mapped.... )
osgi> [EL Config]: The access type for the persistent class [class test.eclipselink.data.Data1] is set to [FIELD].
[EL Config]: The alias name for the entity class [class test.eclipselink.data.Data1] is being defaulted to: Data1.
[EL Config]: The column name for element [field id] is being defaulted to: ID.
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.1.0.v20100614-r7608
[EL Fine]: Detected Vendor platform: org.eclipse.persistence.platform.database.MySQLPlatform
[EL Config]: Connection(27890503)--connecting(DatabaseLogin(
platform=>MySQLPlatform
user name=> "test"
datasource URL=> "jdbc:mysql://127.0.0.1/test"
))
[EL Config]: Connection(20348456)--Connected: jdbc:mysql://127.0.0.1/test
User: test@localhost
Database: MySQL Version: 5.1.41-3ubuntu12.6
Driver: MySQL-AB JDBC Driver Version: mysql-connector-java-5.1.10 ( Revision: ${svn.Revision} )
[EL Config]: Connection(9744175)--connecting(DatabaseLogin(
platform=>MySQLPlatform
user name=> "test"
datasource URL=> "jdbc:mysql://127.0.0.1/test"
))
[EL Config]: Connection(11001145)--Connected: jdbc:mysql://127.0.0.1/test
User: test@localhost
Database: MySQL Version: 5.1.41-3ubuntu12.6
Driver: MySQL-AB JDBC Driver Version: mysql-connector-java-5.1.10 ( Revision: ${svn.Revision} )
[EL Info]: test.eclipselink.data_transactionType=RESOURCE_LOCAL_url=jdbc:mysql://127.0.0.1/test_user=test login successful
[EL Fine]: Connection(20348456)--CREATE TABLE Data1 (ID BIGINT NOT NULL, PRIMARY KEY (ID))
ss
ss
Framework is launched.
id State Bundle
0 ACTIVE org.eclipse.osgi_3.6.0.v20100517
Fragments=3, 16
1 ACTIVE org.eclipse.persistence.jpa_2.1.0.v20100614-r7608
Fragments=10, 13
2 ACTIVE javax.mail.glassfish_1.4.1.v201005082020
3 RESOLVED javax.transaction_1.1.1.v201006150915
Master=0
5 ACTIVE org.apache.ant_1.7.1.v20100518-1145
7 ACTIVE javax.resource_1.5.0.v200906010428
8 ACTIVE javax.xml.stream_1.0.1.v201004272200
9 ACTIVE org.eclipse.persistence.core_2.1.0.v20100614-r7608
Fragments=15
10 RESOLVED org.eclipse.persistence.jpa.osgi_2.1.0.v20100614-r7608
Master=1
11 ACTIVE javax.xml_1.3.4.v201005080400
12 ACTIVE javax.persistence_2.0.1.v201006031150
13 RESOLVED org.eclipse.persistence.jpa.equinox_2.1.0.v20100614-r7608
Master=1
14 ACTIVE org.eclipse.persistence.asm_2.1.0.v20100614-r7608
15 RESOLVED org.eclipse.persistence.oracle_2.1.0.v20100614-r7608
Master=9
16 RESOLVED org.eclipse.persistence.jpa.equinox.weaving_2.1.0.v20100614-r7608
Master=0
17 ACTIVE javax.activation_1.1.0.v201005080500
18 ACTIVE javax.jms_1.1.0.v200906010428
19 ACTIVE org.eclipse.persistence.antlr_2.1.0.v20100614-r7608
21 ACTIVE test.eclipselink_1.0.0.qualifier
22 ACTIVE test.eclipselink.data_1.0.0.qualifier
osgi>
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03131 seconds