001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.camel.management.event; 018 019 import java.util.EventObject; 020 021 import org.apache.camel.CamelContext; 022 import org.apache.camel.Endpoint; 023 import org.apache.camel.Exchange; 024 import org.apache.camel.Processor; 025 import org.apache.camel.Route; 026 import org.apache.camel.spi.EventFactory; 027 028 /** 029 * Default implementation of the {@link org.apache.camel.spi.EventFactory}. 030 * 031 * @version 032 */ 033 public class DefaultEventFactory implements EventFactory { 034 035 public EventObject createCamelContextStartingEvent(CamelContext context) { 036 return new CamelContextStartingEvent(context); 037 } 038 039 public EventObject createCamelContextStartedEvent(CamelContext context) { 040 return new CamelContextStartedEvent(context); 041 } 042 043 public EventObject createCamelContextStoppingEvent(CamelContext context) { 044 return new CamelContextStoppingEvent(context); 045 } 046 047 public EventObject createCamelContextStoppedEvent(CamelContext context) { 048 return new CamelContextStoppedEvent(context); 049 } 050 051 public EventObject createCamelContextStartupFailureEvent(CamelContext context, Throwable cause) { 052 return new CamelContextStartupFailureEvent(context, cause); 053 } 054 055 public EventObject createCamelContextStopFailureEvent(CamelContext context, Throwable cause) { 056 return new CamelContextStopFailureEvent(context, cause); 057 } 058 059 public EventObject createServiceStartupFailureEvent(CamelContext context, Object service, Throwable cause) { 060 return new ServiceStartupFailureEvent(context, service, cause); 061 } 062 063 public EventObject createServiceStopFailureEvent(CamelContext context, Object service, Throwable cause) { 064 return new ServiceStopFailureEvent(context, service, cause); 065 } 066 067 public EventObject createRouteStartedEvent(Route route) { 068 return new RouteStartedEvent(route); 069 } 070 071 public EventObject createRouteStoppedEvent(Route route) { 072 return new RouteStoppedEvent(route); 073 } 074 075 public EventObject createExchangeCreatedEvent(Exchange exchange) { 076 return new ExchangeCreatedEvent(exchange); 077 } 078 079 public EventObject createExchangeCompletedEvent(Exchange exchange) { 080 return new ExchangeCompletedEvent(exchange); 081 } 082 083 public EventObject createExchangeFailedEvent(Exchange exchange) { 084 return new ExchangeFailedEvent(exchange); 085 } 086 087 public EventObject createExchangeFailureHandledEvent(Exchange exchange, Processor failureHandler, boolean deadLetterChannel) { 088 return new ExchangeFailureHandledEvent(exchange, failureHandler, deadLetterChannel); 089 } 090 091 public EventObject createExchangeRedeliveryEvent(Exchange exchange, int attempt) { 092 return new ExchangeRedeliveryEvent(exchange, attempt); 093 } 094 095 public EventObject createExchangeSendingEvent(Exchange exchange, Endpoint endpoint) { 096 return new ExchangeSendingEvent(exchange, endpoint); 097 } 098 099 public EventObject createExchangeSentEvent(Exchange exchange, Endpoint endpoint, long timeTaken) { 100 return new ExchangeSentEvent(exchange, endpoint, timeTaken); 101 } 102 103 public EventObject createCamelContextSuspendingEvent(CamelContext context) { 104 return new CamelContextSuspendingEvent(context); 105 } 106 107 public EventObject createCamelContextSuspendedEvent(CamelContext context) { 108 return new CamelContextSuspendedEvent(context); 109 } 110 111 public EventObject createCamelContextResumingEvent(CamelContext context) { 112 return new CamelContextResumingEvent(context); 113 } 114 115 public EventObject createCamelContextResumedEvent(CamelContext context) { 116 return new CamelContextResumedEvent(context); 117 } 118 119 public EventObject createCamelContextResumeFailureEvent(CamelContext context, Throwable cause) { 120 return new CamelContextResumeFailureEvent(context, cause); 121 } 122 }