1 //
2 // ========================================================================
3 // Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.osgi.boot.utils;
20
21 import org.eclipse.jetty.util.log.Log;
22 import org.eclipse.jetty.util.log.Logger;
23
24 /**
25 * BundleFileLocatorHelperFactory
26 *
27 * Obtain a helper for locating files based on the bundle.
28 */
29 public class BundleFileLocatorHelperFactory
30 {
31 private static final Logger LOG = Log.getLogger(BundleFileLocatorHelperFactory.class);
32
33 private static BundleFileLocatorHelperFactory _instance = new BundleFileLocatorHelperFactory();
34
35 private BundleFileLocatorHelperFactory() {}
36
37 public static BundleFileLocatorHelperFactory getFactory()
38 {
39 return _instance;
40 }
41
42 public BundleFileLocatorHelper getHelper()
43 {
44 BundleFileLocatorHelper helper = BundleFileLocatorHelper.DEFAULT;
45 try
46 {
47 //see if a fragment has supplied an alternative
48 helper = (BundleFileLocatorHelper) Class.forName(BundleFileLocatorHelper.CLASS_NAME).newInstance();
49 }
50 catch (Throwable t)
51 {
52 LOG.ignore(t);
53 }
54 return helper;
55 }
56
57 }