in src/main/java/org/apache/sling/distribution/packaging/impl/SimpleDistributionPackage.java [83:122]
public static SimpleDistributionPackage fromIdString(String packageId, String type) {
String id = null;
if (packageId.startsWith(PACKAGE_START)) {
id = packageId.substring(PACKAGE_START.length());
} else if (packageId.startsWith(PACKAGE_START_OLD)) { //For back compatibility with old path delimiter.
id = packageId.substring(PACKAGE_START_OLD.length());
} else {
return null;
}
String[] parts = id.split(Pattern.quote(DELIM));
if (parts.length < 1 || parts.length > 2) {
return null;
}
String actionString = parts[0];
String pathsString = parts.length < 2 ? null : parts[1];
DistributionRequestType distributionRequestType = DistributionRequestType.fromName(actionString);
SimpleDistributionPackage distributionPackage = null;
if (distributionRequestType != null) {
String[] paths = null;
if (pathsString != null) {
if (packageId.startsWith(PACKAGE_START)) {
paths = pathsString.split(PATH_DELIM);
} else {
paths = pathsString.split(PATH_DELIM_OLD); //For back compatibility with old path delimiter
}
} else {
paths = new String[0];
}
DistributionRequest request = new SimpleDistributionRequest(distributionRequestType, paths);
distributionPackage = new SimpleDistributionPackage(request, type);
}
return distributionPackage;
}