org.jboss.dna.graph.connectors
Interface RepositoryConnection

All Known Implementing Classes:
FederatedRepositoryConnection, InMemoryRepositoryConnection, JBossCacheConnection, SVNRepositoryConnection

@NotThreadSafe
public interface RepositoryConnection

A connection to a repository source.

These connections need not support concurrent operations by multiple threads.

Author:
Randall Hauch

Method Summary
 void close()
          Close this connection to signal that it is no longer needed and that any accumulated resources are to be released.
 void execute(ExecutionContext context, Request request)
          Execute the supplied commands against this repository source.
 CachePolicy getDefaultCachePolicy()
          Get the default cache policy for this repository.
 String getSourceName()
          Get the name for this repository source.
 XAResource getXAResource()
          Return the transactional resource associated with this connection.
 boolean ping(long time, TimeUnit unit)
          Ping the underlying system to determine if the connection is still valid and alive.
 void setListener(RepositorySourceListener listener)
          Set the listener that is to receive notifications to changes to content within this source.
 

Method Detail

getSourceName

String getSourceName()
Get the name for this repository source. This value should be the same as that returned by the same RepositorySource that created this connection.

Returns:
the identifier; never null or empty

getXAResource

XAResource getXAResource()
Return the transactional resource associated with this connection. The transaction manager will use this resource to manage the participation of this connection in a distributed transaction.

Returns:
the XA resource, or null if this connection is not aware of distributed transactions

ping

boolean ping(long time,
             TimeUnit unit)
             throws InterruptedException
Ping the underlying system to determine if the connection is still valid and alive.

Parameters:
time - the length of time to wait before timing out
unit - the time unit to use; may not be null
Returns:
true if this connection is still valid and can still be used, or false otherwise
Throws:
InterruptedException - if the thread has been interrupted during the operation

setListener

void setListener(RepositorySourceListener listener)
Set the listener that is to receive notifications to changes to content within this source.

Parameters:
listener - the new listener, or null if no component is interested in the change notifications

getDefaultCachePolicy

CachePolicy getDefaultCachePolicy()
Get the default cache policy for this repository. If none is provided, a global cache policy will be used.

Returns:
the default cache policy

execute

void execute(ExecutionContext context,
             Request request)
             throws RepositorySourceException
Execute the supplied commands against this repository source.

Parameters:
context - the environment in which the commands are being executed; never null
request - the request to be executed; never null
Throws:
RepositorySourceException - if there is a problem loading the node data

close

void close()
Close this connection to signal that it is no longer needed and that any accumulated resources are to be released.



Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.