Top Description Inners Fields Constructors Methods
org.eclipse.persistence.internal.databaseaccess

public abstract Class ConnectionCustomizer

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Known Direct Subclasses
org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.Empty
Imports
org.eclipse.persistence.sessions.Session

PUBLIC: The base class for connection customization. The extending class must not alter the attributes defined in this class. Consider implementing equals method on the extending class so that the two instances are consider equal if they apply exactly the same customizations. This allows to skip unnecessary work when overriding customizer defined by ServerSession by the one defined by ClientSession: in case the two customizers are equal the old (ServerSession's) customizer is kept. That may save considerable effort in internal connection pooling case: if both ServerSession and ClientSession have exactly the same proxy properties (that happens if ClientSession doesn't have any proxy properties at all and just "inherits" all the properties from its parent ServerSession) then without correct customizer equality check the proxy session opened by ServerSession would have been closed, only to be re-opened again by ClientSession customizer using exactly the same proxy properties (and then the same happens again when ClientSession releases connection).

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
ConnectionCustomizer.Empty

INTERNAL: Empty customizer that does nothing.

Field Summary

Modifier and TypeField and Description
protected Accessor
private ConnectionCustomizer
protected Session

Constructor Summary

AccessConstructor and Description
protected
ConnectionCustomizer(Accessor accessor, Session session)

INTERNAL: Constructor accepts the accessor to which the customizer will be applied and the session that used for customization.

Method Summary

Modifier and TypeMethod and Description
public abstract void
clear()

INTERNAL: Clears customization from connection.

public static ConnectionCustomizer
public abstract void
customize()

INTERNAL: Applies customization to connection.

public Accessor
getAccessor()

INTERNAL:

public ConnectionCustomizer
getPrevCustomizer()

INTERNAL:

public Session
getSession()

INTERNAL:

public abstract boolean
isActive()

INTERNAL: Indicated whether the connection is currently customized.

pack-priv void
setAccessor(Accessor accessor)

INTERNAL: Used only by DatasourceAccessor.clone method.

public void
setPrevCustomizer(ConnectionCustomizer prevCustomizer)

INTERNAL:

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accessorback to summary
protected Accessor accessor
prevCustomizerback to summary
private ConnectionCustomizer prevCustomizer
sessionback to summary
protected Session session

Constructor Detail

ConnectionCustomizerback to summary
protected ConnectionCustomizer(Accessor accessor, Session session)

INTERNAL: Constructor accepts the accessor to which the customizer will be applied and the session that used for customization. The accessor and the session couldn't be altered during the connector's lifetime, the only exception is of the new accessor by DatasourceAccessor.clone method.

Method Detail

clearback to summary
public abstract void clear()

INTERNAL: Clears customization from connection. Called only if connection is customized (isActive()==true). If the method fails due to SQLException it should "eat" it (just like DatasourceAccessor.closeConnection method). isActive method called after this method should always return false.

createEmptyCustomizerback to summary
public static ConnectionCustomizer createEmptyCustomizer(Session session)
customizeback to summary
public abstract void customize()

INTERNAL: Applies customization to connection. Called only if connection is not already customized (isActive()==false). The method may throw SQLException wrapped into DatabaseException. isActive method called after this method should return true only in case the connection was actually customized.

getAccessorback to summary
public Accessor getAccessor()

INTERNAL:

getPrevCustomizerback to summary
public ConnectionCustomizer getPrevCustomizer()

INTERNAL:

getSessionback to summary
public Session getSession()

INTERNAL:

isActiveback to summary
public abstract boolean isActive()

INTERNAL: Indicated whether the connection is currently customized.

setAccessorback to summary
pack-priv void setAccessor(Accessor accessor)

INTERNAL: Used only by DatasourceAccessor.clone method.

setPrevCustomizerback to summary
public void setPrevCustomizer(ConnectionCustomizer prevCustomizer)

INTERNAL:

org.eclipse.persistence.internal.databaseaccess back to summary

pack-priv Class ConnectionCustomizer.Empty

extends ConnectionCustomizer
Class Inheritance

INTERNAL: Empty customizer that does nothing. Used when ServerSession defines customizer and ClientSession explicitly demands no customization. Example: ServerSession has proxy properties, ClientSession has PersistenceUnitProperties.ORACLE_PROXY_TYPE property with an empty String value. Using Empty customizer allows to avoid customization as well as cache the previous (ServerSession - created) customizer, which is brought back after ClientSession releases the accessor.

Field Summary

Inherited from org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer:
accessorsession

Constructor Summary

AccessConstructor and Description
public
Empty(Accessor accessor, Session session)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Implements abstract org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.clear.

INTERNAL: Clears customization from connection.
public void
customize()

Implements abstract org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.customize.

INTERNAL: Applies customization to connection.
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public boolean
isActive()

Implements abstract org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.isActive.

INTERNAL: Indicated whether the connection is currently customized.
Inherited from org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer:
createEmptyCustomizergetAccessorgetPrevCustomizergetSessionsetAccessorsetPrevCustomizer

Constructor Detail

Emptyback to summary
public Empty(Accessor accessor, Session session)

Method Detail

clearback to summary
public void clear()

Implements abstract org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.clear.

Doc from org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.clear.

INTERNAL: Clears customization from connection. Called only if connection is customized (isActive()==true). If the method fails due to SQLException it should "eat" it (just like DatasourceAccessor.closeConnection method). isActive method called after this method should always return false.

Annotations
@Override
customizeback to summary
public void customize()

Implements abstract org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.customize.

Doc from org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.customize.

INTERNAL: Applies customization to connection. Called only if connection is not already customized (isActive()==false). The method may throw SQLException wrapped into DatabaseException. isActive method called after this method should return true only in case the connection was actually customized.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
isActiveback to summary
public boolean isActive()

Implements abstract org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.isActive.

Doc from org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer.isActive.

INTERNAL: Indicated whether the connection is currently customized.

Annotations
@Override