From: Vance K. <va...@us...> - 2006-01-28 03:01:02
|
User: vancek Date: 06/01/27 19:00:55 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3SessionFacadeLogicImpl.java Log: added default exception facility Revision Changes Path 1.8 +54 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java Index: EJB3SessionFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- EJB3SessionFacadeLogicImpl.java 25 Jan 2006 03:03:30 -0000 1.7 +++ EJB3SessionFacadeLogicImpl.java 28 Jan 2006 03:00:55 -0000 1.8 @@ -60,6 +60,12 @@ private static final String SERVICE_DELEGATE_NAME_PATTERN = "serviceDelegateNamePattern"; /** + * The property which stores the pattern defining the default service bean + * exception class name. + */ + private static final String SERVICE_DEFAULT_EXCEPTION_NAME_PATTERN = "defaultServiceExceptionNamePattern"; + + /** * The property that stores the persistence container name. */ public static final String PERSISTENCE_CONTAINER = "persistenceContainerName"; @@ -71,10 +77,15 @@ private static final String PERSISTENCE_CONTEXT_UNIT_NAME = "persistenceContextUnitName"; /** - * The default view type accessability for the session bean + * The default view type accessability for the session bean. */ public static final String SESSION_DEFAULT_VIEW_TYPE = "serviceViewType"; + /** + * The property that stores whether default service exceptions are permitted. + */ + public static final String ALLOW_DEFAULT_SERVICE_EXCEPTION = "allowDefaultServiceException"; + // ---------------- constructor ------------------------------- public EJB3SessionFacadeLogicImpl (Object metaObject, String context) @@ -788,4 +799,46 @@ return allRoles; } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetDefaultExceptionName() + */ + protected String handleGetDefaultExceptionName() + { + String defaultExceptionNamePattern = + (String)this.getConfiguredProperty(SERVICE_DEFAULT_EXCEPTION_NAME_PATTERN); + + return MessageFormat.format( + defaultExceptionNamePattern, + new Object[] {StringUtils.trimToEmpty(this.getName())}); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic# + * handleGetFullyQualifiedDefaultExceptionName() + */ + protected String handleGetFullyQualifiedDefaultExceptionName() + { + StringBuffer fullyQualifiedName = new StringBuffer("java.lang.RuntimeException"); + if (this.isAllowDefaultServiceException()) + { + fullyQualifiedName = new StringBuffer(); + if (StringUtils.isNotBlank(this.getPackageName())) + { + fullyQualifiedName.append(this.getPackageName()); + fullyQualifiedName.append('.'); + } + fullyQualifiedName.append(this.getDefaultExceptionName()); + } + return fullyQualifiedName.toString(); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleIsAllowDefaultServiceException() + */ + protected boolean handleIsAllowDefaultServiceException() + { + return Boolean.valueOf( + String.valueOf(this.getConfiguredProperty(ALLOW_DEFAULT_SERVICE_EXCEPTION))).booleanValue(); + } + } \ No newline at end of file |