use of com.aliyun.oss.model.CannedUdfAcl in project aliyun-oss-java-sdk by aliyun.
the class ResponseParsers method parseGetUdfInfo.
/**
* Unmarshall get udf info response body to udf info.
*/
public static UdfInfo parseGetUdfInfo(InputStream responseBody) throws ResponseParseException {
try {
Element root = getXmlRootElement(responseBody);
String name = root.getChildText("Name");
String id = root.getChildText("ID");
String owner = root.getChildText("Owner");
String desc = root.getChildText("Description");
Date date = DateUtil.parseIso8601Date(root.getChildText("CreationDate"));
CannedUdfAcl acl = CannedUdfAcl.parse(root.getChildText("ACL"));
return new UdfInfo(name, owner, id, desc, acl, date);
} catch (JDOMParseException e) {
throw new ResponseParseException(e.getPartialDocument() + ": " + e.getMessage(), e);
} catch (Exception e) {
throw new ResponseParseException(e.getMessage(), e);
}
}
use of com.aliyun.oss.model.CannedUdfAcl in project aliyun-oss-java-sdk by aliyun.
the class ResponseParsers method parseListUdf.
/**
* Unmarshall list udf response body to udf info list.
*/
@SuppressWarnings("unchecked")
public static List<UdfInfo> parseListUdf(InputStream responseBody) throws ResponseParseException {
try {
Element root = getXmlRootElement(responseBody);
List<UdfInfo> udfs = new ArrayList<UdfInfo>();
if (root.getChild("UDFInfo") != null) {
List<Element> udfElems = root.getChildren("UDFInfo");
for (Element elem : udfElems) {
String name = elem.getChildText("Name");
String id = elem.getChildText("ID");
String owner = elem.getChildText("Owner");
String desc = elem.getChildText("Description");
Date date = DateUtil.parseIso8601Date(elem.getChildText("CreationDate"));
CannedUdfAcl acl = CannedUdfAcl.parse(elem.getChildText("ACL"));
udfs.add(new UdfInfo(name, owner, id, desc, acl, date));
}
}
return udfs;
} catch (JDOMParseException e) {
throw new ResponseParseException(e.getPartialDocument() + ": " + e.getMessage(), e);
} catch (Exception e) {
throw new ResponseParseException(e.getMessage(), e);
}
}
Aggregations