Revision: 1629 http://svn.sourceforge.net/spring-rich-c/?rev=1629&view=rev Author: kevinstembridge Date: 2007-01-08 08:29:49 -0800 (Mon, 08 Jan 2007)
Log Message: ----------- Initial import Added Paths: ----------- trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ServiceNotFoundException.java Added: trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ServiceNotFoundException.java =================================================================== --- trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ServiceNotFoundException.java (rev 0) +++ trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ServiceNotFoundException.java 2007-01-08 16:29:49 UTC (rev 1629) @@ -0,0 +1,90 @@ +/* + * Copyright 2002-2006 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.springframework.richclient.application; + + +/** + * Indicates that an application service of a given type could not be found. + * + * @author Kevin Stembridge + * @since 0.3 + * + */ +public class ServiceNotFoundException extends RuntimeException { + + private static final long serialVersionUID = 4732373005271272964L; + private final Class serviceClass; + + private static String createDefaultMessage(Class serviceClass) { + + if (serviceClass != null) { + return "Unable to locate an application service of type [" + + serviceClass.getName() + + "]"; + } + else { + return "Unable to locate an application service. The type of the service is either " + + "unknown or was not provided when this exception was created."; + } + + } + + /** + * Creates a new [EMAIL PROTECTED] ServiceNotFoundException}. A default message containing the name of the + * given class will be used. + * + * @param serviceClass The class of the application service that could not be located. + */ + public ServiceNotFoundException(Class serviceClass) { + super(createDefaultMessage(serviceClass)); + this.serviceClass = serviceClass; + } + + /** + * Creates a new [EMAIL PROTECTED] ServiceNotFoundException} with the given detail message and nested + * exception. + * + * @param message The detail message. + * @param serviceClass The class of the application service that could not be located. + * @param cause An optional nested exception that occurred attempting to locate the service. + */ + public ServiceNotFoundException(String message, Class serviceClass) { + super(message); + this.serviceClass = serviceClass; + } + + /** + * Creates a new [EMAIL PROTECTED] ServiceNotFoundException} with the given detail message and nested + * exception. + * + * @param message The detail message. + * @param serviceClass The class of the application service that could not be located. + * @param cause An optional nested exception that occurred attempting to locate the service. + */ + public ServiceNotFoundException(String message, Class serviceClass, Throwable cause) { + super(message, cause); + this.serviceClass = serviceClass; + } + + /** + * Returns class of the application service that could not be located. + * @return Returns the service class. + */ + public Class getServiceClass() { + return this.serviceClass; + } + +} Property changes on: trunk/spring-richclient/core/src/main/java/org/springframework/richclient/application/ServiceNotFoundException.java ___________________________________________________________________ Name: svn:keywords + Author Id Revision Date HeadURL Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ spring-rich-c-cvs mailing list spring-rich-c-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs