View Javadoc
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   * @deprecated Use the standard ObjectFactory instead.  This variation uses an unsafe mechanism to access the ICS
32   * object.
33   */
34  @Deprecated
35  public final class WraPathTranslationServiceFactory {
36  
37      /**
38       * Return a new instance of the WraPathTranslationService.
39       * 
40       * @param ics context, if available. Null is allowed
41       * @return service
42       * @deprecated Use the standard ObjectFactory instead.  This method uses an unsafe mechanism to access the ICS
43       * object
44       */
45      @Deprecated
46      public static WraPathTranslationService getService(ICS ics) {
47          if (ics == null) {
48              ics = ICSFactory.getOrCreateICS();
49          }
50  
51          Object o = ics.GetObj(WraPathTranslationService.class.getName());
52          if (o instanceof WraPathTranslationService)
53              return (WraPathTranslationService) o;
54  
55          UrlRegistry x = new UrlRegistry(ics, AssetApiWraCoreFieldDao.getInstance(ics), new AssetApiVirtualWebrootDao(ics));
56  
57          ics.SetObj(WraPathTranslationService.class.getName(), x);
58          return x;
59  
60      }
61  }