Package org.apache.stanbol.enhancer.servicesapi

Examples of org.apache.stanbol.enhancer.servicesapi.NoSuchPartException


  public <T> T getPart(UriRef uri, Class<T> clazz) throws NoSuchPartException {
        readLock.lock();
        try {
            Object part = parts.get(uri);
            if(part == null){
                throw new NoSuchPartException(uri);
            }
            if(clazz.isAssignableFrom(part.getClass())){
                return (T)part;
            } else {
                throw new ClassCastException("The part '"+part+"'(class: "
View Full Code Here


          count++;
        }
        } finally {
            readLock.unlock();
        }
      throw new NoSuchPartException(index);
  }
View Full Code Here

        int count = 0;
        for(Map.Entry<UriRef, Object> entry : parts.entrySet()) {
          if (count == index) {
            result = entry.getValue();
            if (!result.getClass().isAssignableFrom(clazz)) {
              throw new NoSuchPartException("The body part 0 is of type "+result.getClass().getName()+" which cannot be converted to "+clazz.getName());
            }
            return (T) result;
          }
          count++;
        }
        } finally {
            readLock.unlock();
        }
       throw new NoSuchPartException(index);
  }
View Full Code Here

            if(uriRef.equals(mainContentPartUri)){
                throw new IllegalStateException("The main ContentPart (uri '"
                    + uriRef+"') CAN NOT be removed!");
            }
            if(parts.remove(uriRef) == null){
                throw new NoSuchPartException(uriRef);
            }
        } finally {
            writeLock.unlock();
        }
  }
View Full Code Here

  public <T> T getPart(UriRef uri, Class<T> clazz) throws NoSuchPartException {
        readLock.lock();
        try {
            Object part = parts.get(uri);
            if(part == null){
                throw new NoSuchPartException(uri);
            }
            if(clazz.isAssignableFrom(part.getClass())){
                return (T)part;
            } else {
                throw new ClassCastException("The part '"+part+"'(class: "
View Full Code Here

          count++;
        }
        } finally {
            readLock.unlock();
        }
      throw new NoSuchPartException(index);
  }
View Full Code Here

        int count = 0;
        for(Map.Entry<UriRef, Object> entry : parts.entrySet()) {
          if (count == index) {
            result = entry.getValue();
            if (!result.getClass().isAssignableFrom(clazz)) {
              throw new NoSuchPartException("The body part 0 is of type "+result.getClass().getName()+" which cannot be converted to "+clazz.getName());
            }
            return (T) result;
          }
          count++;
        }
        } finally {
            readLock.unlock();
        }
       throw new NoSuchPartException(index);
  }
View Full Code Here

            if(uriRef.equals(mainContentPartUri)){
                throw new IllegalStateException("The main ContentPart (uri '"
                    + uriRef+"') CAN NOT be removed!");
            }
            if(parts.remove(uriRef) == null){
                throw new NoSuchPartException(uriRef);
            }
        } finally {
            writeLock.unlock();
        }
  }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.servicesapi.NoSuchPartException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.