/** * 创建表资源 * * @param r * {@link TableResource}类型对象 * @throws OdpsException */ public void create(TableResource r) throws OdpsException { create(getDefaultProjectName(), r); }
/** * 创建文件资源 * * @param r * {@link FileResource}类型对象 * @param in * 上传资源的输入流 * @throws OdpsException */ public void create(FileResource r, InputStream in) throws OdpsException { create(getDefaultProjectName(), r, in); }
/** * 创建 Volume 资源 * * @param r * {@link VolumeResource}类型对象 * @throws OdpsException */ public void create(VolumeResource r) throws OdpsException { create(getDefaultProjectName(), r); }
create(projectName, resource, input); return (FileResource) get(projectName, resourceName);
try { inputStream = new FileInputStream(resFile); odps.resources().create(resource, inputStream); } catch (IOException ex) { throw new ODPSConsoleException(ODPSConsoleConstants.FILE_UPLOAD_FAIL, ex);
private void addTable(Odps odps) throws OdpsException, ODPSConsoleException { String tablePartition = refName; PartitionSpec spec = null; if (partitionSpec == null || partitionSpec.length() == 0) { partitionSpec = null; } else { spec = new PartitionSpec(partitionSpec); } TableResource resource = new TableResource(refName, null, spec); resource.setComment(comment); resource.setName(alias); if (!isUpdate) { odps.resources().create(projectName, resource); } else { try { odps.resources().update(projectName, resource); } catch (NoSuchObjectException e) { // 如果不存在,则直接添加 odps.resources().create(projectName, resource); } } }
public Instance run() throws OdpsException { String tmpRes = "lot-" + UUID.randomUUID().toString(); FileResource res = new FileResource(); res.setName(tmpRes); res.setIsTempResource(true); ByteArrayInputStream stream = getTaskInputStream(); odps.resources().create(odps.getDefaultProject(), res, stream); return LOTTask.run(odps, getCurrentProject(), tmpRes, false, getHints(), getResourceAliasesForCurrentProject()); }
odps.resources().create(res, in); return resourceName; } catch (OdpsException e) {
odps.resources().create(res, in); return rname; } catch (OdpsException e) {
odps.resources().create(res, in); return rname; } catch (OdpsException e) {
odps.resources().create(res, in); return resourceName; } catch (OdpsException e) {
private void addVolume(Odps odps) throws OdpsException, ODPSConsoleException { if ("".equals(alias)) { throwUsageError(System.err, "pls set alias for volume file."); } String refPath = projectName + "/volumes" + (refName.startsWith("/") ? "" : "/") + refName; Type resType = Type.valueOf(type.toUpperCase()); VolumeResource resource = null; if (resType == Type.VOLUMEFILE) { resource = new VolumeFileResource(); } else if (resType == Type.VOLUMEARCHIVE){ resource = new VolumeArchiveResource(); } else { throw new ODPSConsoleException("unsupported volume resource type: " + resType); } resource.setComment(comment); resource.setName(alias); resource.setVolumePath(refPath); if (isUpdate) { try { odps.resources().update(resource); return; } catch (NoSuchObjectException e) { } } odps.resources().create(resource); }