@SuppressWarnings("unchecked")
 @Override
 public <S> Set<? extends Config<S>> getConfigs(S subject) {
   if (subject instanceof Device || subject.toString().contains("device")) {
     return devicesConfigs;
   } else if (subject.toString().contains("link")) {
     return linksConfigs;
   }
   return null;
 }
  @Override
  protected Resource getEntry(final S container, final E entry) {
    if (entry.isDirectory()) {
      return new AbstractDirectoryResource(container.toString()) {};
    } else {
      return new AbstractFileResource() {
        @Override
        public InputStream createStream() throws IOException {
          return new InputStream() {

            int read = 0;

            @Override
            public int read() throws IOException {
              if (read < entry.getSize()) {
                read++;
                return container.read();
              }
              return -1;
            }
          };
        }
      };
    }
  }
Example #3
0
 /**
  * Method toString.
  *
  * @return String
  */
 public String toString() {
   return "("
       + ((first == null) ? "" : first.toString())
       + ", "
       + ((second == null) ? "" : second.toString())
       + ")";
 }
  protected AbstractDocumentServiceIT(final List<S> indexes) {
    this.indexes = new ArrayList<>(indexes);

    indexesArray = new String[indexes.size()];
    int i = 0;
    for (final S index : indexes) {
      indexesArray[i++] = index.toString();
    }
  }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(
       GridDhtPartitionsFullMessage.class,
       this,
       "partCnt",
       parts.size(),
       "super",
       super.toString());
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(
       GridNearAtomicUpdateRequest.class,
       this,
       "filter",
       Arrays.toString(filter),
       "parent",
       super.toString());
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(
       GridDiscoveryEvent.class,
       this,
       "nodeId8",
       U.id8(nodeId()),
       "msg",
       message(),
       "type",
       name(),
       "tstamp",
       timestamp());
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(
       GridDhtLocalPartition.class,
       this,
       "state",
       state(),
       "reservations",
       reservations(),
       "empty",
       map.isEmpty(),
       "createTime",
       U.format(createTime),
       "mapPubSize",
       mapPubSize);
 }
  /** {@inheritDoc} */
  @Override
  public String toString() {
    GridCacheMvccCandidate<?> prev = previous();
    GridCacheMvccCandidate<?> next = next();

    return S.toString(
        GridCacheMvccCandidate.class,
        this,
        "key",
        parent == null ? null : parent.key(),
        "masks",
        Mask.toString(flags()),
        "prevVer",
        (prev == null ? null : prev.version()),
        "nextVer",
        (next == null ? null : next.version()));
  }
Example #10
0
    /** {@inheritDoc} */
    @Override
    public String toString() {
      int size;

      synchronized (this) {
        size = entries.size();
      }

      return S.toString(
          Buffer.class,
          this,
          "entriesCnt",
          size,
          "locFutsSize",
          locFuts.size(),
          "reqsSize",
          reqs.size());
    }
  /** {@inheritDoc} */
  @Override
  public String toString() {
    ClusterNode oldestNode = this.oldestNode.get();

    return S.toString(
        GridDhtPartitionsExchangeFuture.class,
        this,
        "oldest",
        oldestNode == null ? "null" : oldestNode.id(),
        "oldestOrder",
        oldestNode == null ? "null" : oldestNode.order(),
        "evtLatch",
        evtLatch == null ? "null" : evtLatch.getCount(),
        "remaining",
        remaining(),
        "super",
        super.toString());
  }
 private static <T, S> T adaptToEnum(Class<T> targetType, S sourceObject) {
   try {
     String literal;
     if (sourceObject instanceof Enum) {
       literal = ((Enum<?>) sourceObject).name();
     } else if (sourceObject instanceof String) {
       literal = (String) sourceObject;
     } else {
       literal = sourceObject.toString();
     }
     NotationParser<String, T> parser =
         new NotationConverterToNotationParserAdapter<String, T>(
             new EnumFromCharSequenceNotationParser(targetType));
     T parsedLiteral = parser.parseNotation(literal);
     return targetType.cast(parsedLiteral);
   } catch (TypeConversionException e) {
     throw new IllegalArgumentException(
         String.format(
             "Can't convert '%s' to enum type '%s'", sourceObject, targetType.getSimpleName()),
         e);
   }
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridCacheQueryResponse.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridCacheHibernateBlobStore.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(IgfsFragmentizerRequest.class, this);
 }
Example #16
0
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridFutureAdapter.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridCacheContinuousQueryAdapter.class, this);
 }
Example #18
0
 @Override
 public String toString() {
   return state.toString();
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(VisorNodeSuppressedErrorsJob.class, this);
 }
Example #20
0
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(
       GridNearTxLocal.class, this, "mappings", mappings.keySet(), "super", super.toString());
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridCacheSharedManagerAdapter.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridDotNetPortableTypeConfiguration.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(VisorCacheStoreConfiguration.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridUriDeploymentUriParser.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridDhtUnlockRequest.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(RandomEvictionPolicy.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridCacheEvictionRequest.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridCacheFifoEvictionPolicy.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridMessageListenHandler.class, this);
 }
 /** {@inheritDoc} */
 @Override
 public String toString() {
   return S.toString(GridNearCache.class, this);
 }