Package org.apache.helix

Examples of org.apache.helix.PropertyType


    class MockDataAccessor extends Mocks.MockAccessor {

      @Override
      public <T extends HelixProperty> T getProperty(PropertyKey key) {

        PropertyType type = key.getType();
        if (type == PropertyType.EXTERNALVIEW || type == PropertyType.IDEALSTATES) {
          return (T) new ExternalView(_externalView);
        }
        return null;
      }
View Full Code Here


        return null;
      }

      @Override
      public <T extends HelixProperty> List<T> getChildValues(PropertyKey key) {
        PropertyType type = key.getType();
        List<T> result = new ArrayList<T>();
        Class<? extends HelixProperty> clazz = key.getTypeClass();
        if (type == PropertyType.EXTERNALVIEW || type == PropertyType.IDEALSTATES) {
          HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
          result.add((T) typedInstance);
View Full Code Here

  void addListener(Object listener, PropertyKey propertyKey, ChangeType changeType,
      EventType[] eventType) {
    checkConnected();

    PropertyType type = propertyKey.getType();

    synchronized (this) {
      for (CallbackHandler handler : _handlers) {
        // compare property-key path and listener reference
        if (handler.getPath().equals(propertyKey.getPath())
View Full Code Here

  class MockHelixManager extends Mocks.MockManager {
    class MockDataAccessor extends Mocks.MockAccessor {
      @Override
      public <T extends HelixProperty> List<T> getChildValues(PropertyKey key) {
        List<T> result = new ArrayList<T>();
        PropertyType type = key.getType();
        Class<? extends HelixProperty> clazz = key.getTypeClass();
        if (type == PropertyType.EXTERNALVIEW) {
          HelixProperty typedInstance = HelixProperty.convertToTypedInstance(clazz, _externalView);
          result.add((T) typedInstance);
          return result;
View Full Code Here

        return result;
      }

      @Override
      public <T extends HelixProperty> T getProperty(PropertyKey key) {
        PropertyType type = key.getType();
        if (type == PropertyType.EXTERNALVIEW) {
          return (T) new ExternalView(_externalView);
        } else if (type == PropertyType.IDEALSTATES) {
          return (T) new IdealState(_idealState);
        }
View Full Code Here

    _propertyKeyBuilder = new PropertyKey.Builder(_clusterName);
  }

  @Override
  public <T extends HelixProperty> boolean createProperty(PropertyKey key, T value) {
    PropertyType type = key.getType();
    String path = key.getPath();
    int options = constructOptions(type);
    boolean success = false;
    switch (type) {
    case STATEMODELDEFS:
View Full Code Here

    return success;
  }

  @Override
  public <T extends HelixProperty> boolean setProperty(PropertyKey key, T value) {
    PropertyType type = key.getType();
    if (!value.isValid()) {
      throw new HelixException("The ZNRecord for " + type + " is not valid.");
    }

    String path = key.getPath();
    int options = constructOptions(type);

    if (type.usePropertyTransferServer()) {
      if (_zkPropertyTransferSvcUrl != null && _zkPropertyTransferClient != null) {
        ZNRecordUpdate update = new ZNRecordUpdate(path, OpCode.SET, value.getRecord());
        _zkPropertyTransferClient.enqueueZNRecordUpdate(update, _zkPropertyTransferSvcUrl);
        return true;
      }
View Full Code Here

    return success;
  }

  @Override
  public <T extends HelixProperty> boolean updateProperty(PropertyKey key, T value) {
    PropertyType type = key.getType();
    String path = key.getPath();
    int options = constructOptions(type);

    boolean success = false;
    switch (type) {
    case CURRENTSTATES:
      success = _groupCommit.commit(_baseDataAccessor, options, path, value.getRecord());
      break;
    default:
      if (type.usePropertyTransferServer()) {
        if (_zkPropertyTransferSvcUrl != null && _zkPropertyTransferClient != null) {
          ZNRecordUpdate update = new ZNRecordUpdate(path, OpCode.UPDATE, value.getRecord());
          _zkPropertyTransferClient.enqueueZNRecordUpdate(update, _zkPropertyTransferSvcUrl);

          return true;
View Full Code Here

    // check if bucketized
    for (int i = 0; i < keys.size(); i++) {
      PropertyKey key = keys.get(i);
      ZNRecord record = children.get(i);

      PropertyType type = key.getType();
      String path = key.getPath();
      int options = constructOptions(type);
      // ZNRecord record = null;

      switch (type) {
View Full Code Here

    return childValues;
  }

  @Override
  public <T extends HelixProperty> T getProperty(PropertyKey key) {
    PropertyType type = key.getType();
    String path = key.getPath();
    int options = constructOptions(type);
    ZNRecord record = null;
    try {
      Stat stat = new Stat();
View Full Code Here

TOP

Related Classes of org.apache.helix.PropertyType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.