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


            resp.setExpires(new Date());
            return resp;

        } catch (LdapException | CursorException | IOException e) {
            log.warn("could not access LDAP repository: {}", e.getMessage());
            throw new DataRetrievalException(e);
        }
    }
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

            }
            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 Collections.emptyList();
        } catch (RDFParseException e) {
            throw new DataRetrievalException("parse error while trying to parse remote RDF content",e);
        } catch (IOException e) {
            throw new DataRetrievalException("I/O error while trying to read remote RDF content",e);
        }
    }
View Full Code Here

          return sL.getReasonPhrase();
        }
      });
      return null;
    } catch (Exception e) {
      throw new DataRetrievalException(e);
    }
  }
View Full Code Here

            ClientResponse result = new ClientResponse(handler.httpStatus, handler.triples);
            result.setExpires(expiresDate);
            return result;
        } catch (RepositoryException e) {
            log.error("error while initialising Sesame repository; classpath problem?",e);
            throw new DataRetrievalException("error while initialising Sesame repository; classpath problem?",e);
        } catch (ClientProtocolException e) {
            log.error("HTTP client error while trying to retrieve resource {}: {}", resource, e.getMessage());
            throw new DataRetrievalException("I/O error while trying to retrieve resource "+resource,e);
        } catch (IOException e) {
            log.error("I/O error while trying to retrieve resource {}: {}", resource, e.getMessage());
            throw new DataRetrievalException("I/O error while trying to retrieve resource "+resource,e);
        } catch(RuntimeException ex) {
            log.error("Unknown error while trying to retrieve resource {}: {}", resource, ex.getMessage());
            throw new DataRetrievalException("Unknown error while trying to retrieve resource "+resource,ex);
        }

    }
View Full Code Here

        Model triples = new TreeModel();
        try {
            ModelCommons.add(triples, DummyProvider.class.getResourceAsStream(filename), resource, RDFFormat.TURTLE);

        } 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);
        }

        ClientResponse response = new ClientResponse(200, triples);

        return response;
View Full Code Here

                    },
                    ValueFactoryImpl.getInstance());

            return Collections.emptyList();
        } catch (QueryResultParseException e) {
            throw new DataRetrievalException("parse error while trying to parse remote SPARQL results",e);
        } catch (TupleQueryResultHandlerException e) {
            throw new DataRetrievalException("parse error while trying to parse remote SPARQL results",e);
        } catch (IOException e) {
            throw new DataRetrievalException("I/O error while trying to read remote RDF content",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.