/** * Validates jar and its functions against remote jars. * First checks if there is no duplicate by jar name and then looks for duplicates among functions. * * @param remoteJars list of remote jars to validate against * @param jarName jar name to be validated * @param functions list of functions present in jar to be validated * @throws JarValidationException in case of jar with the same name was found * @throws FunctionValidationException in case duplicated function was found */ private void validateAgainstRemoteRegistry(List<Jar> remoteJars, String jarName, List<String> functions) { for (Jar remoteJar : remoteJars) { if (remoteJar.getName().equals(jarName)) { throw new JarValidationException(String.format("Jar with %s name has been already registered", jarName)); } for (String remoteFunction : remoteJar.getFunctionSignatureList()) { for (String func : functions) { if (remoteFunction.equals(func)) { throw new FunctionValidationException( String.format("Found duplicated function in %s: %s", remoteJar.getName(), remoteFunction)); } } } } }
/** * Return list of jars that are missing in local function registry * but present in remote function registry. * Also updates version holder with remote function registry version. * * @param remoteFunctionRegistry remote function registry * @param localFunctionRegistry local function registry * @param version holder for remote function registry version * @return list of missing jars */ private List<String> getMissingJars(RemoteFunctionRegistry remoteFunctionRegistry, LocalFunctionRegistry localFunctionRegistry, DataChangeVersion version) { List<Jar> remoteJars = remoteFunctionRegistry.getRegistry(version).getJarList(); List<String> localJars = localFunctionRegistry.getAllJarNames(); List<String> missingJars = new ArrayList<>(); for (Jar jar : remoteJars) { if (!localJars.contains(jar.getName())) { missingJars.add(jar.getName()); } } return missingJars; }
List<Jar> jars = Lists.newArrayList(); for (Jar j : registry.getJarList()) { if (j.getName().equals(jarName)) { jarToBeDeleted = j; } else {
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserBitShared.Jar message) throws java.io.IOException { if(message.hasName()) output.writeString(1, message.getName(), false); for(String functionSignature : message.getFunctionSignatureList()) output.writeString(2, functionSignature, true); } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.Jar message)
/** * <code>optional string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserBitShared.Jar message) throws java.io.IOException { if(message.hasName()) output.writeString(1, message.getName(), false); for(String functionSignature : message.getFunctionSignatureList()) output.writeString(2, functionSignature, true); } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.Jar message)
/** * <code>optional string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /**