Author: rhauch
Date: 2008-05-28 13:18:41 -0400 (Wed, 28 May 2008)
New Revision: 206
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java
Removed:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnection.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceEnvironment.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceException.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceListener.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/RepositoryCommand.java
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java
Log:
DNA-68: Create connector API
http://jira.jboss.org/jira/browse/DNA-68
Renamed the connector and command packages since they all fall under the "graph
SPI".
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnection.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnection.java 2008-05-28
15:48:30 UTC (rev 205)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnection.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-import java.util.concurrent.TimeUnit;
-import javax.transaction.xa.XAResource;
-import org.jboss.dna.spi.connector.commands.RepositoryCommand;
-
-/**
- * A connection to a repository source.
- * <p>
- * These connections need not support concurrent operations by multiple threads, since
the federation engine never uses them this
- * way.
- * </p>
- * @author Randall Hauch
- */
-public interface RepositoryConnection {
-
- /**
- * Get the name for this repository source. This value should be the same as that
{@link RepositorySource#getName() returned}
- * by the same {@link RepositorySource} that created this connection.
- * @return the identifier; never null or empty
- */
- String getSourceName();
-
- /**
- * 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.
- * @return the XA resource, or null if this connection is not aware of distributed
transactions
- */
- XAResource getXAResource();
-
- /**
- * Ping the underlying system to determine if the connection is still valid and
alive.
- * @param time the length of time to wait before timing out
- * @param unit the time unit to use; may not be null
- * @return 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
- */
- boolean ping( long time, TimeUnit unit ) throws InterruptedException;
-
- /**
- * Set the listener that is to receive notifications to changes to content within
this source.
- * @param listener the new listener, or null if no component is interested in the
change notifications
- */
- void setListener( RepositorySourceListener listener );
-
- /**
- * Execute the supplied commands against this repository source.
- * @param env the environment in which the commands are being executed; never null
- * @param commands the commands to be executed; never null
- * @throws RepositorySourceException if there is a problem loading the node data
- */
- void execute( RepositorySourceEnvironment env, RepositoryCommand... commands ) throws
RepositorySourceException;
-
- /**
- * Close this connection to signal that it is no longer needed and that any
accumulated resources are to be released.
- * @throws InterruptedException if the thread has been interrupted while the close
was in progress
- */
- void close() throws InterruptedException;
-}
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java 2008-05-28
15:48:30 UTC (rev 205)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-/**
- * @author Randall Hauch
- */
-public interface RepositoryConnectionFactory {
-
- /**
- * Get a connection from this factory.
- * @return a connection
- * @throws RepositorySourceException if there is a problem obtaining a connection
- * @throws InterruptedException if the thread is interrupted while attempting to get
a connection
- * @throws IllegalStateException if the factory is not in a state to create or return
connections
- */
- RepositoryConnection getConnection() throws RepositorySourceException,
InterruptedException;
-}
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java 2008-05-28
15:48:30 UTC (rev 205)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-import java.io.Serializable;
-import javax.naming.Referenceable;
-import org.jboss.dna.spi.cache.CachePolicy;
-
-/**
- * A repository source is a description of a resource that can be used to access or store
repository information. This class
- * serves as a factory for {@link RepositoryConnection} instances and provides some basic
configuration information.
- * <p>
- * Typically this interface is implemented by classes that provide standard-style getters
and setters for the various properties
- * necessary for proper configuration via reflection or introspection. This interface
expects nor defines any such properties,
- * leaving that entirely to the implementation classes.
- * </p>
- * <p>
- * Objects that implement this <code>RepositorySource</code> interface are
typically registered with a naming service such as
- * Java Naming and Directory Interface<sup><font
size=-3>TM</font></sup> (JNDI). This interface extends both
- * {@link Referenceable} and {@link Serializable} so that such objects can be stored in
any JNDI naming context and enable proper
- * system recovery,
- * </p>
- * @author Randall Hauch
- */
-public interface RepositorySource extends RepositoryConnectionFactory, Referenceable,
Serializable {
-
- /**
- * Get the name for this repository source.
- * @return the name; never null or empty
- */
- String getName();
-
- /**
- * Get the maximum number of retries that may be performed on a given operation when
using
- * {@link #getConnection() connections} created by this source. This value does not
constitute a minimum number of retries; in
- * fact, the connection user is not required to retry any operations.
- * @return the maximum number of allowable retries, or 0 if the source has no limit
- */
- int getRetryLimit();
-
- /**
- * Set the maximum number of retries that may be performed on a given operation when
using
- * {@link #getConnection() connections} created by this source. This value does not
constitute a minimum number of retries; in
- * fact, the connection user is not required to retry any operations.
- * @param limit the maximum number of allowable retries, or 0 if the source has no
limit
- */
- void setRetryLimit( int limit );
-
- /**
- * Get the default cache policy for this source. If none is provided, a global cache
policy will be used.
- * @return the default cache policy
- */
- CachePolicy getDefaultCachePolicy();
-
-}
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceEnvironment.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceEnvironment.java 2008-05-28
15:48:30 UTC (rev 205)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceEnvironment.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.NameFactory;
-import org.jboss.dna.spi.graph.Property;
-import org.jboss.dna.spi.graph.ValueFactories;
-
-/**
- * @author Randall Hauch
- */
-public interface RepositorySourceEnvironment {
-
- /**
- * Get the factories that should be used to create values for {@link Property
properties}.
- * @return the property value factory; never null
- */
- ValueFactories getValueFactories();
-
- /**
- * Get the factory that should be used to create {@link Name names}.
- * @return the name factory; never null
- */
- NameFactory getNameFactory();
-
- /**
- * Get the {@link RepositorySource} instance that this environment represents. This
instance will be the same instance that
- * created the {@link RepositoryConnection} for which this environment was created
and is being used.
- * @return the repository source; never null
- */
- RepositorySource getRepositorySource();
-
-}
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceException.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceException.java 2008-05-28
15:48:30 UTC (rev 205)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceException.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-/**
- * @author Randall Hauch
- */
-public class RepositorySourceException extends RuntimeException {
-
- private final String sourceName;
-
- /**
- * @param sourceName the identifier of the source from which this exception eminates
- */
- public RepositorySourceException( String sourceName ) {
- this.sourceName = sourceName;
- }
-
- /**
- * @param sourceName the identifier of the source from which this exception eminates
- * @param message
- */
- public RepositorySourceException( String sourceName, String message ) {
- super(message);
- this.sourceName = sourceName;
- }
-
- /**
- * @param sourceName the identifier of the source from which this exception eminates
- * @param cause
- */
- public RepositorySourceException( String sourceName, Throwable cause ) {
- super(cause);
- this.sourceName = sourceName;
- }
-
- /**
- * @param sourceName the identifier of the source from which this exception eminates
- * @param message
- * @param cause
- */
- public RepositorySourceException( String sourceName, String message, Throwable cause
) {
- super(message, cause);
- this.sourceName = sourceName;
- }
-
- /**
- * @return sourceName
- */
- public String getSourceName() {
- return this.sourceName;
- }
-
-}
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceListener.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceListener.java 2008-05-28
15:48:30 UTC (rev 205)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceListener.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector;
-
-/**
- * @author Randall Hauch
- */
-public interface RepositorySourceListener {
-
- void notify( String sourceName, Object... events );
-}
Copied: branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands (from
rev 204, branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands)
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnPath.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnPath.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
import org.jboss.dna.spi.graph.Path;
@@ -28,7 +28,7 @@
* recipient to obtain the path that the command applies to.
* @author Randall Hauch
*/
-public interface ActsOnPath extends RepositoryCommand {
+public interface ActsOnPath extends GraphCommand {
/**
* Get the path to which this command applies.
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnProperties.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/ActsOnProperties.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
import org.jboss.dna.spi.cache.Cacheable;
import org.jboss.dna.spi.graph.Name;
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/CreateNodeCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/CreateNodeCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
import java.util.Iterator;
import org.jboss.dna.spi.cache.Cacheable;
@@ -30,7 +30,7 @@
* A command to get the children of a single node given its path.
* @author Randall Hauch
*/
-public interface CreateNodeCommand extends RepositoryCommand, ActsOnPath, Cacheable,
ActsOnProperties {
+public interface CreateNodeCommand extends GraphCommand, ActsOnPath, Cacheable,
ActsOnProperties {
/**
* Get the names of the children for this new node. The recipient of the command
should {@link Iterator#remove() remove} any
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/DeleteBranchCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/DeleteBranchCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,11 +19,11 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
/**
* Command that deletes a branch given by a specified path.
* @author Randall Hauch
*/
-public interface DeleteBranchCommand extends RepositoryCommand, ActsOnPath {
+public interface DeleteBranchCommand extends GraphCommand, ActsOnPath {
}
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetChildrenCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetChildrenCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
import java.util.Iterator;
import org.jboss.dna.spi.cache.Cacheable;
@@ -29,7 +29,7 @@
* A command to get the children of a single node given its path.
* @author Randall Hauch
*/
-public interface GetChildrenCommand extends RepositoryCommand, ActsOnPath, Cacheable {
+public interface GetChildrenCommand extends GraphCommand, ActsOnPath, Cacheable {
/**
* Set the children of this node using an iterator of names. Any existing child
references already set on this command will be
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetNodeCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
/**
* A command to get the properties and children for a single node given its path.
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetPropertiesCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GetPropertiesCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
import org.jboss.dna.spi.cache.Cacheable;
@@ -27,6 +27,6 @@
* A command to obtain from the source the properties for a single node given its path.
* @author Randall Hauch
*/
-public interface GetPropertiesCommand extends RepositoryCommand, ActsOnPath, Cacheable,
ActsOnProperties {
+public interface GetPropertiesCommand extends GraphCommand, ActsOnPath, Cacheable,
ActsOnProperties {
}
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/GraphCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.commands;
+
+/**
+ * The base interface for all repository commands
+ * @author Randall Hauch
+ */
+public interface GraphCommand {
+
+ /**
+ * Return whether this command has been cancelled.
+ * @return true if this command has been cancelled, or false otherwise.
+ */
+ boolean isCancelled();
+
+}
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/MoveBranchCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/MoveBranchCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.dna.spi.connector.commands;
+package org.jboss.dna.spi.graph.commands;
import org.jboss.dna.spi.graph.Path;
@@ -27,7 +27,7 @@
* Command that moves a branch from one path to another.
* @author Randall Hauch
*/
-public interface MoveBranchCommand extends RepositoryCommand, ActsOnPath {
+public interface MoveBranchCommand extends GraphCommand, ActsOnPath {
/**
* Get the new path to which the branch is to be moved.
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/RepositoryCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/RepositoryCommand.java 2008-05-28
15:45:27 UTC (rev 204)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/commands/RepositoryCommand.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.spi.connector.commands;
-
-/**
- * The base interface for all repository commands
- * @author Randall Hauch
- */
-public interface RepositoryCommand {
-
- /**
- * Return whether this command has been cancelled.
- * @return true if this command has been cancelled, or false otherwise.
- */
- boolean isCancelled();
-
-}
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.connection;
+
+import org.jboss.dna.spi.graph.NamespaceRegistry;
+import org.jboss.dna.spi.graph.Property;
+import org.jboss.dna.spi.graph.ValueFactories;
+
+/**
+ * @author Randall Hauch
+ */
+public interface ExecutionEnvironment {
+
+ /**
+ * Get the factories that should be used to create values for {@link Property
properties}.
+ * @return the property value factory; never null
+ */
+ ValueFactories getValueFactories();
+
+ /**
+ * Get the namespace registry for this environment.
+ * @return the namespace registry; never null
+ */
+ NamespaceRegistry getNamespaceRegistry();
+
+ /**
+ * Return the repository source against which this environment applies.
+ * @return the repository source; never null
+ */
+ RepositorySource getRepositorySource();
+
+}
Property changes on:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/ExecutionEnvironment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java
(from rev 204,
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnection.java)
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnection.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.connection;
+
+import java.util.concurrent.TimeUnit;
+import javax.transaction.xa.XAResource;
+import org.jboss.dna.spi.graph.commands.GraphCommand;
+
+/**
+ * A connection to a repository source.
+ * <p>
+ * These connections need not support concurrent operations by multiple threads, since
the federation engine never uses them this
+ * way.
+ * </p>
+ * @author Randall Hauch
+ */
+public interface RepositoryConnection {
+
+ /**
+ * Get the name for this repository source. This value should be the same as that
{@link RepositorySource#getName() returned}
+ * by the same {@link RepositorySource} that created this connection.
+ * @return the identifier; never null or empty
+ */
+ String getSourceName();
+
+ /**
+ * 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.
+ * @return the XA resource, or null if this connection is not aware of distributed
transactions
+ */
+ XAResource getXAResource();
+
+ /**
+ * Ping the underlying system to determine if the connection is still valid and
alive.
+ * @param time the length of time to wait before timing out
+ * @param unit the time unit to use; may not be null
+ * @return 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
+ */
+ boolean ping( long time, TimeUnit unit ) throws InterruptedException;
+
+ /**
+ * Set the listener that is to receive notifications to changes to content within
this source.
+ * @param listener the new listener, or null if no component is interested in the
change notifications
+ */
+ void setListener( RepositorySourceListener listener );
+
+ /**
+ * Execute the supplied commands against this repository source.
+ * @param env the environment in which the commands are being executed; never null
+ * @param commands the commands to be executed; never null
+ * @throws RepositorySourceException if there is a problem loading the node data
+ */
+ void execute( ExecutionEnvironment env, GraphCommand... commands ) throws
RepositorySourceException;
+
+ /**
+ * Close this connection to signal that it is no longer needed and that any
accumulated resources are to be released.
+ * @throws InterruptedException if the thread has been interrupted while the close
was in progress
+ */
+ void close() throws InterruptedException;
+}
Copied:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java
(from rev 204,
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositoryConnectionFactory.java)
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositoryConnectionFactory.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.connection;
+
+/**
+ * @author Randall Hauch
+ */
+public interface RepositoryConnectionFactory {
+
+ /**
+ * Get a connection from this factory.
+ * @return a connection
+ * @throws RepositorySourceException if there is a problem obtaining a connection
+ * @throws InterruptedException if the thread is interrupted while attempting to get
a connection
+ * @throws IllegalStateException if the factory is not in a state to create or return
connections
+ */
+ RepositoryConnection getConnection() throws RepositorySourceException,
InterruptedException;
+}
Copied:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java
(from rev 204,
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySource.java)
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySource.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.connection;
+
+import java.io.Serializable;
+import javax.naming.Referenceable;
+import org.jboss.dna.spi.cache.CachePolicy;
+
+/**
+ * A repository source is a description of a resource that can be used to access or store
repository information. This class
+ * serves as a factory for {@link RepositoryConnection} instances and provides some basic
configuration information.
+ * <p>
+ * Typically this interface is implemented by classes that provide standard-style getters
and setters for the various properties
+ * necessary for proper configuration via reflection or introspection. This interface
expects nor defines any such properties,
+ * leaving that entirely to the implementation classes.
+ * </p>
+ * <p>
+ * Objects that implement this <code>RepositorySource</code> interface are
typically registered with a naming service such as
+ * Java Naming and Directory Interface<sup><font
size=-3>TM</font></sup> (JNDI). This interface extends both
+ * {@link Referenceable} and {@link Serializable} so that such objects can be stored in
any JNDI naming context and enable proper
+ * system recovery,
+ * </p>
+ * @author Randall Hauch
+ */
+public interface RepositorySource extends RepositoryConnectionFactory, Referenceable,
Serializable {
+
+ /**
+ * Get the name for this repository source.
+ * @return the name; never null or empty
+ */
+ String getName();
+
+ /**
+ * Get the maximum number of retries that may be performed on a given operation when
using
+ * {@link #getConnection() connections} created by this source. This value does not
constitute a minimum number of retries; in
+ * fact, the connection user is not required to retry any operations.
+ * @return the maximum number of allowable retries, or 0 if the source has no limit
+ */
+ int getRetryLimit();
+
+ /**
+ * Set the maximum number of retries that may be performed on a given operation when
using
+ * {@link #getConnection() connections} created by this source. This value does not
constitute a minimum number of retries; in
+ * fact, the connection user is not required to retry any operations.
+ * @param limit the maximum number of allowable retries, or 0 if the source has no
limit
+ */
+ void setRetryLimit( int limit );
+
+ /**
+ * Get the default cache policy for this source. If none is provided, a global cache
policy will be used.
+ * @return the default cache policy
+ */
+ CachePolicy getDefaultCachePolicy();
+
+}
Copied:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java
(from rev 204,
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceException.java)
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceException.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.connection;
+
+/**
+ * @author Randall Hauch
+ */
+public class RepositorySourceException extends RuntimeException {
+
+ private final String sourceName;
+
+ /**
+ * @param sourceName the identifier of the source from which this exception eminates
+ */
+ public RepositorySourceException( String sourceName ) {
+ this.sourceName = sourceName;
+ }
+
+ /**
+ * @param sourceName the identifier of the source from which this exception eminates
+ * @param message
+ */
+ public RepositorySourceException( String sourceName, String message ) {
+ super(message);
+ this.sourceName = sourceName;
+ }
+
+ /**
+ * @param sourceName the identifier of the source from which this exception eminates
+ * @param cause
+ */
+ public RepositorySourceException( String sourceName, Throwable cause ) {
+ super(cause);
+ this.sourceName = sourceName;
+ }
+
+ /**
+ * @param sourceName the identifier of the source from which this exception eminates
+ * @param message
+ * @param cause
+ */
+ public RepositorySourceException( String sourceName, String message, Throwable cause
) {
+ super(message, cause);
+ this.sourceName = sourceName;
+ }
+
+ /**
+ * @return sourceName
+ */
+ public String getSourceName() {
+ return this.sourceName;
+ }
+
+}
Copied:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java
(from rev 204,
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/RepositorySourceListener.java)
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/graph/connection/RepositorySourceListener.java 2008-05-28
17:18:41 UTC (rev 206)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.spi.graph.connection;
+
+/**
+ * @author Randall Hauch
+ */
+public interface RepositorySourceListener {
+
+ void notify( String sourceName, Object... events );
+}