2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.configuration;
11 import java.io.Serializable;
13 public abstract class ConfigurationObject implements Serializable {
14 private static final long serialVersionUID = 1L;
15 private static final String DEFAULT_REGEX = "^[\\w-=\\+\\*\\.\\(\\)\\[\\]\\@\\|\\:]{1,256}$";
16 private static final String REGEX_PROP_NAME = "resourceNameRegularExpression";
17 private static String regex;
20 String customRegex = System.getProperty(REGEX_PROP_NAME);
21 regex = (customRegex != null) ? customRegex : DEFAULT_REGEX;
25 * Checks if the provided resource name matches the controller resource name
29 * The resource name to test
30 * @return true if the resource name is not null and matches the controller
31 * resource name regular expression, false otherwise
33 protected boolean isValidResourceName(String name) {
34 return name != null && name.matches(regex);
38 * Return the regular expression currently in use for testing the controller
41 * @return The regular expression
43 public static String getRegularExpression() {