Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2009-11-11 20:30:28 +0000
committerkmoore2009-11-11 20:30:28 +0000
commitb4d6cd800e2a2eb4186e3139c850d115947d123a (patch)
tree6ddf873956eaf32f05f053a4020206ef9b28071d /jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal
parentebecd172771c606d1e2f8aa81cf0acdc40675e3b (diff)
downloadwebtools.dali-b4d6cd800e2a2eb4186e3139c850d115947d123a.tar.gz
webtools.dali-b4d6cd800e2a2eb4186e3139c850d115947d123a.tar.xz
webtools.dali-b4d6cd800e2a2eb4186e3139c850d115947d123a.zip
294899 - refactoring in an effort to support default Cacheable again
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/GenericPersistenceUnit2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java124
5 files changed, 262 insertions, 5 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
index ed5009247a..64b67b65b2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
@@ -9,8 +9,21 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.persistence;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.NullConnection2_0;
+import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.NullOptions2_0;
+
public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
{
+ public PersistenceUnitProperties buildConnection(PersistenceUnit parent) {
+ return new NullConnection2_0(parent);
+ }
+
+ public PersistenceUnitProperties buildOptions(PersistenceUnit parent) {
+ return new NullOptions2_0(parent);
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
index cc8c4f15e8..c7f3fa3430 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
@@ -10,17 +10,29 @@
package org.eclipse.jpt.core.internal.jpa2.context.persistence;
import org.eclipse.jpt.core.context.persistence.Persistence;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory;
+import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.GenericConnection2_0;
+import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.GenericOptions2_0;
import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
+import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
{
-
@Override
public PersistenceUnit2_0 buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
return new GenericPersistenceUnit2_0(parent, xmlPersistenceUnit);
}
+
+ public JpaConnection2_0 buildConnection(PersistenceUnit parent) {
+ return new GenericConnection2_0(parent);
+ }
+
+ public JpaOptions2_0 buildOptions(PersistenceUnit parent) {
+ return new GenericOptions2_0(parent);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/GenericPersistenceUnit2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/GenericPersistenceUnit2_0.java
index a9fcd6e415..43067c2630 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/GenericPersistenceUnit2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/GenericPersistenceUnit2_0.java
@@ -11,8 +11,6 @@ package org.eclipse.jpt.core.internal.jpa2.context.persistence;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.GenericConnection2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.GenericOptions2_0;
import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
@@ -69,8 +67,8 @@ public class GenericPersistenceUnit2_0
protected void initializeProperties() {
super.initializeProperties();
- this.connection = new GenericConnection2_0(this);
- this.options = new GenericOptions2_0(this);
+ this.connection = (JpaConnection2_0) getContextNodeFactory().buildConnection(this);
+ this.options = (JpaOptions2_0) getContextNodeFactory().buildOptions(this);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
new file mode 100644
index 0000000000..2e7130f1d7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.context.persistence.connection;
+
+import java.util.Map;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
+import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
+
+/**
+ * GenericConnection2_0
+ */
+public class NullConnection2_0 extends AbstractPersistenceUnitProperties
+ implements JpaConnection2_0
+{
+
+
+ // ********** constructors **********
+ public NullConnection2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ //do nothing
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ //do nothing
+ }
+
+ public void propertyRemoved(String propertyName) {
+ //do nothing
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = PU property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ //do nothing
+ }
+
+ // ********** Driver **********
+ public String getDriver() {
+ return null;
+ }
+
+ public void setDriver(String newDriver) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultDriver() {
+ return DEFAULT_JDBC_DRIVER;
+ }
+
+ // ********** URL **********
+ public String getUrl() {
+ return null;
+ }
+
+ public void setUrl(String newUrl) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultUrl() {
+ return DEFAULT_JDBC_URL;
+ }
+
+ // ********** User **********
+ public String getUser() {
+ return null;
+ }
+
+ public void setUser(String newUser) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultUser() {
+ return DEFAULT_JDBC_USER;
+ }
+
+ // ********** Password **********
+ public String getPassword() {
+ return null;
+ }
+
+ public void setPassword(String newPassword) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultPassword() {
+ return DEFAULT_JDBC_PASSWORD;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
new file mode 100644
index 0000000000..a09768382a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+* Copyright (c) 2009 Oracle. All rights reserved.
+* This program and the accompanying materials are made available under the
+* terms of the Eclipse Public License v1.0, which accompanies this distribution
+* and is available at http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.context.persistence.options;
+
+import java.util.Map;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
+import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
+
+/**
+ * JPA 2.0 options
+ */
+public class NullOptions2_0 extends AbstractPersistenceUnitProperties
+ implements JpaOptions2_0
+{
+
+
+ // ********** constructors **********
+ public NullOptions2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ //do nothing
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ //do nothing
+ }
+
+ public void propertyRemoved(String propertyName) {
+ //do nothing
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = PU property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ //do nothing
+ }
+
+ // ********** LockTimeout **********
+ public Integer getLockTimeout() {
+ return null;
+ }
+
+ public void setLockTimeout(Integer newLockTimeout) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Integer getDefaultLockTimeout() {
+ return DEFAULT_LOCK_TIMEOUT;
+ }
+
+ // ********** QueryTimeout **********
+ public Integer getQueryTimeout() {
+ return null;
+ }
+
+ public void setQueryTimeout(Integer newQueryTimeout) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Integer getDefaultQueryTimeout() {
+ return DEFAULT_QUERY_TIMEOUT;
+ }
+
+
+ // ********** ValidationGroupPrePersist **********
+ public String getValidationGroupPrePersist() {
+ return null;
+ }
+
+ public void setValidationGroupPrePersist(String newValidationGroupPrePersist) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultValidationGroupPrePersist() {
+ return DEFAULT_VALIDATION_GROUP_PRE_PERSIST;
+ }
+
+ // ********** ValidationGroupPreUpdate **********
+ public String getValidationGroupPreUpdate() {
+ return null;
+ }
+
+ public void setValidationGroupPreUpdate(String newValidationGroupPreUpdate) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultValidationGroupPreUpdate() {
+ return DEFAULT_VALIDATION_GROUP_PRE_UPDATE;
+ }
+
+ // ********** ValidationGroupPreRemove **********
+ public String getValidationGroupPreRemove() {
+ return null;
+ }
+
+ public void setValidationGroupPreRemove(String newValidationGroupPreRemove) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getDefaultValidationGroupPreRemove() {
+ return DEFAULT_VALIDATION_GROUP_PRE_REMOVE;
+ }
+}

Back to the top