Skip to content

Package: BundleResolver

BundleResolver

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.common;
15:
16: import org.eclipse.emf.ecore.EClassifier;
17: import org.osgi.framework.Bundle;
18:
19: /**
20: * Class to resolve an EClassifier to a Bundle.
21: *
22: * @author Eugen Neufeld
23: * @since 1.22
24: *
25: */
26: public interface BundleResolver {
27:
28:         /**
29:          * Exception that is used if a bundle could not be found.
30:          *
31:          * @author Eugen Neufeld
32:          *
33:          */
34:         class NoBundleFoundException extends Exception {
35:                 private static final long serialVersionUID = 1L;
36:
37:                 /**
38:                  * Default Constructor.
39:                  *
40:                  * @param eClassifier The EClassifier to log for.
41:                  */
42:                 public NoBundleFoundException(EClassifier eClassifier) {
43:                         super(String.format("No Bundle could not be found for %1$s.", eClassifier.getName())); //$NON-NLS-1$
44:                 }
45:         }
46:
47:         /**
48:          * Retrieve the edit bundle for the passed EClassifier.
49:          *
50:          * @param eClassifier The EClassifier to get the edit bundle for
51:          * @return the Bundle , never null
52:          * @throws NoBundleFoundException if no bundle could be found
53:          */
54:         Bundle getEditBundle(EClassifier eClassifier) throws NoBundleFoundException;
55: }