%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
net.sf.infrared.aspects.api.ApiAspect |
|
|
1 | /* |
|
2 | * Copyright 2005 Tavant Technologies and Contributors |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | * |
|
16 | * |
|
17 | * |
|
18 | * Original Author: binil.thomas (Tavant Technologies) |
|
19 | * Contributor(s): prashant.nair; |
|
20 | * |
|
21 | */ |
|
22 | package net.sf.infrared.aspects.api; |
|
23 | ||
24 | import net.sf.infrared.agent.MonitorFacade; |
|
25 | import net.sf.infrared.agent.MonitorFactory; |
|
26 | import net.sf.infrared.aspects.AbstractBaseAspect; |
|
27 | ||
28 | import org.codehaus.aspectwerkz.AspectContext; |
|
29 | import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint; |
|
30 | ||
31 | /** |
|
32 | * |
|
33 | * @author binil.thomas |
|
34 | * @author prashant.nair |
|
35 | */ |
|
36 | public class ApiAspect extends AbstractBaseAspect { |
|
37 | private String layerName; |
|
38 | ||
39 | 0 | public ApiAspect(AspectContext aspectContext) { |
40 | 0 | layerName = aspectContext.getParameter("layer"); |
41 | 0 | } |
42 | ||
43 | public Object collectMetrics(StaticJoinPoint sjp) throws Throwable { |
|
44 | 0 | MonitorFacade facade = MonitorFactory.getFacade(); |
45 | 0 | if(! isMonitoringEnabled(facade) ) { |
46 | 0 | return sjp.proceed(); |
47 | } |
|
48 | ||
49 | 0 | final Class classObj = sjp.getSignature().getDeclaringType(); |
50 | 0 | final String methodName = sjp.getSignature().getName(); |
51 | 0 | ApiContext ctx = new ApiContext(classObj.getName(), methodName, layerName); |
52 | 0 | return recordExecution(ctx, sjp, facade); |
53 | } |
|
54 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |