You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2006/11/05 22:21:25 UTC

svn commit: r471534 - /incubator/tuscany/java/sca/services/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitMetadata.java

Author: meerajk
Date: Sun Nov  5 13:21:24 2006
New Revision: 471534

URL: http://svn.apache.org/viewvc?view=rev&rev=471534
Log:
Added implementation code.

Modified:
    incubator/tuscany/java/sca/services/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitMetadata.java

Modified: incubator/tuscany/java/sca/services/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitMetadata.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitMetadata.java?view=diff&rev=471534&r1=471533&r2=471534
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitMetadata.java (original)
+++ incubator/tuscany/java/sca/services/persistence/common/src/main/java/org/apache/tuscany/service/persistence/common/PersistenceUnitMetadata.java Sun Nov  5 13:21:24 2006
@@ -18,10 +18,216 @@
  */
 package org.apache.tuscany.service.persistence.common;
 
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+import javax.persistence.spi.ClassTransformer;
+import javax.persistence.spi.PersistenceUnitInfo;
+import javax.persistence.spi.PersistenceUnitTransactionType;
+import javax.sql.DataSource;
+
 /**
  * Encpasulates the information in the persistence.xml file.
  *
  */
-class PersistenceUnitMetadata {
+class PersistenceUnitMetadata implements PersistenceUnitInfo {
+
+    /**
+     * Transaction type.
+     */
+    private PersistenceUnitTransactionType transactionType;
+    
+    /**
+     * Configuration properties.
+     */
+    private Properties properties;
+    
+    /**
+     * Root JAT URL.
+     */
+    private URL rootUrl;
+    
+    /**
+     * Persistence unit name.
+     */
+    private String unitName;
+    
+    /**
+     * Persistence provider class.
+     */
+    private String providerClass;
+    
+    /**
+     * Non JTA Datasource.
+     */
+    private DataSource nonJtaDataSource;
+    
+    /**
+     * Temporary classloader.
+     */
+    private ClassLoader tempClassLoader;
+    
+    /**
+     * Mapped file names.
+     */
+    private List<String> mappingFileNames;
+    
+    /**
+     * Mapped persistent classes.
+     */
+    private List<String> managedClassNames;
+    
+    /**
+     * JTA datasource.
+     */
+    private DataSource jtaDataSource;
+    
+    /**
+     * JAR file URLs.
+     */
+    private List<URL> jarFileUrls;
+    
+    /**
+     * Classloader.
+     */
+    private ClassLoader classLoader;
+    
+    /**
+     * Whether unlisted classes in the DD are exluded.
+     */
+    private boolean unlistedClassesExcluded;
+
+    
+    /**
+     * Initializes the properties.
+     * 
+     * @param transactionType Transaction type.
+     * @param properties Configuration properties.
+     * @param rootUrl Root JAT URL.
+     * @param unitName Persistence unit name.
+     * @param providerClass Persistence provider class.
+     * @param nonJtaDataSource Non JTA Datasource.
+     * @param tempClassLoader Temporary classloader.
+     * @param mappingFileNames Mapped file names.
+     * @param managedClassNames Mapped persistent classes.
+     * @param jtaDataSource JTA datasource.
+     * @param jarFileUrls JAR file URLs.
+     * @param classLoader Classloader.
+     * @param unlistedClassesExcluded Whether unlisted classes in the DD are exluded.
+     */
+    public PersistenceUnitMetadata(PersistenceUnitTransactionType transactionType, Properties properties, URL rootUrl, String unitName, String providerClass, DataSource nonJtaDataSource, ClassLoader tempClassLoader, List<String> mappingFileNames, List<String> managedClassNames, DataSource jtaDataSource, List<URL> jarFileUrls, ClassLoader classLoader, boolean unlistedClassesExcluded) {
+        super();
+        this.transactionType = transactionType;
+        this.properties = properties;
+        this.rootUrl = rootUrl;
+        this.unitName = unitName;
+        this.providerClass = providerClass;
+        this.nonJtaDataSource = nonJtaDataSource;
+        this.tempClassLoader = tempClassLoader;
+        this.mappingFileNames = mappingFileNames;
+        this.managedClassNames = managedClassNames;
+        this.jtaDataSource = jtaDataSource;
+        this.jarFileUrls = jarFileUrls;
+        this.classLoader = classLoader;
+        this.unlistedClassesExcluded = unlistedClassesExcluded;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#addTransformer(javax.persistence.spi.ClassTransformer)
+     */
+    public void addTransformer(ClassTransformer classTransformer) {
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#excludeUnlistedClasses()
+     */
+    public boolean excludeUnlistedClasses() {
+        return unlistedClassesExcluded;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getClassLoader()
+     */
+    public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getJarFileUrls()
+     */
+    public List<URL> getJarFileUrls() {
+        return jarFileUrls;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getJtaDataSource()
+     */
+    public DataSource getJtaDataSource() {
+        return jtaDataSource;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getManagedClassNames()
+     */
+    public List<String> getManagedClassNames() {
+        return managedClassNames;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getMappingFileNames()
+     */
+    public List<String> getMappingFileNames() {
+        return mappingFileNames;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()
+     */
+    public ClassLoader getNewTempClassLoader() {
+        return tempClassLoader;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getNonJtaDataSource()
+     */
+    public DataSource getNonJtaDataSource() {
+        return nonJtaDataSource;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceProviderClassName()
+     */
+    public String getPersistenceProviderClassName() {
+        return providerClass;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()
+     */
+    public String getPersistenceUnitName() {
+        return unitName;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getPersistenceUnitRootUrl()
+     */
+    public URL getPersistenceUnitRootUrl() {
+        return rootUrl;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getProperties()
+     */
+    public Properties getProperties() {
+        return properties;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.persistence.spi.PersistenceUnitInfo#getTransactionType()
+     */
+    public PersistenceUnitTransactionType getTransactionType() {
+        return transactionType;
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org