@Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public FactoryResource findResource(String path) throws FactoryException { logIt("findResource(...) called"); logIt("params : path=" + path); try { FactoryResourceIdentifier identifier = binding.lookup(path); if (!identifier.getService().equals(SERVICE_NAME)) { throw new CoreServiceException( "Resource " + identifier + " is not managed by " + SERVICE_NAME); } if (identifier.getType().equals(Forum.RESOURCE_NAME)) { return readForum(path); } else if (identifier.getType().equals(ThreadMessage.RESOURCE_NAME)) { return readThreadMessage(path); } throw new CoreServiceException( "Resource " + identifier + " is not managed by " + SERVICE_NAME); } catch (Exception e) { logger.error("unable to find the resource at path " + path, e); throw new CoreServiceException("unable to find the resource at path " + path, e); } }
private void checkResourceType(FactoryResourceIdentifier identifier, String resourceType) throws MembershipServiceException { if (!identifier.getService().equals(getServiceName())) { throw new MembershipServiceException( "resource identifier " + identifier + " does not refer to service " + getServiceName()); } if (!identifier.getType().equals(resourceType)) { throw new MembershipServiceException( "resource identifier " + identifier + " does not refer to a resource of type " + resourceType); } }
/** * Read name with an optional pep check. * * @param path path to the given resource. * @param pepCheck true to make the check. * @return a factoryResource if it can be find. */ @TransactionAttribute(TransactionAttributeType.REQUIRED) private FactoryResource findResource(String path, boolean pepCheck) throws FactoryException { try { FactoryResourceIdentifier identifier = binding.lookup(path); if (!identifier.getService().equals(GreetingService.SERVICE_NAME)) { throw new GreetingServiceException( "Resource " + identifier + " is not managed by " + GreetingService.SERVICE_NAME); } if (identifier.getType().equals(Name.RESOURCE_NAME)) { return readName(path, pepCheck); } throw new GreetingServiceException( "Resource " + identifier + " is not managed by Greeting Service"); } catch (Exception e) { logger.error("unable to find the resource at path " + path, e); throw new GreetingServiceException("unable to find the resource at path " + path, e); } }
@Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public FactoryResource findResource(String path) throws FactoryException { try { FactoryResourceIdentifier identifier = binding.lookup(path); if (!identifier.getService().equals(ProjectService.SERVICE_NAME)) { throw new CoreServiceException( "Resource " + identifier + " is not managed by " + ProjectService.SERVICE_NAME); } if (identifier.getType().equals("Project")) { return getProject(path); } throw new CoreServiceException( "Resource " + identifier + " is not managed by " + ProjectService.SERVICE_NAME); } catch (Exception e) { throw new CoreServiceException("unable to find the resource at path " + path, e); } }