org.springframework.extensions.surf.exception.PlatformRuntimeException Java Examples
The following examples show how to use
org.springframework.extensions.surf.exception.PlatformRuntimeException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceDictionaryBuilder.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
/** * Sort through the resources grouping them by api name/scope, then version. * @param resources Collection<Object> * @return Map */ private static <T> Map<ApiScopeKey,Map<Integer,List<ResourceWithMetadata>>> parseResources(Collection<Object> resources) { Map<ApiScopeKey,Map<Integer,List<ResourceWithMetadata>>> apiMap = new HashMap<ApiScopeKey,Map<Integer,List<ResourceWithMetadata>>>(); for (Object bean : resources) { List<ResourceMetadata> metaData = ResourceInspector.inspect(bean.getClass()); Api api = ResourceInspector.inspectApi(bean.getClass()); if (api == null) { throw new PlatformRuntimeException("Invalid resource bean defintion. No @WebApi defined for package: "+bean.getClass().getPackage().getName()); } ApiScopeKey key = new ApiScopeKey(api); //Find api scope/name and use a key Map<Integer,List<ResourceWithMetadata>> apiVersions = apiMap.get(key); if (apiVersions == null) { //if doesn't exist then create it. apiVersions = new HashMap<Integer,List<ResourceWithMetadata>>(); apiMap.put(key, apiVersions); } List<ResourceWithMetadata> resourcesWithMeta = apiVersions.get(api.getVersion()); if (resourcesWithMeta == null) { //if doesn't exist then create it. resourcesWithMeta = new ArrayList<ResourceWithMetadata>(); apiVersions.put(api.getVersion(), resourcesWithMeta); } //For each meta just add it to the list. for (ResourceMetadata resourceMeta : metaData) { resourcesWithMeta.add(new ResourceWithMetadata(bean, resourceMeta)); } } return apiMap; }