-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
ModelControllerMBeanHelper.java
576 lines (505 loc) · 26.1 KB
/
ModelControllerMBeanHelper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.jmx.model;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ACCESS_MECHANISM;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ATTRIBUTES;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.FAILURE_DESCRIPTION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OPERATION_HEADERS;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REPLY_PROPERTIES;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.REQUEST_PROPERTIES;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.RESULT;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION;
import static org.jboss.as.jmx.JmxMessages.MESSAGES;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
import javax.management.InvalidAttributeValueException;
import javax.management.JMRuntimeException;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.QueryExp;
import javax.management.ReflectionException;
import org.jboss.as.controller.ExpressionResolver;
import org.jboss.as.controller.ModelController;
import org.jboss.as.controller.ModelController.OperationTransactionControl;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.descriptions.DescriptionProvider;
import org.jboss.as.controller.registry.ImmutableManagementResourceRegistration;
import org.jboss.as.controller.registry.OperationEntry;
import org.jboss.as.core.security.AccessMechanism;
import org.jboss.as.jmx.model.ChildAddOperationFinder.ChildAddOperationEntry;
import org.jboss.as.jmx.model.ResourceAccessControlUtil.ResourceAccessControl;
import org.jboss.as.jmx.model.RootResourceIterator.ResourceAction;
import org.jboss.as.server.operations.RootResourceHack;
import org.jboss.as.server.operations.RootResourceHack.ResourceAndRegistration;
import org.jboss.dmr.ModelNode;
/**
*
* @author <a href="kabir.khan@jboss.com">Kabir Khan</a>
*/
public class ModelControllerMBeanHelper {
static final String CLASS_NAME = ModelController.class.getName();
private static final String AUTHORIZED_ERROR = "JBAS013456";
private final boolean standalone;
private final ModelController controller;
private final ResourceAccessControlUtil accessControlUtil;
private final PathAddress CORE_SERVICE_PLATFORM_MBEAN = PathAddress.pathAddress(PathElement.pathElement("core-service", "platform-mbean"));
private final TypeConverters converters;
private final ConfiguredDomains configuredDomains;
private final String domain;
ModelControllerMBeanHelper(TypeConverters converters, ConfiguredDomains configuredDomains, String domain,
ModelController controller, boolean standalone) {
this.converters = converters;
this.configuredDomains = configuredDomains;
this.domain = domain;
this.controller = controller;
this.accessControlUtil = new ResourceAccessControlUtil(controller);
this.standalone = standalone;
}
int getMBeanCount() {
return new RootResourceIterator<Integer>(accessControlUtil, getRootResourceAndRegistration().getResource(), new ResourceAction<Integer>() {
int count;
@Override
public ObjectName onAddress(PathAddress address) {
return isExcludeAddress(address) ? null : ObjectNameAddressUtil.createObjectName(domain, address);
}
public boolean onResource(ObjectName address) {
count++;
return true;
}
public Integer getResult() {
return count;
}
}).iterate();
}
Set<ObjectInstance> queryMBeans(final ObjectName name, final QueryExp query) {
return new RootResourceIterator<Set<ObjectInstance>>(accessControlUtil, getRootResourceAndRegistration().getResource(),
new ObjectNameMatchResourceAction<Set<ObjectInstance>>(name) {
Set<ObjectInstance> set = new HashSet<ObjectInstance>();
@Override
public boolean onResource(ObjectName resourceName) {
if (name == null || name.apply(resourceName)) {
//TODO check query
set.add(new ObjectInstance(resourceName, CLASS_NAME));
}
return true;
}
@Override
public Set<ObjectInstance> getResult() {
if (set.size() == 1 && set.contains(ModelControllerMBeanHelper.createRootObjectName(domain))) {
return Collections.emptySet();
}
return set;
}
}).iterate();
}
Set<ObjectName> queryNames(final ObjectName name, final QueryExp query) {
return new RootResourceIterator<Set<ObjectName>>(accessControlUtil, getRootResourceAndRegistration().getResource(),
new ObjectNameMatchResourceAction<Set<ObjectName>>(name) {
Set<ObjectName> set = new HashSet<ObjectName>();
@Override
public boolean onResource(ObjectName resourceName) {
if (name == null || name.apply(resourceName)) {
//TODO check query
set.add(resourceName);
}
return true;
}
@Override
public Set<ObjectName> getResult() {
if (set.size() == 1 && set.contains(ModelControllerMBeanHelper.createRootObjectName(domain))) {
return Collections.emptySet();
}
return set;
}
}).iterate();
}
PathAddress resolvePathAddress(final ObjectName name) {
return ObjectNameAddressUtil.resolvePathAddress(domain, getRootResourceAndRegistration().getResource(), name);
}
PathAddress resolvePathAddress(final ObjectName name, ResourceAndRegistration reg) {
return ObjectNameAddressUtil.resolvePathAddress(domain, reg.getResource(), name);
}
MBeanInfo getMBeanInfo(final ObjectName name) throws InstanceNotFoundException {
final ResourceAndRegistration reg = getRootResourceAndRegistration();
final PathAddress address = resolvePathAddress(name, reg);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
final ResourceAccessControl accessControl = accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, true);
return MBeanInfoFactory.createMBeanInfo(name, converters, configuredDomains, standalone, address, getMBeanRegistration(address, reg));
}
Object getAttribute(final ObjectName name, final String attribute) throws AttributeNotFoundException, InstanceNotFoundException, ReflectionException {
final ResourceAndRegistration reg = getRootResourceAndRegistration();
final PathAddress address = resolvePathAddress(name, reg);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
final ResourceAccessControl accessControl = accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, false);
return getAttribute(reg, address, name, attribute, accessControl);
}
AttributeList getAttributes(ObjectName name, String[] attributes) throws InstanceNotFoundException, ReflectionException {
final ResourceAndRegistration reg = getRootResourceAndRegistration();
final PathAddress address = resolvePathAddress(name, reg);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
final ResourceAccessControl accessControl = accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, false);
AttributeList list = new AttributeList();
for (String attribute : attributes) {
try {
list.add(new Attribute(attribute, getAttribute(reg, address, name, attribute, accessControl)));
} catch (AttributeNotFoundException e) {
throw new ReflectionException(e);
}
}
return list;
}
private Object getAttribute(final ResourceAndRegistration reg, final PathAddress address, final ObjectName name, final String attribute, final ResourceAccessControl accessControl) throws ReflectionException, AttributeNotFoundException, InstanceNotFoundException {
final ImmutableManagementResourceRegistration registration = getMBeanRegistration(address, reg);
final DescriptionProvider provider = registration.getModelDescription(PathAddress.EMPTY_ADDRESS);
if (provider == null) {
throw MESSAGES.descriptionProviderNotFound(address);
}
final ModelNode description = provider.getModelDescription(null);
final String attributeName = findAttributeName(description.get(ATTRIBUTES), attribute);
if (!accessControl.isReadableAttribute(attributeName)) {
throw MESSAGES.notAuthorizedToReadAttribute(attributeName);
}
ModelNode op = new ModelNode();
op.get(OP).set(READ_ATTRIBUTE_OPERATION);
op.get(OP_ADDR).set(address.toModelNode());
op.get(NAME).set(attributeName);
ModelNode result = execute(op);
String error = getFailureDescription(result);
if (error != null) {
throw new AttributeNotFoundException(error);
}
return converters.fromModelNode(description.require(ATTRIBUTES).require(attributeName), result.get(RESULT));
}
void setAttribute(ObjectName name, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
final ResourceAndRegistration reg = getRootResourceAndRegistration();
final PathAddress address = resolvePathAddress(name, reg);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
final ResourceAccessControl accessControl = accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, false);
setAttribute(reg, address, name, attribute, accessControl);
}
AttributeList setAttributes(ObjectName name, AttributeList attributes) throws InstanceNotFoundException, ReflectionException {
final ResourceAndRegistration reg = getRootResourceAndRegistration();
final PathAddress address = resolvePathAddress(name, reg);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
final ResourceAccessControl accessControl = accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, false);
for (Attribute attribute : attributes.asList()) {
try {
setAttribute(reg, address, name, attribute, accessControl);
} catch (JMRuntimeException e) {
//Propagate the JMRuntimeException thrown from authorization
throw e;
} catch (Exception e) {
throw MESSAGES.cannotSetAttribute(e, attribute.getName());
}
}
return attributes;
}
private void setAttribute(final ResourceAndRegistration reg, final PathAddress address, final ObjectName name, final Attribute attribute, ResourceAccessControl accessControl) throws InvalidAttributeValueException, AttributeNotFoundException, InstanceNotFoundException {
final ImmutableManagementResourceRegistration registration = getMBeanRegistration(address, reg);
final DescriptionProvider provider = registration.getModelDescription(PathAddress.EMPTY_ADDRESS);
if (provider == null) {
throw MESSAGES.descriptionProviderNotFound(address);
}
final ModelNode description = provider.getModelDescription(null);
final String attributeName = findAttributeName(description.get(ATTRIBUTES), attribute.getName());
if (!standalone) {
throw MESSAGES.attributeNotWritable(attribute);
}
if (!accessControl.isWritableAttribute(attributeName)) {
throw MESSAGES.notAuthorizedToWriteAttribute(attributeName);
}
ModelNode op = new ModelNode();
op.get(OP).set(WRITE_ATTRIBUTE_OPERATION);
op.get(OP_ADDR).set(address.toModelNode());
op.get(NAME).set(attributeName);
try {
op.get(VALUE).set(converters.toModelNode(description.require(ATTRIBUTES).require(attributeName), attribute.getValue()));
} catch (ClassCastException e) {
throw MESSAGES.invalidAttributeType(e, attribute.getName());
}
ModelNode result = execute(op);
String error = getFailureDescription(result);
if (error != null) {
//Since read-resource-description does not know the parameters of the operation, i.e. if a vault expression is used or not,
//check the error code
//TODO add a separate authorize step where we check ourselves that the operation will pass authorization?
if (isVaultExpression(attribute.getValue()) && error.contains(AUTHORIZED_ERROR)) {
throw MESSAGES.notAuthorizedToWriteAttribute(attributeName);
}
throw new InvalidAttributeValueException(error);
}
}
ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException {
final PathAddress address = resolvePathAddress(name);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(name, address, false);
return new ObjectInstance(name, CLASS_NAME);
}
Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException {
if (operationName == null) {
throw MESSAGES.nullVar("operationName");
}
if (params == null) {
params = new Object[0];
}
if (signature == null) {
signature = new String[0];
}
if (params.length != signature.length) {
throw MESSAGES.differentLengths("params", "signature");
}
final ResourceAndRegistration reg = getRootResourceAndRegistration();
final PathAddress address = resolvePathAddress(name, reg);
if (address == null) {
throw MESSAGES.mbeanNotFound(name);
}
final ImmutableManagementResourceRegistration registration = getMBeanRegistration(address, reg);
String realOperationName = null;
OperationEntry opEntry = registration.getOperationEntry(PathAddress.EMPTY_ADDRESS, operationName);
if (opEntry != null) {
realOperationName = operationName;
} else {
String opName = NameConverter.convertFromCamelCase(operationName);
opEntry = registration.getOperationEntry(PathAddress.EMPTY_ADDRESS, opName);
if (opEntry != null) {
realOperationName = opName;
}
}
if (opEntry == null) {
//Brute force search in case the operation name is not standard format
Map<String, OperationEntry> ops = registration.getOperationDescriptions(PathAddress.EMPTY_ADDRESS, false);
for (Map.Entry<String, OperationEntry> entry : ops.entrySet()) {
if (operationName.equals(NameConverter.convertToCamelCase(entry.getKey()))) {
opEntry = entry.getValue();
realOperationName = entry.getKey();
break;
}
}
}
if (opEntry == null) {
ChildAddOperationEntry entry = ChildAddOperationFinder.findAddChildOperation(reg.getRegistration().getSubModel(address), operationName);
if (entry == null) {
throw MESSAGES.noOperationCalled(null, operationName, address);
}
PathElement element = entry.getElement();
if (element.isWildcard()) {
if (params.length == 0) {
throw MESSAGES.wildcardNameParameterRequired();
}
element = PathElement.pathElement(element.getKey(), (String)params[0]);
Object[] newParams = new Object[params.length - 1];
System.arraycopy(params, 1, newParams, 0, newParams.length);
params = newParams;
}
return invoke(entry.getOperationEntry(), ADD, address.append(element), params);
}
return invoke(opEntry, realOperationName, address, params);
}
private Object invoke(final OperationEntry entry, final String operationName, PathAddress address, Object[] params) throws InstanceNotFoundException, MBeanException, ReflectionException {
if (!standalone && !entry.getFlags().contains(OperationEntry.Flag.READ_ONLY)) {
throw MESSAGES.noOperationCalled(operationName);
}
ResourceAccessControl accessControl;
if (operationName.equals("add")) {
accessControl = accessControlUtil.getResourceAccess(address, true);
} else {
ObjectName objectName = ObjectNameAddressUtil.createObjectName(operationName, address);
accessControl = accessControlUtil.getResourceAccessWithInstanceNotFoundExceptionIfNotAccessible(
objectName, address, true);
}
if (!accessControl.isExecutableOperation(operationName)) {
throw MESSAGES.notAuthorizedToExecuteOperation(operationName);
}
final ModelNode description = entry.getDescriptionProvider().getModelDescription(null);
ModelNode op = new ModelNode();
op.get(OP).set(operationName);
op.get(OP_ADDR).set(address.toModelNode());
if (params.length > 0) {
ModelNode requestProperties = description.require(REQUEST_PROPERTIES);
Set<String> keys = requestProperties.keys();
if (keys.size() != params.length) {
throw MESSAGES.differentLengths("params", "description");
}
Iterator<String> it = requestProperties.keys().iterator();
for (int i = 0 ; i < params.length ; i++) {
String attributeName = it.next();
ModelNode paramDescription = requestProperties.get(attributeName);
op.get(attributeName).set(converters.toModelNode(paramDescription, params[i]));
}
}
ModelNode result = execute(op);
String error = getFailureDescription(result);
if (error != null) {
if (error.contains(AUTHORIZED_ERROR)) {
for (Object param : params) {
//Since read-resource-description does not know the parameters of the operation, i.e. if a vault expression is used or not,
//check the error code
//TODO add a separate authorize step where we check ourselves that the operation will pass authorization?
if (isVaultExpression(param)) {
throw MESSAGES.notAuthorizedToExecuteOperation(operationName);
}
}
}
throw new ReflectionException(null, error);
}
if (!description.hasDefined(REPLY_PROPERTIES)) {
return null;
}
//TODO we could have more than one reply property
return converters.fromModelNode(description.get(REPLY_PROPERTIES), result.get(RESULT));
}
private ResourceAndRegistration getRootResourceAndRegistration() {
return RootResourceHack.INSTANCE.getRootResource(controller);
}
private ModelNode execute(ModelNode op) {
op.get(OPERATION_HEADERS, ACCESS_MECHANISM).set(AccessMechanism.JMX.toString());
return controller.execute(op, null, OperationTransactionControl.COMMIT, null);
}
private ImmutableManagementResourceRegistration getMBeanRegistration(PathAddress address, ResourceAndRegistration reg) throws InstanceNotFoundException {
//TODO Populate MBeanInfo
ImmutableManagementResourceRegistration resourceRegistration = reg.getRegistration().getSubModel(address);
if (resourceRegistration == null) {
throw MESSAGES.registrationNotFound(address);
}
return resourceRegistration;
}
private String getFailureDescription(ModelNode result) {
if (result.hasDefined(FAILURE_DESCRIPTION)) {
return result.get(FAILURE_DESCRIPTION).toString();
}
return null;
}
private String findAttributeName(ModelNode attributes, String attributeName) throws AttributeNotFoundException{
if (attributes.hasDefined(attributeName)) {
return attributeName;
}
for (String key : attributes.keys()) {
if (NameConverter.convertToCamelCase(key).equals(attributeName)) {
return key;
}
}
throw MESSAGES.attributeNotFound(attributeName);
}
private boolean isExcludeAddress(PathAddress pathAddress) {
return pathAddress.equals(CORE_SERVICE_PLATFORM_MBEAN);
}
private boolean isVaultExpression(Object value) {
if (value != null && value.getClass() == String.class){
String valueString = (String)value;
if (ExpressionResolver.EXPRESSION_PATTERN.matcher(valueString).matches()) {
return TypeConverters.VAULT_PATTERN.matcher(valueString).matches();
}
}
return false;
}
public static ObjectName createRootObjectName(String domain) {
try {
return ObjectName.getInstance(domain, "management-root", "server");
} catch (MalformedObjectNameException e) {
throw new RuntimeException(e);
}
}
private abstract class ObjectNameMatchResourceAction<T> implements ResourceAction<T> {
private final ObjectName baseName;
private final Map<String, String> properties;
private final ObjectName domainOnlyName;
protected ObjectNameMatchResourceAction(ObjectName baseName) {
this.baseName = baseName;
this.properties = baseName == null ? Collections.<String, String>emptyMap() : baseName.getKeyPropertyList();
try {
this.domainOnlyName = baseName == null ? null : ObjectName.getInstance(baseName.getDomain() + ":*");
} catch (MalformedObjectNameException e) {
throw new IllegalStateException(e);
}
}
@Override
public ObjectName onAddress(PathAddress address) {
if (isExcludeAddress(address)) {
return null;
}
ObjectName result = null;
ObjectName toMatch = ObjectNameAddressUtil.createObjectName(domain, address);
if (baseName == null) {
result = toMatch;
} else if (address.size() == 0) {
// We can't compare the ObjectName properties a la the final 'else' block,
// because the special management=server property will not match
// Just confirm correct domain
if (domainOnlyName.apply(toMatch)) {
result = toMatch;
}
} else if (address.size() >= properties.size()) {
// We have same or more elements than our target has properties; let it do the match
if (baseName.apply(toMatch)) {
result = toMatch;
}
} else {
// Address may be a parent of an interesting address, so see if it matches all elements it has
boolean matches = domainOnlyName.apply(toMatch);
if (matches) {
for (Map.Entry<String, String> entry : toMatch.getKeyPropertyList().entrySet()) {
String propertyValue = properties.get(entry.getKey());
if (propertyValue == null
|| (!entry.getValue().equals(propertyValue))
&& !baseName.isPropertyValuePattern(entry.getKey())) {
matches = false;
break;
}
}
}
if (matches) {
result = toMatch;
}
}
return result;
}
}
}