http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/Markup.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/Markup.java 
b/src/com/google/wave/api/Markup.java
deleted file mode 100644
index 68509de..0000000
--- a/src/com/google/wave/api/Markup.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- *  Holds a piece of markup to be applied to a blip.
- *
- *  Insert/Append/Replace all can take a {@link Markup} instance instead of
- *  text. The markup should be {@code HTML} and will be converted to wave
- *  in a similar fashion as what happened when {@code HTML} is pasted directly
- *  into a wave.
- */
-public class Markup extends BlipContent {
-
-  /** The {@link Pattern} object used to search markup content. */
-  private static final Pattern MARKUP_PATTERN = Pattern.compile("\\<.*?\\>");
-
-  /** The {@code HTML} content of this markup. */
-  private final String markup;
-
-  /** The plain text version of this markup. */
-  private final String plain;
-
-  /**
-   * Convenience factory method.
-   *
-   * @param markup the {@code HTML} content.
-   * @return an instance of {@link Markup} that represents the given markup.
-   */
-  public static Markup of(String markup) {
-    return new Markup(markup);
-  }
-
-  /**
-   * Constructor.
-   *
-   * @param markup the {@code HTML} content.
-   */
-  public Markup(String markup) {
-    this.markup = markup;
-    this.plain = convertToPlainText(markup);
-  }
-
-  /**
-   * Returns the {@code HTML} content of this markup.
-   *
-   * @return the {@code HTML} content.
-   */
-  public String getMarkup() {
-    return markup;
-  }
-
-  @Override
-  public String getText() {
-    return plain;
-  }
-
-  /**
-   * Converts the given {@code HTML} into robot compatible plain text.
-   *
-   * @param html the text to convert.
-   * @return a plain text version of the given html text.
-   */
-  private static String convertToPlainText(String html) {
-    StringBuffer result = new StringBuffer();
-    Matcher matcher = MARKUP_PATTERN.matcher(html);
-    while (matcher.find()) {
-      String replacement = "";
-      String tag = matcher.group().substring(1, matcher.group().length() - 
1).split(" ")[0];
-      if ("p".equals(tag) || "br".equals(tag)) {
-        replacement = "\n";
-      }
-      matcher.appendReplacement(result, replacement);
-    }
-    matcher.appendTail(result);
-    return result.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/NonJsonSerializable.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/NonJsonSerializable.java 
b/src/com/google/wave/api/NonJsonSerializable.java
deleted file mode 100644
index 986d431..0000000
--- a/src/com/google/wave/api/NonJsonSerializable.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Marks a field to be non-serializable.  When serializing the object to JSON,
- * this field should not be included.
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NonJsonSerializable {}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/OperationQueue.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/OperationQueue.java 
b/src/com/google/wave/api/OperationQueue.java
deleted file mode 100644
index 9e27aa1..0000000
--- a/src/com/google/wave/api/OperationQueue.java
+++ /dev/null
@@ -1,714 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import com.google.wave.api.JsonRpcConstant.ParamsProperty;
-import com.google.wave.api.OperationRequest.Parameter;
-import com.google.wave.api.impl.RawAttachmentData;
-
-import org.waveprotocol.wave.model.id.InvalidIdException;
-import org.waveprotocol.wave.model.id.WaveId;
-import org.waveprotocol.wave.model.id.WaveletId;
-import org.waveprotocol.wave.media.model.AttachmentId;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-/**
- * A utility class that abstracts the queuing of operations, represented by
- * {@link OperationRequest}, using easily callable functions. The
- * {@link OperationQueue} queues the resulting operations in order.
- *
- * Typically there shouldn't be a need to call this directly unless operations
- * are needed on entities outside of the scope of the robot. For example, to
- * modify a blip that does not exist in the current context, you might specify
- * the wave, wavelet, and blip id to generate an operation.
- *
- * Any calls to this will not be reflected in the robot in any way. For 
example,
- * calling wavelet_append_blip will not result in a new blip being added to the
- * robot current context, only an operation to be sent to the robot proxy.
- */
-public class OperationQueue implements Serializable {
-
-  /** A random number generator for the temporary ids. */
-  private static final Random ID_GENERATOR = new Random();
-
-  /** The format of temporary blip ids. */
-  private static final String TEMP_BLIP_ID_FORMAT = "TBD_%s_%s";
-
-  /** The format of temporary wave ids. */
-  private static final String TEMP_WAVE_ID_FORMAT = "%s!TBD_%s";
-
-  /** The format of wavelet ids. */
-  private static final String TEMP_WAVELET_ID_FORMAT = "%s!conv+root";
-
-  /** The format of new operation ids. */
-  private static final String OP_ID_FORMAT = "op%d";
-
-  /** Some class global counters. */
-  private static long nextOpId = 1;
-
-  /** The id that can be set for {@code proxyingFor} parameter. */
-  private final String proxyForId;
-
-  /** The operation queue. */
-  private List<OperationRequest> pendingOperations;
-
-  /**
-   * Constructor that creates a new instance of {@link OperationQueue} with
-   * an empty queue and no proxying information set.
-   */
-  public OperationQueue() {
-    this(new ArrayList<OperationRequest>(), null);
-  }
-
-  /**
-   * Constructor that creates a new instance of {@link OperationQueue} with
-   * a specified proxying information.
-   *
-   * @param proxyForId the proxying information.
-   */
-  public OperationQueue(String proxyForId) {
-    this(new ArrayList<OperationRequest>(), proxyForId);
-  }
-
-  /**
-   * Constructor that creates a new instance of {@link OperationQueue} with
-   * a specified queue and proxying information.
-   *
-   * @param operations the underlying operation queue that should be used for
-   *     this {@link OperationQueue}.
-   * @param proxyForId the proxying information.
-   */
-  public OperationQueue(List<OperationRequest> operations, String proxyForId) {
-    this.pendingOperations = operations;
-    this.proxyForId = proxyForId;
-  }
-
-  /**
-   * Returns a list of the pending operations that have been queued up.
-   *
-   * @return the pending operations.
-   */
-  public List<OperationRequest> getPendingOperations() {
-    return pendingOperations;
-  }
-
-  /**
-   * Returns the id for {@code proxyingFor} parameter.
-   *
-   * @return the proxying id.
-   */
-  public String getProxyForId() {
-    return proxyForId;
-  }
-
-  /**
-   * Creates a view of this {@link OperationQueue} with the proxying for set to
-   * the given id.
-   *
-   * This method returns a new instance of an operation queue that shares the
-   * operation list, but has a different {@link #proxyForId} set so when the
-   * robot uses this new queue, subsequent operations will be sent out with the
-   * {@code proxying_for} field set.
-   *
-   * @param proxyForId the proxying information.
-   * @return a view of this {@link OperationQueue} with the proxying 
information
-   *     set.
-   */
-  public OperationQueue proxyFor(String proxyForId) {
-    return new OperationQueue(pendingOperations, proxyForId);
-  }
-
-  /**
-   * Clears this operation queue.
-   */
-  public void clear() {
-    pendingOperations.clear();
-  }
-
-  /**
-   * Appends a blip to a wavelet.
-   *
-   * @param wavelet the wavelet to append the new blip to.
-   * @param initialContent the initial content of the new blip.
-   * @return an instance of {@link Blip} that represents the new blip.
-   */
-  public Blip appendBlipToWavelet(Wavelet wavelet, String initialContent) {
-    Blip newBlip = newBlip(wavelet, initialContent, null, 
generateTempBlipId(wavelet),
-        wavelet.getRootThread().getId());
-    appendOperation(OperationType.WAVELET_APPEND_BLIP, wavelet,
-        Parameter.of(ParamsProperty.BLIP_DATA, newBlip.serialize()));
-    return newBlip;
-  }
-
-  /**
-   * Adds a participant to a wavelet.
-   *
-   * @param wavelet the wavelet that the new participant should be added to.
-   * @param participantId the id of the new participant.
-   */
-  public void addParticipantToWavelet(Wavelet wavelet, String participantId) {
-    appendOperation(OperationType.WAVELET_ADD_PARTICIPANT_NEWSYNTAX, wavelet,
-        Parameter.of(ParamsProperty.PARTICIPANT_ID, participantId));
-  }
-
-  /**
-   * Removes a participant from a wavelet.
-   *
-   * @param wavelet the wavelet that the participant should be removed from.
-   * @param participantId the id of the participant to be removed.
-   */
-  public void removeParticipantFromWavelet(Wavelet wavelet, String 
participantId) {
-    appendOperation(OperationType.WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX, 
wavelet,
-        Parameter.of(ParamsProperty.PARTICIPANT_ID, participantId));
-  }
-
-  /**
-   * Creates a new wavelet.
-   *
-   * @param domain the domain to create the wavelet in.
-   * @param participants the initial participants on this new wavelet.
-   * @return an instance of {@link Wavelet} that represents the new wavelet.
-   */
-  public Wavelet createWavelet(String domain, Set<String> participants) {
-    return createWavelet(domain, participants, "");
-  }
-
-  /**
-   * Creates a new wavelet with an optional message.
-   *
-   * @param domain the domain to create the wavelet in.
-   * @param participants the initial participants on this new wavelet.
-   * @param message an optional payload that is returned with the corresponding
-   *     event.
-   * @return an instance of {@link Wavelet} that represents the new wavelet.
-   */
-  public Wavelet createWavelet(String domain, Set<String> participants, String 
message) {
-    Wavelet newWavelet = newWavelet(domain, participants, this);
-    OperationRequest operation = 
appendOperation(OperationType.ROBOT_CREATE_WAVELET,
-        newWavelet, Parameter.of(ParamsProperty.WAVELET_DATA, 
newWavelet.serialize()));
-
-    // Don't add the message if it's null or empty.
-    if (message != null && !message.isEmpty()) {
-      operation.addParameter(Parameter.of(ParamsProperty.MESSAGE, message));
-    }
-    return newWavelet;
-  }
-
-  /**
-   * Appends search operation for specified query.
-   *
-   * @param query the query to execute.
-   * @param index the index from which to return results.
-   * @param numresults the number of results to return.
-   */
-  public void search(String query, Integer index, Integer numresults) {
-    Parameter queryParam = Parameter.of(ParamsProperty.QUERY, query);
-    Parameter indexParam = Parameter.of(ParamsProperty.INDEX, index);
-    Parameter numresultsParam = Parameter.of(ParamsProperty.NUM_RESULTS, 
numresults);
-    appendOperation(OperationType.ROBOT_SEARCH, queryParam, indexParam, 
numresultsParam);
-  }
-
-  /**
-   * Sets a key-value pair on the data document of a wavelet.
-   *
-   * @param wavelet to set the data document on.
-   * @param name the name of this data.
-   * @param value the value of this data.
-   */
-  public void setDatadocOfWavelet(Wavelet wavelet, String name, String value) {
-    appendOperation(OperationType.WAVELET_SET_DATADOC, wavelet,
-        Parameter.of(ParamsProperty.DATADOC_NAME, name),
-        Parameter.of(ParamsProperty.DATADOC_VALUE, value));
-  }
-
-  /**
-   * Requests a snapshot of the specified wave.
-   *
-   * @param waveId the id of the wave that should be fetched.
-   * @param waveletId the wavelet id that should be fetched.
-   */
-  public void fetchWavelet(WaveId waveId, WaveletId waveletId) {
-    appendOperation(OperationType.ROBOT_FETCH_WAVE, waveId, waveletId, null);
-  }
-
-  /**
-   * Retrieves list of wave wavelets ids.
-   *
-   * @param waveId the id of the wave.
-   */
-  public void retrieveWaveletIds(WaveId waveId) {
-    appendOperation(OperationType.ROBOT_FETCH_WAVE, waveId, null, null,
-        Parameter.of(ParamsProperty.RETURN_WAVELET_IDS, true));
-  }
-
-  /**
-   * Exports snapshot of wavelet.
-   *
-   * @param waveId the id of the wave that should be exported.
-   * @param waveletId the id of the wavelet that should be exported.
-   */
-  public void exportSnapshot(WaveId waveId, WaveletId waveletId) {
-    appendOperation(OperationType.ROBOT_EXPORT_SNAPSHOT, waveId, waveletId, 
null);
-  }
-
-  /**
-   * Exports deltas of wavelet.
-   *
-   * @param waveId the id of the wave that should be exported.
-   * @param waveletId the id of the wavelet that should be exported.
-   * @param fromVersion start version.
-   * @param toVersion to version.
-   */
-  public void exportRawDeltas(WaveId waveId, WaveletId waveletId,
-      byte[] fromVersion, byte[] toVersion) {
-    appendOperation(OperationType.ROBOT_EXPORT_DELTAS, waveId, waveletId, null,
-        Parameter.of(ParamsProperty.FROM_VERSION, fromVersion),
-        Parameter.of(ParamsProperty.TO_VERSION, toVersion));
-  }
-
-  /**
-   * Export attachment.
-   *
-   * @param attachmentId the id of attachment.
-   */
-  public void exportAttachment(AttachmentId attachmentId) {
-    appendOperation(OperationType.ROBOT_EXPORT_ATTACHMENT,
-        Parameter.of(ParamsProperty.ATTACHMENT_ID, attachmentId.serialise()));
-  }
-
-  /**
-   * Imports deltas of wavelet.
-   *
-   * @param waveId the id of the wave that should be imported.
-   * @param waveletId the id of the wavelet that should be imported.
-   * @param history the history in deltas.
-   */
-  public void importRawDeltas(WaveId waveId, WaveletId waveletId, List<byte[]> 
history) {
-    appendOperation(OperationType.ROBOT_IMPORT_DELTAS,
-        waveId, waveletId, null, Parameter.of(ParamsProperty.RAW_DELTAS, 
history));
-  }
-
-  /**
-   * Imports attachment.
-   *
-   * @param waveId the id of the wave that should be imported.
-   * @param waveletId the id of the wavelet that should be imported.
-   * @param attachmentId the id of attachment.
-   * @param attachmentData the attachment data.
-   */
-  public void importAttachment(WaveId waveId, WaveletId waveletId,
-      AttachmentId attachmentId, RawAttachmentData attachmentData) {
-    appendOperation(OperationType.ROBOT_IMPORT_ATTACHMENT,
-        waveId, waveletId, null,
-        Parameter.of(ParamsProperty.ATTACHMENT_ID, attachmentId.serialise()),
-        Parameter.of(ParamsProperty.ATTACHMENT_DATA, attachmentData));
-  }
-
-  /**
-   * Sets the title of a wavelet.
-   *
-   * @param wavelet the wavelet whose title will be changed.
-   * @param title the new title to be set.
-   */
-  public void setTitleOfWavelet(Wavelet wavelet, String title) {
-    appendOperation(OperationType.WAVELET_SET_TITLE, wavelet,
-        Parameter.of(ParamsProperty.WAVELET_TITLE, title));
-  }
-
-  /**
-   * Modifies a tag in a wavelet.
-   *
-   * @param wavelet the wavelet to modify the tag from.
-   * @param tag the name of the tag to be modified
-   * @param modifyHow how to modify the tag. The default behavior is to add the
-   *     tag. Specify {@code remove} to remove, or specify {@code null} or
-   *     {@code add} to add.
-   */
-  public void modifyTagOfWavelet(Wavelet wavelet, String tag, String 
modifyHow) {
-    appendOperation(OperationType.WAVELET_MODIFY_TAG, wavelet,
-        Parameter.of(ParamsProperty.NAME, tag),
-        Parameter.of(ParamsProperty.MODIFY_HOW, modifyHow));
-  }
-
-  /**
-   * Creates a child blip of another blip.
-   *
-   * @param blip the parent blip.
-   * @return an instance of {@link Blip} that represents the new child blip.
-   */
-  public Blip createChildOfBlip(Blip blip) {
-    // Create a new thread.
-    String tempBlipId = generateTempBlipId(blip.getWavelet());
-    Wavelet wavelet = blip.getWavelet();
-    BlipThread thread = new BlipThread(tempBlipId, -1, new ArrayList<String>(),
-        wavelet.getBlips());
-
-    // Add the new thread to the blip and wavelet.
-    blip.addThread(thread);
-    wavelet.addThread(thread);
-
-    // Create a new blip in the new thread.
-    Blip newBlip = newBlip(blip.getWavelet(), "", blip.getBlipId(), 
tempBlipId, thread.getId());
-    appendOperation(OperationType.BLIP_CREATE_CHILD, blip,
-        Parameter.of(ParamsProperty.BLIP_DATA, newBlip.serialize()));
-    return newBlip;
-  }
-
-  /**
-   * Appends a new blip to the end of the thread of the given blip.
-   *
-   * @param blip the blip whose thread will be appended.
-   * @return an instance of {@link Blip} that represents the new blip.
-   */
-  public Blip continueThreadOfBlip(Blip blip) {
-    Blip newBlip = newBlip(blip.getWavelet(), "", blip.getParentBlipId(),
-        generateTempBlipId(blip.getWavelet()), blip.getThread().getId());
-    appendOperation(OperationType.BLIP_CONTINUE_THREAD, blip,
-        Parameter.of(ParamsProperty.BLIP_DATA, newBlip.serialize()));
-    return newBlip;
-  }
-
-  /**
-   * Deletes the specified blip.
-   *
-   * @param wavelet the wavelet that owns the blip.
-   * @param blipId the id of the blip that will be deleted.
-   */
-  public void deleteBlip(Wavelet wavelet, String blipId) {
-    appendOperation(OperationType.BLIP_DELETE, wavelet.getWaveId(), 
wavelet.getWaveletId(),
-        blipId);
-  }
-
-  /**
-   * Appends content with markup to a blip.
-   *
-   * @param blip the blip where this markup content should be added to.
-   * @param content the markup content that should be added to the blip.
-   */
-  public void appendMarkupToDocument(Blip blip, String content) {
-    appendOperation(OperationType.DOCUMENT_APPEND_MARKUP, blip,
-        Parameter.of(ParamsProperty.CONTENT, content));
-  }
-
-  /**
-   * Submits this operation queue when the given {@code other} operation queue
-   * is submitted.
-   *
-   * @param other the other operation queue to merge this operation queue with.
-   */
-  public void submitWith(OperationQueue other) {
-    other.pendingOperations.addAll(this.pendingOperations);
-    this.pendingOperations = other.pendingOperations;
-  }
-
-  /**
-   * Creates and queues a document modify operation.
-   *
-   * @param blip the blip to modify.
-   * @return an instance of {@code OperationRequest} that represents this
-   *     operation. The caller of this method should append the required and/or
-   *     optional parameters, such as:
-   *     <ul>
-   *       <li>{@code modifyAction}</li>
-   *       <li>{@code modifyQuery}</li>
-   *       <li>{@code index}</li>
-   *       <li>{@code range}</li>
-   *     </ul>
-   */
-  public OperationRequest modifyDocument(Blip blip) {
-    return appendOperation(OperationType.DOCUMENT_MODIFY, blip);
-  }
-
-  /**
-   * Inserts a new inline blip at a specified location.
-   *
-   * @param blip the blip to anchor this inline blip from.
-   * @param position the position in the given blip to insert this new inline
-   *     blip.
-   * @return an instance of {@link Blip} that represents the inline blip.
-   */
-  public Blip insertInlineBlipToDocument(Blip blip, int position) {
-    // Create a new thread.
-    String tempBlipId = generateTempBlipId(blip.getWavelet());
-    Wavelet wavelet = blip.getWavelet();
-    BlipThread thread = new BlipThread(tempBlipId, position, new 
ArrayList<String>(),
-        wavelet.getBlips());
-
-    // Add the new thread to the blip and wavelet.
-    blip.addThread(thread);
-    wavelet.addThread(thread);
-
-    // Create a new blip in the new thread.
-    Blip inlineBlip = newBlip(blip.getWavelet(), "", blip.getBlipId(), 
tempBlipId,
-        thread.getId());
-    appendOperation(OperationType.DOCUMENT_INSERT_INLINE_BLIP, blip,
-        Parameter.of(ParamsProperty.INDEX, position),
-        Parameter.of(ParamsProperty.BLIP_DATA, inlineBlip.serialize()));
-    return inlineBlip;
-  }
-
-  /**
-   * Creates and appends a new operation to the operation queue.
-   *
-   * @param opType the type of the operation.
-   * @param parameters the parameters that should be added as a property of
-   *     the operation.
-   * @return an instance of {@link OperationRequest} that represents the queued
-   *     operation.
-   */
-  OperationRequest appendOperation(OperationType opType, Parameter... 
parameters) {
-    return appendOperation(opType, null, null, null, parameters);
-  }
-
-  /**
-   * Creates and appends a new operation to the operation queue.
-   *
-   * @param opType the type of the operation.
-   * @param wavelet the wavelet to apply the operation to.
-   * @param parameters the parameters that should be added as a property of
-   *     the operation.
-   * @return an instance of {@link OperationRequest} that represents the queued
-   *     operation.
-   */
-  OperationRequest appendOperation(OperationType opType, Wavelet wavelet,
-      Parameter... parameters) {
-    return appendOperation(opType, wavelet.getWaveId(), 
wavelet.getWaveletId(), null, parameters);
-  }
-
-  /**
-   * Creates and appends a new operation to the operation queue.
-   *
-   * @param opType the type of the operation.
-   * @param blip the blip to apply this operation to.
-   * @param parameters the parameters that should be added as a property of
-   *     the operation.
-   * @return an instance of {@link OperationRequest} that represents the queued
-   *     operation.
-   */
-  OperationRequest appendOperation(OperationType opType, Blip blip, 
Parameter... parameters) {
-    return appendOperation(opType, blip.getWaveId(), blip.getWaveletId(), 
blip.getBlipId(),
-        parameters);
-  }
-
-  /**
-   * Creates and appends a new operation to the operation queue.
-   *
-   * @param opType the type of the operation.
-   * @param waveId the wave id in which the operation should be applied to.
-   * @param waveletId the wavelet id of the given wave in which the operation
-   *     should be applied to.
-   * @param blipId the optional blip id of the given wave in which the 
operation
-   *     should be applied to. Not all operations require blip id.
-   * @param parameters the parameters that should be added as a property of
-   *     the operation.
-   * @return an instance of {@link OperationRequest} that represents the queued
-   *     operation.
-   */
-  OperationRequest appendOperation(OperationType opType, WaveId waveId, 
WaveletId waveletId,
-      String blipId, Parameter... parameters) {
-    return addOperation(opType, waveId, waveletId, blipId, 
pendingOperations.size(), parameters);
-  }
-
-  /**
-   * Creates and prepends a new operation to the operation queue.
-   *
-   * @param opType the type of the operation.
-   * @param waveId the wave id in which the operation should be applied to.
-   * @param waveletId the wavelet id of the given wave in which the operation
-   *     should be applied to.
-   * @param blipId the optional blip id of the given wave in which the 
operation
-   *     should be applied to. Not all operations require blip id.
-   * @param parameters the parameters that should be added as a property of
-   *     the operation.
-   * @return an instance of {@link OperationRequest} that represents the queued
-   *     operation.
-   */
-  OperationRequest prependOperation(OperationType opType, WaveId waveId, 
WaveletId waveletId,
-      String blipId, Parameter... parameters) {
-    return addOperation(opType, waveId, waveletId, blipId, 0, parameters);
-  }
-
-  /**
-   * Creates and adds a new operation to the operation queue.
-   *
-   * @param opType the type of the operation.
-   * @param waveId the wave id in which the operation should be applied to.
-   * @param waveletId the wavelet id of the given wave in which the operation
-   *     should be applied to.
-   * @param blipId the optional blip id of the given wave in which the 
operation
-   *     should be applied to. Not all operations require blip id.
-   * @param index the index where this new operation should be added to in the
-   *     queue.
-   * @param parameters the parameters that should be added as a property of
-   *     the operation.
-   * @return an instance of {@link OperationRequest} that represents the queued
-   *     operation.
-   */
-  OperationRequest addOperation(OperationType opType, WaveId waveId, WaveletId 
waveletId,
-      String blipId, int index, Parameter... parameters) {
-    String waveIdString = null;
-    if (waveId != null) {
-      waveIdString = ApiIdSerializer.instance().serialiseWaveId(waveId);
-    }
-
-    String waveletIdString = null;
-    if (waveletId != null) {
-      waveletIdString = 
ApiIdSerializer.instance().serialiseWaveletId(waveletId);
-    }
-
-    OperationRequest operation = new OperationRequest(opType.method(),
-        String.format(OP_ID_FORMAT, nextOpId++),
-        waveIdString, waveletIdString, blipId, parameters);
-
-    // Set the proxying for parameter, if necessary.
-    if (proxyForId != null && !proxyForId.isEmpty()) {
-      operation.addParameter(Parameter.of(ParamsProperty.PROXYING_FOR, 
proxyForId));
-    }
-
-    pendingOperations.add(index, operation);
-    return operation;
-  }
-
-  /**
-   * Generates a temporary blip id.
-   *
-   * @param wavelet the wavelet to seed the temporary id.
-   * @return a temporary blip id.
-   */
-  private static String generateTempBlipId(Wavelet wavelet) {
-    return String.format(TEMP_BLIP_ID_FORMAT,
-        ApiIdSerializer.instance().serialiseWaveletId(wavelet.getWaveletId()),
-        ID_GENERATOR.nextInt());
-  }
-
-  /**
-   * Creates a new {@code Blip} object used for this session. A temporary
-   * id will be assigned to the newly created {@code Blip} object.
-   *
-   * @param wavelet the wavelet that owns this blip.
-   * @param initialContent the initial content of the new blip.
-   * @param parentBlipId the parent of this blip.
-   * @return an instance of new {@code Blip} object used for this session.
-   */
-  private static Blip newBlip(Wavelet wavelet, String initialContent, String 
parentBlipId,
-      String blipId, String threadId) {
-    Blip newBlip = new Blip(blipId, initialContent, parentBlipId, threadId, 
wavelet);
-    if (parentBlipId != null) {
-      Blip parentBlip = wavelet.getBlips().get(parentBlipId);
-      if (parentBlip != null) {
-        parentBlip.getChildBlipIds().add(newBlip.getBlipId());
-      }
-    }
-    wavelet.getBlips().put(newBlip.getBlipId(), newBlip);
-
-    BlipThread thread = wavelet.getThread(threadId);
-    if (thread != null) {
-      thread.appendBlip(newBlip);
-    }
-    return newBlip;
-  }
-
-  /**
-   * Creates a new {@code Wavelet} object used for this session. A temporary
-   * wave id will be assigned to this newly created {@code Wavelet} object.
-   *
-   * @param domain the domain that is used for the wave and wavelet ids.
-   * @param participants the participants that should be added to the new
-   *     wavelet.
-   * @param opQueue the operation queue of the new wavelet.
-   * @return an instance of new {@code Wavelet} object used for this
-   *     session.
-   */
-  private static Wavelet newWavelet(String domain, Set<String> participants,
-      OperationQueue opQueue) {
-    // Make sure that participant list is not null;
-    if (participants == null) {
-      participants = Collections.emptySet();
-    }
-
-    WaveId waveId;
-    WaveletId waveletId;
-    try {
-      waveId = ApiIdSerializer.instance().deserialiseWaveId(
-          String.format(TEMP_WAVE_ID_FORMAT, domain, ID_GENERATOR.nextInt()));
-      waveletId = ApiIdSerializer.instance().deserialiseWaveletId(
-          String.format(TEMP_WAVELET_ID_FORMAT, domain));
-    } catch (InvalidIdException e) {
-      throw new IllegalStateException("Invalid temporary id", e);
-    }
-
-    String rootBlipId = String.format(TEMP_BLIP_ID_FORMAT,
-        ApiIdSerializer.instance().serialiseWaveletId(waveletId),
-        ID_GENERATOR.nextInt());
-    Map<String, Blip> blips = new HashMap<String, Blip>();
-    Map<String, String> roles = new HashMap<String, String>();
-    Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
-
-    List<String> blipIds = new ArrayList<String>();
-    blipIds.add(rootBlipId);
-    BlipThread rootThread = new BlipThread("", -1, blipIds, blips);
-
-    Wavelet wavelet = new Wavelet(waveId, waveletId, rootBlipId, rootThread, 
participants,
-        roles, blips, threads, opQueue);
-
-    Blip rootBlip = new Blip(rootBlipId, "", null, "", wavelet);
-    blips.put(rootBlipId, rootBlip);
-
-    return wavelet;
-  }
-
-  /**
-   * Modifies the role of a participant in a wavelet.
-   *
-   * @param wavelet the wavelet that the participant is on
-   * @param participant whose role to modify
-   * @param role to set for the participant
-   */
-  public void modifyParticipantRoleOfWavelet(Wavelet wavelet, String 
participant, String role) {
-    appendOperation(OperationType.WAVELET_MODIFY_PARTICIPANT_ROLE, wavelet,
-        Parameter.of(ParamsProperty.PARTICIPANT_ID, participant),
-        Parameter.of(ParamsProperty.PARTICIPANT_ROLE, role));
-  }
-
-  /**
-   * Notifies the robot information.
-   *
-   * @param protocolVersion the wire protocol version of the robot.
-   * @param capabilitiesHash the capabilities hash of the robot.
-   */
-  public void notifyRobotInformation(ProtocolVersion protocolVersion, String 
capabilitiesHash) {
-    prependOperation(OperationType.ROBOT_NOTIFY, null, null, null,
-        Parameter.of(ParamsProperty.PROTOCOL_VERSION, 
protocolVersion.getVersionString()),
-        Parameter.of(ParamsProperty.CAPABILITIES_HASH, capabilitiesHash));
-  }
-
-  public void fetchProfiles(FetchProfilesRequest request) {
-    appendOperation(OperationType.ROBOT_FETCH_PROFILES,
-        Parameter.of(ParamsProperty.FETCH_PROFILES_REQUEST, request));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/OperationRequest.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/OperationRequest.java 
b/src/com/google/wave/api/OperationRequest.java
deleted file mode 100644
index d12ba80..0000000
--- a/src/com/google/wave/api/OperationRequest.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import com.google.wave.api.JsonRpcConstant.ParamsProperty;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A class that represents an operation request.
- *
- * @author [email protected] (Marcel Prasetya)
- */
-public class OperationRequest {
-
-  /**
-   * A helper inner class that represents an operation parameter. Useful for
-   * constructing the operation.
-   *
-   * @author [email protected] (Marcel Prasetya)
-   */
-  public static class Parameter {
-
-    private final ParamsProperty key;
-    private final Object value;
-
-    /**
-     * Factory method.
-     *
-     * @param key the key of the parameter
-     * @param value the value of the parameter
-     * @return a parameter with the specified key and value
-     */
-    public static Parameter of(ParamsProperty key, Object value) {
-      return new Parameter(key, value);
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param key the key of the parameter.
-     * @param value the value of the parameter.
-     */
-    private Parameter(ParamsProperty key, Object value) {
-      this.key = key;
-      this.value = value;
-    }
-
-    /**
-     * Returns the key of the parameter.
-     *
-     * @return the key of the parameter.
-     */
-    public ParamsProperty getKey() {
-      return key;
-    }
-
-    /**
-     * Returns the value of the parameter.
-     *
-     * @return the value of the parameter.
-     */
-    public Object getValue() {
-      return value;
-    }
-  }
-
-  private final String method;
-  private final String id;
-  private final Map<ParamsProperty, Object> parameters;
-
-  /**
-   * Constructor.
-   *
-   * @param method the method or operation to be executed.
-   *     See {@link OperationType}.
-   * @param id the id of the request.
-   * @param waveId the wave id to apply this operation to.
-   * @param waveletId the wavelet id to apply this operation to.
-   * @param blipId the blip id to apply this operation to.
-   * @param params additional parameters for this operation. See
-   *     {@link ParamsProperty}.
-   */
-  public OperationRequest(String method, String id, String waveId, String 
waveletId, String blipId,
-      Parameter... params) {
-    this.method = method;
-    this.id = id;
-    this.parameters = new HashMap<ParamsProperty, Object>(params.length + 3);
-    setWaveId(waveId);
-    setWaveletId(waveletId);
-    setBlipId(blipId);
-    for (Parameter parameter : params) {
-      this.parameters.put(parameter.getKey(), parameter.getValue());
-    }
-  }
-
-  /**
-   * Constructor without {@code blipId}.
-   *
-   * @param method the method or operation to be executed.
-   *     See {@link OperationType}.
-   * @param id the id of the request.
-   * @param waveId the wave id to apply this operation to.
-   * @param waveletId the wavelet id to apply this operation to.
-   * @param parameters additional parameters for this operation. See
-   *     {@link ParamsProperty}.
-   */
-  public OperationRequest(String method, String id, String waveId, String 
waveletId,
-      Parameter... parameters) {
-    this(method, id, waveId, waveletId, null, parameters);
-  }
-
-  /**
-   * Constructor without {@code waveId}, {@code waveletId}, and {@code blipId}.
-   *
-   * @param method the method or operation to be executed.
-   *     See {@link OperationType}.
-   * @param id the id of the request.
-   * @param parameters additional parameters for this operation. See
-   *     {@link ParamsProperty}.
-   */
-  public OperationRequest(String method, String id, Parameter... parameters) {
-    this(method, id, null, null, null, parameters);
-  }
-
-  /**
-   * Constructor that extracts {@code waveId}, {@code waveletId}, and
-   * {@code blipId} from the given {@code BlipData}.
-   *
-   * @param method the method or operation to be executed.
-   *     See {@link OperationType}.
-   * @param id the id of the request.
-   * @param blipData the {@code BlipData} to extract {@code waveId},
-   *     {@code waveletId}, and {@code blipId} from.
-   * @param parameters additional parameters for this operation. See
-   *     {@link ParamsProperty}.
-   */
-  public OperationRequest(String method, String id, BlipData blipData, 
Parameter...parameters) {
-    this(method, id, blipData.getWaveId(), blipData.getWaveletId(), 
blipData.getBlipId(),
-        parameters);
-  }
-
-  /**
-   * Returns the method name that should be invoked.
-   *
-   * @return the method name.
-   */
-  public String getMethod() {
-    return method;
-  }
-
-  /**
-   * Returns the id of this request.
-   *
-   * @return the id of this request.
-   */
-  public String getId() {
-    return id;
-  }
-
-  /**
-   * Returns the parameters of this request.
-   *
-   * @return the parameters of this request.
-   */
-  public Map<ParamsProperty, Object> getParams() {
-    return parameters;
-  }
-
-  /**
-   * @param waveId to set
-   */
-  private void setWaveId(String waveId) {
-    if (waveId != null) {
-      parameters.put(ParamsProperty.WAVE_ID, waveId);
-    }
-  }
-
-  /**
-   * Returns the wave id where this request should be invoked on. This might 
not
-   * be applicable to all requests.
-   *
-   * @return the wave id.
-   */
-  public String getWaveId() {
-    return (String) getParameter(ParamsProperty.WAVE_ID);
-  }
-
-  /**
-   * @param waveletId to set
-   */
-  private void setWaveletId(String waveletId) {
-    if (waveletId != null) {
-      parameters.put(ParamsProperty.WAVELET_ID, waveletId);
-    }
-  }
-
-  /**
-   * Returns the wavelet id where this request should be invoked on. This might
-   * not be applicable to all requests.
-   *
-   * @return the wavelet id.
-   */
-  public String getWaveletId() {
-    return (String) getParameter(ParamsProperty.WAVELET_ID);
-  }
-
-  /**
-   * @param blipId to set
-   */
-  private void setBlipId(String blipId) {
-    if (blipId != null) {
-      parameters.put(ParamsProperty.BLIP_ID, blipId);
-    }
-  }
-
-  /**
-   * Returns the blip id where this request should be invoked on. This might 
not
-   * be applicable to all requests.
-   *
-   * @return the blip id.
-   */
-  public String getBlipId() {
-    return (String) getParameter(ParamsProperty.BLIP_ID);
-  }
-
-  /**
-   * Returns a parameter of this request.
-   *
-   * @param property the key of the parameter.
-   * @return a parameter of this request, that is keyed by the given input, or
-   *     {@code null} if the parameter doesn't exist.
-   */
-  public Object getParameter(ParamsProperty property) {
-    return parameters.get(property);
-  }
-
-  /**
-   * Adds a parameter to this request.
-   *
-   * @param parameter to be added.
-   */
-  public void addParameter(Parameter parameter) {
-    parameters.put(parameter.getKey(), parameter.getValue());
-  }
-
-  @Override
-  public String toString() {
-    return 
String.format("{'method':'%s','id':'%s','waveId':'%s','waveletId':'%s','blipId':'%s',"
 +
-        "'parameters':%s}", method, id, getWaveId(), getWaveletId(), 
getBlipId(), parameters);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/OperationType.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/OperationType.java 
b/src/com/google/wave/api/OperationType.java
deleted file mode 100644
index d295a2e..0000000
--- a/src/com/google/wave/api/OperationType.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-/**
- * The Operation types supported by Robots.
- *
- * @author [email protected] (Seth Covitz)
- * @author [email protected] (Marcel Prasetya)
- */
-public enum OperationType {
-  UNKNOWN("unknown"),
-  WAVELET_APPEND_BLIP("wavelet.appendBlip"),
-  WAVELET_CREATE("wavelet.create"),
-  WAVELET_REMOVE_SELF("wavelet.removeSelf"),
-  WAVELET_SET_TITLE("wavelet.setTitle"),
-
-  // TODO(mprasetya): Remove the "newsyntax" suffix once renaming is complete.
-  WAVELET_ADD_PARTICIPANT_NEWSYNTAX("wavelet.addParticipant"),
-  WAVELET_REMOVE_PARTICIPANT_NEWSYNTAX("wavelet.removeParticipant"),
-
-  WAVELET_APPEND_DATADOC("wavelet.appendDatadoc"),
-  WAVELET_SET_DATADOC("wavelet.setDatadoc"),
-  WAVELET_MODIFY_TAG("wavelet.modifyTag"),
-  WAVELET_MODIFY_PARTICIPANT_ROLE("wavelet.modifyParticipantRole"),
-
-  BLIP_CONTINUE_THREAD("blip.continueThread"),
-  BLIP_CREATE_CHILD("blip.createChild"),
-  BLIP_DELETE("blip.delete"),
-  BLIP_SET_AUTHOR("blip.setAuthor"),
-  BLIP_SET_CREATION_TIME("blip.setCreationTime"),
-
-  DOCUMENT_DELETE_ANNOTATION("document.deleteAnnotation"),
-  DOCUMENT_SET_ANNOTATION("document.setAnnotation"),
-  DOCUMENT_SET_ANNOTATION_NORANGE("document.setAnnotationNoRange"),
-
-  DOCUMENT_APPEND("document.append"),
-  DOCUMENT_APPEND_MARKUP("document.appendMarkup"),
-  DOCUMENT_APPEND_STYLED_TEXT("document.appendStyledText"),
-  DOCUMENT_DELETE("document.delete"),
-  DOCUMENT_INSERT("document.insert"),
-  DOCUMENT_MODIFY("document.modify"),
-  DOCUMENT_REPLACE("document.replace"),
-
-  DOCUMENT_APPEND_ELEMENT("document.appendElement"),
-  DOCUMENT_DELETE_ELEMENT("document.deleteElement"),
-  DOCUMENT_INSERT_ELEMENT("document.insertElement"),
-  DOCUMENT_INSERT_ELEMENT_AFTER("document.insertElementAfter"),
-  DOCUMENT_INSERT_ELEMENT_BEFORE("document.insertElementBefore"),
-  DOCUMENT_MODIFY_ELEMENT_ATTRS("document.modifyElementAttrs"),
-  DOCUMENT_REPLACE_ELEMENT("document.replaceElement"),
-
-  DOCUMENT_APPEND_INLINE_BLIP("document.appendInlineBlip"),
-  DOCUMENT_INSERT_INLINE_BLIP("document.insertInlineBlip"),
-  
DOCUMENT_INSERT_INLINE_BLIP_AFTER_ELEMENT("document.insertInlineBlipAfterElement"),
-
-  // Some operations not associated with a context
-  ROBOT_FOLDER_ACTION("robot.folderAction"),
-  ROBOT_CREATE_WAVELET("robot.createWavelet"),
-  ROBOT_FETCH_MY_PROFILE("robot.fetchMyProfile"),
-  ROBOT_FETCH_PROFILES("robot.fetchProfiles"),
-  ROBOT_FETCH_WAVE("robot.fetchWave"),
-  ROBOT_NOTIFY("robot.notify"),
-  ROBOT_SEARCH("robot.search"),
-
-  ROBOT_EXPORT_SNAPSHOT("robot.exportSnapshot"),
-  ROBOT_EXPORT_DELTAS("robot.exportDeltas"),
-  ROBOT_EXPORT_ATTACHMENT("robot.exportAttachment"),
-  ROBOT_IMPORT_SNAPSHOT("robot.importSnapshot"),
-  ROBOT_IMPORT_DELTAS("robot.importDeltas"),
-  ROBOT_IMPORT_ATTACHMENT("robot.importAttachment"),
-
-  // Remove these deprecated operations once all robots are upgraded to v0.21.
-  @Deprecated WAVELET_ADD_PARTICIPANT("wavelet.participant.add"),
-  @Deprecated WAVELET_REMOVE_PARTICIPANT("wavelet.participant.remove"),
-
-  @Deprecated WAVELET_DATADOC_APPEND("wavelet.datadoc.append"),
-  @Deprecated WAVELET_DATADOC_SET("wavelet.datadoc.set"),
-
-  @Deprecated DOCUMENT_ANNOTATION_DELETE("document.annotation.delete"),
-  @Deprecated DOCUMENT_ANNOTATION_SET("document.annotation.set"),
-  @Deprecated 
DOCUMENT_ANNOTATION_SET_NORANGE("document.annotation.setNoRange"),
-
-  @Deprecated DOCUMENT_ELEMENT_APPEND("document.element.append"),
-  @Deprecated DOCUMENT_ELEMENT_DELETE("document.element.delete"),
-  @Deprecated DOCUMENT_ELEMENT_INSERT("document.element.insert"),
-  @Deprecated DOCUMENT_ELEMENT_INSERT_AFTER("document.element.insertAfter"),
-  @Deprecated DOCUMENT_ELEMENT_INSERT_BEFORE("document.element.insertBefore"),
-  @Deprecated DOCUMENT_ELEMENT_MODIFY_ATTRS("document.element.modifyAttrs"),
-  @Deprecated DOCUMENT_ELEMENT_REPLACE("document.element.replace"),
-
-  @Deprecated DOCUMENT_INLINE_BLIP_APPEND("document.inlineBlip.append"),
-  @Deprecated DOCUMENT_INLINE_BLIP_INSERT("document.inlineBlip.insert"),
-  @Deprecated 
DOCUMENT_INLINE_BLIP_INSERT_AFTER_ELEMENT("document.inlineBlip.insertAfterElement"),
-
-  @Deprecated ROBOT_NOTIFY_CAPABILITIES_HASH("robot.notifyCapabilitiesHash");
-
-  private static final Logger LOG = 
Logger.getLogger(OperationType.class.getName());
-
-  private static final Map<String, OperationType> reverseLookupMap =
-      new HashMap<String, OperationType>();
-
-  static {
-    for (OperationType operationType : OperationType.values()) {
-      if (reverseLookupMap.containsKey(operationType.method)) {
-        LOG.warning("Operation with method name " + operationType.method + " 
already exist.");
-      }
-      reverseLookupMap.put(operationType.method, operationType);
-    }
-  }
-
-  private final String method;
-
-  private OperationType(String method) {
-    this.method = method;
-  }
-
-  /**
-   * Returns the method name of an operation type.
-   *
-   * @return The method name of an operation type.
-   */
-  public String method() {
-    return method;
-  }
-
-  /**
-   * Returns an {@link OperationType} enumeration that has the given method
-   * name. If no match is found, UNKNOWN is returned.
-   *
-   * @param methodName The method name of an operation.
-   * @return An {@link OperationType} that has the given method name.
-   */
-  public static OperationType fromMethodName(String methodName) {
-    OperationType operationType = reverseLookupMap.get(methodName);
-    if (operationType == null) {
-      return UNKNOWN;
-    }
-    return operationType;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/ParticipantProfile.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/ParticipantProfile.java 
b/src/com/google/wave/api/ParticipantProfile.java
deleted file mode 100644
index 7b9709a..0000000
--- a/src/com/google/wave/api/ParticipantProfile.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.io.Serializable;
-
-/**
- * ParticipantProfile represents participant information. It contains display
- * name, avatar's URL, and an external URL to view the participant's profile
- * page. This is a data transfer object that is being sent from Robot when 
Rusty
- * queries a profile. A participant can be the Robot itself, or a user in the
- * Robot's domain.
- *
- * @author [email protected] (Marcel Prasetya)
- */
-public final class ParticipantProfile implements Serializable {
-
-  private final String address;
-  private final String name;
-  private final String imageUrl;
-  private final String profileUrl;
-
-  /**
-   * Constructs an empty profile.
-   */
-  public ParticipantProfile() {
-    this("", "", "", "");
-  }
-
-  /**
-   * Constructs a profile.
-   *
-   * @param name the name of the participant.
-   * @param imageUrl the URL of the participant's avatar.
-   * @param profileUrl the URL of the participant's external profile page.
-   */
-  public ParticipantProfile(String name, String imageUrl, String profileUrl) {
-    this("", name, imageUrl, profileUrl);
-  }
-
-  /**
-   * Constructs a profile.
-   *
-   * @param address the address of the participant.
-   * @param name the name of the participant.
-   * @param imageUrl the URL of the participant's avatar.
-   * @param profileUrl the URL of the participant's external profile page.
-   */
-  public ParticipantProfile(String address, String name, String imageUrl,
-      String profileUrl) {
-    this.address = address;
-    this.name = name;
-    this.imageUrl = imageUrl;
-    this.profileUrl = profileUrl;
-  }
-
-  /**
-   * @return the address of the participant.
-   */
-  public String getAddress() {
-    return address;
-  }
-
-  /**
-   * @return the name of the participant.
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * @return the URL of the participant's avatar.
-   */
-  public String getImageUrl() {
-    return imageUrl;
-  }
-
-  /**
-   * @return the URL of the profile page.
-   */
-  public String getProfileUrl() {
-    return profileUrl;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/Participants.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/Participants.java 
b/src/com/google/wave/api/Participants.java
deleted file mode 100644
index e11aae2..0000000
--- a/src/com/google/wave/api/Participants.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A class that represents wavelet's participants. This class supports various
- * participant related operations, such as, adding participant to a wavelet.
- */
-public class Participants implements Set<String>, Serializable {
-
-  /**
-   * Roles to use for the participants
-   */
-  public enum Role {
-    /** Full member. */
-    FULL,
-    /** Can only view the wave. */
-    READ_ONLY,
-    /** Not recognized. Probably a newer server version. */
-    UNKNOWN;
-  }
-
-  /** A set of participant id that represents wavelet participants. */
-  private final Set<String> participants;
-
-  /** The wavelet that this participant set represents. */
-  private final Wavelet wavelet;
-
-  /** The operation queue to queue operation to the robot proxy. */
-  private final OperationQueue operationQueue;
-
-  /** The roles of the participants. The values are strings to match the wire
-   * protocol.
-   */
-  private final Map<String, String> roles;
-
-  /**
-   * Constructor.
-   *
-   * @param participants a collection of initial participants of the wavelet.
-   * @param wavelet the wavelet that this participants list represents.
-   * @param operationQueue the operation queue to queue operation to the robot
-   *     proxy.
-   */
-  public Participants(Collection<String> participants, Map<String, String> 
roles,
-      Wavelet wavelet, OperationQueue operationQueue) {
-    this.participants = new LinkedHashSet<String>(participants);
-    this.roles = roles;
-    this.wavelet = wavelet;
-    this.operationQueue = operationQueue;
-  }
-
-  /**
-   * Add the given participant id if it doesn't exist.
-   *
-   * @param participantId the id of the participant that will be added.
-   * @return {@code true} if the given participant id does not exist yet
-   *     in the set of participants, which means that a new
-   *     {@code wavelet.addParticipant()} has been queued. Otherwise, returns
-   *     {@code false}.
-   */
-  @Override
-  public boolean add(String participantId) {
-    if (participants.contains(participantId)) {
-      return false;
-    }
-
-    operationQueue.addParticipantToWavelet(wavelet, participantId);
-    participants.add(participantId);
-    return true;
-  }
-
-  /**
-   * Checks whether the given participant id exists in the set or not.
-   *
-   * @param participantId the participant id to check.
-   * @return {@code true} if the set contains the given participant id.
-   *     Otherwise, returns {@code false}.
-   */
-  @Override
-  public boolean contains(Object participantId) {
-    return participants.contains(participantId);
-  }
-
-  /**
-   * Returns the number of participants of the wavelet that owns this
-   * participant set.
-   *
-   * @return the number of participants.
-   */
-  @Override
-  public int size() {
-    return participants.size();
-  }
-
-  /**
-   * Checks whether this participant set is empty or not.
-   *
-   * @return {@code true} if the participant set is empty. Otherwise, returns
-   *     {@code false}.
-   */
-  @Override
-  public boolean isEmpty() {
-    return participants.isEmpty();
-  }
-
-  @Override
-  public Iterator<String> iterator() {
-    return participants.iterator();
-  }
-
-  @Override
-  public boolean addAll(Collection<? extends String> c) {
-    boolean retval = false;
-    for (String participant : c) {
-      retval = retval || add(participant);
-    }
-    return retval;
-  }
-
-  @Override
-  public void clear() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public boolean containsAll(Collection<?> c) {
-    boolean retval = true;
-    for (Object participant : c) {
-      retval = retval && contains(participant);
-    }
-    return retval;
-  }
-
-  /**
-   * Remove the given participant id if it exist.
-   *
-   * @param participantId the id of the participant that will be removed.
-   * @return {@code true} if the given participant id does exist in the set
-   *     of participants, which means that the
-   *     {@code wavelet.removeParticipant()} has been dequeued. Otherwise, 
returns
-   *     {@code false}.
-   */
-  @Override
-  public boolean remove(Object oParticipantId) {
-    
-    if(!(oParticipantId instanceof String)) {
-      throw new IllegalArgumentException("ParticipantId must be a string.");
-    }
-    String participantId = (String) oParticipantId;
-    
-    if (!participants.contains(participantId)) {
-      return false;
-    }
-
-    operationQueue.removeParticipantFromWavelet(wavelet, participantId);
-    participants.remove(participantId);
-    return true;
-  }
-
-  @Override
-  public boolean removeAll(Collection<?> c) {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public boolean retainAll(Collection<?> c) {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public Object[] toArray() {
-    return participants.toArray();
-  }
-
-  @Override
-  public <T> T[] toArray(T[] a) {
-    return participants.toArray(a);
-  }
-
-  public void setParticipantRole(String participant, Role role) {
-    operationQueue.modifyParticipantRoleOfWavelet(wavelet, participant, 
role.name());
-    roles.put(participant, role.name());
-  }
-  
-  public Role getParticipantRole(String participant) {
-    String stringRole = roles.get(participant);
-    if (stringRole == null) {
-      return Role.FULL;
-    }
-    try {
-      return Role.valueOf(stringRole);
-    } catch (IllegalArgumentException e) {
-      return Role.UNKNOWN;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/Plaintext.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/Plaintext.java 
b/src/com/google/wave/api/Plaintext.java
deleted file mode 100644
index 742dec2..0000000
--- a/src/com/google/wave/api/Plaintext.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-/**
- * A class that models a plain-text content of a blip.
- */
-public class Plaintext extends BlipContent {
-
-  /** The text content. */
-  private final StringBuilder text;
-
-  /**
-   * Convenience factory method.
-   *
-   * @param text the text to construct the {@link Plaintext} object.
-   * @return an instance of {@link Plaintext} that represents the given string.
-   */
-  public static Plaintext of(String text) {
-    return new Plaintext(text);
-  }
-
-  /**
-   * Constructor.
-   *
-   * @param text the text content.
-   */
-  public Plaintext(String text) {
-    this.text = new StringBuilder(text);
-  }
-
-  /**
-   * Appends the given text to this {@link Plaintext} instance.
-   *
-   * @param text the text to be appended.
-   * @return an instance of this {@link Plaintext}, for chaining.
-   */
-  public Plaintext append(String text) {
-    this.text.append(text);
-    return this;
-  }
-
-  @Override
-  public String getText() {
-    return text.toString();
-  }
-
-  @Override
-  public int hashCode() {
-    return text.toString().hashCode();
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-
-    if (o == null) {
-      return false;
-    }
-
-    if (getClass() != o.getClass()) {
-      return false;
-    }
-
-    Plaintext other = (Plaintext) o;
-    if (text == null && other.text == null) {
-      return true;
-    }
-
-    if ((text == null && other.text != null) || (text != null && other.text == 
null)) {
-      return false;
-    }
-
-    return text.toString().equals(other.text.toString());
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/ProtocolVersion.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/ProtocolVersion.java 
b/src/com/google/wave/api/ProtocolVersion.java
deleted file mode 100644
index c6fc14a..0000000
--- a/src/com/google/wave/api/ProtocolVersion.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-/**
- * An enumeration that represents the robot API wire protocol versions.
- *
- * @author [email protected] (Marcel Prasetya)
- */
-public enum ProtocolVersion {
-  V1("0.1"),
-  V2("0.2"),
-  V2_1("0.21"),
-  V2_2("0.22");
-
-  /** The default protocol version. */
-  public static final ProtocolVersion DEFAULT = ProtocolVersion.V2_2;
-
-  /** Logger. */
-  private static final Logger LOG = 
Logger.getLogger(ProtocolVersion.class.getName());
-
-  /** Reverse mapping from version string to {@link ProtocolVersion} enum. */
-  private static final Map<String, ProtocolVersion> REVERSE_LOOKUP_MAP =
-      new HashMap<String, ProtocolVersion>(ProtocolVersion.values().length);
-
-  static {
-    for (ProtocolVersion protocolVersion : ProtocolVersion.values()) {
-      String versionString = protocolVersion.versionString;
-      if (REVERSE_LOOKUP_MAP.containsKey(versionString)) {
-        LOG.warning("There are more than one ProtocolVersions that have the 
same version string " +
-            versionString);
-      }
-      REVERSE_LOOKUP_MAP.put(versionString, protocolVersion);
-    }
-  }
-
-  /** The version string, for example, 0.1. */
-  private final String versionString;
-
-  /**
-   * Constructor.
-   *
-   * @param versionString the version string, for example, 0.1.
-   */
-  private ProtocolVersion(String versionString) {
-    this.versionString = versionString;
-  }
-
-  /**
-   * @return the version string.
-   */
-  public String getVersionString() {
-    return versionString;
-  }
-
-  /**
-   * @param other the other {@link ProtocolVersion} to compare to.
-   * @return {@code true} if {@code this} version is less than the {@code 
other}
-   *     version.
-   */
-  public boolean isLessThan(ProtocolVersion other) {
-    return versionString.compareTo(other.versionString) < 0;
-  }
-
-  /**
-   * @param other the other {@link ProtocolVersion} to compare to.
-   * @return {@code true} if {@code this} version is less than or equal to the
-   *     {@code other} version.
-   */
-  public boolean isLessThanOrEqual(ProtocolVersion other) {
-    return versionString.compareTo(other.versionString) <= 0;
-  }
-
-  /**
-   * @param other the other {@link ProtocolVersion} to compare to.
-   * @return {@code true} if {@code this} version is greater than or equal to
-   *     the {@code other} version.
-   */
-  public boolean isGreaterThanOrEqual(ProtocolVersion other) {
-    return versionString.compareTo(other.versionString) >= 0;
-  }
-
-  /**
-   * @param other the other {@link ProtocolVersion} to compare to.
-   * @return {@code true} if {@code this} version is greater than the
-   *     {@code other} version.
-   */
-  public boolean isGreaterThan(ProtocolVersion other) {
-    return versionString.compareTo(other.versionString) > 0;
-  }
-
-  /**
-   * Returns a {@link ProtocolVersion} that represents the given version 
string,
-   * or {@link ProtocolVersion#DEFAULT} if the version string is invalid.
-   *
-   * @param versionString the version string.
-   * @return a {@link ProtocolVersion}.
-   */
-  public static ProtocolVersion fromVersionString(String versionString) {
-    ProtocolVersion protocolVersion = REVERSE_LOOKUP_MAP.get(versionString);
-    if (protocolVersion == null) {
-      return DEFAULT;
-    }
-    return protocolVersion;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/Range.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/Range.java 
b/src/com/google/wave/api/Range.java
deleted file mode 100644
index 53cf0b6..0000000
--- a/src/com/google/wave/api/Range.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.io.Serializable;
-
-/**
- * A class that models a range, that contains a start and end index.
- */
-public class Range implements Serializable {
-
-  /** Start of the range. */
-  private final int start;
-
-  /** End of the range. */
-  private final int end;
-
-  /**
-   * Constructs a range object given a start and end index into the document.
-   *
-   * @param start the start of the range.
-   * @param end the end of the range.
-   */
-  public Range(int start, int end) {
-    this.start = start;
-    this.end = end;
-  }
-
-  /**
-   * Returns the starting index of the range.
-   *
-   * @return the starting index.
-   */
-  public int getStart() {
-    return start;
-  }
-
-  /**
-   * Returns the ending index of the range.
-   *
-   * @return the ending index.
-   */
-  public int getEnd() {
-    return end;
-  }
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + end;
-    result = prime * result + start;
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj) {
-      return true;
-    }
-
-    if (obj == null) {
-      return false;
-    }
-
-    if (getClass() != obj.getClass()) {
-      return false;
-    }
-
-    Range other = (Range) obj;
-    return start == other.start && end == other.end;
-  }
-
-  @Override
-  public String toString() {
-    return "Range(" + start + ',' + end + ')';
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/Restriction.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/Restriction.java 
b/src/com/google/wave/api/Restriction.java
deleted file mode 100644
index 9bc7e7f..0000000
--- a/src/com/google/wave/api/Restriction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-/**
- * A class that represents a property filter for element, that can be used when
- * when searching for an element inside a blip.
- */
-public class Restriction {
-
-  /** The key of the property. */
-  private final String key;
-
-  /** The value of the property. */
-  private final String value;
-
-  /**
-   * Creates an instance of {@link Restriction} for a property with the given
-   * key and value.
-   *
-   * @param key the key of the property to restrict.
-   * @param value the value of the property to restrict.
-   * @return an instance of {@link Restriction}.
-   */
-  public static Restriction of(String key, String value) {
-    return new Restriction(key, value);
-  }
-
-  /**
-   * Constructor.
-   *
-   * @param key the key of the property to restrict.
-   * @param value the value of the property to restrict.
-   */
-  private Restriction(String key, String value) {
-    this.key = key;
-    this.value = value;
-  }
-
-  /**
-   * @return the key of the property to restrict.
-   */
-  public String getKey() {
-    return key;
-  }
-
-  /**
-   * @return the value of the property to restrict.
-   */
-  public String getValue() {
-    return value;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/RobotSerializer.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/RobotSerializer.java 
b/src/com/google/wave/api/RobotSerializer.java
deleted file mode 100644
index 9bcbf76..0000000
--- a/src/com/google/wave/api/RobotSerializer.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import static com.google.wave.api.OperationType.ROBOT_NOTIFY;
-import static com.google.wave.api.OperationType.ROBOT_NOTIFY_CAPABILITIES_HASH;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonParser;
-import com.google.wave.api.JsonRpcConstant.ParamsProperty;
-import com.google.wave.api.JsonRpcConstant.RequestProperty;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.NavigableMap;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Logger;
-
-/**
- * Utility class to serialize and deserialize Events and Operations to and from
- * JSON string for V2.* of the protocol.
- * 
- * @author [email protected] (Marcel Prasetya)
- * @author [email protected] (Lennard de Rijk)
- */
-public class RobotSerializer {
-
-  /** The counter for protocol versions. */
-  public static final Map<ProtocolVersion, AtomicInteger> 
PROTOCOL_VERSION_COUNTERS;
-
-  static {
-    PROTOCOL_VERSION_COUNTERS = new HashMap<ProtocolVersion, AtomicInteger>();
-    // Put in the V2 protocols that are used in this serializer
-    for (ProtocolVersion protcolVersion : ProtocolVersion.values()) {
-      if (protcolVersion.isGreaterThanOrEqual(ProtocolVersion.V2)) {
-        PROTOCOL_VERSION_COUNTERS.put(protcolVersion, new AtomicInteger());
-      }
-    }
-  }
-
-  private static final Logger LOG = 
Logger.getLogger(RobotSerializer.class.getName());
-
-  /** An map of {@link Gson}s for serializing and deserializing JSON. */
-  private final NavigableMap<ProtocolVersion, Gson> gsons;
-
-  /** The default protocol version. */
-  private final ProtocolVersion defaultProtocolVersion;
-
-  /**
-   * An instance of {@link JsonParser} to parse JSON string into
-   * {@link JsonElement}.
-   */
-  private final JsonParser jsonParser;
-
-  /**
-   * Constructor. Note that the defaultprotocol version must occur in the map
-   * of {@link Gson}s.
-   *
-   * @param gsons an map of {@link Gson}s for serializing and deserializing
-   *     JSON, keyed by protocol version.
-   * @param defaultProtocolVersion the default protocol version.
-   */
-  public RobotSerializer(NavigableMap<ProtocolVersion, Gson> gsons,
-      ProtocolVersion defaultProtocolVersion) {
-    if (!gsons.containsKey(defaultProtocolVersion)) {
-      throw new IllegalArgumentException(
-          "The serializer map does not contain a serializer for the default 
protocol version");
-    }
-    this.gsons = gsons;
-    this.defaultProtocolVersion = defaultProtocolVersion;
-    this.jsonParser = new JsonParser();
-  }
-
-  /**
-   * Deserializes the given JSON string into an instance of the given type.
-   *
-   * @param <T> the generic type of the given class.
-   * @param jsonString the JSON string to deserialize.
-   * @param type the type to deserialize the JSON string into.
-   * @param protocolVersion the wire protocol version of the given JSON string.
-   * @return an instance of {@code type}, that is constructed by deserializing
-   *     the given {@code jsonString}
-   */
-  public <T> T deserialize(String jsonString, Type type, ProtocolVersion 
protocolVersion) {
-    return getGson(protocolVersion).<T>fromJson(jsonString, type);
-  }
-
-  /**
-   * Serializes the given object into a JSON string.
-   *
-   * @param <T> the generic type of the given object.
-   * @param object the object to serialize.
-   * @return a JSON string representation of {@code object}.
-   */
-  public <T> String serialize(T object) {
-    return serialize(object, defaultProtocolVersion);
-  }
-
-  /**
-   * Serializes the given object into a JSON string.
-   *
-   * @param <T> the generic type of the given object.
-   * @param object the object to serialize.
-   * @param type the specific genericized type of {@code object}.
-   * @return a JSON string representation of {@code object}.
-   */
-  public <T> String serialize(T object, Type type) {
-    return serialize(object, type, defaultProtocolVersion);
-  }
-
-  /**
-   * Serializes the given object into a JSON string.
-   *
-   * @param <T> the generic type of the given object.
-   * @param object the object to serialize.
-   * @param protocolVersion the version of the serializer to use.
-   * @return a JSON string representation of {@code object}.
-   */
-  public <T> String serialize(T object, ProtocolVersion protocolVersion) {
-    return getGson(protocolVersion).toJson(object);
-  }
-
-  /**
-   * Serializes the given object into a JSON string.
-   *
-   * @param <T> the generic type of the given object.
-   * @param object the object to serialize.
-   * @param type the specific genericized type of {@code object}.
-   * @param protocolVersion the version of the serializer to use.
-   * @return a JSON string representation of {@code object}.
-   */
-  public <T> String serialize(T object, Type type, ProtocolVersion 
protocolVersion) {
-    return getGson(protocolVersion).toJson(object, type);
-  }
-
-  /**
-   * Parses the given JSON string into a {@link JsonElement}.
-   *
-   * @param jsonString the string to parse.
-   * @return a {@link JsonElement} representation of the input
-   *     {@code jsonString}.
-   */
-  public JsonElement parse(String jsonString) {
-    return jsonParser.parse(jsonString);
-  }
-
-  /**
-   * Deserializes operations. This method supports only the new JSON-RPC style
-   * operations.
-   *
-   * @param jsonString the operations JSON string to deserialize.
-   * @return a list of {@link OperationRequest},that represents the operations.
-   * @throws InvalidRequestException if there is a problem deserializing the
-   *     operations.
-   */
-  public List<OperationRequest> deserializeOperations(String jsonString)
-      throws InvalidRequestException {
-    if (Util.isEmptyOrWhitespace(jsonString)) {
-      return Collections.emptyList();
-    }
-
-    // Parse incoming operations.
-    JsonArray requestsAsJsonArray = null;
-
-    JsonElement json = null;
-    try {
-      json = jsonParser.parse(jsonString);
-    } catch (JsonParseException e) {
-      throw new InvalidRequestException("Couldn't deserialize incoming 
operations: " +
-          jsonString, null, e);
-    }
-
-    if (json.isJsonArray()) {
-      requestsAsJsonArray = json.getAsJsonArray();
-    } else {
-      requestsAsJsonArray = new JsonArray();
-      requestsAsJsonArray.add(json);
-    }
-
-    // Convert incoming operations into a list of JsonRpcRequest.
-    ProtocolVersion protocolVersion = 
determineProtocolVersion(requestsAsJsonArray);
-    PROTOCOL_VERSION_COUNTERS.get(protocolVersion).incrementAndGet();
-    List<OperationRequest> requests = new 
ArrayList<OperationRequest>(requestsAsJsonArray.size());
-    for (JsonElement requestAsJsonElement : requestsAsJsonArray) {
-      validate(requestAsJsonElement);
-      requests.add(getGson(protocolVersion).fromJson(requestAsJsonElement,
-          OperationRequest.class));
-    }
-    return requests;
-  }
-
-  /**
-   * Determines the protocol version of a given operation bundle JSON by
-   * inspecting the first operation in the bundle. If it is a
-   * {@code robot.notify} operation, and contains {@code protocolVersion}
-   * parameter, then this method will return the value of that parameter.
-   * Otherwise, this method will return the default version.
-   *
-   * @param operationBundle the operation bundle to check.
-   * @return the wire protocol version of the given operation bundle.
-   */
-  private ProtocolVersion determineProtocolVersion(JsonArray operationBundle) {
-    if (operationBundle.size() == 0 || !operationBundle.get(0).isJsonObject()) 
{
-      return defaultProtocolVersion;
-    }
-
-    JsonObject firstOperation = operationBundle.get(0).getAsJsonObject();
-    if (!firstOperation.has(RequestProperty.METHOD.key())) {
-      return defaultProtocolVersion;
-    }
-
-    String method = 
firstOperation.get(RequestProperty.METHOD.key()).getAsString();
-    if (isRobotNotifyOperationMethod(method)) {
-      JsonObject params = 
firstOperation.get(RequestProperty.PARAMS.key()).getAsJsonObject();
-      if (params.has(ParamsProperty.PROTOCOL_VERSION.key())) {
-        JsonElement protocolVersionElement = 
params.get(ParamsProperty.PROTOCOL_VERSION.key());
-        if (!protocolVersionElement.isJsonNull()) {
-          return 
ProtocolVersion.fromVersionString(protocolVersionElement.getAsString());
-        }
-      }
-    }
-    return defaultProtocolVersion;
-  }
-
-  /**
-   * Determines the protocol version of a given operation bundle by inspecting
-   * the first operation in the bundle. If it is a {@code robot.notify}
-   * operation, and contains {@code protocolVersion} parameter, then this 
method
-   * will return the value of that parameter. Otherwise, this method will 
return
-   * the default version.
-   *
-   * @param operationBundle the operation bundle to check.
-   * @return the wire protocol version of the given operation bundle.
-   */
-  private ProtocolVersion determineProtocolVersion(List<OperationRequest> 
operationBundle) {
-    if (operationBundle.size() == 0) {
-      return defaultProtocolVersion;
-    }
-
-    OperationRequest firstOperation = operationBundle.get(0);
-    if (isRobotNotifyOperationMethod(firstOperation.getMethod())) {
-      String versionString = (String) 
firstOperation.getParameter(ParamsProperty.PROTOCOL_VERSION);
-      if (versionString != null) {
-        return ProtocolVersion.fromVersionString(versionString);
-      }
-    }
-    return defaultProtocolVersion;
-  }
-
-  /**
-   * Serializes a list of {@link OperationRequest} objects into a JSON string.
-   *
-   * @param operations List of operations to serialize.
-   * @return A JSON string representing the serialized operations.
-   */
-  public String serializeOperations(List<OperationRequest> operations)
-      throws JsonParseException {
-    ProtocolVersion protocolVersion = determineProtocolVersion(operations);
-    return getGson(protocolVersion).toJson(operations);
-  }
-
-  /**
-   * Returns an instance of Gson for the given protocol version.
-   *
-   * @param protocolVersion the protocol version.
-   * @return an instance of {@link Gson}.
-   */
-  private Gson getGson(ProtocolVersion protocolVersion) {
-    // Returns the last entry which protocol version is less than or equal to
-    // the given protocol version.
-    Entry<ProtocolVersion, Gson> entry = gsons.floorEntry(protocolVersion);
-    if (entry == null) {
-      LOG.severe("Could not find the proper Gson for protocol version " + 
protocolVersion);
-      return null;
-    }
-    return entry.getValue();
-  }
-
-  /**
-   * Validates that the incoming JSON is a JSON object that represents a
-   * JSON-RPC request.
-   *
-   * @param jsonElement the incoming JSON.
-   * @throws InvalidRequestException if the incoming JSON does not have the
-   *     required properties.
-   */
-  private static void validate(JsonElement jsonElement) throws 
InvalidRequestException {
-    if (!jsonElement.isJsonObject()) {
-      throw new InvalidRequestException("The incoming JSON is not a JSON 
object: " + jsonElement);
-    }
-
-    JsonObject jsonObject = jsonElement.getAsJsonObject();
-
-    StringBuilder missingProperties = new StringBuilder();
-    for (RequestProperty requestProperty : RequestProperty.values()) {
-      if (!jsonObject.has(requestProperty.key())) {
-        missingProperties.append(requestProperty.key());
-      }
-    }
-
-    if (missingProperties.length() > 0) {
-      throw new InvalidRequestException("Missing required properties " + 
missingProperties +
-          "operation: " + jsonObject);
-    }
-  }
-
-  /**
-   * Checks whether the given operation method is of a robot notify operation.
-   *
-   * @param method the method to check.
-   * @return {@code true} if the given method is a robot notify operation's
-   *     method.
-   */
-  @SuppressWarnings("deprecation")
-  private static boolean isRobotNotifyOperationMethod(String method) {
-    return ROBOT_NOTIFY_CAPABILITIES_HASH.method().equals(method) ||
-        ROBOT_NOTIFY.method().equals(method);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/7d8609e7/src/com/google/wave/api/SearchResult.java
----------------------------------------------------------------------
diff --git a/src/com/google/wave/api/SearchResult.java 
b/src/com/google/wave/api/SearchResult.java
deleted file mode 100644
index 2b38393..0000000
--- a/src/com/google/wave/api/SearchResult.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.google.wave.api;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * SearchResult is returned from a search request.
- *
- */
-public class SearchResult {
-  
-  /**
-   * Digest contains the digest information for one 'hit' in the result.
-   */
-  public static class Digest {
-    private final String title;
-    private final String snippet;
-    private final String waveId;
-    private final long lastModified;
-    private final long created;
-    private final int unreadCount;
-    private final int blipCount;
-    private final List<String> participants;
-
-    public Digest(String title, String snippet, String waveId, List<String> 
participants,
-                  long lastModified, long created, int unreadCount, int 
blipCount) {
-      this.title = title;
-      this.snippet = snippet;
-      this.waveId = waveId;
-      this.participants = new ArrayList<String>(participants);
-      this.lastModified = lastModified;
-      this.created = created;
-      this.unreadCount = unreadCount;
-      this.blipCount = blipCount;
-    }
-
-    public String getTitle() {
-      return title;
-    }
-
-    public String getSnippet() {
-      return snippet;
-    }
-
-    public String getWaveId() {
-      return waveId;
-    }
-
-    public List<String> getParticipants() {
-      return participants;
-    }
-
-    public long getLastModified() {
-      return lastModified;
-    }
-    
-    public long getCreated() {
-      return created;
-    }
-
-    public int getUnreadCount() {
-      return unreadCount;
-    }
-
-    public int getBlipCount() {
-      return blipCount;
-    }
-  }
-
-  private final String query;
-  private int numResults;
-  private final List<Digest> digests = new ArrayList<Digest>(10);
-
-  public SearchResult(String query) {
-    this.query = query;
-    this.numResults = 0;
-  }
-
-  /**
-   * Add a result to the set
-   * @param digest to add
-   */
-  public void addDigest(Digest digest) {
-    numResults += 1;
-    digests.add(digest);
-  }
-
-  /**
-   * @returns the query associated with this result
-   */
-  public String getQuery() {
-    return query;
-  }
-
-  /**
-   * @returns the number of results
-   */
-  public int getNumResults() {
-    return numResults;
-  }
-
-  /**
-   * @returns the digests for the result
-   */
-  public List<Digest> getDigests() {
-    return digests;
-  }
-}

Reply via email to