String contextId = getContextId(ctx);
logger.debug("contextId=" + contextId + " attributeId=" + attributeId);
if (contextId == null || contextId.equals("")) {
return null;
}
Context context = m_contexts.getContext(contextId);
logger.debug("got context");
Object values = null;
logger.debug("designatorType" + designatorType);
switch (designatorType) {
case AttributeDesignator.SUBJECT_TARGET:
if (0 > context.nSubjectValues(attributeId)) {
values = null;
} else {
logger.debug("getting n values for " + attributeId + "="
+ context.nSubjectValues(attributeId));
switch (context.nSubjectValues(attributeId)) {
case 0:
values = null;
/*
* values = new String[1]; ((String[])values)[0] =
* Authorization.UNDEFINED;
*/
break;
case 1:
values = new String[1];
((String[]) values)[0] =
context.getSubjectValue(attributeId);
break;
default:
values = context.getSubjectValues(attributeId);
}
if (logger.isDebugEnabled()) {
if (values == null) {
logger.debug("RETURNING NO VALUES FOR " + attributeId);
} else {
StringBuffer sb = new StringBuffer();
sb.append("RETURNING " + ((String[]) values).length
+ " VALUES FOR " + attributeId + " ==");
for (int i = 0; i < ((String[]) values).length; i++) {
sb.append(" " + ((String[]) values)[i]);
}
logger.debug(sb.toString());
}
}
}
break;
case AttributeDesignator.ACTION_TARGET:
if (0 > context.nActionValues(attributeId)) {
values = null;
} else {
switch (context.nActionValues(attributeId)) {
case 0:
values = null;
/*
* values = new String[1]; ((String[])values)[0] =
* Authorization.UNDEFINED;
*/
break;
case 1:
values = new String[1];
((String[]) values)[0] =
context.getActionValue(attributeId);
break;
default:
values = context.getActionValues(attributeId);
}
}
break;
case AttributeDesignator.RESOURCE_TARGET:
if (0 > context.nResourceValues(attributeId)) {
values = null;
} else {
switch (context.nResourceValues(attributeId)) {
case 0:
values = null;
/*
* values = new String[1]; ((String[])values)[0] =
* Authorization.UNDEFINED;
*/
break;
case 1:
values = new String[1];
((String[]) values)[0] =
context.getResourceValue(attributeId);
break;
default:
values = context.getResourceValues(attributeId);
}
}
break;
case AttributeDesignator.ENVIRONMENT_TARGET:
if (0 > context.nEnvironmentValues(attributeId)) {
values = null;
} else {
switch (context.nEnvironmentValues(attributeId)) {
case 0:
values = null;
/*
* values = new String[1]; ((String[])values)[0] =
* Authorization.UNDEFINED;
*/
break;
case 1:
values = new String[1];
((String[]) values)[0] =
context.getEnvironmentValue(attributeId);
break;
default:
values = context.getEnvironmentValues(attributeId);
}
}
break;
default:
}