use of javax.activation.CommandInfo in project sling by apache.
the class OsgiMailcapCommandMap method getPreferredCommands.
private void getPreferredCommands(String mimeType, List<CommandInfo> accumulator, boolean fallback) {
for (Map.Entry<Bundle, MailcapFile> entry : db.entrySet()) {
Map<?, ?> commandMap = fallback ? entry.getValue().getMailcapFallbackList(mimeType) : entry.getValue().getMailcapList(mimeType);
if (commandMap == null) {
continue;
}
for (Object verbObject : commandMap.keySet()) {
String verb = (String) verbObject;
if (!commandsHaveVerb(accumulator, verb)) {
List<?> commands = (List<?>) commandMap.get(verb);
String className = (String) commands.get(0);
accumulator.add(new CommandInfo(verb, className));
}
}
}
}
use of javax.activation.CommandInfo in project sling by apache.
the class OsgiMailcapCommandMap method getCommand.
@Override
public CommandInfo getCommand(String mimeType, String cmdName) {
if (mimeType != null) {
mimeType = mimeType.toLowerCase(Locale.ENGLISH);
}
CommandInfo command = null;
synchronized (sync) {
command = getCommand(mimeType, cmdName, false);
if (command != null) {
return command;
}
command = getCommand(mimeType, cmdName, true);
}
return command;
}
use of javax.activation.CommandInfo in project sling by apache.
the class OsgiMailcapCommandMap method getAllCommands.
private void getAllCommands(String mimeType, List<CommandInfo> accumulator, boolean fallback) {
for (Map.Entry<Bundle, MailcapFile> entry : db.entrySet()) {
Map<?, ?> commandMap = fallback ? entry.getValue().getMailcapFallbackList(mimeType) : entry.getValue().getMailcapList(mimeType);
if (commandMap == null) {
continue;
}
for (Object verbAsObject : commandMap.keySet()) {
String verb = (String) verbAsObject;
List<?> commands = (List<?>) commandMap.get(verb);
for (Object command : commands) {
accumulator.add(new CommandInfo(verb, (String) command));
}
}
}
}
Aggregations