http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java deleted file mode 100644 index 478d1af..0000000 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClient.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.nearinfinity.blur.thrift; - -/** - * 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. - */ -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; -import java.util.List; - -import org.apache.thrift.TException; - -import com.nearinfinity.blur.thrift.commands.BlurCommand; -import com.nearinfinity.blur.thrift.generated.Blur.Client; -import com.nearinfinity.blur.thrift.generated.Blur.Iface; -import com.nearinfinity.blur.thrift.generated.BlurException; - -public class BlurClient { - - static class BlurClientInvocationHandler implements InvocationHandler { - - private List<Connection> connections; - - public BlurClientInvocationHandler(List<Connection> connections) { - this.connections = connections; - } - - @Override - public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { - return BlurClientManager.execute(connections, new BlurCommand<Object>() { - @Override - public Object call(Client client) throws BlurException, TException { - try { - return method.invoke(client, args); - } catch (IllegalArgumentException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - Throwable targetException = e.getTargetException(); - if (targetException instanceof BlurException) { - throw (BlurException) targetException; - } - if (targetException instanceof TException) { - throw (TException) targetException; - } - throw new RuntimeException(targetException); - } - } - }); - } - - } - - public static Iface getClient(String connectionStr) { - List<Connection> connections = BlurClientManager.getConnections(connectionStr); - return getClient(connections); - } - - public static Iface getClient(Connection connection) { - return getClient(Arrays.asList(connection)); - } - - public static Iface getClient(List<Connection> connections) { - return (Iface) Proxy.newProxyInstance(Iface.class.getClassLoader(), new Class[] { Iface.class }, new BlurClientInvocationHandler(connections)); - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java deleted file mode 100644 index 4d14c4f..0000000 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/BlurClientManager.java +++ /dev/null @@ -1,339 +0,0 @@ -package com.nearinfinity.blur.thrift; - -/** - * 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. - */ -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Proxy; -import java.net.Proxy.Type; -import java.net.Socket; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; - -import org.apache.thrift.TException; -import org.apache.thrift.protocol.TBinaryProtocol; -import org.apache.thrift.protocol.TProtocol; -import org.apache.thrift.transport.TFramedTransport; -import org.apache.thrift.transport.TSocket; -import org.apache.thrift.transport.TTransportException; - -import com.nearinfinity.blur.log.Log; -import com.nearinfinity.blur.log.LogFactory; -import com.nearinfinity.blur.thrift.generated.Blur; -import com.nearinfinity.blur.thrift.generated.Blur.Client; -import com.nearinfinity.blur.thrift.generated.BlurException; - -public class BlurClientManager { - - private static final Object NULL = new Object(); - - private static final Log LOG = LogFactory.getLog(BlurClientManager.class); - private static final int MAX_RETRIES = 5; - private static final long BACK_OFF_TIME = TimeUnit.MILLISECONDS.toMillis(250); - private static final long MAX_BACK_OFF_TIME = TimeUnit.SECONDS.toMillis(10); - private static final long ONE_SECOND = TimeUnit.SECONDS.toMillis(1); - - private static Map<Connection, BlockingQueue<Client>> clientPool = new ConcurrentHashMap<Connection, BlockingQueue<Client>>(); - private static Thread daemon; - private static AtomicBoolean running = new AtomicBoolean(true); - private static Map<Connection, Object> badConnections = new ConcurrentHashMap<Connection, Object>(); - - static { - startDaemon(); - } - - private static void startDaemon() { - daemon = new Thread(new Runnable() { - private Set<Connection> good = new HashSet<Connection>(); - - @Override - public void run() { - while (running.get()) { - good.clear(); - Set<Connection> badConns = badConnections.keySet(); - for (Connection connection : badConns) { - if (isConnectionGood(connection)) { - good.add(connection); - } - } - for (Connection connection : good) { - badConnections.remove(connection); - } - try { - Thread.sleep(ONE_SECOND); - } catch (InterruptedException e) { - return; - } - } - } - }); - daemon.setDaemon(true); - daemon.setName("Blur-Client-Manager-Connection-Checker"); - daemon.start(); - } - - protected static boolean isConnectionGood(Connection connection) { - try { - returnClient(connection, getClient(connection)); - return true; - } catch (TTransportException e) { - LOG.debug("Connection [{0}] is still bad.", connection); - } catch (IOException e) { - LOG.debug("Connection [{0}] is still bad.", connection); - } - return false; - } - - public static <CLIENT, T> T execute(Connection connection, AbstractCommand<CLIENT, T> command) throws BlurException, TException, IOException { - return execute(connection, command, MAX_RETRIES, BACK_OFF_TIME, MAX_BACK_OFF_TIME); - } - - public static <CLIENT, T> T execute(Connection connection, AbstractCommand<CLIENT, T> command, int maxRetries, long backOffTime, long maxBackOffTime) throws BlurException, - TException, IOException { - return execute(Arrays.asList(connection), command, maxRetries, backOffTime, maxBackOffTime); - } - - public static <CLIENT, T> T execute(List<Connection> connections, AbstractCommand<CLIENT, T> command) throws BlurException, TException, IOException { - return execute(connections, command, MAX_RETRIES, BACK_OFF_TIME, MAX_BACK_OFF_TIME); - } - - private static class LocalResources { - AtomicInteger retries = new AtomicInteger(); - AtomicReference<Blur.Client> client = new AtomicReference<Client>(); - List<Connection> shuffledConnections = new ArrayList<Connection>(); - Random random = new Random(); - } - - @SuppressWarnings("unchecked") - public static <CLIENT, T> T execute(List<Connection> connections, AbstractCommand<CLIENT, T> command, int maxRetries, long backOffTime, long maxBackOffTime) - throws BlurException, TException, IOException { - LocalResources localResources = new LocalResources(); - AtomicReference<Client> client = localResources.client; - Random random = localResources.random; - AtomicInteger retries = localResources.retries; - List<Connection> shuffledConnections = localResources.shuffledConnections; - - retries.set(0); - shuffledConnections.addAll(connections); - - Collections.shuffle(shuffledConnections, random); - boolean allBad = true; - int connectionErrorCount = 0; - while (true) { - for (Connection connection : shuffledConnections) { - if (isBadConnection(connection)) { - continue; - } - client.set(null); - try { - client.set(getClient(connection)); - } catch (IOException e) { - if (handleError(connection, client, retries, command, e, maxRetries, backOffTime, maxBackOffTime)) { - throw e; - } else { - markBadConnection(connection); - continue; - } - } - try { - T result = command.call((CLIENT) client.get()); - allBad = false; - return result; - } catch (RuntimeException e) { - Throwable cause = e.getCause(); - if (cause instanceof TTransportException) { - TTransportException t = (TTransportException) cause; - if (handleError(connection, client, retries, command, t, maxRetries, backOffTime, maxBackOffTime)) { - throw t; - } - } else { - throw e; - } - } catch (TTransportException e) { - if (handleError(connection, client, retries, command, e, maxRetries, backOffTime, maxBackOffTime)) { - throw e; - } - } finally { - if (client.get() != null) { - returnClient(connection, client); - } - } - } - if (allBad) { - connectionErrorCount++; - LOG.error("All connections are bad [" + connectionErrorCount + "]."); - if (connectionErrorCount >= 5) { - throw new IOException("All connections are bad."); - } - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - throw new BException("Unknown error.", e); - } - } - } - } - - private static void markBadConnection(Connection connection) { - LOG.info("Marking bad connection [{0}]", connection); - badConnections.put(connection, NULL); - } - - private static boolean isBadConnection(Connection connection) { - return badConnections.containsKey(connection); - } - - private static <CLIENT, T> boolean handleError(Connection connection, AtomicReference<Blur.Client> client, AtomicInteger retries, AbstractCommand<CLIENT, T> command, - Exception e, int maxRetries, long backOffTime, long maxBackOffTime) { - if (client.get() != null) { - trashConnections(connection, client); - markBadConnection(connection); - client.set(null); - } - if (retries.get() > maxRetries) { - LOG.error("No more retries [{0}] out of [{1}]", retries, maxRetries); - return true; - } - LOG.error("Retrying call [{0}] retry [{1}] out of [{2}] message [{3}]", command, retries.get(), maxRetries, e.getMessage()); - sleep(backOffTime, maxBackOffTime, retries.get(), maxRetries); - retries.incrementAndGet(); - return false; - } - - public static void sleep(long backOffTime, long maxBackOffTime, int retry, int maxRetries) { - long extra = (maxBackOffTime - backOffTime) / maxRetries; - long sleep = backOffTime + (extra * retry); - LOG.info("Backing off call for [{0} ms]", sleep); - try { - Thread.sleep(sleep); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - public static <CLIENT, T> T execute(String connectionStr, AbstractCommand<CLIENT, T> command, int maxRetries, long backOffTime, long maxBackOffTime) throws BlurException, - TException, IOException { - return execute(getConnections(connectionStr), command, maxRetries, backOffTime, maxBackOffTime); - } - - public static List<Connection> getConnections(String connectionStr) { - int start = 0; - int index = connectionStr.indexOf(','); - if (index >= 0) { - List<Connection> connections = new ArrayList<Connection>(); - while (index >= 0) { - connections.add(new Connection(connectionStr.substring(start, index))); - start = index + 1; - index = connectionStr.indexOf(',', start); - } - connections.add(new Connection(connectionStr.substring(start))); - return connections; - } - return Arrays.asList(new Connection(connectionStr)); - } - - public static <CLIENT, T> T execute(String connectionStr, AbstractCommand<CLIENT, T> command) throws BlurException, TException, IOException { - return execute(getConnections(connectionStr), command); - } - - private static void returnClient(Connection connection, AtomicReference<Blur.Client> client) { - returnClient(connection, client.get()); - } - - private static void returnClient(Connection connection, Blur.Client client) { - try { - clientPool.get(connection).put(client); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - private static void trashConnections(Connection connection, AtomicReference<Client> c) { - BlockingQueue<Client> blockingQueue; - synchronized (clientPool) { - blockingQueue = clientPool.put(connection, new LinkedBlockingQueue<Client>()); - try { - blockingQueue.put(c.get()); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - LOG.info("Trashing client for connections [{0}]", connection); - for (Client client : blockingQueue) { - close(client); - } - } - - public static void close(Client client) { - client.getInputProtocol().getTransport().close(); - client.getOutputProtocol().getTransport().close(); - } - - private static Client getClient(Connection connection) throws TTransportException, IOException { - BlockingQueue<Client> blockingQueue; - synchronized (clientPool) { - blockingQueue = clientPool.get(connection); - if (blockingQueue == null) { - blockingQueue = new LinkedBlockingQueue<Client>(); - clientPool.put(connection, blockingQueue); - } - } - if (blockingQueue.isEmpty()) { - return newClient(connection); - } - try { - return blockingQueue.take(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - public static Client newClient(Connection connection) throws TTransportException, IOException { - String host = connection.getHost(); - int port = connection.getPort(); - TSocket trans; - Socket socket; - if (connection.isProxy()) { - Proxy proxy = new Proxy(Type.SOCKS, new InetSocketAddress(connection.getProxyHost(), connection.getProxyPort())); - socket = new Socket(proxy); - } else { - socket = new Socket(); - } - socket.setTcpNoDelay(true); - socket.connect(new InetSocketAddress(host, port)); - trans = new TSocket(socket); - - TProtocol proto = new TBinaryProtocol(new TFramedTransport(trans)); - Client client = new Client(proto); - return client; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java deleted file mode 100644 index e3d79ee..0000000 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/Connection.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.nearinfinity.blur.thrift; - -/** - * 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. - */ - -public class Connection { - - private int _port; - private String _host; - private String _proxyHost; - private int _proxyPort; - private boolean _proxy = false; - - public Connection(String connectionStr) { - int index = connectionStr.indexOf(':'); - if (index >= 0) { - _host = connectionStr.substring(0, index); - _port = Integer.parseInt(connectionStr.substring(index + 1)); - // @TODO make this connection parse proxy ports as well - } else { - throw new RuntimeException("Connection string of [" + connectionStr + "] does not match 'host1:port,host2:port,...'"); - } - } - - public Connection(String host, int port, String proxyHost, int proxyPort) { - _port = port; - _host = host; - _proxyHost = proxyHost; - _proxyPort = proxyPort; - _proxy = true; - } - - public Connection(String host, int port) { - _port = port; - _host = host; - } - - public String getHost() { - return _host; - } - - public int getPort() { - return _port; - } - - public boolean isProxy() { - return _proxy; - } - - public int getProxyPort() { - return _proxyPort; - } - - public String getProxyHost() { - return _proxyHost; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((_host == null) ? 0 : _host.hashCode()); - result = prime * result + _port; - result = prime * result + (_proxy ? 1231 : 1237); - result = prime * result + ((_proxyHost == null) ? 0 : _proxyHost.hashCode()); - result = prime * result + _proxyPort; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Connection other = (Connection) obj; - if (_host == null) { - if (other._host != null) - return false; - } else if (!_host.equals(other._host)) - return false; - if (_port != other._port) - return false; - if (_proxy != other._proxy) - return false; - if (_proxyHost == null) { - if (other._proxyHost != null) - return false; - } else if (!_proxyHost.equals(other._proxyHost)) - return false; - if (_proxyPort != other._proxyPort) - return false; - return true; - } - - @Override - public String toString() { - return "Connection [_host=" + _host + ", _port=" + _port + ", _proxy=" + _proxy + ", _proxyHost=" + _proxyHost + ", _proxyPort=" + _proxyPort + "]"; - } - - public Object getConnectionStr() { - if (_proxyHost != null) { - return _host + ":" + _port + "/" + _proxyHost + ":" + _proxyPort; - } - return _host + ":" + _port; - } -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java deleted file mode 100644 index 7a43ad8..0000000 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/commands/BlurCommand.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.nearinfinity.blur.thrift.commands; - -/** - * 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. - */ -import com.nearinfinity.blur.thrift.AbstractCommand; -import com.nearinfinity.blur.thrift.generated.Blur; - -public abstract class BlurCommand<T> extends AbstractCommand<Blur.Client, T> { - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AlternateColumnDefinition.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AlternateColumnDefinition.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AlternateColumnDefinition.java deleted file mode 100644 index d600e35..0000000 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AlternateColumnDefinition.java +++ /dev/null @@ -1,334 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.7.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - */ -package com.nearinfinity.blur.thrift.generated; - -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - */ -public class AlternateColumnDefinition implements org.apache.thrift.TBase<AlternateColumnDefinition, AlternateColumnDefinition._Fields>, java.io.Serializable, Cloneable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AlternateColumnDefinition"); - - private static final org.apache.thrift.protocol.TField ANALYZER_CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("analyzerClassName", org.apache.thrift.protocol.TType.STRING, (short)1); - - /** - * - */ - public String analyzerClassName; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * - */ - ANALYZER_CLASS_NAME((short)1, "analyzerClassName"); - - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // ANALYZER_CLASS_NAME - return ANALYZER_CLASS_NAME; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.ANALYZER_CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("analyzerClassName", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AlternateColumnDefinition.class, metaDataMap); - } - - public AlternateColumnDefinition() { - } - - public AlternateColumnDefinition( - String analyzerClassName) - { - this(); - this.analyzerClassName = analyzerClassName; - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public AlternateColumnDefinition(AlternateColumnDefinition other) { - if (other.isSetAnalyzerClassName()) { - this.analyzerClassName = other.analyzerClassName; - } - } - - public AlternateColumnDefinition deepCopy() { - return new AlternateColumnDefinition(this); - } - - @Override - public void clear() { - this.analyzerClassName = null; - } - - /** - * - */ - public String getAnalyzerClassName() { - return this.analyzerClassName; - } - - /** - * - */ - public AlternateColumnDefinition setAnalyzerClassName(String analyzerClassName) { - this.analyzerClassName = analyzerClassName; - return this; - } - - public void unsetAnalyzerClassName() { - this.analyzerClassName = null; - } - - /** Returns true if field analyzerClassName is set (has been assigned a value) and false otherwise */ - public boolean isSetAnalyzerClassName() { - return this.analyzerClassName != null; - } - - public void setAnalyzerClassNameIsSet(boolean value) { - if (!value) { - this.analyzerClassName = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case ANALYZER_CLASS_NAME: - if (value == null) { - unsetAnalyzerClassName(); - } else { - setAnalyzerClassName((String)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case ANALYZER_CLASS_NAME: - return getAnalyzerClassName(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case ANALYZER_CLASS_NAME: - return isSetAnalyzerClassName(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof AlternateColumnDefinition) - return this.equals((AlternateColumnDefinition)that); - return false; - } - - public boolean equals(AlternateColumnDefinition that) { - if (that == null) - return false; - - boolean this_present_analyzerClassName = true && this.isSetAnalyzerClassName(); - boolean that_present_analyzerClassName = true && that.isSetAnalyzerClassName(); - if (this_present_analyzerClassName || that_present_analyzerClassName) { - if (!(this_present_analyzerClassName && that_present_analyzerClassName)) - return false; - if (!this.analyzerClassName.equals(that.analyzerClassName)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(AlternateColumnDefinition other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - AlternateColumnDefinition typedOther = (AlternateColumnDefinition)other; - - lastComparison = Boolean.valueOf(isSetAnalyzerClassName()).compareTo(typedOther.isSetAnalyzerClassName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetAnalyzerClassName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.analyzerClassName, typedOther.analyzerClassName); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // ANALYZER_CLASS_NAME - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.analyzerClassName = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.analyzerClassName != null) { - oprot.writeFieldBegin(ANALYZER_CLASS_NAME_FIELD_DESC); - oprot.writeString(this.analyzerClassName); - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("AlternateColumnDefinition("); - boolean first = true; - - sb.append("analyzerClassName:"); - if (this.analyzerClassName == null) { - sb.append("null"); - } else { - sb.append(this.analyzerClassName); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - -} - http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/33df9310/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AnalyzerDefinition.java ---------------------------------------------------------------------- diff --git a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AnalyzerDefinition.java b/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AnalyzerDefinition.java deleted file mode 100644 index af758a8..0000000 --- a/src/blur-thrift/src/main/java/com/nearinfinity/blur/thrift/generated/AnalyzerDefinition.java +++ /dev/null @@ -1,586 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.7.0) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - */ -package com.nearinfinity.blur.thrift.generated; - -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - */ -public class AnalyzerDefinition implements org.apache.thrift.TBase<AnalyzerDefinition, AnalyzerDefinition._Fields>, java.io.Serializable, Cloneable { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AnalyzerDefinition"); - - private static final org.apache.thrift.protocol.TField DEFAULT_DEFINITION_FIELD_DESC = new org.apache.thrift.protocol.TField("defaultDefinition", org.apache.thrift.protocol.TType.STRUCT, (short)1); - private static final org.apache.thrift.protocol.TField FULL_TEXT_ANALYZER_CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("fullTextAnalyzerClassName", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField COLUMN_FAMILY_DEFINITIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("columnFamilyDefinitions", org.apache.thrift.protocol.TType.MAP, (short)3); - - /** - * - */ - public ColumnDefinition defaultDefinition; // required - /** - * - */ - public String fullTextAnalyzerClassName; // required - /** - * - */ - public Map<String,ColumnFamilyDefinition> columnFamilyDefinitions; // required - - /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ - public enum _Fields implements org.apache.thrift.TFieldIdEnum { - /** - * - */ - DEFAULT_DEFINITION((short)1, "defaultDefinition"), - /** - * - */ - FULL_TEXT_ANALYZER_CLASS_NAME((short)2, "fullTextAnalyzerClassName"), - /** - * - */ - COLUMN_FAMILY_DEFINITIONS((short)3, "columnFamilyDefinitions"); - - private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); - - static { - for (_Fields field : EnumSet.allOf(_Fields.class)) { - byName.put(field.getFieldName(), field); - } - } - - /** - * Find the _Fields constant that matches fieldId, or null if its not found. - */ - public static _Fields findByThriftId(int fieldId) { - switch(fieldId) { - case 1: // DEFAULT_DEFINITION - return DEFAULT_DEFINITION; - case 2: // FULL_TEXT_ANALYZER_CLASS_NAME - return FULL_TEXT_ANALYZER_CLASS_NAME; - case 3: // COLUMN_FAMILY_DEFINITIONS - return COLUMN_FAMILY_DEFINITIONS; - default: - return null; - } - } - - /** - * Find the _Fields constant that matches fieldId, throwing an exception - * if it is not found. - */ - public static _Fields findByThriftIdOrThrow(int fieldId) { - _Fields fields = findByThriftId(fieldId); - if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); - return fields; - } - - /** - * Find the _Fields constant that matches name, or null if its not found. - */ - public static _Fields findByName(String name) { - return byName.get(name); - } - - private final short _thriftId; - private final String _fieldName; - - _Fields(short thriftId, String fieldName) { - _thriftId = thriftId; - _fieldName = fieldName; - } - - public short getThriftFieldId() { - return _thriftId; - } - - public String getFieldName() { - return _fieldName; - } - } - - // isset id assignments - - public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.DEFAULT_DEFINITION, new org.apache.thrift.meta_data.FieldMetaData("defaultDefinition", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnDefinition.class))); - tmpMap.put(_Fields.FULL_TEXT_ANALYZER_CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("fullTextAnalyzerClassName", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.COLUMN_FAMILY_DEFINITIONS, new org.apache.thrift.meta_data.FieldMetaData("columnFamilyDefinitions", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), - new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ColumnFamilyDefinition.class)))); - metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AnalyzerDefinition.class, metaDataMap); - } - - public AnalyzerDefinition() { - this.fullTextAnalyzerClassName = "org.apache.lucene.analysis.standard.StandardAnalyzer"; - - } - - public AnalyzerDefinition( - ColumnDefinition defaultDefinition, - String fullTextAnalyzerClassName, - Map<String,ColumnFamilyDefinition> columnFamilyDefinitions) - { - this(); - this.defaultDefinition = defaultDefinition; - this.fullTextAnalyzerClassName = fullTextAnalyzerClassName; - this.columnFamilyDefinitions = columnFamilyDefinitions; - } - - /** - * Performs a deep copy on <i>other</i>. - */ - public AnalyzerDefinition(AnalyzerDefinition other) { - if (other.isSetDefaultDefinition()) { - this.defaultDefinition = new ColumnDefinition(other.defaultDefinition); - } - if (other.isSetFullTextAnalyzerClassName()) { - this.fullTextAnalyzerClassName = other.fullTextAnalyzerClassName; - } - if (other.isSetColumnFamilyDefinitions()) { - Map<String,ColumnFamilyDefinition> __this__columnFamilyDefinitions = new HashMap<String,ColumnFamilyDefinition>(); - for (Map.Entry<String, ColumnFamilyDefinition> other_element : other.columnFamilyDefinitions.entrySet()) { - - String other_element_key = other_element.getKey(); - ColumnFamilyDefinition other_element_value = other_element.getValue(); - - String __this__columnFamilyDefinitions_copy_key = other_element_key; - - ColumnFamilyDefinition __this__columnFamilyDefinitions_copy_value = new ColumnFamilyDefinition(other_element_value); - - __this__columnFamilyDefinitions.put(__this__columnFamilyDefinitions_copy_key, __this__columnFamilyDefinitions_copy_value); - } - this.columnFamilyDefinitions = __this__columnFamilyDefinitions; - } - } - - public AnalyzerDefinition deepCopy() { - return new AnalyzerDefinition(this); - } - - @Override - public void clear() { - this.defaultDefinition = null; - this.fullTextAnalyzerClassName = "org.apache.lucene.analysis.standard.StandardAnalyzer"; - - this.columnFamilyDefinitions = null; - } - - /** - * - */ - public ColumnDefinition getDefaultDefinition() { - return this.defaultDefinition; - } - - /** - * - */ - public AnalyzerDefinition setDefaultDefinition(ColumnDefinition defaultDefinition) { - this.defaultDefinition = defaultDefinition; - return this; - } - - public void unsetDefaultDefinition() { - this.defaultDefinition = null; - } - - /** Returns true if field defaultDefinition is set (has been assigned a value) and false otherwise */ - public boolean isSetDefaultDefinition() { - return this.defaultDefinition != null; - } - - public void setDefaultDefinitionIsSet(boolean value) { - if (!value) { - this.defaultDefinition = null; - } - } - - /** - * - */ - public String getFullTextAnalyzerClassName() { - return this.fullTextAnalyzerClassName; - } - - /** - * - */ - public AnalyzerDefinition setFullTextAnalyzerClassName(String fullTextAnalyzerClassName) { - this.fullTextAnalyzerClassName = fullTextAnalyzerClassName; - return this; - } - - public void unsetFullTextAnalyzerClassName() { - this.fullTextAnalyzerClassName = null; - } - - /** Returns true if field fullTextAnalyzerClassName is set (has been assigned a value) and false otherwise */ - public boolean isSetFullTextAnalyzerClassName() { - return this.fullTextAnalyzerClassName != null; - } - - public void setFullTextAnalyzerClassNameIsSet(boolean value) { - if (!value) { - this.fullTextAnalyzerClassName = null; - } - } - - public int getColumnFamilyDefinitionsSize() { - return (this.columnFamilyDefinitions == null) ? 0 : this.columnFamilyDefinitions.size(); - } - - public void putToColumnFamilyDefinitions(String key, ColumnFamilyDefinition val) { - if (this.columnFamilyDefinitions == null) { - this.columnFamilyDefinitions = new HashMap<String,ColumnFamilyDefinition>(); - } - this.columnFamilyDefinitions.put(key, val); - } - - /** - * - */ - public Map<String,ColumnFamilyDefinition> getColumnFamilyDefinitions() { - return this.columnFamilyDefinitions; - } - - /** - * - */ - public AnalyzerDefinition setColumnFamilyDefinitions(Map<String,ColumnFamilyDefinition> columnFamilyDefinitions) { - this.columnFamilyDefinitions = columnFamilyDefinitions; - return this; - } - - public void unsetColumnFamilyDefinitions() { - this.columnFamilyDefinitions = null; - } - - /** Returns true if field columnFamilyDefinitions is set (has been assigned a value) and false otherwise */ - public boolean isSetColumnFamilyDefinitions() { - return this.columnFamilyDefinitions != null; - } - - public void setColumnFamilyDefinitionsIsSet(boolean value) { - if (!value) { - this.columnFamilyDefinitions = null; - } - } - - public void setFieldValue(_Fields field, Object value) { - switch (field) { - case DEFAULT_DEFINITION: - if (value == null) { - unsetDefaultDefinition(); - } else { - setDefaultDefinition((ColumnDefinition)value); - } - break; - - case FULL_TEXT_ANALYZER_CLASS_NAME: - if (value == null) { - unsetFullTextAnalyzerClassName(); - } else { - setFullTextAnalyzerClassName((String)value); - } - break; - - case COLUMN_FAMILY_DEFINITIONS: - if (value == null) { - unsetColumnFamilyDefinitions(); - } else { - setColumnFamilyDefinitions((Map<String,ColumnFamilyDefinition>)value); - } - break; - - } - } - - public Object getFieldValue(_Fields field) { - switch (field) { - case DEFAULT_DEFINITION: - return getDefaultDefinition(); - - case FULL_TEXT_ANALYZER_CLASS_NAME: - return getFullTextAnalyzerClassName(); - - case COLUMN_FAMILY_DEFINITIONS: - return getColumnFamilyDefinitions(); - - } - throw new IllegalStateException(); - } - - /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ - public boolean isSet(_Fields field) { - if (field == null) { - throw new IllegalArgumentException(); - } - - switch (field) { - case DEFAULT_DEFINITION: - return isSetDefaultDefinition(); - case FULL_TEXT_ANALYZER_CLASS_NAME: - return isSetFullTextAnalyzerClassName(); - case COLUMN_FAMILY_DEFINITIONS: - return isSetColumnFamilyDefinitions(); - } - throw new IllegalStateException(); - } - - @Override - public boolean equals(Object that) { - if (that == null) - return false; - if (that instanceof AnalyzerDefinition) - return this.equals((AnalyzerDefinition)that); - return false; - } - - public boolean equals(AnalyzerDefinition that) { - if (that == null) - return false; - - boolean this_present_defaultDefinition = true && this.isSetDefaultDefinition(); - boolean that_present_defaultDefinition = true && that.isSetDefaultDefinition(); - if (this_present_defaultDefinition || that_present_defaultDefinition) { - if (!(this_present_defaultDefinition && that_present_defaultDefinition)) - return false; - if (!this.defaultDefinition.equals(that.defaultDefinition)) - return false; - } - - boolean this_present_fullTextAnalyzerClassName = true && this.isSetFullTextAnalyzerClassName(); - boolean that_present_fullTextAnalyzerClassName = true && that.isSetFullTextAnalyzerClassName(); - if (this_present_fullTextAnalyzerClassName || that_present_fullTextAnalyzerClassName) { - if (!(this_present_fullTextAnalyzerClassName && that_present_fullTextAnalyzerClassName)) - return false; - if (!this.fullTextAnalyzerClassName.equals(that.fullTextAnalyzerClassName)) - return false; - } - - boolean this_present_columnFamilyDefinitions = true && this.isSetColumnFamilyDefinitions(); - boolean that_present_columnFamilyDefinitions = true && that.isSetColumnFamilyDefinitions(); - if (this_present_columnFamilyDefinitions || that_present_columnFamilyDefinitions) { - if (!(this_present_columnFamilyDefinitions && that_present_columnFamilyDefinitions)) - return false; - if (!this.columnFamilyDefinitions.equals(that.columnFamilyDefinitions)) - return false; - } - - return true; - } - - @Override - public int hashCode() { - return 0; - } - - public int compareTo(AnalyzerDefinition other) { - if (!getClass().equals(other.getClass())) { - return getClass().getName().compareTo(other.getClass().getName()); - } - - int lastComparison = 0; - AnalyzerDefinition typedOther = (AnalyzerDefinition)other; - - lastComparison = Boolean.valueOf(isSetDefaultDefinition()).compareTo(typedOther.isSetDefaultDefinition()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetDefaultDefinition()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.defaultDefinition, typedOther.defaultDefinition); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetFullTextAnalyzerClassName()).compareTo(typedOther.isSetFullTextAnalyzerClassName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetFullTextAnalyzerClassName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fullTextAnalyzerClassName, typedOther.fullTextAnalyzerClassName); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetColumnFamilyDefinitions()).compareTo(typedOther.isSetColumnFamilyDefinitions()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetColumnFamilyDefinitions()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columnFamilyDefinitions, typedOther.columnFamilyDefinitions); - if (lastComparison != 0) { - return lastComparison; - } - } - return 0; - } - - public _Fields fieldForId(int fieldId) { - return _Fields.findByThriftId(fieldId); - } - - public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { - org.apache.thrift.protocol.TField field; - iprot.readStructBegin(); - while (true) - { - field = iprot.readFieldBegin(); - if (field.type == org.apache.thrift.protocol.TType.STOP) { - break; - } - switch (field.id) { - case 1: // DEFAULT_DEFINITION - if (field.type == org.apache.thrift.protocol.TType.STRUCT) { - this.defaultDefinition = new ColumnDefinition(); - this.defaultDefinition.read(iprot); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 2: // FULL_TEXT_ANALYZER_CLASS_NAME - if (field.type == org.apache.thrift.protocol.TType.STRING) { - this.fullTextAnalyzerClassName = iprot.readString(); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - case 3: // COLUMN_FAMILY_DEFINITIONS - if (field.type == org.apache.thrift.protocol.TType.MAP) { - { - org.apache.thrift.protocol.TMap _map70 = iprot.readMapBegin(); - this.columnFamilyDefinitions = new HashMap<String,ColumnFamilyDefinition>(2*_map70.size); - for (int _i71 = 0; _i71 < _map70.size; ++_i71) - { - String _key72; // required - ColumnFamilyDefinition _val73; // required - _key72 = iprot.readString(); - _val73 = new ColumnFamilyDefinition(); - _val73.read(iprot); - this.columnFamilyDefinitions.put(_key72, _val73); - } - iprot.readMapEnd(); - } - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - break; - default: - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); - } - iprot.readFieldEnd(); - } - iprot.readStructEnd(); - - // check for required fields of primitive type, which can't be checked in the validate method - validate(); - } - - public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { - validate(); - - oprot.writeStructBegin(STRUCT_DESC); - if (this.defaultDefinition != null) { - oprot.writeFieldBegin(DEFAULT_DEFINITION_FIELD_DESC); - this.defaultDefinition.write(oprot); - oprot.writeFieldEnd(); - } - if (this.fullTextAnalyzerClassName != null) { - oprot.writeFieldBegin(FULL_TEXT_ANALYZER_CLASS_NAME_FIELD_DESC); - oprot.writeString(this.fullTextAnalyzerClassName); - oprot.writeFieldEnd(); - } - if (this.columnFamilyDefinitions != null) { - oprot.writeFieldBegin(COLUMN_FAMILY_DEFINITIONS_FIELD_DESC); - { - oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRUCT, this.columnFamilyDefinitions.size())); - for (Map.Entry<String, ColumnFamilyDefinition> _iter74 : this.columnFamilyDefinitions.entrySet()) - { - oprot.writeString(_iter74.getKey()); - _iter74.getValue().write(oprot); - } - oprot.writeMapEnd(); - } - oprot.writeFieldEnd(); - } - oprot.writeFieldStop(); - oprot.writeStructEnd(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("AnalyzerDefinition("); - boolean first = true; - - sb.append("defaultDefinition:"); - if (this.defaultDefinition == null) { - sb.append("null"); - } else { - sb.append(this.defaultDefinition); - } - first = false; - if (!first) sb.append(", "); - sb.append("fullTextAnalyzerClassName:"); - if (this.fullTextAnalyzerClassName == null) { - sb.append("null"); - } else { - sb.append(this.fullTextAnalyzerClassName); - } - first = false; - if (!first) sb.append(", "); - sb.append("columnFamilyDefinitions:"); - if (this.columnFamilyDefinitions == null) { - sb.append("null"); - } else { - sb.append(this.columnFamilyDefinitions); - } - first = false; - sb.append(")"); - return sb.toString(); - } - - public void validate() throws org.apache.thrift.TException { - // check for required fields - } - - private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { - try { - write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - - private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { - try { - read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); - } catch (org.apache.thrift.TException te) { - throw new java.io.IOException(te); - } - } - -} -
