use of javax.activation.CommandMap 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.CommandMap 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));
}
}
}
}
use of javax.activation.CommandMap in project sling by apache.
the class OsgiMailcapCommandMap method findDataContentHandler.
private DataContentHandler findDataContentHandler(String mimeType, boolean fallback) {
for (Map.Entry<Bundle, MailcapFile> entry : db.entrySet()) {
Map<?, ?> commandMap = fallback ? entry.getValue().getMailcapFallbackList(mimeType) : entry.getValue().getMailcapList(mimeType);
if (commandMap != null) {
List<?> v = (List<?>) commandMap.get("content-handler");
if (v == null) {
continue;
}
String name = (String) v.get(0);
DataContentHandler dch = getDataContentHandler(name, entry.getKey());
if (dch != null) {
return dch;
}
}
}
return null;
}
Aggregations