What is the default advice kind when using <aop:advisor>? - spring

What is the default advice kind when using <aop:advisor>? Is it around or something else? I did not find much information in docs. Any link to more information? Thanks.

Well, as the documentation says here:
The advice itself is represented by a bean, and must implement one of the advice interfaces described in Advice types in Spring.
Thus, it is your own choice which type of advice you want to implement in your advisor. It can be any of
around,
before,
after returning,
throws,
introduction.

Related

Why does not exist the AspectJBeforeAdvice class?

In Spring about AOP/AspectJ exists the MethodInterceptor interface. It is used internally to decide if an #Aspect class must be called or not - really an advice method - according with a pointcut.
About its implementations exists (see the former link):
AspectJAfterAdvice
AspectJAfterThrowingAdvice
AspectJAroundAdvice
Question
What is the reason or Why does not exist the AspectJBeforeAdvice class?
This is not meant to be a conclusive answer, because I cannot speak for the Spring AOP team or speculate more than just a little bit about their design goals and motives. Insofar, this question is not a good fit for Stack Overflow, because it does not present a programming problem to be solved by a correct answer.
Anyway, actually it seems that the AOP Alliance's MethodInterceptor interface is not implemented for before advice types. Either it is not necessary or was an oversight. I think, however, that Spring AOP mostly revolves around the Advice interface and, where necessary, its subinterfaces BeforeAdvice and AfterAdvice. Moreover, all concrete advice types extend AbstractAspectJAdvice. This is a screenshot from my IDE:
Please note on the bottom of the picture, that MethodInterceptor itself extends Interceptor, which again intercepts Advice. So, Advice is the common denominator for all advice types, no matter if they are also MethodInterceptors or not.

Understanding ".with" in Ruby

Sorry this is probably a question that has been asked many times but as it regards what is a very common word in English it is pretty much impossible to google or search for it.
I have seen a few examples of Ruby code which looks like this:
EnquiryNotification.with(post: #post)
I'm trying to understand what the ".with" part does. Can anyone shed some light on this please?
with is a class method defined on the EnquiryNotification class (or one of its ancestors). The method is neither a keyword in the Ruby language nor is it a common method on classes shipped with Ruby itself or its standard library. As such, to find what this method does, you would likely have to consult the documentation of your chosen framework or application.
An example of a with method defined in a framework is Sequel::Dataset#with to add a CTE to the current query. The method is also available as a class method in Sequel model classes.
It could also be part of ActionMailer as mentioned by Stefan in a comment above.
In any case though, make sure to consult the documentation of your chosen framework or library for details.

How to use commitHandler on dc.js?

I was looking into the dc-addons packages from Intellipharm. I am interested in the server chart, crossfilter server, and crossfilter server. Unfortunately, all of these functions are currently not working. Then from the blog I saw, There has been a fairly new addition to dc.js called commitHandler. This basically covers the functionality of crossfilter server. Wondering if someone could provide an example of how to use this api.
Thanks
I apologize that this is not really an answer but just some pointers. There was too much for me to write in a comment!
The current progress on this is described toward the end of the long issue dc.js#602, which links to this example.
We are not too far away, but the missing part is a server-side or webworker crossfilter component which defines all of the filters that dc.js needs.
If you're creating your own crossfilter-like server, such as many people have done using ElasticSearch and MongoDB, then hopefully this example will provide some clues.
UPDATE 8-22-20: There is also xfilter, which mocks enough of the crossfilter API to use an alternate backend. Its nanocube support is out of date, but it provides some examples.
Please don't hesitate to ask if you have any questions. This might be a better discussion for the user group than SO. And if you'd consider publishing an example, I'm sure it would help a lot of people!

How to add custom managed metadata on Yammer group

We use Yammer at my place of work, and we are looking for a way of sorting groups in custom manners. To that end, it'd helpful if we could add custom metadata to all the groups that currently exist. Is there any well-defined manner of doing so or, if not, are there ways of achieving custom sorting (i.e., according to our own defined criteria) of groups in Yammer? Any help is greatly appreciated. Thank you!
This is not supported in the product, and it's unlikely to be something added at a platform level. You may be better to raise this over on the Yammer UserVoice site. It would also be useful to drill down a bit into "why" this is useful to you when you post there. I can think of why I might want this, but it may not be the same need as you.

Aspect to trap Controller creation in Roo project - how to?

I would like my first Aspect in a Roo project to run the advice when a web controller starts up. But I cant get the pointcut to match.
The controllers have a class name starting Cfx. I have tried with the following form:
pointcut setBrand() : initialization(Cfx*.new (..));
before() : setBrand()
{
log.info("xxxxxxxxxxxx setting brand");
}
As well as "initialization" I have tried (from the book AspectJ Cookbook) call(Signature) with new keyword, preinitialization, staticinitialization. What is the formula?
Maybe this is related - the Roo aspects do not have this form - no pointcut for example. How are they working? Where is this documented?
Thanks
PS apologies, this is a re-post. I posted this to the Spring Roo forum but got no response. http://forum.springsource.org/showthread.php?129374-Aspect-to-trap-Controller-creation-how-to
I know next to nothing about Roo or Spring, but some AspectJ, so I am going to answer your question from an AspectJ perspective only, assuming that you are an AOP newbie (sorry if my assumption is incorrect):
If you want to do something when a class is loaded, use a staticinitialization(TypePat) pointcut.
If you want to do something when an object (instance) is created, use something like execution(ConstructorPat). The initialization is for special purposes and preinitialization is needed even more rarely. I am assuming that the first one will do for you, not knowing your exact purpose.
Further assuming that something like execution(Cfx*.new (..)) is basically the thing you want, I suggest you look at possible errors or warnings like "advice defined in ... has not been applied [Xlint:adviceDidNotMatch]", because it might just be a pointcut matching issue. Please note that the type pattern you use assumes the matched constructors are in the same package as the aspect and that they have standard visibility (not public or anything else). So unless there is a class-loading issue, maybe you just want to specify more exactly (or more generally) what you want to match. Examples:
com.bigboxco.my_app.Cfx*.new(..)
com.bigboxco..Cfx*.new(..)
public com.bigboxco..Cfx*.new(..)
!private com.bigboxco..Cfx*.new(..)
* com.bigboxco..Cfx*.new(..)
A good strategy could be trying to match one of your constructors by replicating its exact signature and using its fully qualified class name, then working on from that point to make it more general.
Update: I know you can do a web search by yourself, but anyway here are some useful links:
AspectJ quick reference
AspectJ language semantics with topics about signatures, matching etc.

Resources