1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db.exception;
\r
14 import org.simantics.db.ServiceLocator;
\r
17 * Thrown by {@link ServiceLocator} when requested services are unavailable.
\r
19 * @author Tuukka Lehtonen
\r
21 public class ServiceNotFoundException extends RuntimeDatabaseException {
\r
23 private static final long serialVersionUID = 2454410258587204157L;
\r
25 private final ServiceLocator locator;
\r
26 private final Class<?> clazz;
\r
28 public ServiceNotFoundException(ServiceLocator locator, Class<?> clazz, String message) {
\r
30 this.locator = locator;
\r
34 public ServiceNotFoundException(ServiceLocator locator, Class<?> clazz) {
\r
35 this.locator = locator;
\r
40 public String toString() {
\r
41 StringBuilder sb = new StringBuilder();
\r
42 sb.append(clazz.getName()).append(" is not available in ").append(locator.toString());
\r
43 String msg = getMessage();
\r
45 sb.append(" - ").append(msg);
\r
46 return sb.toString();
\r