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;
018    
019    import java.util.EventObject;
020    
021    import org.apache.camel.CamelContext;
022    import org.apache.camel.Exchange;
023    import org.apache.camel.Processor;
024    import org.apache.camel.Route;
025    import org.apache.camel.management.event.CamelContextStartedEvent;
026    import org.apache.camel.management.event.CamelContextStartingEvent;
027    import org.apache.camel.management.event.CamelContextStartupFailureEvent;
028    import org.apache.camel.management.event.CamelContextStopFailureEvent;
029    import org.apache.camel.management.event.CamelContextStoppedEvent;
030    import org.apache.camel.management.event.CamelContextStoppingEvent;
031    import org.apache.camel.management.event.ExchangeCompletedEvent;
032    import org.apache.camel.management.event.ExchangeCreatedEvent;
033    import org.apache.camel.management.event.ExchangeFailureEvent;
034    import org.apache.camel.management.event.ExchangeFailureHandledEvent;
035    import org.apache.camel.management.event.RouteStartedEvent;
036    import org.apache.camel.management.event.RouteStoppedEvent;
037    import org.apache.camel.management.event.ServiceStartupFailureEvent;
038    import org.apache.camel.management.event.ServiceStopFailureEvent;
039    import org.apache.camel.spi.EventFactory;
040    
041    /**
042     * @version $Revision: 813876 $
043     */
044    public class DefaultEventFactory implements EventFactory {
045    
046        public EventObject createCamelContextStartingEvent(CamelContext context) {
047            return new CamelContextStartingEvent(context);
048        }
049    
050        public EventObject createCamelContextStartedEvent(CamelContext context) {
051            return new CamelContextStartedEvent(context);
052        }
053    
054        public EventObject createCamelContextStoppingEvent(CamelContext context) {
055            return new CamelContextStoppingEvent(context);
056        }
057    
058        public EventObject createCamelContextStoppedEvent(CamelContext context) {
059            return new CamelContextStoppedEvent(context);
060        }
061    
062        public EventObject createCamelContextStartupFailureEvent(CamelContext context, Exception cause) {
063            return new CamelContextStartupFailureEvent(context, cause);
064        }
065    
066        public EventObject createCamelContextStopFailureEvent(CamelContext context, Exception cause) {
067            return new CamelContextStopFailureEvent(context, cause);
068        }
069    
070        public EventObject createServiceStartupFailureEvent(CamelContext context, Object service, Exception cause) {
071            return new ServiceStartupFailureEvent(context, service, cause);
072        }
073    
074        public EventObject createServiceStopFailureEvent(CamelContext context, Object service, Exception cause) {
075            return new ServiceStopFailureEvent(context, service, cause);
076        }
077    
078        public EventObject createRouteStartedEvent(Route route) {
079            return new RouteStartedEvent(route);
080        }
081    
082        public EventObject createRouteStoppedEvent(Route route) {
083            return new RouteStoppedEvent(route);
084        }
085    
086        public EventObject createExchangeCreatedEvent(Exchange exchange) {
087            return new ExchangeCreatedEvent(exchange);
088        }
089    
090        public EventObject createExchangeCompletedEvent(Exchange exchange) {
091            return new ExchangeCompletedEvent(exchange);
092        }
093    
094        public EventObject createExchangeFailureEvent(Exchange exchange) {
095            return new ExchangeFailureEvent(exchange);
096        }
097    
098        public EventObject createExchangeFailureHandledEvent(Exchange exchange, Processor failureHandler, boolean deadLetterChannel) {
099            return new ExchangeFailureHandledEvent(exchange, failureHandler, deadLetterChannel);
100        }
101    }