Skip to content

Commit

Permalink
[SHRINKDESC-88] Do not expose the Pattern/Query elements as part of t…
Browse files Browse the repository at this point in the history
…he viewable SPI
  • Loading branch information
ALRubinger committed Sep 7, 2011
1 parent 6197f87 commit 7bd3e65
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Form of {@link GetQuery} for retrieving nodes matching
Expand All @@ -36,13 +33,13 @@
* @author <a href="mailto:alr@jboss.org">Andrew Lee Rubinger</a>
* @author <a href="mailto:bartosz.majsak@gmail.com">Bartosz Majsak</a>
*/
public enum AbsoluteGetQuery implements Query<List<Node>> {
enum AbsoluteGetQuery implements Query<List<Node>> {

INSTANCE;

/**
* {@inheritDoc}
* @see org.jboss.shrinkwrap.descriptor.spi.node.query.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern[])
* @see org.jboss.shrinkwrap.descriptor.spi.node.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.Pattern[])
*/
@Override
public List<Node> execute(final Node node, final Pattern... patterns) throws IllegalArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.List;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Form of {@link GetQuery} used as a convenience to retrieve
Expand All @@ -31,13 +28,13 @@
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
*/
public enum AbsoluteGetSingleQuery implements Query<Node> {
enum AbsoluteGetSingleQuery implements Query<Node> {

INSTANCE;

/**
* {@inheritDoc}
* @see org.jboss.shrinkwrap.descriptor.spi.node.query.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern[])
* @see org.jboss.shrinkwrap.descriptor.spi.node.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.Pattern[])
*/
@Override
public Node execute(final Node node, final Pattern... patterns)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.Map;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Creates the specified {@link Pattern}s starting at the specified
Expand All @@ -29,13 +26,13 @@
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
*/
public enum CreateQuery implements Query<Node> {
enum CreateQuery implements Query<Node> {

INSTANCE;

/**
* {@inheritDoc}
* @see org.jboss.shrinkwrap.descriptor.spi.node.query.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern[])
* @see org.jboss.shrinkwrap.descriptor.spi.node.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.Pattern[])
*/
@Override
public Node execute(final Node node, final Pattern... patterns)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Starting at the specified {@link Node}, either returns an
Expand All @@ -34,7 +31,7 @@
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
*/
public class GetOrCreateQuery implements Query<Node> {
class GetOrCreateQuery implements Query<Node> {

private static final Logger log = Logger.getLogger(GetOrCreateQuery.class.getName());

Expand All @@ -52,7 +49,7 @@ public static GetOrCreateQuery create()

/**
* {@inheritDoc}
* @see org.jboss.shrinkwrap.descriptor.spi.node.query.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern[])
* @see org.jboss.shrinkwrap.descriptor.spi.node.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.Pattern[])
*/
@Override
public Node execute(final Node node, final Pattern... patterns)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@
import java.util.List;
import java.util.Map;

import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Patterns;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.AbsoluteGetQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.CreateQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.GetOrCreateQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.AbsoluteGetSingleQuery;

/**
* {@link Node} is a data structure representing a container in a classic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;

/**
* A pattern that may be executed as part of a {@link Query} upon
Expand All @@ -32,7 +31,7 @@
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
*/
public final class Pattern
final class Pattern
{
//-------------------------------------------------------------------------------------||
// Instance Members -------------------------------------------------------------------||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -26,7 +26,7 @@
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @version $Revision: $
*/
public class Patterns
class Patterns
{
private static final String PATH_SEPARATOR = "/";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;

/**
* Contract for something capable of executing a
Expand All @@ -27,7 +26,7 @@
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
* @param <T> Expected return value from executing a query
*/
public interface Query<T>
interface Query<T>
{
/**
* Queries the tree starting at the specified {@link Node}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Helper util for building {@link Query} implementations
*
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
*/
public final class QueryUtil
final class QueryUtil
{

//-------------------------------------------------------------------------------------||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Form of {@link GetQuery} for retrieving nodes matching
Expand All @@ -36,13 +33,13 @@
* @author <a href="mailto:bartosz.majsak@gmail.com">Bartosz Majsak</a>
*
*/
public enum RelativeGetQuery implements Query<List<Node>> {
enum RelativeGetQuery implements Query<List<Node>> {

INSTANCE;

/**
* {@inheritDoc}
* @see org.jboss.shrinkwrap.descriptor.spi.node.query.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern[])
* @see org.jboss.shrinkwrap.descriptor.spi.node.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.Pattern[])
*/
@Override
public List<Node> execute(final Node node, final Pattern... patterns) throws IllegalArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query.queries;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.List;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Query;

/**
* Form of {@link GetQuery} used as a convenience to retrieve
Expand All @@ -31,13 +28,13 @@
* @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
* @author <a href="mailto:andrew.rubinger@jboss.org">ALR</a>
*/
public enum RelativeGetSingleQuery implements Query<Node> {
enum RelativeGetSingleQuery implements Query<Node> {

INSTANCE;

/**
* {@inheritDoc}
* @see org.jboss.shrinkwrap.descriptor.spi.node.query.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern[])
* @see org.jboss.shrinkwrap.descriptor.spi.node.Query#execute(org.jboss.shrinkwrap.descriptor.spi.node.Node, org.jboss.shrinkwrap.descriptor.spi.node.Pattern[])
*/
@Override
public Node execute(final Node node, final Pattern... patterns)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import static org.jboss.shrinkwrap.descriptor.spi.node.query.TestTreeBuilder.*;
import static org.jboss.shrinkwrap.descriptor.spi.node.TestTreeBuilder.*;

import java.util.List;

import junit.framework.Assert;

import org.jboss.shrinkwrap.descriptor.spi.node.AbsoluteGetQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.NodeAssert;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.AbsoluteGetQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.Pattern;
import org.junit.Test;

public class AbsoluteGetQueryTestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import static org.jboss.shrinkwrap.descriptor.spi.node.query.TestTreeBuilder.*;
import static org.jboss.shrinkwrap.descriptor.spi.node.TestTreeBuilder.*;

import junit.framework.Assert;

import org.jboss.shrinkwrap.descriptor.spi.node.AbsoluteGetSingleQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.AbsoluteGetSingleQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.Patterns;
import org.junit.Test;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import static org.jboss.shrinkwrap.descriptor.spi.node.TestTreeBuilder.*;

import static org.jboss.shrinkwrap.descriptor.spi.node.query.TestTreeBuilder.*;
import java.util.List;

import junit.framework.Assert;

import org.jboss.shrinkwrap.descriptor.spi.node.GetOrCreateQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.queries.GetOrCreateQuery;
import org.jboss.shrinkwrap.descriptor.spi.node.Patterns;
import org.junit.Test;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
*/
package org.jboss.shrinkwrap.descriptor.spi.node;

import static org.jboss.shrinkwrap.descriptor.spi.node.query.TestTreeBuilder.*;
import static org.jboss.shrinkwrap.descriptor.spi.node.TestTreeBuilder.*;

import java.util.List;
import java.util.Map;

import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.junit.Assert;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.shrinkwrap.descriptor.spi.node.query;
package org.jboss.shrinkwrap.descriptor.spi.node;

import java.util.logging.Logger;

import junit.framework.Assert;

import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import org.jboss.shrinkwrap.descriptor.spi.node.query.Pattern;
import org.jboss.shrinkwrap.descriptor.spi.node.Pattern;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down
Loading

0 comments on commit 7bd3e65

Please sign in to comment.