001: /*
002: * $Header: /cvsroot/mvnforum/myvietnam/src/net/myvietnam/mvncore/service/impl/MvnCoreServiceImplDefault.java,v 1.18 2007/10/09 02:41:10 tbtrung Exp $
003: * $Author: tbtrung $
004: * $Revision: 1.18 $
005: * $Date: 2007/10/09 02:41:10 $
006: *
007: * ====================================================================
008: *
009: * Copyright (C) 2002-2007 by MyVietnam.net
010: *
011: * All copyright notices regarding MyVietnam and MyVietnam CoreLib
012: * MUST remain intact in the scripts and source code.
013: *
014: * This library is free software; you can redistribute it and/or
015: * modify it under the terms of the GNU Lesser General Public
016: * License as published by the Free Software Foundation; either
017: * version 2.1 of the License, or (at your option) any later version.
018: *
019: * This library is distributed in the hope that it will be useful,
020: * but WITHOUT ANY WARRANTY; without even the implied warranty of
021: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
022: * Lesser General Public License for more details.
023: *
024: * You should have received a copy of the GNU Lesser General Public
025: * License along with this library; if not, write to the Free Software
026: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
027: *
028: * Correspondence and Marketing Questions can be sent to:
029: * info at MyVietnam net
030: *
031: * @author: Trong Vo
032: */
033: package net.myvietnam.mvncore.service.impl;
034:
035: import net.myvietnam.mvncore.service.BinaryStorageService;
036: import net.myvietnam.mvncore.service.EncoderService;
037: import net.myvietnam.mvncore.service.EnvironmentService;
038: import net.myvietnam.mvncore.service.EventLogService;
039: import net.myvietnam.mvncore.service.FileUploadParserService;
040: import net.myvietnam.mvncore.service.IPFilterService;
041: import net.myvietnam.mvncore.service.MvnCoreInfoService;
042: import net.myvietnam.mvncore.service.MvnCoreLifeCycleService;
043: import net.myvietnam.mvncore.service.MvnCoreService;
044: import net.myvietnam.mvncore.service.URLResolverService;
045: import net.myvietnam.mvncore.util.AssertionUtil;
046:
047: public class MvnCoreServiceImplDefault implements MvnCoreService {
048:
049: protected EncoderService encoderService;
050: protected URLResolverService urlResolverService;
051: protected EnvironmentService environmentService;
052: protected MvnCoreInfoService mvnCoreInfoService;
053: protected BinaryStorageService binaryStorageService;
054: protected MvnCoreLifeCycleService mvnCoreLifeCycleService;
055: protected FileUploadParserService fileUploadParserService;
056: protected EventLogService eventLogService;
057: protected IPFilterService ipFilterService;
058:
059: private static int count;
060:
061: public MvnCoreServiceImplDefault() {
062: count++;
063: AssertionUtil.doAssert(count == 1,
064: "Assertion: Must have only one instance.");
065: }
066:
067: public EncoderService getEncoderService() {
068: if (encoderService == null) {
069: encoderService = new EncoderServiceImplDefault();
070: }
071: return encoderService;
072: }
073:
074: public URLResolverService getURLResolverService() {
075: if (urlResolverService == null) {
076: urlResolverService = new URLResolverServiceImplServletDefault();
077: }
078: return urlResolverService;
079: }
080:
081: public EnvironmentService getEnvironmentService() {
082: if (environmentService == null) {
083: environmentService = new EnvironmentServiceImplDefault(
084: false, false, "default", true, false, false);
085: }
086: return environmentService;
087: }
088:
089: public MvnCoreInfoService getMvnCoreInfoService() {
090: if (mvnCoreInfoService == null) {
091: mvnCoreInfoService = new MvnCoreInfoServiceImplDefault();
092: }
093: return mvnCoreInfoService;
094: }
095:
096: public BinaryStorageService getBinaryStorageService() {
097: if (binaryStorageService == null) {
098: binaryStorageService = new BinaryStorageServiceImplEmpty();
099: }
100: return binaryStorageService;
101: }
102:
103: public MvnCoreLifeCycleService getMvnCoreLifeCycleService() {
104: if (mvnCoreLifeCycleService == null) {
105: mvnCoreLifeCycleService = new MvnCoreLifeCycleServiceImplDefault();
106: }
107: return mvnCoreLifeCycleService;
108: }
109:
110: public FileUploadParserService getFileUploadParserService() {
111: if (fileUploadParserService == null) {
112: fileUploadParserService = new FileUploadParserServiceImplServlet();
113: }
114: return fileUploadParserService;
115: }
116:
117: public EventLogService getEventLogService() {
118: if (eventLogService == null) {
119: eventLogService = new EventLogServiceImplDefault();
120: }
121: return eventLogService;
122: }
123:
124: public IPFilterService getIPFilterService() {
125: if (ipFilterService == null) {
126: ipFilterService = new IPFilterServiceImplDefault();
127: }
128: return ipFilterService;
129: }
130:
131: }
|