diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options')
4 files changed, 0 insertions, 549 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/EclipseLinkOptions.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/EclipseLinkOptions.java deleted file mode 100644 index d8b8aedda8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/EclipseLinkOptions.java +++ /dev/null @@ -1,359 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.core.internal.context.options; - -import java.util.Map; - -import org.eclipse.jpt.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.core.context.persistence.Property; -import org.eclipse.jpt.eclipselink.core.internal.context.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.value.ListValueModel; - -/** - * EclipseLinkOptions - */ -public class EclipseLinkOptions extends EclipseLinkPersistenceUnitProperties - implements Options -{ - // ********** EclipseLink properties ********** - private String sessionName; - private String sessionsXml; - private Boolean includeDescriptorQueries; - private String targetDatabase; // storing EclipseLinkStringValue since value can be TargetDatabase or custom class - private String targetServer; // storing EclipseLinkStringValue since value can be TargetServer or custom class - private String eventListener; - - - // ********** constructors ********** - public EclipseLinkOptions(PersistenceUnit parent, ListValueModel<Property> propertyListAdapter) { - super(parent, propertyListAdapter); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - // TOREVIEW - handle incorrect String in persistence.xml - this.sessionName = - this.getStringValue(ECLIPSELINK_SESSION_NAME); - this.sessionsXml = - this.getStringValue(ECLIPSELINK_SESSIONS_XML); - this.includeDescriptorQueries = - this.getBooleanValue(ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES); - this.targetDatabase = this.getTargetDatabaseFromPersistenceXml(); - this.targetServer = this.getTargetServerFromPersistenceXml(); - this.eventListener = - this.getStringValue(ECLIPSELINK_SESSION_EVENT_LISTENER); - } - - protected String getTargetDatabaseFromPersistenceXml() { - - TargetDatabase standardTargetDatabase = this.getEnumValue(ECLIPSELINK_TARGET_DATABASE, TargetDatabase.values()); - if( ! this.persistenceUnit().containsProperty(ECLIPSELINK_TARGET_DATABASE)) { - return(null); - } - else if(standardTargetDatabase == null) { - return(this.getStringValue(ECLIPSELINK_TARGET_DATABASE)); // custom targetDatabase - } - else { - return(getEclipseLinkStringValueOf(standardTargetDatabase)); - } - } - - protected String getTargetServerFromPersistenceXml() { - - TargetServer standardTargetServer = this.getEnumValue(ECLIPSELINK_TARGET_SERVER, TargetServer.values()); - if( ! this.persistenceUnit().containsProperty(ECLIPSELINK_TARGET_SERVER)) { - return(null); - } - else if(standardTargetServer == null) { - return(this.getStringValue(ECLIPSELINK_TARGET_SERVER)); // custom targetServer - } - else { - return(getEclipseLinkStringValueOf(standardTargetServer)); - } - } - - // ********** behavior ********** - /** - * Adds property names key/value pairs, where: - * key = EclipseLink property key - * value = property id - */ - @Override - protected void addPropertyNames(Map<String, String> propertyNames) { - propertyNames.put( - ECLIPSELINK_SESSION_NAME, - SESSION_NAME_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSIONS_XML, - SESSIONS_XML_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES, - SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_DATABASE, - TARGET_DATABASE_PROPERTY); - propertyNames.put( - ECLIPSELINK_TARGET_SERVER, - TARGET_SERVER_PROPERTY); - propertyNames.put( - ECLIPSELINK_SESSION_EVENT_LISTENER, - SESSION_EVENT_LISTENER_PROPERTY); - } - - public void propertyChanged(PropertyChangeEvent event) { - String aspectName = event.getAspectName(); - if (aspectName.equals(SESSION_NAME_PROPERTY)) { - this.sessionNameChanged(event); - } - else if (aspectName.equals(SESSIONS_XML_PROPERTY)) { - this.sessionsXmlChanged(event); - } - else if (aspectName.equals(TARGET_DATABASE_PROPERTY)) { - this.targetDatabaseChanged(event); - } - else if (aspectName.equals(TARGET_SERVER_PROPERTY)) { - this.targetServerChanged(event); - } - else if (aspectName.equals(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) { - this.includeDescriptorQueriesChanged(event); - } - else if (aspectName.equals(SESSION_EVENT_LISTENER_PROPERTY)) { - this.eventListenerChanged(event); - } - else { - throw new IllegalArgumentException("Illegal event received - property not applicable: " + aspectName); - } - return; - } - - // ********** SessionName ********** - public String getSessionName() { - return this.sessionName; - } - - public void setSessionName(String newSessionName) { - String old = this.sessionName; - this.sessionName = newSessionName; - this.putProperty(SESSION_NAME_PROPERTY, newSessionName); - this.firePropertyChanged(SESSION_NAME_PROPERTY, old, newSessionName); - } - - private void sessionNameChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.sessionName; - this.sessionName = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultSessionName() { - return DEFAULT_SESSION_NAME; - } - - // ********** SessionsXml ********** - public String getSessionsXml() { - return this.sessionsXml; - } - - public void setSessionsXml(String newSessionsXml) { - String old = this.sessionsXml; - this.sessionsXml = newSessionsXml; - this.putProperty(SESSIONS_XML_PROPERTY, newSessionsXml); - this.firePropertyChanged(SESSIONS_XML_PROPERTY, old, newSessionsXml); - } - - private void sessionsXmlChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.sessionsXml; - this.sessionsXml = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultSessionsXml() { - return DEFAULT_SESSIONS_XML; - } - - // ********** IncludeDescriptorQueries ********** - public Boolean getIncludeDescriptorQueries() { - return this.includeDescriptorQueries; - } - - public void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries) { - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newIncludeDescriptorQueries; - this.putProperty(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, newIncludeDescriptorQueries); - this.firePropertyChanged(SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY, old, newIncludeDescriptorQueries); - } - - private void includeDescriptorQueriesChanged(PropertyChangeEvent event) { - String stringValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - Boolean newValue = getBooleanValueOf(stringValue); - - Boolean old = this.includeDescriptorQueries; - this.includeDescriptorQueries = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public Boolean getDefaultIncludeDescriptorQueries() { - return DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES; - } - - // ********** TargetDatabase ********** - /** - * Returns TargetDatabase or custom targetDatabase class. - * - * @return EclipseLink string value for TargetDatabase enum or custom targetDatabase class - */ - public String getTargetDatabase() { - return this.targetDatabase; - } - - /** - * Sets EclipseLink targetDatabase. - * - * @param newTargetDatabase - TargetDatabase - */ - public void setTargetDatabase(TargetDatabase newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - this.setTargetDatabase_(getEclipseLinkStringValueOf(newTargetDatabase)); - } - - /** - * Sets EclipseLink targetDatabase or custom targetDatabase. - * - * @param newTargetDatabase - - * Can be a EclipseLink TargetDatabase literal or - * a fully qualified class name of a custom targetDatabase. - */ - public void setTargetDatabase(String newTargetDatabase) { - if( newTargetDatabase == null) { - this.setTargetDatabase_((String) null); - return; - } - TargetDatabase customTargetDatabase = TargetDatabase.getTargetDatabaseFor(newTargetDatabase); - if(customTargetDatabase == null) { // custom TargetDatabase class - this.setTargetDatabase_(newTargetDatabase); - } - else { - this.setTargetDatabase(customTargetDatabase); - } - } - - private void setTargetDatabase_(String newTargetDatabase) { - String old = this.targetDatabase; - this.targetDatabase = newTargetDatabase; - this.putProperty(TARGET_DATABASE_PROPERTY, newTargetDatabase); - this.firePropertyChanged(TARGET_DATABASE_PROPERTY, old, newTargetDatabase); - } - - private void targetDatabaseChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.targetDatabase; - this.targetDatabase = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultTargetDatabase() { - return DEFAULT_TARGET_DATABASE; - } - - // ********** TargetServer ********** - /** - * Returns TargetServer or custom targetServer class. - * - * @return EclipseLink string value for TargetServer enum or custom targetServer class - */ - public String getTargetServer() { - return this.targetServer; - } - - /** - * Sets EclipseLink targetServer. - * - * @param newTargetServer - TargetServer - */ - public void setTargetServer(TargetServer newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - this.setTargetServer_(getEclipseLinkStringValueOf(newTargetServer)); - } - - /** - * Sets EclipseLink targetServer or custom targetServer. - * - * @param newTargetServer - - * Can be a EclipseLink TargetServer literal or - * a fully qualified class name of a custom targetServer. - */ - public void setTargetServer(String newTargetServer) { - if( newTargetServer == null) { - this.setTargetServer_((String) null); - return; - } - TargetServer customTargetServer = TargetServer.getTargetServerFor(newTargetServer); - if(customTargetServer == null) { // custom TargetServer class - this.setTargetServer_(newTargetServer); - } - else { - this.setTargetServer(customTargetServer); - } - } - - private void setTargetServer_(String newTargetServer) { - String old = this.targetServer; - this.targetServer = newTargetServer; - this.putProperty(TARGET_SERVER_PROPERTY, newTargetServer); - this.firePropertyChanged(TARGET_SERVER_PROPERTY, old, newTargetServer); - } - - private void targetServerChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.targetServer; - this.targetServer = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultTargetServer() { - return DEFAULT_TARGET_SERVER; - } - - // ********** EventListener ********** - public String getEventListener() { - return this.eventListener; - } - - public void setEventListener(String newEventListener) { - String old = this.eventListener; - this.eventListener = newEventListener; - this.putProperty(SESSION_EVENT_LISTENER_PROPERTY, newEventListener); - this.firePropertyChanged(SESSION_EVENT_LISTENER_PROPERTY, old, newEventListener); - } - - private void eventListenerChanged(PropertyChangeEvent event) { - String newValue = (event.getNewValue() == null) ? null : ((Property) event.getNewValue()).getValue(); - String old = this.eventListener; - this.eventListener = newValue; - this.firePropertyChanged(event.getAspectName(), old, newValue); - } - - public String getDefaultEventListener() { - return DEFAULT_SESSION_EVENT_LISTENER; - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/Options.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/Options.java deleted file mode 100644 index 5ce81f2a08..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/Options.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.core.internal.context.options; - -import org.eclipse.jpt.eclipselink.core.internal.context.EclipseLinkPersistenceUnitProperties; -import org.eclipse.jpt.eclipselink.core.internal.context.PersistenceUnitProperties; - -/** - * Session Options - */ -public interface Options extends PersistenceUnitProperties -{ - String getDefaultSessionName(); - String getSessionName(); - void setSessionName(String newSessionName); - static final String SESSION_NAME_PROPERTY = "sessionNameProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_NAME = "eclipselink.session-name"; - static final String DEFAULT_SESSION_NAME = ""; // no default - - String getDefaultSessionsXml(); - String getSessionsXml(); - void setSessionsXml(String newSessionsXml); - static final String SESSIONS_XML_PROPERTY = "sessionsXmlProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSIONS_XML = "eclipselink.sessions-xml"; - static final String DEFAULT_SESSIONS_XML = ""; // no default - - Boolean getDefaultIncludeDescriptorQueries(); - Boolean getIncludeDescriptorQueries(); - void setIncludeDescriptorQueries(Boolean newIncludeDescriptorQueries); - static final String SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY = "includeDescriptorQueriesProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES = "eclipselink.session.include.descriptor.queries"; - static final Boolean DEFAULT_SESSION_INCLUDE_DESCRIPTOR_QUERIES = Boolean.TRUE; - - String getDefaultTargetDatabase(); - String getTargetDatabase(); - void setTargetDatabase(String newTargetDatabase); - void setTargetDatabase(TargetDatabase newTargetDatabase); - static final String TARGET_DATABASE_PROPERTY = "targetDatabaseProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TARGET_DATABASE = "eclipselink.target-database"; - static final String DEFAULT_TARGET_DATABASE = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(TargetDatabase.auto); - - String getDefaultTargetServer(); - String getTargetServer(); - void setTargetServer(String newTargetServer); - void setTargetServer(TargetServer newTargetServer); - static final String TARGET_SERVER_PROPERTY = "targetServerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_TARGET_SERVER = "eclipselink.target-server"; - static final String DEFAULT_TARGET_SERVER = - EclipseLinkPersistenceUnitProperties.getEclipseLinkStringValueOf(TargetServer.none); - - String getDefaultEventListener(); - String getEventListener(); - void setEventListener(String newEventListener); - static final String SESSION_EVENT_LISTENER_PROPERTY = "eventListenerProperty"; - // EclipseLink key string - static final String ECLIPSELINK_SESSION_EVENT_LISTENER = "eclipselink.session-event-listener"; - static final String DEFAULT_SESSION_EVENT_LISTENER = null; // no default - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/TargetDatabase.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/TargetDatabase.java deleted file mode 100644 index e15010c3f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/TargetDatabase.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.core.internal.context.options; - -/** - * TargetDatabase - */ -public enum TargetDatabase { - attunity, - auto, - cloudscape, - database, - db2, - db2mainframe, - dbase, - derby, - hsql, - informix, - javadb, - mysqlplatform, - oracle, - pointbase, - postgresql, - sqlanywhere, - sqlserver, - sybase, - timesten; - - // EclipseLink value string - static final String ATTUNITY = "Attunity"; - static final String AUTO = "Auto"; - static final String CLOUDSCAPE = "Cloudscape"; - static final String DATABASE = "Database"; - static final String DB2 = "DB2"; - static final String DB2MAINFRAME = "DB2Mainframe"; - static final String DBASE = "DBase"; - static final String DERBY = "Derby"; - static final String HSQL = "HSQL"; - static final String INFORMIX = "Informix"; - static final String JAVADB = "JavaDB"; - static final String MYSQLPLATFORM = "MySQLPlatform"; - static final String ORACLE = "Oracle"; - static final String POINTBASE = "PointBase"; - static final String POSTGRESQL = "PostgreSQL"; - static final String SQLANYWHERE = "SQLAnyWhere"; - static final String SQLSERVER = "SQLServer"; - static final String SYBASE = "Sybase"; - static final String TIMESTEN = "TimesTen"; - - /** - * Return the TargetDatabase value corresponding to the given literal. - */ - public static TargetDatabase getTargetDatabaseFor(String literal) { - - for( TargetDatabase targetDatabase : TargetDatabase.values()) { - if(targetDatabase.toString().equals(literal)) { - return targetDatabase; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/TargetServer.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/TargetServer.java deleted file mode 100644 index 62ceaabdc7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/options/TargetServer.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008 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.eclipselink.core.internal.context.options; - -/** - * TargetServer - */ -public enum TargetServer { - none, - oc4j, - sunas9, - websphere, - websphere_6_1, - weblogic, - weblogic_9, - weblogic_10, - jboss; - - // EclipseLink value string - static final String NONE = "None"; - static final String OC4J = "OC4J"; - static final String SUNAS9 = "SunAS9"; - static final String WEBSPHERE = "WebSphere"; - static final String WEBSPHERE_6_1 = "WebSphere_6_1"; - static final String WEBLOGIC = "WebLogic"; - static final String WEBLOGIC_9 = "WebLogic_9"; - static final String WEBLOGIC_10 = "WebLogic_10"; - static final String JBOSS = "JBoss"; - - /** - * Return the TargetServer value corresponding to the given literal. - */ - public static TargetServer getTargetServerFor(String literal) { - - for( TargetServer targetServer : TargetServer.values()) { - if(targetServer.toString().equals(literal)) { - return targetServer; - } - } - return null; - } -}
\ No newline at end of file |