Examples of MetadataInfo


Examples of co.cask.cdap.explore.service.MetaDataInfo

  }

  @Override
  public MetaDataInfo getInfo(MetaDataInfo.InfoType infoType) throws ExploreException, SQLException {
    try {
      MetaDataInfo ret = infoType.getDefaultValue();
      if (ret != null) {
        return ret;
      }

      Map<String, String> sessionConf = startSession();
      SessionHandle sessionHandle = cliService.openSession("", "", sessionConf);
      try {
        // Convert to GetInfoType
        GetInfoType hiveInfoType = null;
        for (GetInfoType t : GetInfoType.values()) {
          if (t.name().equals("CLI_" + infoType.name())) {
            hiveInfoType = t;
            break;
          }
        }
        if (hiveInfoType == null) {
          // Should not come here, unless there is a mismatch between Explore and Hive info types.
          LOG.warn("Could not find Hive info type %s", infoType);
          return null;
        }
        GetInfoValue val = cliService.getInfo(sessionHandle, hiveInfoType);
        LOG.trace("Retrieving info: {}, got value {}", infoType, val);
        return new MetaDataInfo(val.getStringValue(), val.getShortValue(), val.getIntValue(), val.getLongValue());
      } finally {
        closeSession(sessionHandle);
      }
    } catch (HiveSQLException e) {
      throw getSqlException(e);
View Full Code Here

Examples of co.cask.cdap.explore.service.MetaDataInfo

      @Override
      public Void execute(HttpRequest request, HttpResponder responder)
        throws IllegalArgumentException, SQLException, ExploreException, IOException {
        LOG.trace("Received get info for {}", type);
        MetaDataInfo.InfoType infoType = MetaDataInfo.InfoType.fromString(type);
        MetaDataInfo metadataInfo = exploreService.getInfo(infoType);
        responder.sendJson(HttpResponseStatus.OK, metadataInfo);
        return null;
      }
    });
  }
View Full Code Here

Examples of com.puppetlabs.geppetto.validation.runner.MetadataInfo

          }
        }
        else {
          // pick (one of) the existing versions (it is actually illegal to have more
          // than one, so just pick the first one).
          MetadataInfo first = Iterables.get(existingVersions, 0);
          b = moduleNodeData.get(first);
        }
        createUnresolvedEdge(a, b, d);
      }
      // Add edges for all resolved dependencies
      for(MetadataInfo.Resolution r : mi.getResolvedDependencies()) {
        createResolvedEdge(a, moduleNodeData.get(r.metadata), r.dependency);
      }
    }
    Map<File, ModuleNodeData> fileIndex = Maps.newHashMap();
    for(Map.Entry<Object, ModuleNodeData> m : moduleNodeData.entrySet()) {
      if(!(m.getKey() instanceof ModuleName)) {
        MetadataInfo mi = (MetadataInfo) m.getKey();
        fileIndex.put(mi.getFile(), m.getValue());
      }
    }
    Map<File, Multimap<File, Export>> ambiguities = exportData.getAmbiguityMap();
    for(Map.Entry<File, Multimap<File, AllModuleReferences.Export>> x : exportData.getImportMap().entrySet()) {
      // get the imported
View Full Code Here

Examples of com.puppetlabs.geppetto.validation.runner.MetadataInfo

        ModuleName moduleName = m.getName();
        if(options.isCheckModuleSemantics() && isOnPath(pathToFile(f.getAbsolutePath(), root), searchPath)) {
          // remember the metadata and where it came from
          // and if it represents a NODE as opposed to a regular MODULE
          moduleData.put(
            moduleName, new MetadataInfo(m, f, nodeRootPath.isPrefixOf(new Path(f.getAbsolutePath()))));
        }
        if(isValidationWanted(examinedFiles, f)) {
          validateModuleMetadata(m, diagnostics, f, root, options, ticker.newChild(1));
        }
        else
View Full Code Here

Examples of com.torrent4j.model.metadata.MetadataInfo

    this.strategy = strategy;
    this.metadata = metadata;
    this.hash = new TorrentHash(this, metadata.getInfoHash());

    // parse file list
    final MetadataInfo info = metadata.getInfo();
    final byte[] pieceHashes = info.getPieceHashes();
    final int pieces = pieceHashes.length / 20;
    long piecesLength = 0;
    for (int i = 0; i < pieces; i++) {
      final byte[] hash = Arrays.copyOfRange(pieceHashes, i * 20,
          (i + 1) * 20);
      final int length = (int) (i + 1 == pieces ? (info.getLength() - piecesLength)
          : info.getPieceLength());

      this.pieces.add(new TorrentPiece(this, hash, i, info
          .getPieceLength() * i, length));
      piecesLength += length;
    }

    final Path torrentPath = Paths.get(info.getName());
    long offset = 0;
    for (final MetadataFile metaFile : info.getFiles()) {
      byte[] hash = null;
      if (metaFile.getHash() != null)
        hash = MD5.fromString(metaFile.getHash());
      final List<TorrentPiece> filePieces = getPieces(Range
          .getRangeByLength(offset, metaFile.getLength()));
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.MetadataInfo

    if (path.segmentCount() < 2) {
      handleNotFound(req, resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      return;
    }

    MetadataInfo node = getNode(path, req, resp);
    if (node == null) {
      handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    String key = req.getParameter("key"); //$NON-NLS-1$
    try {
      String prefix = getPrefix(path);

      //if a key is specified get that single value, otherwise get the entire node
      JSONObject result = null;
      if (key != null) {
        prefix = prefix + '/' + key;
        String value = node.getProperty(prefix.toString());
        if (value == null) {
          handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
          return;
        }
        result = new JSONObject().put(key, value);
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.MetadataInfo

    if (path.segmentCount() < 2) {
      handleNotFound(req, resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      return;
    }

    MetadataInfo info = getNode(path, req, resp);
    if (info == null) {
      //should not fail on delete when resource doesn't exist
      resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
      return;

    }
    String key = req.getParameter("key");
    try {
      String prefix = getPrefix(path);
      //if a key is specified write that single value, otherwise write the entire node
      boolean changed = false;
      if (key != null) {
        prefix = prefix + '/' + key;
        changed = info.setProperty(prefix.toString(), null) != null;
      } else {
        //can't overwrite base user settings via preference servlet
        if (prefix.startsWith("User")) {
          resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
          return;
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.MetadataInfo

    IPath path = getPath(req);
    if (path.segmentCount() < 2) {
      handleNotFound(req, resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      return;
    }
    MetadataInfo info = getNode(path, req, resp);
    if (info == null) {
      handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    String key = req.getParameter("key"); //$NON-NLS-1$
    String prefix = getPrefix(path);
    try {
      boolean changed = false;
      if (key != null) {
        prefix = prefix + '/' + key;
        String newValue = req.getParameter("value"); //$NON-NLS-1$
        String oldValue = info.setProperty(prefix.toString(), newValue);
        changed = !newValue.equals(oldValue);
      } else {
        JSONObject newNode = new JSONObject(new JSONTokener(req.getReader()));
        //can't overwrite base user settings via preference servlet
        if (prefix.startsWith("User")) {
          resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
          return;
        }
        //operations should not be removed by PUT
        if (!prefix.equals("operations")) {

          //clear existing values matching prefix
          changed |= removeMatchingProperties(info, prefix.toString());
        }
        for (Iterator<String> it = newNode.keys(); it.hasNext();) {
          key = it.next();
          String newValue = newNode.getString(key);
          String qualifiedKey = prefix + '/' + key;
          String oldValue = info.setProperty(qualifiedKey, newValue);
          changed |= !newValue.equals(oldValue);
        }
      }
      if (changed)
        save(info);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.