(String name)
| 277 | // TODO: What's current namespace? Should we allow same name among |
| 278 | // different engines? |
| 279 | private void validateName(String name) throws DDFException { |
| 280 | Boolean isNameExisted; |
| 281 | try { |
| 282 | this.getManager().getDDFByName(name); |
| 283 | isNameExisted = true; |
| 284 | } catch (DDFException e) { |
| 285 | isNameExisted = false; |
| 286 | } |
| 287 | if(isNameExisted) { |
| 288 | throw new DDFException(String.format("DDF with name %s already exists", name)); |
| 289 | } |
| 290 | |
| 291 | Pattern p = Pattern.compile("^[a-zA-Z0-9_-]*$"); |
| 292 | Matcher m = p.matcher(name); |
| 293 | if(!m.find()) { |
| 294 | throw new DDFException(String.format("Invalid name %s, only allow alphanumeric (uppercase and lowercase a-z, numbers 0-9) " + |
| 295 | "and dash (\"-\") and underscore (\"_\")", name)); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | @Override |
| 300 | public String getGlobalObjectType() { |
no test coverage detected