org.ow2.easybeans.mavenplugin.server
Class PersistenceSupport

java.lang.Object
  extended by org.ow2.easybeans.mavenplugin.server.PersistenceSupport
All Implemented Interfaces:
EZBEventListener, org.ow2.util.event.api.IEventListener

public class PersistenceSupport
extends Object
implements EZBEventListener

Manage the persistence provider support. This class receives events from the server and report all container starting events to its owns listeners.

Author:
Vincent Michaud

Field Summary
static int ARTIFACT_ID
          ArtifactID information.
static int GROUP_ID
          GroupID information.
static int JPA_ECLIPSELINK
          Index of Eclipselink persistence provider.
static int JPA_HIBERNATE
          Index of Hibernate persistence provider.
static int JPA_OPENJPA
          Index of OpenJPA persistence provider.
static int JPA_TOPLINK
          Index of Toplink persistence provider.
static int TYPE
          Type information.
static int VERSION
          Version information.
 
Constructor Summary
PersistenceSupport(EZBEventComponent eventComponent)
          Constructor.
 
Method Summary
 boolean accept(org.ow2.util.event.api.IEvent event)
          Check whether the listener wants to handle this event.
 void addListener(IPersistenceListener listener)
          Add a listener.
static String getDependencies(int indexPersistenceProvider, int typeInfo)
          Get information on the persistence provider.
 String getEventProviderFilter()
          Get the event provider filter.
static String getImplementation(int indexPersistenceProvider)
          Get the implementation of the persistence provider.
 org.ow2.util.event.api.EventPriority getPriority()
          Get the event priority.
static int getSupportedPersistenceProviders()
          Get the number of supported persistence providers.
 void handle(org.ow2.util.event.api.IEvent event)
          Handle the event.
 void removeListener(IPersistenceListener listener)
          Remove a listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JPA_ECLIPSELINK

public static final int JPA_ECLIPSELINK
Index of Eclipselink persistence provider. Used as first argument of getDependencies() function.

See Also:
Constant Field Values

JPA_HIBERNATE

public static final int JPA_HIBERNATE
Index of Hibernate persistence provider. Used as first argument of getDependencies() function.

See Also:
Constant Field Values

JPA_OPENJPA

public static final int JPA_OPENJPA
Index of OpenJPA persistence provider. Used as first argument of getDependencies() function.

See Also:
Constant Field Values

JPA_TOPLINK

public static final int JPA_TOPLINK
Index of Toplink persistence provider. Used as first argument of getDependencies().

See Also:
Constant Field Values

GROUP_ID

public static final int GROUP_ID
GroupID information. Used as second argument of getDependencies() function.

See Also:
Constant Field Values

ARTIFACT_ID

public static final int ARTIFACT_ID
ArtifactID information. Used as second argument of getDependencies() function.

See Also:
Constant Field Values

VERSION

public static final int VERSION
Version information. Used as second argument of getDependencies() function.

See Also:
Constant Field Values

TYPE

public static final int TYPE
Type information. Used as second argument of getDependencies() function.

See Also:
Constant Field Values
Constructor Detail

PersistenceSupport

public PersistenceSupport(EZBEventComponent eventComponent)
Constructor.

Parameters:
eventComponent - The EasyBeans event component
Method Detail

addListener

public void addListener(IPersistenceListener listener)
Add a listener.

Parameters:
listener - The listener

removeListener

public void removeListener(IPersistenceListener listener)
Remove a listener.

Parameters:
listener - The listener

getImplementation

public static String getImplementation(int indexPersistenceProvider)
Get the implementation of the persistence provider.

Parameters:
indexPersistenceProvider - The index of the persistence provider
Returns:
The name of the class

getSupportedPersistenceProviders

public static int getSupportedPersistenceProviders()
Get the number of supported persistence providers.

Returns:
The number of supported persistence providers.

getDependencies

public static String getDependencies(int indexPersistenceProvider,
                                     int typeInfo)
Get information on the persistence provider.

Parameters:
indexPersistenceProvider - The index of the persistence provider
typeInfo - The type of the information
Returns:
The information requested

handle

public void handle(org.ow2.util.event.api.IEvent event)
Handle the event. Get all implementations of persistence providers and notify this information to the listeners.

Specified by:
handle in interface org.ow2.util.event.api.IEventListener
Parameters:
event - The event to handle.

accept

public boolean accept(org.ow2.util.event.api.IEvent event)
Check whether the listener wants to handle this event.

Specified by:
accept in interface org.ow2.util.event.api.IEventListener
Parameters:
event - The event to check.
Returns:
True if the listener wants to handle this event, false otherwise.

getPriority

public org.ow2.util.event.api.EventPriority getPriority()
Get the event priority.

Specified by:
getPriority in interface org.ow2.util.event.api.IEventListener
Returns:
A normal synchrone priority

getEventProviderFilter

public String getEventProviderFilter()
Get the event provider filter. The event provider filter is a regular expression that define which event provider the listener needs to listen.

Specified by:
getEventProviderFilter in interface EZBEventListener
Returns:
The event provider filter.


Copyright © 2006-2011 OW2 Consortium. All Rights Reserved.