001/* 002 * GWTEventService 003 * Copyright (c) 2011 and beyond, strawbill UG (haftungsbeschr?nkt) 004 * 005 * This is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU Lesser General Public License as 007 * published by the Free Software Foundation; either version 3 of 008 * the License, or (at your option) any later version. 009 * Other licensing for GWTEventService may also be possible on request. 010 * Please view the license.txt of the project for more information. 011 * 012 * This software is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this software; if not, write to the Free 019 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022package de.novanic.eventservice.client.event.service.creator; 023 024import com.google.gwt.core.client.GWT; 025import de.novanic.eventservice.client.event.service.EventService; 026import de.novanic.eventservice.client.event.service.EventServiceAsync; 027 028/** 029 * The {@link de.novanic.eventservice.client.event.service.creator.EventServiceCreator} is a factory to 030 * create a new {@link de.novanic.eventservice.client.event.service.EventServiceAsync} which is required 031 * for the connection to the server side. 032 * 033 * The default implementation uses a standard way to map GWT services and creates a service instance of 034 * {@link de.novanic.eventservice.client.event.service.EventService}. 035 * 036 * @author sstrohschein 037 * <br>Date: 19.10.2010 038 * <br>Time: 22:47:12 039 */ 040public final class DefaultEventServiceCreator implements EventServiceCreator 041{ 042 /** 043 * The {@link DefaultEventServiceCreator} should be created via the getInstance method. 044 * @see DefaultEventServiceCreator#getInstance() 045 */ 046 private DefaultEventServiceCreator() {} 047 048 /** 049 * The {@link DefaultEventServiceCreator} should be created via the getInstance method. 050 * @see DefaultEventServiceCreatorHolder#getInstance() 051 */ 052 private static class DefaultEventServiceCreatorHolder { 053 private static DefaultEventServiceCreator INSTANCE = new DefaultEventServiceCreator(); 054 } 055 056 /** 057 * Factory-Holder class to ensure thread-safe lazy-loading with IODH. 058 */ 059 public static EventServiceCreator getInstance() { 060 return DefaultEventServiceCreatorHolder.INSTANCE; 061 } 062 063 /** 064 * Creates a new {@link de.novanic.eventservice.client.event.service.EventServiceAsync} which is required 065 * for the connection to the server side. 066 * This implementation uses a standard way to map GWT services and creates a service instance of 067 * {@link de.novanic.eventservice.client.event.service.EventService}. 068 * @return {@link de.novanic.eventservice.client.event.service.EventServiceAsync} interface for the server side service 069 */ 070 public EventServiceAsync createEventService() { 071 return (EventServiceAsync)GWT.create(EventService.class); 072 } 073}