Package org.apache.marmotta.ldclient.exception

Examples of org.apache.marmotta.ldclient.exception.DataRetrievalException


    private LdapConnection openLdapConnection(Endpoint endpoint) throws DataRetrievalException {
        java.net.URI u;
    try {
      u = new java.net.URI(endpoint.getEndpointUrl());
    } catch (URISyntaxException e) {
      throw new DataRetrievalException("Invalid enpooint URI", e);
    }
    LdapConnectionConfig config = new LdapConnectionConfig();
    config.setLdapHost(u.getHost());
    config.setLdapPort(u.getPort() > 0 ? u.getPort() : 389);
    if (endpoint.hasProperty("loginDN")) {
      config.setName(endpoint.getProperty("loginDN"));
    }
    if (endpoint.hasProperty("loginPW")) {
      config.setName(endpoint.getProperty("loginPW"));
    }
        LdapNetworkConnection connection = new LdapNetworkConnection(config);
        try {
      connection.bind();
    } catch (Exception e) {
      throw new DataRetrievalException("LDAP connnection could not be bind", e);
    }
        if (connection.isAuthenticated()) {
          return connection;
        } else {
          throw new DataRetrievalException("LDAP connnection could not be stablished");
        }

    }
View Full Code Here


                final ClientResponse resp = new ClientResponse(200, rep);
                resp.setExpires(new Date());
                return resp;

            } catch (Exception e) {
        throw new DataRetrievalException(e);
      } finally {
                conn.close();
            }
        } catch (RepositoryException e1) {
            log.warn("Could not create SailRep: {}", e1.getMessage());
            throw new DataRetrievalException(e1);
        }
    }
View Full Code Here

        try {
            java.net.URI u;
            u = new java.net.URI(endpoint.getEndpointUrl());
            return u.getPath() != null ? u.getPath().substring(1) : "";
        } catch (URISyntaxException e) {
            throw new DataRetrievalException("Invalid LDAP-Suffix config for endpoint '" + endpoint.getName() + "'!");
        }
    }
View Full Code Here

        List<String> data;
    try {
      data = getChildList(suffix, con);
    } catch (Exception e) {
      log.error("Error getting childs: {}", e.getMessage(), e);
      throw new DataRetrievalException(e);
    }
        String next = null;
        for (String dn : data) {
            if (dn.toLowerCase().endsWith((current + "," + suffix).toLowerCase())) {
                next = dn;
                break;
            }
        }

        if (next == null) throw new DataRetrievalException("The Object '" + current + "' cannot be found");

        return buildDN(next, path.replaceFirst("^[^/]*(/|$)", ""), con);
    }
View Full Code Here

            video_id = StringUtils.removeStart(uri, YOUTUBE_GDATA);
        }
        if (StringUtils.isBlank(video_id)) {
            String msg = "Not valid video id found in '" + uri + "'";
            log.error(msg);
            throw new DataRetrievalException(msg);
        } else {
            try {
                conn.add(new URIImpl(uri), new URIImpl(FOAF_PRIMARY_TOPIC), new URIImpl(YoutubeVideoProvider.YOUTUBE_BASE_URI + video_id), (Resource)null);
                // FIXME: add inverse triple, but maybe at the YoutubeVideoProvider
                conn.close();
View Full Code Here

                con.commit();
            } catch(RepositoryException ex) {
                con.rollback();
            } catch (RDFParseException e) {
                throw new DataRetrievalException("could not parse resource data for file "+filename);
            } catch (IOException e) {
                throw new DataRetrievalException("could not load resource data for file "+filename);
            } finally {
                con.close();
            }

            ClientResponse response = new ClientResponse(200, triples);

            return response;
        } catch (RepositoryException e) {
            throw new DataRetrievalException("could not load resource data for file "+filename);
        }

    }
View Full Code Here

                con.commit();
            } catch(RepositoryException ex) {
                con.rollback();
            } catch (RDFParseException e) {
                throw new DataRetrievalException("could not parse resource data for file "+filename);
            } catch (IOException e) {
                throw new DataRetrievalException("could not load resource data for file "+filename);
            } finally {
                con.close();
            }

            ClientResponse response = new ClientResponse(200, triples);

            return response;
        } catch (RepositoryException e) {
            throw new DataRetrievalException("could not load resource data for file "+filename);
        }

    }
View Full Code Here

            }
            return followUp;

            // throw new DataRetrievalException("Invalid response from Mediawiki-API.");
        } catch (RepositoryException e) {
            throw new DataRetrievalException("repository error while parsing XML response", e);
        } catch (IOException e) {
            throw new DataRetrievalException("I/O error while parsing HTML response", e);
        } catch (JDOMException e) {
            throw new DataRetrievalException("could not parse XML response. It is not in proper XML format", e);
        }
    }
View Full Code Here

                    return StringUtils.equals(param.getSubject().stringValue(), resourceUri);
                }
            });
            return Collections.emptyList();
        } catch (RDFParseException e) {
            throw new DataRetrievalException("parse error while trying to parse Turtle from Freebase", e);
        } catch (IOException e) {
            throw new DataRetrievalException("I/O error while trying to read remote Turtle from Freebase", e);
        }

    }
View Full Code Here


            return findAdditionalRequestUrls(resource, htmlDoc, requestUrl);

        } catch (IOException e) {
            throw new DataRetrievalException("I/O error while parsing HTML response",e);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.marmotta.ldclient.exception.DataRetrievalException

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.