-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Predicate is now part of the container-API to promote reuse. Updated …
…maven to version 3.0.5. Initial project API (no impl)
- Loading branch information
1 parent
e7a8f98
commit 07f8998
Showing
16 changed files
with
176 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ager/impl/src/main/java/org/jboss/forge/addon/manager/impl/filters/DirectAddonFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...er/impl/src/main/java/org/jboss/forge/addon/manager/impl/filters/LocalResourceFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
container-api/src/main/java/org/jboss/forge/container/util/Predicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.container.util; | ||
|
||
/** | ||
* Determines a true or false value for a given input. | ||
* | ||
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a> | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
* | ||
* @param <INPUTTYPE> | ||
*/ | ||
public interface Predicate<INPUTTYPE> | ||
{ | ||
boolean accept(INPUTTYPE type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
dependencies/api/src/main/java/org/jboss/forge/dependencies/collection/Predicate.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
projects/api/src/main/java/org/jboss/forge/projects/BaseProject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.projects; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.jboss.forge.facets.BaseFaceted; | ||
|
||
/** | ||
* Convenience base class for {@link Project} implementations. | ||
* | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
public abstract class BaseProject extends BaseFaceted implements Project | ||
{ | ||
private final Map<Object, Object> attributes = new HashMap<Object, Object>(); | ||
|
||
@Override | ||
public Object getAttribute(final Object key) | ||
{ | ||
return attributes.get(key); | ||
} | ||
|
||
@Override | ||
public void setAttribute(final Object key, final Object value) | ||
{ | ||
attributes.put(key, value); | ||
} | ||
|
||
@Override | ||
public void removeAttribute(final Object key) | ||
{ | ||
attributes.remove(key); | ||
} | ||
|
||
/* | ||
* Project instances are the same if they share a common root directory. | ||
*/ | ||
@Override | ||
public int hashCode() | ||
{ | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + ((getProjectRoot() == null) ? 0 : getProjectRoot().hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object obj) | ||
{ | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
BaseProject other = (BaseProject) obj; | ||
if (getProjectRoot() == null) | ||
{ | ||
if (other.getProjectRoot() != null) | ||
return false; | ||
} | ||
else if (!getProjectRoot().equals(other.getProjectRoot())) | ||
return false; | ||
return true; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
projects/api/src/main/java/org/jboss/forge/projects/Project.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.projects; | ||
|
||
import org.jboss.forge.facets.Faceted; | ||
import org.jboss.forge.resource.Resource; | ||
|
||
/** | ||
* Describes a set of {@link Resource} instances that represent a unit of work. | ||
* | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
public interface Project extends Faceted | ||
{ | ||
/** | ||
* Get a value from this project's internal attributes. If the value is not set, return <code>null</code> instead. | ||
*/ | ||
public Object getAttribute(Object key); | ||
|
||
/** | ||
* Set a value in this project's internal attributes. | ||
*/ | ||
public void setAttribute(Object key, Object value); | ||
|
||
/** | ||
* Remove a value from this project's internal attributes. | ||
*/ | ||
public void removeAttribute(Object key); | ||
|
||
/** | ||
* Get the {@link Resource} representing the root directory of this {@link Project}. | ||
*/ | ||
public Resource<?> getProjectRoot(); | ||
} |
22 changes: 22 additions & 0 deletions
22
projects/api/src/main/java/org/jboss/forge/projects/ProjectFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2013 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.jboss.forge.projects; | ||
|
||
import org.jboss.forge.resource.Resource; | ||
|
||
/** | ||
* Used to create new or obtain references to existing {@link Project} instances. | ||
* | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
public interface ProjectFactory | ||
{ | ||
/** | ||
* Locate a {@link Project} in the parent hierarchy of the given {@link Resource}. | ||
*/ | ||
public Project findProject(final Resource<?> target); | ||
} |