Package com.attivio.sdk.client

Interfaces for client side AIE development. The ServiceFactory can be used to create all clients represented here using various host+port/uri combinations.

Example Ingestion Code

 ServiceFactory serviceFactory = ServiceFactoryFactory.get();
 serviceFactory.setZookeeperConnectionInformation("myHost:17001");
 * IngestClient feeder = serviceFactory.getService(IngestClient.class);
 IngestDocument doc1 = new IngestDocument("myId-1");
 doc1.setField("title", "my title");
 feeder.feed(doc1);
 // feed more documents
 feeder.commit();
 // wait for the commit to complete
 feeder.waitForCompletion();
 

Example Search Code

 ServiceFactory serviceFactory = ServiceFactoryFactory.get();
 serviceFactory.setZookeeperConnectionInformation("myHost:17001");
 SearchClient searcher = serviceFactory.getService(SearchClient.class);
 QueryRequest req = new QueryRequest("foo");
 req.addFacetField("myFacetField");
 // set more query parameters
 QueryResponse resp = searcher.search(req);
 // output response information
 

Example Content Store Code

 ServiceFactory serviceFactory = ServiceFactoryFactory.get();
 serviceFactory.setZookeeperConnectionInformation("myHost:17001");
 ContentStoreClient contentStore = serviceFactory.getService(ContentStoreClient.class);

 // Create an object which can produce an input stream with relevant content (any useful bytes - like an image file)
 InputStreamBuilder contentSource = new InputStreamBuilder()
                                                   {
                                                       private final FileInputStream fis = new FileInputStream("some_image.png");

                                                       @Override
                                                       InputStream createInputStream() throws IOException {
                                                         return fis;
                                                       }

                                                       @Override
                                                       void close() throws IOException {
                                                         if (fis != null) {
                                                           fis.close();
                                                          }
                                                       }
                                                    };
 // Store the content in the content store and get back a content pointer
 ContentPointer cp = contentStore.store("my_content_id", contentSource);

 // do something with the content pointer, like store it in a document
 IngestDocument doc = new IngestDocument("my_doc_id");
 IngestField imageField = new IngestField("image");
 imageField.addFieldValue(cp);
 doc.setField(imageField);
 

Example Connector Code

 ServiceFactory serviceFactory = ServiceFactoryFactory.get();
 serviceFactory.setZookeeperConnectionInformation("myHost:17001");
 ConnectorControlApi connectorClient = serviceFactory.getService(ConnectorControlApi.class);

 // start the connector named "myCustomConnector"
 connectorClient.start("myCustomConnector");