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