Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleanup & removed marker interface.

either easyb or wicket tester is misbehaving. example app works fine.

git-svn-id: https://svn.kenai.com/svn/joint~svn/branches/dev@74 9bc3f32a-7c93-cb2a-8a4d-965fa692a531
  • Loading branch information...
commit 02beef03c477bc03ca274bd99cebb8cf65d81af4 1 parent 3a9660d
btilford authored
Showing with 763 additions and 706 deletions.
  1. +97 −96 joint-core/src/main/java/org/joint/JointLookup.java
  2. +18 −15 joint-core/src/main/java/org/joint/JointNameComparator.java
  3. +4 −22 joint-core/src/main/java/org/joint/JointUtil.java
  4. +0 −2  joint-core/src/main/java/org/joint/annotations/Joint.java
  5. +3 −2 joint-core/src/main/java/org/joint/spi/Jointed.java
  6. +15 −13 joint-nav-spi/src/main/java/org/joint/nav/NavPositionComparator.java
  7. +17 −15 joint-nav-spi/src/main/java/org/joint/nav/NavUtil.java
  8. +2 −3 joint-nav-spi/src/main/java/org/joint/nav/spi/Navigatable.java
  9. +19 −15 joint-registers-spi/src/main/java/org/joint/registers/RegistryNameComparator.java
  10. +34 −32 joint-registers-spi/src/main/java/org/joint/registers/spi/AbstractJointRegistry.java
  11. +1 −2  joint-registers-spi/src/main/java/org/joint/registers/spi/JointRegister.java
  12. +1 −2  joint-registers-spi/src/main/java/org/joint/registers/spi/ManualJointRegister.java
  13. +8 −7 joint-registers/src/main/java/org/joint/registers/HierarchicalRegistry.java
  14. +5 −6 joint-registers/src/test/groovy/org/joint/Stub.groovy
  15. +2 −3 joint-registers/src/test/java/org/joint/registers/DummyJoint.java
  16. +79 −67 pom.xml
  17. +3 −3 test/src/main/java/org/joint/testing/DummyJoint.java
  18. +3 −3 test/src/main/java/org/joint/testing/UnexportedJoint.java
  19. +16 −16 test/src/test/easyb/org/joint/testing/DummyJoint.story
  20. +124 −113 tooling/src/main/java/org/joint/tooling/ServiceExporter.java
  21. +126 −125 wicket-joint/pom.xml
  22. +29 −26 wicket-joint/wicket-joint-core/src/main/java/org/joint/wicket/core/SiteNavRegistry.java
  23. +22 −23 wicket-joint/wicket-joint-core/src/main/java/org/joint/wicket/core/WicketUtil.java
  24. +48 −22 ...cket-joint-example/wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/BasePage.java
  25. +9 −8 ...cket-joint-example/wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/HomePage.java
  26. +26 −18 ...icket-joint-example/wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/NavList.java
  27. +21 −16 ...cket-joint-example/wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/NavPanel.java
  28. +6 −18 ...ket-joint-example/wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/WicketApp.java
  29. +18 −5 ...nt/wicket-joint-example/wicket-joint-example-common/src/test/easyb/org/joint/examples/common/HomePage.story
  30. +7 −8 ...nt/wicket-joint-example/wicket-joint-example-page1/src/main/java/org/joint/wicket/examples/page1/Page1.java
View
193 joint-core/src/main/java/org/joint/JointLookup.java
@@ -4,17 +4,17 @@
*/
package org.joint;
-import org.joint.exceptions.JointException;
-import org.joint.spi.Jointed;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
import org.joint.annotations.Joint;
+import org.joint.exceptions.JointException;
import org.joint.exceptions.JointInstantiationException;
import org.joint.exceptions.JointNotFoundException;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Item;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* The core, really just a wrapper around org.openide.util.Lookup with some
* added functionality for looking up Jointed classes using various aspects
@@ -42,7 +42,7 @@ private JointLookup() {
* @return
*/
public static synchronized Lookup getJointLookup() {
- return Lookup.getDefault();
+ return Lookup.getDefault();
}
/**
@@ -52,17 +52,18 @@ public static synchronized Lookup getJointLookup() {
* @return all implementations of type
*/
@SuppressWarnings("unchecked")
- public static synchronized <T extends Jointed> Set<Class<T>> lookupJoints(
- final Class<T> type) {
- Lookup.Template<T> template = new Lookup.Template<T>(type);
- Lookup.Result<T> result = Lookup.getDefault().lookup(template);
- Collection<? extends Item<T>> items = result.allItems();
- Set<Class<T>> joints = new HashSet<Class<T>>(
- items.size());
- for (Item<T> item : items) {
- joints.add((Class<T>) item.getType());
- }
- return joints;
+ public static synchronized <T> Set<Class<T>> lookupJoints(
+ final Class<T> type) {
+ Lookup.Template<T> template = new Lookup.Template<T>(type);
+ Lookup.Result<T> result = Lookup.getDefault().lookup(template);
+ Collection<? extends Item<T>> items = result.allItems();
+ Set<Class<T>> joints = new HashSet<Class<T>>(
+ items.size()
+ );
+ for (Item<T> item : items) {
+ joints.add((Class<T>) item.getType());
+ }
+ return joints;
}
/**
@@ -76,29 +77,31 @@ public static synchronized Lookup getJointLookup() {
* @Joint.id
*/
@SuppressWarnings("unchecked")
- public static <T extends Jointed> Class<T> findByJointId(
- final Class<T> type,
- final String id) throws JointNotFoundException {
-
- Set<Class<T>> joints = null;
-
- Object owner = new Object();
- synchronized (owner) {
- joints = lookupJoints(type);
- }
-
- Class<? extends T> result = null;
- for (Class<? extends T> joint : joints) {
- if (id.equals(getJointId(joint))) {
- result = joint;
- break;
- }
- }
- if (result == null) {
- throw new JointNotFoundException("Unable to find joint " + id
- + " of type " + type.getName());
- }
- return (Class<T>) result;
+ public static <T> Class<T> findByJointId(
+ final Class<T> type,
+ final String id) throws JointNotFoundException {
+
+ Set<Class<T>> joints = null;
+
+ Object owner = new Object();
+ synchronized (owner) {
+ joints = lookupJoints(type);
+ }
+
+ Class<T> result = null;
+ for (Class<T> joint : joints) {
+ if (id.equals(getJointId(joint))) {
+ result = joint;
+ break;
+ }
+ }
+ if (result == null) {
+ throw new JointNotFoundException(
+ "Unable to find joint " + id
+ + " of type " + type.getName()
+ );
+ }
+ return (Class<T>) result;
}
/**
@@ -107,9 +110,9 @@ public static synchronized Lookup getJointLookup() {
* @param type a class extending Jointed
* @return the @Joint annotation on type
*/
- public static synchronized <T extends Jointed> Joint getJoint(
- final Class<T> type) {
- return type.getAnnotation(Joint.class);
+ public static synchronized <T> Joint getJoint(
+ final Class<T> type) {
+ return type.getAnnotation(Joint.class);
}
/**
@@ -118,19 +121,19 @@ public static synchronized Lookup getJointLookup() {
* @param type Class extending Jointed
* @return @Joint.id of type
*/
- public static <T extends Jointed> String getJointId(
- final Class<T> type) {
- Object owner = new Object();
- Joint joint = null;
-
- synchronized (owner) {
- joint = getJoint(type);
- }
- String id = null;
- if (joint != null) {
- id = joint.id();
- }
- return id;
+ public static <T> String getJointId(
+ final Class<T> type) {
+ Object owner = new Object();
+ Joint joint = null;
+
+ synchronized (owner) {
+ joint = getJoint(type);
+ }
+ String id = null;
+ if (joint != null) {
+ id = joint.id();
+ }
+ return id;
}
/**
@@ -147,50 +150,48 @@ public static synchronized Lookup getJointLookup() {
* @return a new instance of type which has a @Joint.id of <param>id</param>
* @throws JointInstantiationException
* @throws JointNotFoundException
- * @throws JointException
+ * @throws JointException
*/
- public static <T extends Jointed> T newJointInstance(
- final Class<? extends T> type,
- final String id) throws JointInstantiationException,
- JointNotFoundException {
- Class<? extends T> jointClass = null;
- Object owner = new Object();
-
- synchronized (owner) {
- jointClass = findByJointId(type,
- id);
- }
-
- T joint = null;
- if (jointClass != null) {
- joint = newJointInstance(jointClass);
- }
- return joint;
+ public static <T> T newJointInstance(
+ final Class<T> type,
+ final String id) throws JointInstantiationException,
+ JointNotFoundException {
+ Class<T> jointClass = null;
+ Object owner = new Object();
+
+ synchronized (owner) {
+ jointClass = findByJointId(
+ type,
+ id
+ );
+ }
+
+ T joint = null;
+ if (jointClass != null) {
+ joint = newJointInstance(jointClass);
+ }
+ return joint;
}
- public static <T extends Jointed> T newJointInstance(
- final Class<? extends T> type) throws JointInstantiationException {
- T joint = null;
- try {
- joint = type.newInstance();
- } catch (InstantiationException ex) {
- throw new JointInstantiationException(ex);
- } catch (IllegalAccessException ex) {
- throw new JointInstantiationException(ex);
- }
- return joint;
+ public static <T> T newJointInstance(
+ final Class<T> type) throws JointInstantiationException {
+ T joint = null;
+ try {
+ joint = type.newInstance();
+ } catch (InstantiationException ex) {
+ throw new JointInstantiationException(ex);
+ } catch (IllegalAccessException ex) {
+ throw new JointInstantiationException(ex);
+ }
+ return joint;
}
- public static <T extends Jointed> T newJointInstance(
- final Class<? extends T> type,
- final String id,
- final boolean eagerLoad) throws JointInstantiationException,
- JointNotFoundException,
- JointException {
- T joint = newJointInstance(type,
- id);
-
-
- return joint;
+ public static <T> T newJointInstance(
+ final Class<T> type,
+ final String id,
+ final boolean eagerLoad) throws JointInstantiationException,
+ JointNotFoundException {
+ T joint = newJointInstance(type, id);
+ return joint;
}
}
View
33 joint-core/src/main/java/org/joint/JointNameComparator.java
@@ -5,30 +5,33 @@
package org.joint;
import java.util.Comparator;
+
import org.joint.annotations.Joint;
-import org.joint.spi.Jointed;
/**
*
* @param <T>
* @author btilford
*/
-public class JointNameComparator<T extends Jointed> implements
- Comparator<Class<T>> {
+public class JointNameComparator<T> implements
+ Comparator<Class<T>> {
@Override
public int compare(Class<T> j1,
- Class<T> j2) {
- int val = 0;
- if (JointLookup.getJointId(j1) != null) {
- val = 1;
- if (JointLookup.getJointId(j2) != null) {
- val = j1.getAnnotation(Joint.class).id().compareTo(j2.getAnnotation(
- Joint.class).id());
- }
- } else if (JointLookup.getJointId(j2) != null) {
- val = -1;
- }
- return val;
+ Class<T> j2) {
+ int val = 0;
+ if (JointLookup.getJointId(j1) != null) {
+ val = 1;
+ if (JointLookup.getJointId(j2) != null) {
+ val = j1.getAnnotation(Joint.class).id().compareTo(
+ j2.getAnnotation(
+ Joint.class
+ ).id()
+ );
+ }
+ } else if (JointLookup.getJointId(j2) != null) {
+ val = -1;
+ }
+ return val;
}
}
View
26 joint-core/src/main/java/org/joint/JointUtil.java
@@ -4,9 +4,8 @@
*/
package org.joint;
-import org.joint.exceptions.DefaultJointException;
import org.joint.annotations.Joint;
-import org.joint.spi.Jointed;
+import org.joint.exceptions.DefaultJointException;
/**
*
@@ -17,25 +16,8 @@
private JointUtil() {
}
- @SuppressWarnings("unchecked")
- public static boolean isJoint(final Class type) throws
- DefaultJointException {
- boolean extendsJointed = false;
- for (Class superType : type.getClasses()) {
- if (superType.equals(Jointed.class)) {
- extendsJointed = true;
- break;
- }
- }
- if (extendsJointed) {
- if (type.isAnnotationPresent(Joint.class)) {
- return true;
- } else {
- throw new DefaultJointException("Missing @Joint annotation");
- }
- } else {
- throw new DefaultJointException(type.getName() + " is not a " + Jointed.class.
- getName());
- }
+
+ public static boolean isJoint(final Class type) {
+ return type.isAnnotationPresent(Joint.class);
}
}
View
2  joint-core/src/main/java/org/joint/annotations/Joint.java
@@ -9,8 +9,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.joint.spi.Jointed;
-import org.joint.tooling.annotations.Export;
/**
* All implementations of Jointed should be annotated with @Joint to be given
View
5 joint-core/src/main/java/org/joint/spi/Jointed.java
@@ -5,10 +5,11 @@
package org.joint.spi;
/**
- * The core class. All implementations will implement or extend this marker
- * interface in some way.
+ * No need for a marker interface
* @author btilford
+ * @deprecated
*/
+@Deprecated
public interface Jointed {
}
View
28 joint-nav-spi/src/main/java/org/joint/nav/NavPositionComparator.java
@@ -4,29 +4,31 @@
*/
package org.joint.nav;
-import java.util.Comparator;
import org.joint.nav.spi.Navigatable;
+import java.util.Comparator;
+
/**
*
* @param <T>
* @author btilford
*/
public class NavPositionComparator<T extends Navigatable> implements
- Comparator<Class<T>> {
+ Comparator<Class<T>> {
@Override
public int compare(final Class<T> o1,
- final Class<T> o2) {
- int val = 0;
- if (NavUtil.isNavigationAnnotted(o1) && NavUtil.isNavigationAnnotted(o2)) {
- val = NavUtil.getNavigation(o1).position() - NavUtil.getNavigation(
- o2).position();
- } else if (NavUtil.isNavigationAnnotted(o1)) {
- val = 1;
- } else if (NavUtil.isNavigationAnnotted(o2)) {
- val = -1;
- }
- return val;
+ final Class<T> o2) {
+ int val = 0;
+ if (NavUtil.isNavigationAnnotted(o1) && NavUtil.isNavigationAnnotted(o2)) {
+ val = NavUtil.getNavigation(o1).position() - NavUtil.getNavigation(
+ o2
+ ).position();
+ } else if (NavUtil.isNavigationAnnotted(o1)) {
+ val = 1;
+ } else if (NavUtil.isNavigationAnnotted(o2)) {
+ val = -1;
+ }
+ return val;
}
}
View
32 joint-nav-spi/src/main/java/org/joint/nav/NavUtil.java
@@ -17,26 +17,28 @@ private NavUtil() {
}
public static boolean validate(
- final Class<? extends Navigatable> navigatable) {
- if (!isNavigationAnnotted(navigatable)) {
- throw new IllegalArgumentException(
- "Class " + navigatable.getName()
- + " is not Annotated with @Navigation!");
- }
- return true;
+ final Class<? extends Navigatable> navigatable) {
+ if (!isNavigationAnnotted(navigatable)) {
+ throw new IllegalArgumentException(
+ "Class " + navigatable.getName()
+ + " is not Annotated with @Navigation!"
+ );
+ }
+ return true;
}
public static boolean isNavigationAnnotted(
- final Class<? extends Navigatable> navigatable) {
- return navigatable.isAnnotationPresent(Navigation.class);
+ final Class<? extends Navigatable> navigatable) {
+ return navigatable.isAnnotationPresent(Navigation.class);
}
public static Navigation getNavigation(
- final Class<? extends Navigatable> navigatable) {
- if (isNavigationAnnotted(navigatable)) {
- return navigatable.getAnnotation(Navigation.class);
- }
- throw new IllegalArgumentException(
- "Navigatable class was not annotated properly. Missing @Navigation annotation.");
+ final Class<? extends Navigatable> navigatable) {
+ if (isNavigationAnnotted(navigatable)) {
+ return navigatable.getAnnotation(Navigation.class);
+ }
+ throw new IllegalArgumentException(
+ "Navigatable class was not annotated properly. Missing @Navigation annotation."
+ );
}
}
View
5 joint-nav-spi/src/main/java/org/joint/nav/spi/Navigatable.java
@@ -4,13 +4,12 @@
*/
package org.joint.nav.spi;
-import org.joint.spi.Jointed;
-
/**
*
* @param <T>
* @author btilford
*/
-public interface Navigatable extends Jointed {
+public interface Navigatable {
+
String getTitle();
}
View
34 joint-registers-spi/src/main/java/org/joint/registers/RegistryNameComparator.java
@@ -4,10 +4,10 @@
*/
package org.joint.registers;
-import java.util.Comparator;
import org.joint.JointLookup;
import org.joint.registers.spi.JointRegister;
-import org.joint.spi.Jointed;
+
+import java.util.Comparator;
/**
*
@@ -15,21 +15,25 @@
* @param <T>
* @author btilford
*/
-public class RegistryNameComparator<J extends Jointed, T extends JointRegister<J>> implements
- Comparator<T> {
+public class RegistryNameComparator<J, T extends JointRegister<J>> implements
+ Comparator<T> {
@Override
public int compare(final T o1, final T o2) {
- int val = 0;
- if (JointLookup.getJointId(o1.getClass()) != null && JointLookup.getJointId(
- o2.getClass()) != null) {
- val = JointLookup.getJointId(o1.getClass()).compareTo(JointLookup.getJointId(
- o2.getClass()));
- } else if (JointLookup.getJointId(o1.getClass()) != null) {
- val = 1;
- } else if (JointLookup.getJointId(o2.getClass()) != null) {
- val = -1;
- }
- return val;
+ int val = 0;
+ if (JointLookup.getJointId(o1.getClass()) != null && JointLookup.getJointId(
+ o2.getClass()
+ ) != null) {
+ val = JointLookup.getJointId(o1.getClass()).compareTo(
+ JointLookup.getJointId(
+ o2.getClass()
+ )
+ );
+ } else if (JointLookup.getJointId(o1.getClass()) != null) {
+ val = 1;
+ } else if (JointLookup.getJointId(o2.getClass()) != null) {
+ val = -1;
+ }
+ return val;
}
}
View
66 joint-registers-spi/src/main/java/org/joint/registers/spi/AbstractJointRegistry.java
@@ -4,7 +4,10 @@
*/
package org.joint.registers.spi;
-import org.joint.spi.Jointed;
+
+import org.joint.annotations.Joint;
+import org.joint.tooling.annotations.Export;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -12,8 +15,6 @@
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import org.joint.annotations.Joint;
-import org.joint.tooling.annotations.Export;
/**
* Partially implemented JointRegister backed by a HashMap
@@ -21,28 +22,28 @@
* @author btilford
*/
@Export({JointRegister.class})
-public abstract class AbstractJointRegistry<T extends Jointed> implements
- JointRegister<T>,
- Loadable,
- Purgeable,
- ManualJointRegister<T>,
- Serializable {
+public abstract class AbstractJointRegistry<T> implements
+ JointRegister<T>,
+ Loadable,
+ Purgeable,
+ ManualJointRegister<T>,
+ Serializable {
private Map<String, Class<T>> joints =
- new TreeMap<String, Class<T>>();
+ new TreeMap<String, Class<T>>();
@Override
public synchronized List<Class<T>> getJoints() {
- List<Class<T>> list = new ArrayList<Class<T>>(joints.values());
- Collections.sort(list, this.getJointsComparator());
- return list;
+ List<Class<T>> list = new ArrayList<Class<T>>(joints.values());
+ Collections.sort(list, this.getJointsComparator());
+ return list;
}
public abstract Comparator<Class<T>> getJointsComparator();
@Override
public synchronized Class<T> getJoint(final String jointId) {
- return joints.get(jointId);
+ return joints.get(jointId);
}
/**
@@ -51,35 +52,36 @@
*/
@Override
public synchronized void registerJoint(final Class<T> type) {
- joints.put(type.getAnnotation(Joint.class).id(), type);
+ joints.put(type.getAnnotation(Joint.class).id(), type);
}
@Override
public void purge() {
- this.joints.clear();
+ this.joints.clear();
}
@Override
public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final AbstractJointRegistry<T> other =
- (AbstractJointRegistry<T>) obj;
- if (this.joints != other.joints && (this.joints == null || !this.joints.equals(
- other.joints))) {
- return false;
- }
- return true;
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final AbstractJointRegistry<T> other =
+ (AbstractJointRegistry<T>) obj;
+ if (this.joints != other.joints && (this.joints == null || !this.joints.equals(
+ other.joints
+ ))) {
+ return false;
+ }
+ return true;
}
@Override
public int hashCode() {
- int hash = 7;
- hash = 23 * hash + (this.joints != null ? this.joints.hashCode() : 0);
- return hash;
+ int hash = 7;
+ hash = 23 * hash + (this.joints != null ? this.joints.hashCode() : 0);
+ return hash;
}
}
View
3  joint-registers-spi/src/main/java/org/joint/registers/spi/JointRegister.java
@@ -5,14 +5,13 @@
package org.joint.registers.spi;
import java.util.Collection;
-import org.joint.spi.Jointed;
/**
* Context for registering joints
* @param <T>
* @author btilford
*/
-public interface JointRegister<T extends Jointed> extends Jointed {
+public interface JointRegister<T> {
Collection<Class<T>> getJoints();
View
3  joint-registers-spi/src/main/java/org/joint/registers/spi/ManualJointRegister.java
@@ -4,7 +4,6 @@
*/
package org.joint.registers.spi;
-import org.joint.spi.Jointed;
/**
* Intended to be used with JointRegister implementations that allow registering
@@ -12,7 +11,7 @@
* @param <T>
* @author btilford
*/
-public interface ManualJointRegister<T extends Jointed> extends JointRegister<T> {
+public interface ManualJointRegister<T> extends JointRegister<T> {
void registerJoint(Class<T> type);
}
View
15 joint-registers/src/main/java/org/joint/registers/HierarchicalRegistry.java
@@ -8,8 +8,8 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+
import org.joint.registers.spi.AbstractJointRegistry;
-import org.joint.spi.Jointed;
import org.joint.registers.spi.JointRegister;
/**
@@ -23,7 +23,7 @@
* @param <T>
* @author btilford
*/
-public abstract class HierarchicalRegistry<T extends Jointed> extends AbstractJointRegistry {
+public abstract class HierarchicalRegistry<T> extends AbstractJointRegistry {
static final long serialVersionUID = 1L;
@@ -39,15 +39,16 @@
*/
@SuppressWarnings("unchecked")
public List<JointRegister<T>> getChildren() {
- List<JointRegister<T>> list = new ArrayList<JointRegister<T>>(
- children.getJoints());
- Collections.sort(list, getChildrenComparator());
- return list;
+ List<JointRegister<T>> list = new ArrayList<JointRegister<T>>(
+ children.getJoints()
+ );
+ Collections.sort(list, getChildrenComparator());
+ return list;
}
public abstract Comparator<JointRegister<T>> getChildrenComparator();
public synchronized HierarchicalRegistry<? extends T> getParent() {
- return parent;
+ return parent;
}
}
View
11 joint-registers/src/test/groovy/org/joint/Stub.groovy
@@ -4,18 +4,17 @@
*/
package org.joint
-import org.joint.spi.Jointed
+
import org.joint.annotations.Joint
import org.joint.tooling.annotations.Export
-
/**
*
* @author btilford
*/
-@Joint(id="test")
-@Export(Jointed.class)
-class Stub implements Jointed {
-
+@Joint(id = "test")
+@Export(Object.class)
+class Stub {
+
}
View
5 joint-registers/src/test/java/org/joint/registers/DummyJoint.java
@@ -4,7 +4,6 @@
*/
package org.joint.registers;
-import org.joint.spi.Jointed;
import org.joint.annotations.Joint;
import org.joint.tooling.annotations.Export;
@@ -13,8 +12,8 @@
* @author btilford
*/
@Joint(id = DummyJoint.JOINT_ID)
-@Export(Jointed.class)
-public class DummyJoint implements Jointed {
+@Export(Object.class)
+public class DummyJoint {
static final String JOINT_ID = "testjoint";
View
146 pom.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.joint</groupId>
<artifactId>joint</artifactId>
<packaging>pom</packaging>
<version>1.0-M6-SNAPSHOT</version>
<description>
- A plugin framework based on the Netbeans Lookup API
+ A plugin framework based on the Netbeans Lookup API
</description>
<name>joint</name>
<inceptionYear>2009</inceptionYear>
@@ -80,23 +81,23 @@
</execution>
</executions>
</plugin>
- <!--<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.0-beta-4</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <doCheck>false</doCheck>
- <doUpdate>false</doUpdate>
- </configuration>
- </plugin>-->
+ <!--<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ <version>1.0-beta-4</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>create</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <doCheck>false</doCheck>
+ <doUpdate>false</doUpdate>
+ </configuration>
+ </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -120,7 +121,7 @@
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>${gmaven.version}</version>
@@ -162,7 +163,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.4</version>
+ <version>1.7.2</version>
</dependency>
</dependencies>
</plugin>
@@ -170,7 +171,7 @@
<plugin>
<groupId>org.easyb</groupId>
<artifactId>maven-easyb-plugin</artifactId>
- <version>0.9.5.2</version>
+ <version>0.9.7</version>
<inherited>true</inherited>
<executions>
<execution>
@@ -179,6 +180,17 @@
</goals>
</execution>
</executions>
+ <configuration>
+ <storyType>html</storyType>
+ <storyReport>${project.build.directory}/easyb/easyb_report.html</storyReport>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</pluginManagement>
@@ -191,10 +203,10 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
- <!--<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>buildnumber-maven-plugin</artifactId>
- </plugin>-->
+ <!--<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>buildnumber-maven-plugin</artifactId>
+ </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -207,7 +219,7 @@
<groupId>org.easyb</groupId>
<artifactId>maven-easyb-plugin</artifactId>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
</plugin>
@@ -220,23 +232,23 @@
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
- <!--<dependency>
- <groupId>org.codehaus.groovy.maven.runtime</groupId>
- <artifactId>gmaven-runtime-1.6</artifactId>
- <version>1.0-rc-5</version>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
+ <!--<dependency>
+ <groupId>org.codehaus.groovy.maven.runtime</groupId>
+ <artifactId>gmaven-runtime-1.6</artifactId>
+ <version>1.0-rc-5</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
- </exclusions>
- </dependency>-->
+ </exclusions>
+ </dependency>-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
- <!--<classifier>jdk15</classifier>-->
+ <!--<classifier>jdk15</classifier>-->
<scope>test</scope>
</dependency>
<dependency>
@@ -245,11 +257,11 @@
<version>0.9.7</version>
<scope>test</scope>
</dependency>
- <!--
- Located in Netbeans repository
- url: http://bits.netbeans.org/maven2/
- index: http://bits.netbeans.org/maven2/.index/
- -->
+ <!--
+ Located in Netbeans repository
+ url: http://bits.netbeans.org/maven2/
+ index: http://bits.netbeans.org/maven2/.index/
+ -->
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-lookup</artifactId>
@@ -262,10 +274,10 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <!--
- hmm
- <classifier>jdk15</classifier>
- -->
+ <!--
+ hmm
+ <classifier>jdk15</classifier>
+ -->
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
@@ -275,13 +287,13 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>
- <!--<dependency>
- <groupId>org.codehaus.groovy.maven.runtime</groupId>
- <artifactId>gmaven-runtime-1.6</artifactId>
- </dependency>-->
+ <!--<dependency>
+ <groupId>org.codehaus.groovy.maven.runtime</groupId>
+ <artifactId>gmaven-runtime-1.6</artifactId>
+ </dependency>-->
</dependencies>
-
+
<modules>
<module>tooling</module>
<module>joint-core</module>
@@ -293,11 +305,11 @@
<module>joint-nav-spi</module>
</modules>
<repositories>
- <repository>
- <id>netbeans</id>
- <name>openide</name>
- <url>http://bits.netbeans.org/maven2/</url>
- </repository>
+ <repository>
+ <id>netbeans</id>
+ <name>openide</name>
+ <url>http://bits.netbeans.org/maven2/</url>
+ </repository>
</repositories>
<distributionManagement>
<repository>
@@ -332,9 +344,9 @@
<version>2.4.3</version>
<configuration>
<skip>false</skip>
- <!--<suiteXmlFiles>
- <suiteXmlFile>${basedir}/src/test/resources/conf/testng.xml</suiteXmlFile>
- </suiteXmlFiles>-->
+ <!--<suiteXmlFiles>
+ <suiteXmlFile>${basedir}/src/test/resources/conf/testng.xml</suiteXmlFile>
+ </suiteXmlFiles>-->
</configuration>
</plugin>
@@ -354,7 +366,7 @@
<ruleset>/rulesets/naming.xml</ruleset>
<ruleset>/rulesets/braces.xml</ruleset>
- <!--<ruleset>/rulesets/controversial.xml</ruleset>-->
+ <!--<ruleset>/rulesets/controversial.xml</ruleset>-->
</rulesets>
<format>xml</format>
<linkXRef>true</linkXRef>
@@ -385,9 +397,9 @@
<version>2.4</version>
<configuration>
<encoding>utf-8</encoding>
- <!--
- fixes issue with dashboard plugin
- -->
+ <!--
+ fixes issue with dashboard plugin
+ -->
<xmlOutputDirectory>${project.build.directory}</xmlOutputDirectory>
<tags>
<tag>@fixme</tag>
@@ -436,13 +448,13 @@
</plugins>
</reporting>
- <properties>
+ <properties>
<netbeans.version>RELEASE69</netbeans.version>
<testng.version>5.12.1</testng.version>
<project.source.level>1.6</project.source.level>
<project.target.platform>1.6</project.target.platform>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gmaven.version>1.3</gmaven.version>
- <groovy.version>1.7.4</groovy.version>
+ <groovy.version>1.7.2</groovy.version>
</properties>
</project>
View
6 test/src/main/java/org/joint/testing/DummyJoint.java
@@ -5,14 +5,14 @@
package org.joint.testing;
import org.joint.annotations.Joint;
-import org.joint.spi.Jointed;
import org.joint.tooling.annotations.Export;
/**
*
* @author btilford
*/
-@Export(Jointed.class)
+@Export(Object.class)
@Joint(id = "dummy")
-public class DummyJoint implements Jointed {
+public class DummyJoint {
+
}
View
6 test/src/main/java/org/joint/testing/UnexportedJoint.java
@@ -5,14 +5,14 @@
package org.joint.testing;
import org.joint.annotations.Joint;
-import org.joint.spi.Jointed;
import org.joint.tooling.annotations.Export;
/**
*
* @author btilford
*/
-@Export({Jointed.class})
+@Export({Object.class})
@Joint(id = "unexported")
-public class UnexportedJoint implements Jointed {
+public class UnexportedJoint {
+
}
View
32 test/src/test/easyb/org/joint/testing/DummyJoint.story
@@ -1,54 +1,54 @@
package org.joint.testing
+
import static org.joint.JointLookup.*
-import org.joint.spi.Jointed
scenario "Lookup all Jointed", {
given "A correctly exported joint called 'dummy'", {
- joint = null
- joints = []
+ joint = null
+ joints = []
}
when "all Jointed implementations are looked up", {
- joints = lookupJoints(Jointed.class)
+ joints = lookupJoints(Jointed.class)
}
then "there should be at least 1 joint on the classpath", {
- joints.empty.shouldBe false
- println "number of joints on the classpath ${joints?.size()}"
+ joints.empty.shouldBe false
+ println "number of joints on the classpath ${joints?.size()}"
}
}
scenario "Lookup joint by id", {
given "A joint with id of dummy"
when "looked up", {
- joint = findByJointId(Jointed.class,"dummy");
+ joint = findByJointId(Jointed.class, "dummy");
}
then "it should have been found", {
- println "Joint: " + (joint != null ? joint?.getName() : "null")
- joint.shouldNotBe null
+ println "Joint: " + (joint != null ? joint?.getName() : "null")
+ joint.shouldNotBe null
}
}
scenario "Get the joint's id", {
given "A class with a join id of dummy", {
- dummy = DummyJoint.class
+ dummy = DummyJoint.class
}
when "the id is retreived from JointLookup", {
- id = getJointId(dummy)
+ id = getJointId(dummy)
}
then "the id should be the expexted dummy", {
- id.shouldBe "dummy"
+ id.shouldBe "dummy"
}
}
scenario "Joint instantiation", {
given "An implementation of Jointed with an id of dummy", {
- type = DummyJoint.class
- id = "dummy"
+ type = DummyJoint.class
+ id = "dummy"
}
when "JointLookup.newJointInstance is called", {
- instance = newJointInstance(type,id)
+ instance = newJointInstance(type, id)
}
then "No exceptions are thrown", {
}
and "An instance is created", {
- instance.shouldNotBe null
+ instance.shouldNotBe null
}
}
View
237 tooling/src/main/java/org/joint/tooling/ServiceExporter.java
@@ -4,12 +4,8 @@
*/
package org.joint.tooling;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
+import org.joint.tooling.annotations.Export;
+
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
@@ -22,7 +18,12 @@
import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
-import org.joint.tooling.annotations.Export;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
/**
*
@@ -44,26 +45,27 @@ public ServiceExporter() {
* Key = file name (interface fqn)
* Value = implementation class fqn
*/
+
private Map<String, Set<String>> services =
- new TreeMap<String, Set<String>>();
+ new TreeMap<String, Set<String>>();
@Override
public boolean process(final Set<? extends TypeElement> annotations,
- final RoundEnvironment roundEnv) {
- note("ServiceExporter.process() : round " + round);
- /*
- * We only need to process 1 time.
- */
- if (round > 1) {
- return false;
- }
- round++;
- /* Start building the list of exports */
- processRootElements(roundEnv.getRootElements());
- /* list is complete create and print the files */
- export();
- /* false lets other Processors process the Export annotation as well */
- return false;
+ final RoundEnvironment roundEnv) {
+ note("ServiceExporter.process() : round " + round);
+ /*
+ * We only need to process 1 time.
+ */
+ if (round > 1) {
+ return false;
+ }
+ round++;
+ /* Start building the list of exports */
+ processRootElements(roundEnv.getRootElements());
+ /* list is complete create and print the files */
+ export();
+ /* false lets other Processors process the Export annotation as well */
+ return false;
}
/**
@@ -71,9 +73,9 @@ public boolean process(final Set<? extends TypeElement> annotations,
* @param rootElements
*/
private void processRootElements(final Set<? extends Element> rootElements) {
- for (Element element : rootElements) {
- processElement(element);
- }
+ for (Element element : rootElements) {
+ processElement(element);
+ }
}
/**
@@ -81,22 +83,23 @@ private void processRootElements(final Set<? extends Element> rootElements) {
* @param element
*/
private void processElement(final Element element) {
- for (AnnotationMirror annotation : processingEnv.getElementUtils().getAllAnnotationMirrors(
- element)) {
- /*
- * Only need to process @Export annotations.
- */
- if (isExportAnnotation(annotation)) {
- note(annotation.getAnnotationType().toString());
- for (AnnotationValue value :
- annotation.getElementValues().values()) {
- /*
- * process each exported class.
- */
- processAnnotationValue(value, element);
- }
- }
- }
+ for (AnnotationMirror annotation : processingEnv.getElementUtils().getAllAnnotationMirrors(
+ element
+ )) {
+ /*
+ * Only need to process @Export annotations.
+ */
+ if (isExportAnnotation(annotation)) {
+ note(annotation.getAnnotationType().toString());
+ for (AnnotationValue value :
+ annotation.getElementValues().values()) {
+ /*
+ * process each exported class.
+ */
+ processAnnotationValue(value, element);
+ }
+ }
+ }
}
/**
@@ -105,27 +108,31 @@ private void processElement(final Element element) {
* @param element
*/
private void processAnnotationValue(final AnnotationValue value,
- final Element element) {
- note(value.toString());
- /*
- * We don't want the .class extension on the export file name(s).
- */
- for (String spiFqn : value.getValue().toString().split(",")) {
- String spiFileName = spiFqn.replaceAll(classRegx, "");
- if (!services.containsKey(spiFileName)) {
- services.put(spiFileName, new TreeSet<String>());
- }
- services.get(
- spiFileName).add(
- element.toString().replaceAll(
- classRegx, ""));
-
- }
+ final Element element) {
+ note(value.toString());
+ /*
+ * We don't want the .class extension on the export file name(s).
+ */
+ for (String spiFqn : value.getValue().toString().split(",")) {
+ String spiFileName = spiFqn.replaceAll(classRegx, "");
+ if (!services.containsKey(spiFileName)) {
+ services.put(spiFileName, new TreeSet<String>());
+ }
+ services.get(
+ spiFileName
+ ).add(
+ element.toString().replaceAll(
+ classRegx, ""
+ )
+ );
+
+ }
}
private boolean isExportAnnotation(final AnnotationMirror annotation) {
- return annotation.getAnnotationType().toString().equals(
- Export.class.getName());
+ return annotation.getAnnotationType().toString().equals(
+ Export.class.getName()
+ );
}
/**
@@ -133,64 +140,68 @@ private boolean isExportAnnotation(final AnnotationMirror annotation) {
* implementations.
*/
private void export() {
- for (String service : services.keySet()) {
- FileObject file = getServiceExportFile(service);
- if (file != null) {
- PrintWriter out = null;
- try {
- out = new PrintWriter(file.openOutputStream(), true);
- for (String export : services.get(service)) {
- note("\t\texporting " + export);
- out.println(export);
- }
- } catch (IOException ex) {
- note(ex.getMessage());
- } finally {
- if (out != null) {
- out.close();
- }
- }
- } else {
- processingEnv.getMessager().printMessage(Kind.ERROR,
- "Unable to get a file to write to.");
- }
- }
+ for (String service : services.keySet()) {
+ FileObject file = getServiceExportFile(service);
+ if (file != null) {
+ PrintWriter out = null;
+ try {
+ out = new PrintWriter(file.openOutputStream(), true);
+ for (String export : services.get(service)) {
+ note("\t\texporting " + export);
+ out.println(export);
+ }
+ } catch (IOException ex) {
+ note(ex.getMessage());
+ } finally {
+ if (out != null) {
+ out.close();
+ }
+ }
+ } else {
+ processingEnv.getMessager().printMessage(
+ Kind.ERROR,
+ "Unable to get a file to write to."
+ );
+ }
+ }
}
private FileObject getServiceExportFile(final String service) {
- FileObject file = null;
- try {
- /*
- * First try to create the file.
- */
- file =
- processingEnv.getFiler().createResource(
- StandardLocation.CLASS_OUTPUT,
- "", serviceFolder + service);
- } catch (IOException ex1) {
- try {
- /*
- * fall back to getting the file (create fails if it already
- * exists.
- */
- file =
- processingEnv.getFiler().getResource(
- StandardLocation.CLASS_OUTPUT,
- "",
- serviceFolder + service);
- } catch (IOException ex) {
- note(ex.getMessage());
- }
- }
- if (file == null) {
- note("Unable to get or create export file \"" + service + "\".");
- } else {
- note(file.getName());
- }
- return file;
+ FileObject file = null;
+ try {
+ /*
+ * First try to create the file.
+ */
+ file =
+ processingEnv.getFiler().createResource(
+ StandardLocation.CLASS_OUTPUT,
+ "", serviceFolder + service
+ );
+ } catch (IOException ex1) {
+ try {
+ /*
+ * fall back to getting the file (create fails if it already
+ * exists.
+ */
+ file =
+ processingEnv.getFiler().getResource(
+ StandardLocation.CLASS_OUTPUT,
+ "",
+ serviceFolder + service
+ );
+ } catch (IOException ex) {
+ note(ex.getMessage());
+ }
+ }
+ if (file == null) {
+ note("Unable to get or create export file \"" + service + "\".");
+ } else {
+ note(file.getName());
+ }
+ return file;
}
protected void note(final String note) {
- processingEnv.getMessager().printMessage(Kind.NOTE, note);
+ processingEnv.getMessager().printMessage(Kind.NOTE, note);
}
}
View
251 wicket-joint/pom.xml
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>joint</artifactId>
- <groupId>org.joint</groupId>
- <version>1.0-M6-SNAPSHOT</version>
+ <artifactId>joint</artifactId>
+ <groupId>org.joint</groupId>
+ <version>1.0-M6-SNAPSHOT</version>
</parent>
<modules>
- <module>wicket-joint-example</module>
- <module>wicket-joint-core</module>
+ <module>wicket-joint-example</module>
+ <module>wicket-joint-core</module>
</modules>
<modelVersion>4.0.0</modelVersion>
<groupId>org.joint</groupId>
@@ -16,134 +17,134 @@
<version>1.0-M6-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket</artifactId>
- <version>${dep.wicket.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.4.2</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>${jetty.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-management</artifactId>
- <version>${jetty.version}</version>
- <scope>provided</scope>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket</artifactId>
+ <version>${dep.wicket.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>${jetty.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>${jetty.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-management</artifactId>
+ <version>${jetty.version}</version>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>org.joint</groupId>
- <artifactId>joint-registers</artifactId>
- <version>1.0-M6-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.joint</groupId>
- <artifactId>joint-nav</artifactId>
- <version>1.0-M6-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.joint</groupId>
- <artifactId>wicket-joint-core</artifactId>
- <version>1.0-M6-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.joint</groupId>
- <artifactId>wicket-joint-example-common</artifactId>
- <version>1.0-M6-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.joint</groupId>
- <artifactId>wicket-joint-example-page1</artifactId>
- <version>1.0-M6-SNAPSHOT</version>
- </dependency>
+ <dependency>
+ <groupId>org.joint</groupId>
+ <artifactId>joint-registers</artifactId>
+ <version>1.0-M6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.joint</groupId>
+ <artifactId>joint-nav</artifactId>
+ <version>1.0-M6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.joint</groupId>
+ <artifactId>wicket-joint-core</artifactId>
+ <version>1.0-M6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.joint</groupId>
+ <artifactId>wicket-joint-example-common</artifactId>
+ <version>1.0-M6-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.joint</groupId>
+ <artifactId>wicket-joint-example-page1</artifactId>
+ <version>1.0-M6-SNAPSHOT</version>
+ </dependency>
- </dependencies>
+ </dependencies>
</dependencyManagement>
<dependencies>
- <dependency>
- <groupId>org.joint</groupId>
- <artifactId>joint-nav</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.joint</groupId>
+ <artifactId>joint-nav</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket</artifactId>
+ </dependency>
</dependencies>
<build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- <resource>
- <directory>src/main/groovy</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.groovy</exclude>
- </excludes>
- </resource>
- </resources>
- <testResources>
- <testResource>
- <directory>src/test/java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </testResource>
- <testResource>
- <directory>src/test/groovy</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.groovy</exclude>
- </excludes>
- </testResource>
- </testResources>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/groovy</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.groovy</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ <testResource>
+ <directory>src/test/groovy</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.groovy</exclude>
+ </excludes>
+ </testResource>
+ </testResources>
</build>
<properties>
- <jetty.version>6.1.4</jetty.version>
- <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
- <dep.wicket.version>1.4.2</dep.wicket.version>
- <org-openide-util.version>RELEASE67</org-openide-util.version>
- <testng.version>5.9</testng.version>
- <project.source.level>1.6</project.source.level>
- <project.target.platform>1.6</project.target.platform>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jetty.version>6.1.4</jetty.version>
+ <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
+ <dep.wicket.version>1.4.12</dep.wicket.version>
+ <org-openide-util.version>RELEASE67</org-openide-util.version>
+ <testng.version>5.9</testng.version>
+ <project.source.level>1.6</project.source.level>
+ <project.target.platform>1.6</project.target.platform>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
View
55 wicket-joint/wicket-joint-core/src/main/java/org/joint/wicket/core/SiteNavRegistry.java
@@ -4,10 +4,8 @@
*/
package org.joint.wicket.core;
-import java.util.Comparator;
-import java.util.Set;
+import org.apache.wicket.Page;
import org.joint.JointLookup;
-import org.joint.JointNameComparator;
import org.joint.annotations.Joint;
import org.joint.exceptions.JointNotFoundException;
import org.joint.nav.NavPositionComparator;
@@ -16,18 +14,20 @@
import org.joint.registers.HierarchicalRegistry;
import org.joint.registers.RegistryNameComparator;
import org.joint.registers.spi.JointRegister;
-import org.joint.spi.Jointed;
+
+import java.util.Comparator;
+import java.util.Set;
/**
* Intended for use as a the Root Navigation of a site. Loads all Navigatable
* implementations which are part of "registry.nav.wicket.site" registry.
* e.g. @Navigation(navRegistryIds = {"registry.nav.wicket.site",...}...)
*
- *
+ *
* @author btilford
*/
@Joint(id = SiteNavRegistry.JOINT_ID)
-public class SiteNavRegistry extends HierarchicalRegistry<Navigatable> {
+public class SiteNavRegistry<T extends Page & Navigatable> extends HierarchicalRegistry<T> {
static final long serialVersionUID = 2L;
@@ -36,37 +36,40 @@
@Override
@SuppressWarnings("unchecked")
public void load() throws JointNotFoundException {
- Set<Class<Navigatable>> allNav = JointLookup.lookupJoints(
- Navigatable.class);
- for (Class<? extends Navigatable> nav : allNav) {
- if (nav.isAnnotationPresent(Navigation.class)) {
- for (String id :
- nav.getAnnotation(Navigation.class).navRegistryIds()) {
- if (id.equals(JOINT_ID)) {
- registerJoint(nav);
- }
- }
- } else {
- throw new JointNotFoundException("Unable to load Navigatable class "
- + nav.getName() + " it was not annoted with @Navigation");
+ Set<Class<Navigatable>> allNav = JointLookup.lookupJoints(
+ Navigatable.class
+ );
+ for (Class<? extends Navigatable> nav : allNav) {
+ if (nav.isAnnotationPresent(Navigation.class)) {
+ for (String id :
+ nav.getAnnotation(Navigation.class).navRegistryIds()) {
+ if (id.equals(JOINT_ID)) {
+ registerJoint(nav);
+ }
+ }
+ } else {
+ throw new JointNotFoundException(
+ "Unable to load Navigatable class "
+ + nav.getName() + " it was not annoted with @Navigation"
+ );
- }
- }
+ }
+ }
}
@Override
@SuppressWarnings("unchecked")
- public void registerChild(HierarchicalRegistry<Navigatable> child) {
- this.children.registerJoint(child.getClass());
+ public void registerChild(HierarchicalRegistry<T> child) {
+ this.children.registerJoint(child.getClass());
}
@Override
- public Comparator<JointRegister<Navigatable>> getChildrenComparator() {
- return new RegistryNameComparator<Navigatable, JointRegister<Navigatable>>();
+ public Comparator<JointRegister<T>> getChildrenComparator() {
+ return new RegistryNameComparator<T, JointRegister<T>>();
}
@Override
public Comparator<Class<Navigatable>> getJointsComparator() {
- return new NavPositionComparator<Navigatable>();
+ return new NavPositionComparator<Navigatable>();
}
}
View
45 wicket-joint/wicket-joint-core/src/main/java/org/joint/wicket/core/WicketUtil.java
@@ -9,7 +9,6 @@
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.joint.nav.NavUtil;
-import org.joint.nav.annotations.Navigation;
import org.joint.nav.spi.Navigatable;
/**
@@ -22,23 +21,23 @@ private WicketUtil() {
}
public static boolean isWebPage(
- final Class<? extends Navigatable> navigatable) {
- for (Class clazz : navigatable.getClasses()) {
- if (clazz.equals(WebPage.class)) {
- return true;
- }
- }
- return false;
+ final Class<? extends Navigatable> navigatable) {
+ for (Class clazz : navigatable.getClasses()) {
+ if (clazz.equals(WebPage.class)) {
+ return true;
+ }
+ }
+ return false;
}
public static boolean isPanel(
- final Class<? extends Navigatable> navigatable) {
- for (Class clazz : navigatable.getClasses()) {
- if (clazz.equals(Panel.class)) {
- return true;
- }
- }
- return false;
+ final Class<? extends Navigatable> navigatable) {
+ for (Class clazz : navigatable.getClasses()) {
+ if (clazz.equals(Panel.class)) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -49,13 +48,13 @@ public static boolean isPanel(
* @return
*/
public static <T extends WebPage & Navigatable> Link<T> linkForPage(
- final String id,
- final Class<T> type) {
- Link<T> link = null;
- if (NavUtil.isNavigationAnnotted(type)) {
- link = new BookmarkablePageLink<T>(id, type);
- }
- return link;
+ final String id,
+ final Class<T> type) {
+ Link<T> link = null;
+ if (NavUtil.isNavigationAnnotted(type)) {
+ link = new BookmarkablePageLink<T>(id, type);
+ }
+ return link;
}
-
+
}
View
70 .../wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/BasePage.java
@@ -16,13 +16,19 @@
*/
package org.joint.wicket.examples.common;
-import java.util.Arrays;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
+import org.joint.exceptions.JointNotFoundException;
import org.joint.nav.spi.Navigatable;
+import org.joint.wicket.core.SiteNavRegistry;
+import org.slf4j.impl.Log4jLoggerAdapter;
+
+import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* Wicket WebPage will be extended by all other pages.
@@ -37,18 +43,20 @@
* @author btilford
*/
public abstract class BasePage extends WebPage implements
- Navigatable {
+ Navigatable {
private String title;
+ private static final Logger logger = Logger.getLogger(BasePage.class.getName());
+
public BasePage() {
- super();
- initJoints();
+ super();
+ initJoints();
}
protected BasePage(PageParameters parameters) {
- super(parameters);
- initJoints();
+ super(parameters);
+ initJoints();
}
/**
@@ -56,30 +64,48 @@ protected BasePage(PageParameters parameters) {
*/
@SuppressWarnings("unchecked")
protected void initJoints() {
- if (getApplication() instanceof WicketApp) {
- WicketApp app = (WicketApp) getApplication();
- add(new NavPanel("siteNav", app.getSiteNav()));
- }
- add(new Label("header.text", "Wicket Joint"));
- add(new ListView("annotations", Arrays.asList(
- getClass().getAnnotations())) {
+ SiteNavRegistry<BasePage> siteNav = new SiteNavRegistry<BasePage>();
+ try {
+ siteNav.load();
+ for (Object o : siteNav.getJoints()) {
+ System.out.println("JOINT: " + o.toString());
+ }
+ } catch (JointNotFoundException ex) {
+ logger.log(Level.SEVERE, ex.getMessage(), ex);
+ }
+ if (getApplication() instanceof WicketApp) {
+ WicketApp app = (WicketApp) getApplication();
+ add(new NavPanel("siteNav", siteNav));
+ }
+ add(new Label("header.text", "Wicket Joint"));
+ add(
+ new ListView(
+ "annotations", Arrays.asList(
+ getClass().getAnnotations()
+ )
+ ) {
- static final long serialVersionUID = 1L;
+ static final long serialVersionUID = 1L;
- @Override
- protected void populateItem(ListItem item) {
- item.add(new Label("annotation",
- item.getModelObject().toString()));
- }
- });
+ @Override
+ protected void populateItem(ListItem item) {
+ item.add(
+ new Label(
+ "annotation",
+ item.getModelObject().toString()
+ )
+ );
+ }
+ }
+ );
}
@Override
public String getTitle() {
- return this.title;
+ return this.title;
}
public void setTitle(String title) {
- this.title = title;
+ this.title = title;
}
}
View
17 .../wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/HomePage.java
@@ -5,15 +5,16 @@
import org.joint.annotations.Joint;
import org.joint.nav.annotations.Navigation;
import org.joint.nav.spi.Navigatable;
-import org.joint.wicket.core.SiteNavRegistry;
import org.joint.tooling.annotations.Export;
+import org.joint.wicket.core.SiteNavRegistry;
+
/**
* A wicket WebPage that will be loaded into SiteNavRegistry but the Example
* WicketApp
*/
@Joint(id = "Home")
@Navigation(navRegistryIds = {SiteNavRegistry.JOINT_ID},
- position = 0)
+ position = 0)
@Export(Navigatable.class)
public class HomePage extends BasePage {
@@ -26,20 +27,20 @@
* Page parameters
*/
public HomePage(final PageParameters parameters) {
- super(parameters);
+ super(parameters);
}
public HomePage() {
- super();
+ super();
}
@Override
protected void initJoints() {
- super.initJoints();
- this.setTitle("Home");
- add(new Label("message", "This is the Home Page"));
- add(new Label("title", this.getTitle()));
+ super.initJoints();
+ this.setTitle("Home");
+ add(new Label("message", "This is the Home Page"));
+
}
}
View
44 ...e/wicket-joint-example-common/src/main/java/org/joint/wicket/examples/common/NavList.java
@@ -4,7 +4,7 @@
*/
package org.joint.wicket.examples.common;
-import java.util.List;
+import org.apache.wicket.Page;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.Link;
@@ -14,34 +14,42 @@
import org.joint.annotations.Joint;
import org.joint.nav.spi.Navigatable;
+import java.util.List;
+
/**
*