Author: rhauch
Date: 2008-05-19 16:30:04 -0400 (Mon, 19 May 2008)
New Revision: 181
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnPath.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnProperties.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/CreateNodeCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/DeleteBranchCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/MoveBranchCommand.java
Removed:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeInformationCommand.java
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetChildrenCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeCommand.java
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetPropertiesCommand.java
Log:
DNA-68: Create connector API
http://jira.jboss.org/jira/browse/DNA-68
Restructured the repository command interfaces by making the inheritance hierarchy more
shallow and by adding orthogonal interfaces (e.g, "ActsAs...") that add behavior
to the commands.
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnPath.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnPath.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnPath.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.jboss.dna.spi.graph.Path;
+
+/**
+ * Aspect interface for any repository command that acts upon a specific path. This
aspect adds a method that can be used by the
+ * recipient to obtain the path that the command applies to.
+ * @author Randall Hauch
+ */
+public interface ActsOnPath extends RepositoryCommand {
+
+ /**
+ * Get the path to which this command applies.
+ * @return the path; never null
+ */
+ Path getPath();
+}
Property changes on:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnPath.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnProperties.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnProperties.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnProperties.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.jboss.dna.spi.cache.Cacheable;
+import org.jboss.dna.spi.graph.Name;
+
+/**
+ * Aspect interface for any repository command that acts upon or updates properties on a
given node. This aspect also allows for
+ * the recipient to {@link Cacheable#setCachePolicy(org.jboss.dna.spi.cache.CachePolicy)
update the cache policy} for the updated
+ * information.
+ * @author Randall Hauch
+ */
+public interface ActsOnProperties extends ActsOnPath, Cacheable {
+
+ /**
+ * Set the values for the named property. Any existing property values, if previously
set, will be overwritten. If there are
+ * no property vlaues or if all of the property values are null, the property will be
removed.
+ * @param propertyName the name of the property
+ * @param values the property values
+ */
+ void setProperty( Name propertyName, Object... values );
+
+}
Property changes on:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/ActsOnProperties.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/CreateNodeCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/CreateNodeCommand.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/CreateNodeCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -0,0 +1,48 @@
+/*
+ * 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;
+
+import java.util.Iterator;
+import org.jboss.dna.spi.cache.Cacheable;
+import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.graph.Property;
+
+/**
+ * A command to get the children of a single node given its path.
+ * @author Randall Hauch
+ */
+public interface CreateNodeCommand extends RepositoryCommand, ActsOnPath, Cacheable,
ActsOnProperties {
+
+ /**
+ * Get the names of the children for this new node. The recipient of the command
should {@link Iterator#remove() remove} any
+ * child name that will not be stored.
+ * @return the names of the node's children; never null, but possibly empty
+ */
+ Iterator<Name> getChildren();
+
+ /**
+ * Get the properties for this new node. The recipient of the command should {@link
Iterator#remove() remove} any property
+ * that will not be stored.
+ * @return the property iterator; never null, but possibly empty
+ */
+ Iterator<Property> getProperties();
+}
Property changes on:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/CreateNodeCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/DeleteBranchCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/DeleteBranchCommand.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/DeleteBranchCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * Command that deletes a branch given by a specified path.
+ * @author Randall Hauch
+ */
+public interface DeleteBranchCommand extends RepositoryCommand, ActsOnPath {
+}
Property changes on:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/DeleteBranchCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetChildrenCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetChildrenCommand.java 2008-05-19
20:27:57 UTC (rev 180)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetChildrenCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -22,13 +22,14 @@
package org.jboss.dna.spi.connector.commands;
import java.util.Iterator;
+import org.jboss.dna.spi.cache.Cacheable;
import org.jboss.dna.spi.graph.Name;
/**
- * A command to get the children of a single node.
+ * A command to get the children of a single node given its path.
* @author Randall Hauch
*/
-public interface GetChildrenCommand extends GetNodeInformationCommand {
+public interface GetChildrenCommand extends RepositoryCommand, ActsOnPath, Cacheable {
/**
* Set the children of this node using an iterator of names. Any existing child
references already set on this command will be
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetCommand.java 2008-05-19
20:27:57 UTC (rev 180)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -1,45 +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;
-
-import org.jboss.dna.spi.cache.CachePolicy;
-
-/**
- * Base interface for any repository command that retrieves information.
- * @author Randall Hauch
- */
-public interface GetCommand extends RepositoryCommand {
-
- /**
- * Get the caching policy to be used for this command's results. Note that the
values of the policy are relative to the time
- * the information was obtained, so the same instance can be used repeatedly.
- * </p>
- * @return cachePolicy the caching policy, which may not be null if no caching policy
is defined
- */
- public CachePolicy getCachePolicy();
-
- /**
- * Set the caching policy for this command's results.
- * @param cachePolicy the caching policy to use for this command's results
- */
- public void setCachePolicy( CachePolicy cachePolicy );
-}
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeCommand.java 2008-05-19
20:27:57 UTC (rev 180)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -22,7 +22,7 @@
package org.jboss.dna.spi.connector.commands;
/**
- * A command to get the properties and children for a single node.
+ * A command to get the properties and children for a single node given its path.
* @author Randall Hauch
*/
public interface GetNodeCommand extends GetChildrenCommand, GetPropertiesCommand {
Deleted:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeInformationCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeInformationCommand.java 2008-05-19
20:27:57 UTC (rev 180)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetNodeInformationCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -1,50 +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;
-
-import org.jboss.dna.spi.graph.Name;
-import org.jboss.dna.spi.graph.Path;
-import org.jboss.dna.spi.graph.Property;
-
-/**
- * A command to get information about a single node.
- * @author Randall Hauch
- */
-public interface GetNodeInformationCommand extends GetCommand {
-
- /**
- * Get the path of the node for which the children are to be obtained.
- * @return the node's path
- */
- Path getPath();
-
- /**
- * Get the property with the given name. This method is useful when the source has
previously saved node-specific information
- * in properties, and that information is required to process commands. As the node
may not have yet been obtained from the
- * source, the source should not expect properties to always exist on the supplied
node.
- * @param propertyName the name of the property to retrieve
- * @return the property with the supplied name, or null if that property is not
already known to the component that created
- * this command
- */
- Property getProperty( Name propertyName );
-
-}
Modified:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetPropertiesCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetPropertiesCommand.java 2008-05-19
20:27:57 UTC (rev 180)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/GetPropertiesCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -21,20 +21,12 @@
*/
package org.jboss.dna.spi.connector.commands;
-import org.jboss.dna.spi.graph.Name;
+import org.jboss.dna.spi.cache.Cacheable;
/**
- * A command to get the properties for a single node.
+ * A command to obtain from the source the properties for a single node given its path.
* @author Randall Hauch
*/
-public interface GetPropertiesCommand extends GetNodeInformationCommand {
+public interface GetPropertiesCommand extends RepositoryCommand, ActsOnPath, Cacheable,
ActsOnProperties {
- /**
- * Set the values for the named property. Any existing property values, if previously
set, will be overwritten. If there are
- * no property vlaues or if all of the property values are null, the property will be
removed.
- * @param propertyName the name of the property
- * @param values the property values
- */
- void setProperty( Name propertyName, Object... values );
-
}
Added:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/MoveBranchCommand.java
===================================================================
---
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/MoveBranchCommand.java
(rev 0)
+++
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/MoveBranchCommand.java 2008-05-19
20:30:04 UTC (rev 181)
@@ -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.connector.commands;
+
+import org.jboss.dna.spi.graph.Path;
+
+/**
+ * Command that moves a branch from one path to another.
+ * @author Randall Hauch
+ */
+public interface MoveBranchCommand extends RepositoryCommand, ActsOnPath {
+
+ /**
+ * Get the new path to which the branch is to be moved.
+ * @return the new path; never null
+ */
+ Path getNewPath();
+}
Property changes on:
branches/federation/dna-spi/src/main/java/org/jboss/dna/spi/connector/commands/MoveBranchCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain