Professional Documents
Culture Documents
®
Outside In SearchML © 1992-2005 Stellent Chicago, Inc. All rights
reserved.
®
Rosette Globalization Platform Portions Copyright © Basis
Technology Corp. 2003-2005. All rights reserved.
Trademarks
Don't Stop At Search, Endeca, Endeca InFront, Endeca Navigation
Engine, Guided Navigation, and ProFind are registered trademarks, and
Endeca Data Foundry and Endeca Latitude are trademarks of Endeca
Technologies, Inc.
Preface
Contacting Endeca Standard Customer Support . . . . . . . . . . . . . . . . xii
getRecordSpec() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
getSeverity() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
DIException Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
getMessage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
DIInvalidOperation Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
getMessage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
DIInvalidParameter Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
getMessage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
DISystemOperation Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
getMessage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Index
Preface
Italic text may also indicate new terms that appear in the
Endeca Glossary.
IMPORTANT: This document assumes that you are already familiar with
Endeca components and terminology as discussed in the Endeca
Concepts Guide and are comfortable programming in languages that can
access Web services, such as Java and C#.
14
• On Windows: %ENDECA_ROOT%\lib\services
You can leave the other tabs (Sources, Record Index, and
so on) in their default state.
After you have read one of these sections, you can continue
with the section “Writing the Java Client Application” on
30
Element/Attribute Purpose
Of the various options, the two that you will use are the
following:
Option Purpose
-keep Keeps the source files (.java files) for the stubs
and class files. This is necessary because you
will modify one of the generated source files. If
you do not use this option, only .class files will
be produced
The tool will create a directory with the name that was
specified with the packageName element in the client
configuration file. The directory will contain a number of
files, including the following:
• The Stub class, named DataIndexing_Stub.class,
representing the Web service proxy and implementing
the DataIndexing interface.
• The Service implementation class, named
DataIndexingService_Impl.class.
deserializationContext.popEncodingStyle();
The tool will create a directory with the name that was
specified with the -p option.
return server;
}
Creating Records
r.setValues(keyvals);
The file handle value must map to the file path that is
specified in the URL field in the record adapter of the
partial pipeline. For example, the record adapter in the
C:\NetClient>
using System;
namespace ConsoleApplication1
{
/// <summary>
/// Class to start a baseline update.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
DataIndexingService di=new DataIndexingService();
di.Url="http://localhost:8888/services/DataIndexing";
di.PreAuthenticate=true;
di.Credentials=new System.Net.NetworkCredential("webservices",
"K07YZ17");
try
{
di.startBaselineUpdate();
Status s=di.getStatus();
System.Console.WriteLine(s.systemState);
}
catch (System.Web.Services.Protocols.SoapException e)
{
System.Console.WriteLine(e.Detail.InnerXml);
}
System.Console.ReadLine();
}
}
}
di.startBaselineUpdate();
You could add a while loop that checks the system state
and breaks when either “IDLE” or “SYSTEM_ERROR” is
returned. If one or more SystemError objects are returned
(which, as noted above, can happen even with an “IDLE”
status), the Status.systemErrors property will get the
complete error state and the SystemError properties will
get the error details.
Catching Exceptions
if(e.InnerException != null)
{
Console.WriteLine("InnerException:");
Console.WriteLine(e.InnerException.ToString());
}
}
DataIndexing Interface
The DataIndexing interface provides for adding data
content to the Endeca implementation, retrieving status,
and running partial and baseline updates on the data.
Methods
Parameters:
• handle – The handle to the record adapter that will
handle the data, as specified in the partial update
pipeline. The value must map to the file path specified
by the URL in the adapter (relative to Forge’s incoming
directory).
• records – An array of one or more records (Record
objects) to be passed into the system.
Throws:
• DIInvalidParameter if the handle or records
parameter is null or otherwise invalid.
• DIInvalidOperation if the Endeca Manager is currently
performing an update.
clearContent(String[] handles)
Parameters:
• handle – The handles whose data needs to be cleared.
Developers typically call this method after a successful
update and before they start adding more content.
Throws:
• DIInvalidParameter if the handle parameter is null or
otherwise invalid.
• DIInvalidOperation if the Endeca Manager is currently
performing an update.
• DISystemException if some of the files could not be
deleted or if some other error occurred.
getSystemStatus()
Returns:
Status—A Status object, indicating the state of the
system (whether it is in the middle of an update) and a
collection of errors reported by the components on
individual records in the system.
Throws:
• DISystemException if an error occurred in trying to
obtain the status from the Endeca Manager.
startBaselineUpdate()
Throws:
• DIInvalidOperation if the Endeca Manager is currently
performing an update.
• DISystemException if the baseline update cannot be
started or if some other error occurred.
startPartialUpdate()
Throws:
• DIInvalidOperation if the Endeca Manager is currently
performing an update.
• DISystemException if the partial update cannot be
started or if some other error occurred.
stopBaselineUpdate()
Throws:
• DIInvalidOperation if the Endeca Manager is not
currently performing an update.
• DISystemException if the baseline update cannot be
stopped or if some other error occurred.
PVal Class
A key/value pair, a collection of which constitutes a
Record object. The key is the name of an Endeca property
or dimension, and the value is the String value of that
key.
Constructors
Parameters:
• name – The name of the property or dimension.
• value – The value of the property or dimension.
PVal()
Methods
getName()
Returns:
String—The name of this PVal object.
getValue()
Returns:
String—The value of this PVal object.
setName(String name)
Parameters:
• name – The name assigned to this PVal object.
setValue(String value)
Parameters:
• value – The value assigned to this PVal object.
Record Class
A source record, which is a collection of data in the form
of PVal objects (key/value pairs). The record is added to
the Endeca system with the EndecaSystem.addContent()
method.
Constructors
Record(PVal[] values)
Parameters:
• values – A collection of PVal objects.
Record()
Methods
getValues()
Returns:
PVal[]—The array of PVal objects.
setValues(PVal[] pval)
Parameters:
• pval – The collection of PVal objects to be added to
the record.
Status Class
An object that represents the state of the system,
including failed records and associated error messages.
Methods
getSystemErrors()
Returns:
SystemErrors[]—The array of SystemError objects.
getSystemState()
Returns:
String—The status of the system, as indicated by one of
the above messages.
SystemError Class
An object that represents a system error. Typically, the
error involves a record that failed to be added to the
system. However, the system error may be caused by a
condition that was not related to a failed Record object.
Methods
getComponent()
Returns:
getErrorMsg()
Returns:
String—The error message, as returned from the Endeca
Manager. If the error is due to a failed Record object, the
message may include the reason why the record could
not be added or updated.
getRecordSpec()
Returns:
String—The record specifier of the Record object that
was not added. Returns null if the SystemError is not
related to a particular record.
getSeverity()
Returns:
DIException Class
The DIException represents all exceptions thrown by
Data Indexing related classes. The DIInvalidOperation,
DIInvalidParameter, and DISystemException classes all
inherit from this class.
Methods
getMessage()
Returns:
String—The error message.
DIInvalidOperation Class
The DIInvalidOperation exception is thrown for
operations that were not valid for the state in which the
system was in. For example, calling the addContent()
method when a partial update is in progress will throw
this exception. Typically, users can programmatically
recover from this exception (by waiting for the update to
finish, for example).
Methods
getMessage()
Returns:
String—The error message.
DIInvalidParameter Class
The DIInvalidParameter exception is thrown for
parameters that were not valid for a method.
Methods
getMessage()
Returns:
String—The error message.
DISystemOperation Class
DISystemOperation indicates a much more serious
problem than DIInvalidOperation. Typically, users
cannot programmatically recover from this exception, but
instead must use manual intervention (such as
reprovisioning the system).
Methods
getMessage()
Returns:
String—The error message.
Client.java Example
The Client.java sample code is a basic example of a partial
update application. It extracts source records from a text file
and constructs Data Indexing API Record objects. An array
of these records is added to the system with the
DataIndexing.addContent() method.
package com.endeca.service.dataindexing;
import javax.xml.rpc.Stub;
import java.io.*;
import endeca.*;
//this is the directory from which we parse data to send to the API
private static final String c_strPartialUpdateDataDir =
"C:\\Projects\\partial_updates_data\\";
// this is the file that contains data we want to add
private static final String c_strAddDataInput =
c_strPartialUpdateDataDir+"mexico.txt";
// this is the file that contains data we want to delete
private static final String c_strDelDataInput =
c_strPartialUpdateDataDir+"deletes.txt";
// this is the file that contains data we want to modify
private static final String c_strModDataInput =
c_strPartialUpdateDataDir+"updates.txt";
doClearContent(server);
doAddContent(server);
return server;
}
Client2.java Example
The Client2.java sample code is identical to Client.java
except that the addContentHelper() private method uses
the DataIndexing.addContent() method only once. That
method is listed below.