1 /*
2 * Copyright 2010 FatWire Corporation. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.fatwire.gst.foundation.url;
17
18 import COM.FutureTense.Interfaces.ICS;
19
20 import com.fatwire.gst.foundation.facade.ics.ICSFactory;
21 import com.fatwire.gst.foundation.url.db.UrlRegistry;
22 import com.fatwire.gst.foundation.vwebroot.AssetApiVirtualWebrootDao;
23 import com.fatwire.gst.foundation.wra.AssetApiWraCoreFieldDao;
24
25 /**
26 * Used to instantiate path translation services. Probably should get replaced
27 * by DI at some point.
28 *
29 * @author Tony Field
30 * @since Jul 21, 2010
31 */
32 @Deprecated
33 public final class WraPathTranslationServiceFactory {
34
35 /**
36 * Return a new instance of the WraPathTranslationService.
37 *
38 * @param ics context, if available. Null is allowed
39 * @return service
40 */
41 public static WraPathTranslationService getService(ICS ics) {
42 if (ics == null) {
43 ics = ICSFactory.getOrCreateICS();
44 }
45
46 Object o = ics.GetObj(WraPathTranslationService.class.getName());
47 if (o instanceof WraPathTranslationService)
48 return (WraPathTranslationService) o;
49
50 UrlRegistry x = new UrlRegistry(ics, AssetApiWraCoreFieldDao.getInstance(ics), new AssetApiVirtualWebrootDao(ics));
51
52 ics.SetObj(WraPathTranslationService.class.getName(), x);
53 return x;
54
55 }
56 }