Example #1
0
 protected Object invokeInternal(Object proxyObject, Method method, Object[] arguments)
     throws Throwable {
   BAMTargetEntry bamTargetEntry =
       KSBServiceLocator.getBAMService()
           .recordClientInvocation(this.serviceConfiguration, getTarget(), method, arguments);
   try {
     return method.invoke(getTarget(), arguments);
   } catch (Throwable throwable) {
     if (throwable instanceof InvocationTargetException) {
       throwable = throwable.getCause();
     }
     KSBServiceLocator.getBAMService().recordClientInvocationError(throwable, bamTargetEntry);
     throw throwable;
   }
 }
  /**
   * Used to refresh the service registry after the Application Context is initialized. This way any
   * services that were exported on startup will be available in the service registry once startup
   * is complete.
   */
  private void requeueMessages() {
    LOG.info("Refreshing Service Registry to export services to the bus.");
    KsbApiServiceLocator.getServiceBus().synchronizeLocalServices();

    // automatically requeue documents sitting with status of 'R'
    MessageFetcher messageFetcher = new MessageFetcher((Integer) null);
    KSBServiceLocator.getThreadPool().execute(messageFetcher);
  }
 private void verifyServiceCalls(QName serviceName, boolean shouldHaveBeenCalled)
     throws Exception {
   BAMService bamService = KSBServiceLocator.getBAMService();
   List<BAMTargetEntry> bamCalls = bamService.getCallsForService(serviceName);
   if (!shouldHaveBeenCalled) {
     assertTrue("A service call should not have been recorded yet.", bamCalls.size() == 0);
   } else {
     assertTrue("No service call recorded", bamCalls.size() > 0);
     boolean foundClientCall = false;
     boolean foundServiceCall = false;
     for (BAMTargetEntry bamEntry : bamCalls) {
       if (bamEntry.getServerInvocation()) {
         foundServiceCall = true;
       } else {
         foundClientCall = true;
       }
     }
     assertTrue("No client call recorded", foundClientCall);
     assertTrue("No service call recorded", foundServiceCall);
     assertEquals("Wrong number of calls recorded", 2, bamCalls.size());
   }
 }
Example #4
0
 public static boolean isBamSupported() {
   return KSBServiceLocator.getBAMService() != null
       && Boolean.valueOf(ConfigContext.getCurrentContextConfig().getProperty(Config.BAM_ENABLED));
 }