Skip to content
This repository was archived by the owner on Jan 15, 2020. It is now read-only.

Commit 58c962e

Browse files
committed
Retire unused files to avoid confusions
1 parent 7e54f40 commit 58c962e

8 files changed

Lines changed: 0 additions & 467 deletions

File tree

server/src/com/cloud/configuration/DefaultInterceptorLibrary.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

server/src/com/cloud/event/ActionEventUtils.java

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,9 @@
2222
import com.cloud.user.Account;
2323
import com.cloud.user.AccountVO;
2424
import com.cloud.user.User;
25-
import com.cloud.user.UserContext;
2625
import com.cloud.user.dao.AccountDao;
2726
import com.cloud.user.dao.UserDao;
28-
import com.cloud.utils.component.AnnotationInterceptor;
2927
import com.cloud.utils.component.ComponentContext;
30-
import net.sf.cglib.proxy.Callback;
31-
import net.sf.cglib.proxy.MethodInterceptor;
32-
import net.sf.cglib.proxy.MethodProxy;
3328
import org.apache.cloudstack.framework.events.EventBus;
3429
import org.apache.cloudstack.framework.events.EventBusException;
3530
import org.apache.log4j.Logger;
@@ -38,8 +33,6 @@
3833

3934
import javax.annotation.PostConstruct;
4035
import javax.inject.Inject;
41-
import java.lang.reflect.AnnotatedElement;
42-
import java.lang.reflect.Method;
4336
import java.util.HashMap;
4437
import java.util.Map;
4538

@@ -185,111 +178,4 @@ private static long getDomainId(long accountId){
185178
AccountVO account = _accountDao.findByIdIncludingRemoved(accountId);
186179
return account.getDomainId();
187180
}
188-
189-
public static class ActionEventCallback implements MethodInterceptor, AnnotationInterceptor<EventVO> {
190-
191-
@Override
192-
public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
193-
EventVO event = interceptStart(method);
194-
boolean success = true;
195-
try {
196-
return methodProxy.invokeSuper(object, args);
197-
} catch (Exception e){
198-
success = false;
199-
interceptException(method, event);
200-
throw e;
201-
} finally {
202-
if(success){
203-
interceptComplete(method, event);
204-
}
205-
}
206-
}
207-
208-
@Override
209-
public boolean needToIntercept(AnnotatedElement element) {
210-
if (!(element instanceof Method)) {
211-
return false;
212-
213-
}
214-
Method method = (Method)element;
215-
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
216-
if (actionEvent != null) {
217-
return true;
218-
}
219-
220-
return false;
221-
}
222-
223-
@Override
224-
public EventVO interceptStart(AnnotatedElement element) {
225-
EventVO event = null;
226-
Method method = (Method)element;
227-
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
228-
if (actionEvent != null) {
229-
boolean async = actionEvent.async();
230-
if(async){
231-
UserContext ctx = UserContext.current();
232-
long userId = ctx.getCallerUserId();
233-
long accountId = ctx.getAccountId();
234-
long startEventId = ctx.getStartEventId();
235-
String eventDescription = actionEvent.eventDescription();
236-
if(ctx.getEventDetails() != null){
237-
eventDescription += ". "+ctx.getEventDetails();
238-
}
239-
ActionEventUtils.onStartedActionEvent(userId, accountId, actionEvent.eventType(), eventDescription, startEventId);
240-
}
241-
}
242-
return event;
243-
}
244-
245-
@Override
246-
public void interceptComplete(AnnotatedElement element, EventVO event) {
247-
Method method = (Method)element;
248-
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
249-
if (actionEvent != null) {
250-
UserContext ctx = UserContext.current();
251-
long userId = ctx.getCallerUserId();
252-
long accountId = ctx.getAccountId();
253-
long startEventId = ctx.getStartEventId();
254-
String eventDescription = actionEvent.eventDescription();
255-
if(ctx.getEventDetails() != null){
256-
eventDescription += ". "+ctx.getEventDetails();
257-
}
258-
if(actionEvent.create()){
259-
//This start event has to be used for subsequent events of this action
260-
startEventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_INFO, actionEvent.eventType(), "Successfully created entity for " + eventDescription);
261-
ctx.setStartEventId(startEventId);
262-
} else {
263-
ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_INFO, actionEvent.eventType(), "Successfully completed " + eventDescription, startEventId);
264-
}
265-
}
266-
}
267-
268-
@Override
269-
public void interceptException(AnnotatedElement element, EventVO event) {
270-
Method method = (Method)element;
271-
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
272-
if (actionEvent != null) {
273-
UserContext ctx = UserContext.current();
274-
long userId = ctx.getCallerUserId();
275-
long accountId = ctx.getAccountId();
276-
long startEventId = ctx.getStartEventId();
277-
String eventDescription = actionEvent.eventDescription();
278-
if(ctx.getEventDetails() != null){
279-
eventDescription += ". "+ctx.getEventDetails();
280-
}
281-
if(actionEvent.create()){
282-
long eventId = ActionEventUtils.onCreatedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, actionEvent.eventType(), "Error while creating entity for " + eventDescription);
283-
ctx.setStartEventId(eventId);
284-
} else {
285-
ActionEventUtils.onCompletedActionEvent(userId, accountId, EventVO.LEVEL_ERROR, actionEvent.eventType(), "Error while " + eventDescription, startEventId);
286-
}
287-
}
288-
}
289-
290-
@Override
291-
public Callback getCallback() {
292-
return this;
293-
}
294-
}
295181
}

utils/src/com/cloud/utils/component/AnnotationInterceptor.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

utils/src/com/cloud/utils/component/ComponentMethodProxyCache.java

Lines changed: 0 additions & 90 deletions
This file was deleted.

utils/src/com/cloud/utils/component/InterceptorLibrary.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

utils/src/com/cloud/utils/component/MatchAnyMethodPointcut.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)