return null;
}
for (String cacheName : manager.getCacheNames()) {
- if (!manager.isRunning(cacheName)) continue;
+ if (!manager.isRunning(cacheName)) {
+ continue;
+ }
if (cacheName.startsWith("{" + containerName + "}_")) {
String[] res = cacheName.split("[{}]");
if (res.length >= 4 && res[1].equals(containerName)
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
IPHostId other = (IPHostId) obj;
if (ipAddress == null) {
- if (other.ipAddress != null)
+ if (other.ipAddress != null) {
return false;
- } else if (!ipAddress.equals(other.ipAddress))
+ }
+ } else if (!ipAddress.equals(other.ipAddress)) {
return false;
+ }
return true;
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
IPMacHostId other = (IPMacHostId) obj;
if (ipAddress == null) {
- if (other.ipAddress != null)
+ if (other.ipAddress != null) {
return false;
- } else if (!ipAddress.equals(other.ipAddress))
+ }
+ } else if (!ipAddress.equals(other.ipAddress)) {
return false;
+ }
if (macAddr == null) {
- if (other.macAddr != null)
+ if (other.macAddr != null) {
return false;
- } else if (!macAddr.equals(other.macAddr))
+ }
+ } else if (!macAddr.equals(other.macAddr)) {
return false;
+ }
return true;
}
@Override
public HostNodeConnector call() throws Exception {
HostNodeConnector h = hostTracker.hostFind(trackedHost);
- if (h != null)
+ if (h != null) {
return h;
+ }
hostTracker.setCallableOnPendingARP(trackedHost, this);
Thread.sleep(2000); // wait 2sec to see if the host responds
return hostTracker.hostQuery(trackedHost);
@Override
protected void configureGlobalInstance(Component c, Object imp) {
- if (!imp.equals(BundleScanServiceImpl.class)) return;
+ if (!imp.equals(BundleScanServiceImpl.class)) {
+ return;
+ }
// export service
c.setInterface(
new String[] { IBundleScanService.class.getName() },
}
private boolean matches(Pattern pattern, Set<String> values) {
- if (pattern == null) return true;
+ if (pattern == null) {
+ return true;
+ }
//LOGGER.debug("Matching: {} {}", pattern.toString(), values);
for (String s : values) {
- if (pattern.matcher(s).find()) return true;
+ if (pattern.matcher(s).find()) {
+ return true;
+ }
}
return false;
}
Bundle initBundle, Set<String> excludes)
{
for (BundleInfo other : bundlesToScan) {
- if (other.getId() == target.getId()) continue;
+ if (other.getId() == target.getId()) {
+ continue;
+ }
if (target.isDependantOn(other)) {
if (!visited.contains(other)) {
classes.addAll(BundleScanner.loadClasses(
private boolean isDependantOn(BundleInfo other) {
for (String pkg : importPkgs) {
- if (other.exportPkgs.contains(pkg)) return true;
+ if (other.exportPkgs.contains(pkg)) {
+ return true;
+ }
}
return false;
}
public List<BundleInfo> getDependencies(Collection<BundleInfo> bundles) {
List<BundleInfo> result = new ArrayList<BundleInfo>();
for(BundleInfo bundle : bundles) {
- if (isDependantOn(bundle)) result.add(bundle);
+ if (isDependantOn(bundle)) {
+ result.add(bundle);
+ }
}
return result;
}
private static Set<String> parsePackages(String packageString) {
- if (packageString == null) return Collections.emptySet();
+ if (packageString == null) {
+ return Collections.emptySet();
+ }
String[] packages = packageString.split(",");
Set<String> result = new HashSet<String>();
for (int i=0; i<packages.length; i++) {
boolean includeDependentBundleClasses)
{
BundleInfo info = bundleAnnotations.get(context.getBundle().getBundleId());
- if (info == null) return Collections.emptyList();
+ if (info == null) {
+ return Collections.emptyList();
+ }
Pattern pattern = mergePatterns(annotations, false);
List<Class<?>> result = null;
if (includeDependentBundleClasses) {
StringBuilder errors = new StringBuilder();
for (String name : annotatedClasses) {
try {
- if (excludes != null && excludes.contains(name)) continue;
+ if (excludes != null && excludes.contains(name)) {
+ continue;
+ }
result.add(initBundle.loadClass(name));
} catch (ClassNotFoundException e) {
errors.append(name).append(", ");
if (c.endsWith("*")) {
c = c.substring(0, c.length() - 1);
}
- if (regex.length() > 0) regex.append("|");
+ if (regex.length() > 0) {
+ regex.append("|");
+ }
regex.append("^");
if (convert2signature) {
regex.append("L").append(c.replaceAll("\\.", "/"));
}
private void validate(List<Class<?>> classes) {
- if (classes == null || classes.size() == 0) return;
+ if (classes == null || classes.size() == 0) {
+ return;
+ }
Map<String,String> names = new HashMap<String,String>();
StringBuilder conflictsMsg = new StringBuilder();
for (Class<?> c : classes) {
XmlRootElement root = c.getAnnotation(XmlRootElement.class);
- if (root == null) continue;
+ if (root == null) {
+ continue;
+ }
String rootName = root.name();
if ("##default".equals(rootName)) {
String clsName = c.getSimpleName();
}
@Context
public void setSecurityContext(SecurityContext context) {
- if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName();
+ if (context != null && context.getUserPrincipal() != null) {
+ username = context.getUserPrincipal().getName();
+ }
}
protected String getUserName() {
return username;
@Context
public void setSecurityContext(SecurityContext context) {
- if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName();
+ if (context != null && context.getUserPrincipal() != null) {
+ username = context.getUserPrincipal().getName();
+ }
}
protected String getUserName() {
@Context
public void setSecurityContext(SecurityContext context) {
- if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName();
+ if (context != null && context.getUserPrincipal() != null) {
+ username = context.getUserPrincipal().getName();
+ }
}
protected String getUserName() {
return username;
@Context
public void setSecurityContext(SecurityContext context) {
- if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName();
+ if (context != null && context.getUserPrincipal() != null) {
+ username = context.getUserPrincipal().getName();
+ }
}
protected String getUserName() {
return username;
}
@Context
public void setSecurityContext(SecurityContext context) {
- if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName();
+ if (context != null && context.getUserPrincipal() != null) {
+ username = context.getUserPrincipal().getName();
+ }
}
protected String getUserName() {
import org.opendaylight.controller.sal.utils.INodeFactory;
import org.opendaylight.controller.sal.core.Node;
-public class StubNodeFactory implements INodeFactory
- {
- void init() {
- }
+public class StubNodeFactory implements INodeFactory {
+ void init() {
+ }
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- }
+ /**
+ * Function called by the dependency manager when at least one dependency
+ * become unsatisfied or when the component is shutting down because for
+ * example bundle is being stopped.
+ *
+ */
+ void destroy() {
+ }
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
+ /**
+ * Function called by dependency manager after "init ()" is called and after
+ * the services provided by the class are registered in the service registry
+ *
+ */
+ void start() {
+ }
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
+ /**
+ * Function called by the dependency manager before the services exported by
+ * the component are unregistered, this will be followed by a "destroy ()"
+ * calls
+ *
+ */
+ void stop() {
+ }
- public Node fromString(String nodeType, String nodeId){
- if(nodeType.equals("STUB"))
- try{
- return new Node("STUB", Integer.parseInt(nodeId));
- } catch(ConstructionException e)
- {
- return null;
- }
- return null;
- }
+ public Node fromString(String nodeType, String nodeId){
+ if(nodeType.equals("STUB")) {
+ try {
+ return new Node("STUB", Integer.parseInt(nodeId));
+ } catch(ConstructionException e) {
+ return null;
+ }
+ }
+ return null;
+ }
}
@Override
public ConnectionLocality getLocalityStatus(Node node) {
- if (this.connectionListener == null) return ConnectionLocality.NOT_CONNECTED;
+ if (this.connectionListener == null) {
+ return ConnectionLocality.NOT_CONNECTED;
+ }
return connectionListener.getLocalityStatus(node);
}
@Override
public Status disconnect(Node node) {
IPluginInConnectionService s = pluginService.get(node.getType());
- if (s != null) return s.disconnect(node);
+ if (s != null) {
+ return s.disconnect(node);
+ }
return new Status(StatusCode.NOTFOUND);
}
@Override
public boolean memberExists(String name, String poolName) {
- if(this.pools.containsKey(poolName)){
- if(this.pools.get(poolName).getMember(name) != null )
+ if (this.pools.containsKey(poolName)) {
+ if (this.pools.get(poolName).getMember(name) != null) {
return true;
+ }
}
return false;
}
@Override
- public boolean memberExists(String name, String memberIP,String poolName){
- if(!this.pools.containsKey(poolName))
+ public boolean memberExists(String name, String memberIP,String poolName) {
+ if (!this.pools.containsKey(poolName)) {
return false;
+ }
return this.pools.get(poolName).poolMemberExists(new PoolMember(name, memberIP, poolName));
}
* requires
*/
public String getContainerName() {
- if (containerName == null)
+ if (containerName == null) {
return GlobalConstants.DEFAULT.toString();
+ }
return containerName;
}
private String checkPasswordRecovery() {
final String fileDescription = "Default Network Administrator password recovery file";
File recoveryFile = new File(UserManager.RECOVERY_FILE);
- if (!recoveryFile.exists()) return null;
+ if (!recoveryFile.exists()) {
+ return null;
+ }
// read the recovery file
String pwd = null;
try {
int value = 0;
for (int i = 0; i < length; i++) {
value = array[i];
- if (value < 0)
+ if (value < 0) {
value += 256;
+ }
ret = ret
| (long) ((long) value << ((length - i - 1) * NetUtils.NumBitsInAByte));
}
for (int i = startOffset; i < array.length; i++) {
value = array[i];
- if (value < 0)
+ if (value < 0) {
value += 256;
+ }
ret = ret
| (long) ((long) value << ((array.length - i - 1) * NetUtils.NumBitsInAByte));
}
}
} else {
for (i = 0; i < numBytes; i++) {
- if (i != 0)
+ if (i != 0) {
InputLSBbits = (inputdata[i - 1] & getLSBMask(extraOffsetBits));
+ }
InputMSBbits = (byte) (inputdata[i] & (getMSBMask(NetUtils.NumBitsInAByte
- extraOffsetBits)));
InputMSBbits = (InputMSBbits >= 0) ? InputMSBbits
InputMSBbits = InputLSBbits = 0;
}
if (RestBits < (NetUtils.NumBitsInAByte - extraOffsetBits)) {
- if (numBytes != 0)
+ if (numBytes != 0) {
InputLSBbits = (inputdata[i - 1] & getLSBMask(extraOffsetBits));
+ }
InputMSBbits = (byte) (inputdata[i] & (getMSBMask(RestBits)));
InputMSBbits = (InputMSBbits >= 0) ? InputMSBbits
: InputMSBbits + 256;
data[startByteOffset + i] = (byte) ((data[startByteOffset + i])
| (InputLSBbits << (NetUtils.NumBitsInAByte - extraOffsetBits)) | (InputMSBbits >> extraOffsetBits));
} else if (RestBits == (NetUtils.NumBitsInAByte - extraOffsetBits)) {
- if (numBytes != 0)
+ if (numBytes != 0) {
InputLSBbits = (inputdata[i - 1] & getLSBMask(extraOffsetBits));
+ }
InputMSBbits = (byte) (inputdata[i] & (getMSBMask(NetUtils.NumBitsInAByte
- extraOffsetBits)));
InputMSBbits = (InputMSBbits >= 0) ? InputMSBbits
data[startByteOffset + i] = (byte) (data[startByteOffset + i]
| (InputLSBbits << (NetUtils.NumBitsInAByte - extraOffsetBits)) | (InputMSBbits >> extraOffsetBits));
} else {
- if (numBytes != 0)
+ if (numBytes != 0) {
InputLSBbits = (inputdata[i - 1] & getLSBMask(extraOffsetBits));
+ }
InputMSBbits = (byte) (inputdata[i] & (getMSBMask(NetUtils.NumBitsInAByte
- extraOffsetBits)));
InputMSBbits = (InputMSBbits >= 0) ? InputMSBbits
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
DataLinkAddress other = (DataLinkAddress) obj;
if (name == null) {
- if (other.name != null)
+ if (other.name != null) {
return false;
- } else if (!name.equals(other.name))
+ }
+ } else if (!name.equals(other.name)) {
return false;
+ }
return true;
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (!super.equals(obj))
+ }
+ if (!super.equals(obj)) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
EthernetAddress other = (EthernetAddress) obj;
- if (!Arrays.equals(macAddress, other.macAddress))
+ if (!Arrays.equals(macAddress, other.macAddress)) {
return false;
+ }
return true;
}
LOG.debug("Storage file does not exist, creating empty file");
try {
boolean result = storage.createNewFile();
- if (result == false)
+ if (result == false) {
throw new RuntimeException("Unable to create storage file " + storage);
+ }
} catch (IOException e) {
throw new RuntimeException("Unable to create storage file " + storage, e);
}
}
public static Config fromXml(File from) {
- if(isEmpty(from))
+ if(isEmpty(from)) {
return new Config();
+ }
try {
JAXBContext jaxbContext = JAXBContext.newInstance(Config.class);
@Override
public void close() throws IOException {
- if (reg != null)
+ if (reg != null) {
reg.close();
+ }
unregisterFromLogback();
}
public void setMavenProject(MavenProject project) {
this.projectBaseDir = project.getBasedir();
- if (LOG != null)
+ if (LOG != null) {
LOG.debug(getClass().getCanonicalName(), " project base dir: ",
projectBaseDir);
+ }
}
@VisibleForTesting
}
static List<String> checkCardinality(List<String> extendedClass) {
- if (extendedClass.size() > 1)
+ if (extendedClass.size() > 1) {
throw new IllegalArgumentException(
"Class cannot have more than one super " + "class");
+ }
return extendedClass;
}
Lists.<MethodDeclaration> newArrayList());
sieTemplate.setJavadoc(sie.getNullableDescription());
- if (sie.getNullableDescription() != null)
+ if (sie.getNullableDescription() != null) {
sieTemplate.getAnnotations().add(
Annotation.createDescriptionAnnotation(sie
.getNullableDescription()));
+ }
sieTemplate.getAnnotations().addAll(Annotation.createSieAnnotations(sie));
return sieTemplate;
attrProcessor.getMethods(), generateRuntime,
registratorFullyQualifiedName);
- if (mbe.getNullableDescription() != null)
+ if (mbe.getNullableDescription() != null) {
abstractModuleTemplate.getAnnotations().add(
Annotation.createDescriptionAnnotation(mbe
.getNullableDescription()));
+ }
return abstractModuleTemplate;
}
private static boolean needsDepResolver(AttributeIfc value) {
- if(value instanceof TOAttribute)
+ if(value instanceof TOAttribute) {
return true;
+ }
if(value instanceof ListAttribute) {
AttributeIfc innerAttribute = ((ListAttribute) value).getInnerAttribute();
return needsDepResolver(innerAttribute);
@Override
public boolean equals(Object o) {
- if (this == o)
+ if (this == o) {
return true;
- if (o == null || getClass() != o.getClass())
+ }
+ if (o == null || getClass() != o.getClass()) {
return false;
+ }
Dependency that = (Dependency) o;
- if (mandatory != that.mandatory)
+ if (mandatory != that.mandatory) {
return false;
- if (!sie.equals(that.sie))
+ }
+ if (!sie.equals(that.sie)) {
return false;
+ }
return true;
}
// TODO verify
private boolean isPrimitive(String innerTypeFullyQName) {
- if (innerTypeFullyQName.contains("."))
+ if (innerTypeFullyQName.contains(".")) {
return false;
+ }
return true;
}
public static String getFullyQualifiedName(String packageName,
String className) {
- if (packageName.isEmpty())
+ if (packageName.isEmpty()) {
return className;
+ }
return packageName + "." + className;
}
}
}
private final void checkMutable() {
- if (!NEW.equals(this.getStatus()))
+ if (!NEW.equals(this.getStatus())) {
throw new IllegalStateException("Transaction was already submitted");
+ }
}
@Override
}
RouteChangeImpl<?, ?> other = (RouteChangeImpl<?, ?>) obj;
if (announcement == null) {
- if (other.announcement != null)
+ if (other.announcement != null) {
return false;
- } else if (!announcement.equals(other.announcement))
+ }
+ } else if (!announcement.equals(other.announcement)) {
return false;
+ }
if (removal == null) {
if (other.removal != null) {
return false;
}
- } else if (!removal.equals(other.removal))
+ } else if (!removal.equals(other.removal)) {
return false;
+ }
return true;
}
}
*/
@SuppressWarnings("unchecked")
public static <T> T checkInstanceOf(Object value, Class<T> type) {
- if(!type.isInstance(value))
+ if(!type.isInstance(value)) {
throw new IllegalArgumentException(String.format("Value %s is not of type %s", value, type));
+ }
return (T) value;
}
}
String odlTableName) {
Map<String, XSQLBluePrintNode> map = this.odlNameToBluePrint
.get(odlTableName);
- if (map == null)
+ if (map == null) {
return null;
+ }
return map.values().toArray(new XSQLBluePrintNode[map.size()]);
}
XSQLBluePrintNode other = (XSQLBluePrintNode) obj;
if (odlNode != null) {
return getBluePrintNodeName().equals(other.getBluePrintNodeName());
- } else if (this.odlTableName == null && other.odlTableName != null)
+ } else if (this.odlTableName == null && other.odlTableName != null) {
return false;
- if (this.odlTableName != null && other.odlTableName == null)
+ }
+ if (this.odlTableName != null && other.odlTableName == null) {
return false;
- else
+ }
+ else {
return this.odlTableName.equals(other.odlTableName);
+ }
}
@Override
}
private void init() throws Exception {
- if (addr.startsWith("http://"))
+ if (addr.startsWith("http://")) {
addr = addr.substring(7);
+ }
System.err.print("Address is:" + addr);
socket = new Socket(addr, 40004);
try {
}
public JDBCResultSet addSubQuery(String _sql,String logicalName) {
- if(subQueries == null)
+ if (subQueries == null) {
subQueries = new HashMap<String,JDBCResultSet>();
+ }
JDBCResultSet rs = new JDBCResultSet(_sql);
this.subQueries.put(logicalName,rs);
return rs;
}
public Map<String,JDBCResultSet> getSubQueries() {
- if(this.subQueries==null)
+ if (this.subQueries==null) {
this.subQueries = new HashMap<>();
+ }
return this.subQueries;
}
for (Object child : children) {
String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
- if (odlNodeName == null)
+ if (odlNodeName == null) {
continue;
+ }
XSQLBluePrintNode eNodes[] = bluePrint
.getBluePrintNodeByODLTableName(odlNodeName);
- if (eNodes == null)
+ if (eNodes == null) {
continue;
+ }
boolean match = false;
for (XSQLBluePrintNode enode : eNodes) {
}
}
- if (!match)
+ if (!match) {
continue;
+ }
if (child.getClass().getName().endsWith("ImmutableContainerNode")) {
result.add(child);
for (XSQLBluePrintNode eNode : eNodes) {
bpn = this.tablesInQueryMap.get(eNode
.getBluePrintNodeName());
- if (bpn != null)
+ if (bpn != null) {
break;
+ }
}
boolean isObjectInCriteria = true;
if (bpn != null) {
if (isObjectInCriteria) {
if (root) {
- if (!rec.data.isEmpty())
+ if (!rec.data.isEmpty()) {
addRecord(rec.data);
+ }
} else {
result.add(rec);
}
int braketCount = 0;
int endSubQuery = startSubQuery;
do {
- if (sql.charAt(endSubQuery) == '(')
+ if (sql.charAt(endSubQuery) == '(') {
braketCount++;
- else if (sql.charAt(endSubQuery) == ')')
+ }
+ else if (sql.charAt(endSubQuery) == ')') {
braketCount--;
+ }
endSubQuery++;
} while (braketCount > 0 || endSubQuery == sql.length());
String subQuerySQL = sql.substring(startSubQuery + 1,endSubQuery - 1);
whereTo = order;
}
- if(whereTo==-1)
+ if(whereTo==-1) {
whereTo=lowSQL.length();
+ }
String whereStatement = rs.getSQL().substring(where + 5, whereTo)
.trim();
@Override
public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
final RemoteYangSchema that = (RemoteYangSchema) o;
- if (!qname.equals(that.qname)) return false;
+ if (!qname.equals(that.qname)) {
+ return false;
+ }
return true;
}
@Override
public boolean equals(final Object o) {
- if (this == o) return true;
- if (!(o instanceof RemoteDeviceId)) return false;
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof RemoteDeviceId)) {
+ return false;
+ }
final RemoteDeviceId that = (RemoteDeviceId) o;
- if (!name.equals(that.name)) return false;
- if (!bindingPath.equals(that.bindingPath)) return false;
+ if (!name.equals(that.name)) {
+ return false;
+ }
+ if (!bindingPath.equals(that.bindingPath)) {
+ return false;
+ }
return true;
}
@Override
public void stop(BundleContext context) throws Exception {
- if (brokerServiceTracker != null)
+ if (brokerServiceTracker != null) {
brokerServiceTracker.close();
+ }
- if (session != null)
+ if (session != null) {
session.close();
+ }
synchronized (toClose) {
for (AutoCloseable close : toClose) {
@Override
public void modifiedService(ServiceReference<Broker> reference, Broker service) {
- if (session != null)
+ if (session != null) {
session.close();
+ }
Broker broker = bundleContext.getService(reference);
session = broker.registerProvider(this, bundleContext);
if (statsFlow == storedFlow) {
return true;
}
- if (storedFlow == null && statsFlow != null) return false;
- if (statsFlow == null && storedFlow != null) return false;
+ if (storedFlow == null && statsFlow != null) {
+ return false;
+ }
+ if (statsFlow == null && storedFlow != null) {
+ return false;
+ }
if (storedFlow.getEthernetMatch() == null) {
if (statsFlow.getEthernetMatch() != null) {
return false;
public synchronized ObjectName getOrCreateTransaction() {
Optional<ObjectName> ta = getTransaction();
- if (ta.isPresent())
+ if (ta.isPresent()) {
return ta.get();
+ }
transaction = configRegistryClient.beginConfig();
allOpenedTransactions.add(transaction);
return transaction;
@Override
public void handleNotification(final Notification notification, final Object handback) {
- if (!(notification instanceof NetconfJMXNotification))
+ if (!(notification instanceof NetconfJMXNotification)) {
return;
+ }
// Socket should not be closed at this point
// Activator unregisters this as JMX listener before close is called