Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-06-24 Thread Stefan Fussenegger

Hi Ryan,

I'm the maintainer of wicketstuff-merged-resources. Sorry, I don't watch 
the mailing list as closely as I probably should.


I've just reverted your changes as the project wasn't able to build. The 
required org.wicketstuff:annotations:1.4.7-SNAPSHOT isn't available from 
a public repository - at least none I know of. Additionally, there are 
some other problems:


- I'm not happy with a change in dependencies. Could you explain why you 
went for org.wicketstuff:annotations rather than 
org.wicketstuff:wicketstuff-annotations? Is this the official replacement?


- Your implementation of ResourceMount.enableAnnotations(...) is broken. 
It won't work as soon as you need a second ContributionScanner for a 
different package.


- Try to keep binary compatibility with previous versions. Don't add new 
parameters to methods. Try to keep the old one, add a new one with an 
additional parameter and call it from the old one with a default that 
maintains the old behavior.


Next time, please use JIRA at http://wicketstuff.org/jira/browse/WMR 
(when will it be back again? or will it be back at all?) to create a 
ticket (and submit a patch) in order to get my feedback earlier (I'm 
watching the feeds there and should be able to react pretty quickly).


Regarding your issue, wouldn't it be enough it @*Contribution would be 
@Inherited and superclasses of matching classes would be checked as well 
for potentially overridden annotations? Could you provide a test case 
for your issues so we can figure out if there isn't a less obtrusive way 
to fix it?


Cheers, Stefan


On 05/21/2010 04:35 PM, Ryan Crumley wrote:

Thanks Jeremy. I applied the patches and there are some more errors
down the line. I am looking into resolving them and will submit a
patch once I get to that point. Hopefully this weekend.

Ryan

On Mon, May 17, 2010 at 11:49 PM, Jeremy Thomerson
jer...@wickettraining.com  wrote:

I'm not a maintainer on those projects so I defer on applying the following
patches.  However, I think that it is a bug.  If it is a bug, it will also
require a change in the annotations project in WicketStuff.  I have created
a patch for each.  Could you test it and see if it works?  If so, I'll go
ahead and commit it (unless one of the maintainers objects here first).
Patch for annotations: http://pastebin.com/nxQuLfqf
Patch for merged-resources: http://pastebin.com/Cbpjtvqp
File attachments to the list will be stripped.

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, May 17, 2010 at 9:43 PM, Ryan Crumleycrum...@gmail.com  wrote:


All,

[If there is a wicketstuff specific mailing list please let me know
and I will be happy to post there (wicketstuff.org is down so its
difficult to find information).]

I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
wicketstuff-annotation (1.1) and I have found a potential issue with
annotation detection. My page hierarchy looks something like this:

public abstract class BasePage extends WebPage { ... }

public class HomePage extends BasePage { ... }

I would like to add @JsContribution to BasePage however the resources
are only included if the concrete page (in this example: 'HomePage')
also has resource annotations. Removing @JsContribution from HomePage
results in all resources from BasePage also disappearing. Is this a
known bug? Am I using the framework incorrectly?

Thanks in advance for any guidance.

Ryan

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-06-24 Thread Ryan Crumley
Stefan,

I apologize for checking in changes without your approval. I was excited
about using your project but without scanning super classes it was not
useful to me. I was eager to get it working. =)

These are all good points... I will follow up with you off-list once I have
a few minutes to put together a response and a test case.

Cheers,

Ryan

On Thu, Jun 24, 2010 at 5:52 AM, Stefan Fussenegger s...@molindo.at wrote:

 Hi Ryan,

 I'm the maintainer of wicketstuff-merged-resources. Sorry, I don't watch
 the mailing list as closely as I probably should.

 I've just reverted your changes as the project wasn't able to build. The
 required org.wicketstuff:annotations:1.4.7-SNAPSHOT isn't available from a
 public repository - at least none I know of. Additionally, there are some
 other problems:

 - I'm not happy with a change in dependencies. Could you explain why you
 went for org.wicketstuff:annotations rather than
 org.wicketstuff:wicketstuff-annotations? Is this the official replacement?

 - Your implementation of ResourceMount.enableAnnotations(...) is broken. It
 won't work as soon as you need a second ContributionScanner for a different
 package.

 - Try to keep binary compatibility with previous versions. Don't add new
 parameters to methods. Try to keep the old one, add a new one with an
 additional parameter and call it from the old one with a default that
 maintains the old behavior.

 Next time, please use JIRA at http://wicketstuff.org/jira/browse/WMR (when
 will it be back again? or will it be back at all?) to create a ticket (and
 submit a patch) in order to get my feedback earlier (I'm watching the feeds
 there and should be able to react pretty quickly).

 Regarding your issue, wouldn't it be enough it @*Contribution would be
 @Inherited and superclasses of matching classes would be checked as well for
 potentially overridden annotations? Could you provide a test case for your
 issues so we can figure out if there isn't a less obtrusive way to fix it?

 Cheers, Stefan



 On 05/21/2010 04:35 PM, Ryan Crumley wrote:

 Thanks Jeremy. I applied the patches and there are some more errors
 down the line. I am looking into resolving them and will submit a
 patch once I get to that point. Hopefully this weekend.

 Ryan

 On Mon, May 17, 2010 at 11:49 PM, Jeremy Thomerson
 jer...@wickettraining.com  wrote:

 I'm not a maintainer on those projects so I defer on applying the
 following
 patches.  However, I think that it is a bug.  If it is a bug, it will
 also
 require a change in the annotations project in WicketStuff.  I have
 created
 a patch for each.  Could you test it and see if it works?  If so, I'll go
 ahead and commit it (unless one of the maintainers objects here first).
 Patch for annotations: http://pastebin.com/nxQuLfqf
 Patch for merged-resources: http://pastebin.com/Cbpjtvqp
 File attachments to the list will be stripped.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Mon, May 17, 2010 at 9:43 PM, Ryan Crumleycrum...@gmail.com  wrote:


 All,

 [If there is a wicketstuff specific mailing list please let me know
 and I will be happy to post there (wicketstuff.org is down so its
 difficult to find information).]

 I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
 wicketstuff-annotation (1.1) and I have found a potential issue with
 annotation detection. My page hierarchy looks something like this:

 public abstract class BasePage extends WebPage { ... }

 public class HomePage extends BasePage { ... }

 I would like to add @JsContribution to BasePage however the resources
 are only included if the concrete page (in this example: 'HomePage')
 also has resource annotations. Removing @JsContribution from HomePage
 results in all resources from BasePage also disappearing. Is this a
 known bug? Am I using the framework incorrectly?

 Thanks in advance for any guidance.

 Ryan

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-05-21 Thread Ryan Crumley
Thanks Jeremy. I applied the patches and there are some more errors
down the line. I am looking into resolving them and will submit a
patch once I get to that point. Hopefully this weekend.

Ryan

On Mon, May 17, 2010 at 11:49 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:
 I'm not a maintainer on those projects so I defer on applying the following
 patches.  However, I think that it is a bug.  If it is a bug, it will also
 require a change in the annotations project in WicketStuff.  I have created
 a patch for each.  Could you test it and see if it works?  If so, I'll go
 ahead and commit it (unless one of the maintainers objects here first).
 Patch for annotations: http://pastebin.com/nxQuLfqf
 Patch for merged-resources: http://pastebin.com/Cbpjtvqp
 File attachments to the list will be stripped.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Mon, May 17, 2010 at 9:43 PM, Ryan Crumley crum...@gmail.com wrote:

 All,

 [If there is a wicketstuff specific mailing list please let me know
 and I will be happy to post there (wicketstuff.org is down so its
 difficult to find information).]

 I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
 wicketstuff-annotation (1.1) and I have found a potential issue with
 annotation detection. My page hierarchy looks something like this:

 public abstract class BasePage extends WebPage { ... }

 public class HomePage extends BasePage { ... }

 I would like to add @JsContribution to BasePage however the resources
 are only included if the concrete page (in this example: 'HomePage')
 also has resource annotations. Removing @JsContribution from HomePage
 results in all resources from BasePage also disappearing. Is this a
 known bug? Am I using the framework incorrectly?

 Thanks in advance for any guidance.

 Ryan

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-05-21 Thread Jeremy Thomerson
What's your sf.net ID?   I can add you as committer and you can just commit
the patches.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, May 21, 2010 at 9:35 AM, Ryan Crumley crum...@gmail.com wrote:

 Thanks Jeremy. I applied the patches and there are some more errors
 down the line. I am looking into resolving them and will submit a
 patch once I get to that point. Hopefully this weekend.

 Ryan

 On Mon, May 17, 2010 at 11:49 PM, Jeremy Thomerson
 jer...@wickettraining.com wrote:
  I'm not a maintainer on those projects so I defer on applying the
 following
  patches.  However, I think that it is a bug.  If it is a bug, it will
 also
  require a change in the annotations project in WicketStuff.  I have
 created
  a patch for each.  Could you test it and see if it works?  If so, I'll go
  ahead and commit it (unless one of the maintainers objects here first).
  Patch for annotations: http://pastebin.com/nxQuLfqf
  Patch for merged-resources: http://pastebin.com/Cbpjtvqp
  File attachments to the list will be stripped.
 
  --
  Jeremy Thomerson
  http://www.wickettraining.com
 
 
 
  On Mon, May 17, 2010 at 9:43 PM, Ryan Crumley crum...@gmail.com wrote:
 
  All,
 
  [If there is a wicketstuff specific mailing list please let me know
  and I will be happy to post there (wicketstuff.org is down so its
  difficult to find information).]
 
  I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
  wicketstuff-annotation (1.1) and I have found a potential issue with
  annotation detection. My page hierarchy looks something like this:
 
  public abstract class BasePage extends WebPage { ... }
 
  public class HomePage extends BasePage { ... }
 
  I would like to add @JsContribution to BasePage however the resources
  are only included if the concrete page (in this example: 'HomePage')
  also has resource annotations. Removing @JsContribution from HomePage
  results in all resources from BasePage also disappearing. Is this a
  known bug? Am I using the framework incorrectly?
 
  Thanks in advance for any guidance.
 
  Ryan
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 



Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-05-21 Thread Ryan Crumley
rcrumley

On Fri, May 21, 2010 at 10:04 AM, Jeremy Thomerson
jer...@wickettraining.com wrote:
 What's your sf.net ID?   I can add you as committer and you can just commit
 the patches.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



 On Fri, May 21, 2010 at 9:35 AM, Ryan Crumley crum...@gmail.com wrote:

 Thanks Jeremy. I applied the patches and there are some more errors
 down the line. I am looking into resolving them and will submit a
 patch once I get to that point. Hopefully this weekend.

 Ryan

 On Mon, May 17, 2010 at 11:49 PM, Jeremy Thomerson
 jer...@wickettraining.com wrote:
  I'm not a maintainer on those projects so I defer on applying the
  following
  patches.  However, I think that it is a bug.  If it is a bug, it will
  also
  require a change in the annotations project in WicketStuff.  I have
  created
  a patch for each.  Could you test it and see if it works?  If so, I'll
  go
  ahead and commit it (unless one of the maintainers objects here first).
  Patch for annotations: http://pastebin.com/nxQuLfqf
  Patch for merged-resources: http://pastebin.com/Cbpjtvqp
  File attachments to the list will be stripped.
 
  --
  Jeremy Thomerson
  http://www.wickettraining.com
 
 
 
  On Mon, May 17, 2010 at 9:43 PM, Ryan Crumley crum...@gmail.com wrote:
 
  All,
 
  [If there is a wicketstuff specific mailing list please let me know
  and I will be happy to post there (wicketstuff.org is down so its
  difficult to find information).]
 
  I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
  wicketstuff-annotation (1.1) and I have found a potential issue with
  annotation detection. My page hierarchy looks something like this:
 
  public abstract class BasePage extends WebPage { ... }
 
  public class HomePage extends BasePage { ... }
 
  I would like to add @JsContribution to BasePage however the resources
  are only included if the concrete page (in this example: 'HomePage')
  also has resource annotations. Removing @JsContribution from HomePage
  results in all resources from BasePage also disappearing. Is this a
  known bug? Am I using the framework incorrectly?
 
  Thanks in advance for any guidance.
 
  Ryan
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-05-21 Thread Jeremy Thomerson
User 'rcrumley' was added successfully.

--
Jeremy Thomerson
http://www.wickettraining.com



On Fri, May 21, 2010 at 11:47 AM, Ryan Crumley crum...@gmail.com wrote:

 rcrumley

 On Fri, May 21, 2010 at 10:04 AM, Jeremy Thomerson
 jer...@wickettraining.com wrote:
  What's your sf.net ID?   I can add you as committer and you can just
 commit
  the patches.
 
  --
  Jeremy Thomerson
  http://www.wickettraining.com
 
 
 
  On Fri, May 21, 2010 at 9:35 AM, Ryan Crumley crum...@gmail.com wrote:
 
  Thanks Jeremy. I applied the patches and there are some more errors
  down the line. I am looking into resolving them and will submit a
  patch once I get to that point. Hopefully this weekend.
 
  Ryan
 
  On Mon, May 17, 2010 at 11:49 PM, Jeremy Thomerson
  jer...@wickettraining.com wrote:
   I'm not a maintainer on those projects so I defer on applying the
   following
   patches.  However, I think that it is a bug.  If it is a bug, it will
   also
   require a change in the annotations project in WicketStuff.  I have
   created
   a patch for each.  Could you test it and see if it works?  If so, I'll
   go
   ahead and commit it (unless one of the maintainers objects here
 first).
   Patch for annotations: http://pastebin.com/nxQuLfqf
   Patch for merged-resources: http://pastebin.com/Cbpjtvqp
   File attachments to the list will be stripped.
  
   --
   Jeremy Thomerson
   http://www.wickettraining.com
  
  
  
   On Mon, May 17, 2010 at 9:43 PM, Ryan Crumley crum...@gmail.com
 wrote:
  
   All,
  
   [If there is a wicketstuff specific mailing list please let me know
   and I will be happy to post there (wicketstuff.org is down so its
   difficult to find information).]
  
   I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
   wicketstuff-annotation (1.1) and I have found a potential issue with
   annotation detection. My page hierarchy looks something like this:
  
   public abstract class BasePage extends WebPage { ... }
  
   public class HomePage extends BasePage { ... }
  
   I would like to add @JsContribution to BasePage however the resources
   are only included if the concrete page (in this example: 'HomePage')
   also has resource annotations. Removing @JsContribution from HomePage
   results in all resources from BasePage also disappearing. Is this a
   known bug? Am I using the framework incorrectly?
  
   Thanks in advance for any guidance.
  
   Ryan
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
 
 



wicketstuff-merged-resources 3.1 parent class scanning?

2010-05-17 Thread Ryan Crumley
All,

[If there is a wicketstuff specific mailing list please let me know
and I will be happy to post there (wicketstuff.org is down so its
difficult to find information).]

I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
wicketstuff-annotation (1.1) and I have found a potential issue with
annotation detection. My page hierarchy looks something like this:

public abstract class BasePage extends WebPage { ... }

public class HomePage extends BasePage { ... }

I would like to add @JsContribution to BasePage however the resources
are only included if the concrete page (in this example: 'HomePage')
also has resource annotations. Removing @JsContribution from HomePage
results in all resources from BasePage also disappearing. Is this a
known bug? Am I using the framework incorrectly?

Thanks in advance for any guidance.

Ryan

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: wicketstuff-merged-resources 3.1 parent class scanning?

2010-05-17 Thread Jeremy Thomerson
I'm not a maintainer on those projects so I defer on applying the following
patches.  However, I think that it is a bug.  If it is a bug, it will also
require a change in the annotations project in WicketStuff.  I have created
a patch for each.  Could you test it and see if it works?  If so, I'll go
ahead and commit it (unless one of the maintainers objects here first).

Patch for annotations: http://pastebin.com/nxQuLfqf
http://pastebin.com/nxQuLfqfPatch for merged-resources:
http://pastebin.com/Cbpjtvqp

http://pastebin.com/CbpjtvqpFile attachments to the list will be stripped.

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, May 17, 2010 at 9:43 PM, Ryan Crumley crum...@gmail.com wrote:

 All,

 [If there is a wicketstuff specific mailing list please let me know
 and I will be happy to post there (wicketstuff.org is down so its
 difficult to find information).]

 I am using wicketstuff-merged-resources (3.1-SNAPSHOT) with
 wicketstuff-annotation (1.1) and I have found a potential issue with
 annotation detection. My page hierarchy looks something like this:

 public abstract class BasePage extends WebPage { ... }

 public class HomePage extends BasePage { ... }

 I would like to add @JsContribution to BasePage however the resources
 are only included if the concrete page (in this example: 'HomePage')
 also has resource annotations. Removing @JsContribution from HomePage
 results in all resources from BasePage also disappearing. Is this a
 known bug? Am I using the framework incorrectly?

 Thanks in advance for any guidance.

 Ryan

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


Index: annotation/src/main/java/org/wicketstuff/config/MatchingResources.java
===
--- annotation/src/main/java/org/wicketstuff/config/MatchingResources.java	(revision 5264)
+++ annotation/src/main/java/org/wicketstuff/config/MatchingResources.java	(working copy)
@@ -86,12 +86,14 @@
 return urls;
 }
 
+
 /**
  * Get all matching classes that are annotated with the given Annotation.
  * @param annotation an annotation class
+ * @param includeSubclasses if true, this will also return classes whose superclass has the specified annotation
  * @return List of all classes that have the given annotation.  List is empty if non matches found.
  */
-public ListClass? getAnnotatedMatches(Class? extends Annotation annotation)
+public ListClass? getAnnotatedMatches(Class? extends Annotation annotation, boolean includeSubclasses) 
 {
 ListClass? matches = new ArrayListClass?();
 MetadataReaderFactory f = new SimpleMetadataReaderFactory();
@@ -108,22 +110,45 @@
 }
 AnnotationMetadata anno = meta.getAnnotationMetadata();
 SetString types = anno.getAnnotationTypes();
-if (types.contains(annotation.getName()))
+if (types.contains(annotation.getName()) || (includeSubclasses  anySuperHas(getClass(anno.getSuperClassName()), annotation)))
 {
-try
-{
-matches.add(Class.forName(anno.getClassName()));
-}
-catch (ClassNotFoundException e)
-{
-throw new RuntimeException(e);
-}
+matches.add(getClass(anno.getClassName()));
 }
 }
 return matches;
 }
 
 /**
+ * Get all matching classes that are annotated with the given Annotation.  Note that this method only returns
+ * those classes that actually contain the annotation, and does not return classes whose superclass contains 
+ * the annotation.
+ *  
+ * @param annotation an annotation class
+ * @return List of all classes that have the given annotation.  List is empty if non matches found.
+ * @see MatchingResources#getAnnotatedMatches(Class, boolean)
+ */
+public ListClass? getAnnotatedMatches(Class? extends Annotation annotation)
+{
+return getAnnotatedMatches(annotation, false);
+}
+
+private boolean anySuperHas(Class? clz, Class? extends Annotation annotation) 
+{
+return clz != null  (clz.isAnnotationPresent(annotation) || anySuperHas(clz.getSuperclass(), annotation));
+}
+
+private Class? getClass(String className) {
+try
+{
+return Class.forName(className);
+}
+catch (ClassNotFoundException e)
+{
+throw new RuntimeException(e);
+}
+}
+
+/**
  * Get a single matching resource.  Throws an exception if multiple are found.  This is useful if you
  * are expecting to find only one instance of an item on the classpath.
  * @return The single matching {...@link Resource}
Index: