Search in sources :

Example 6 with ObrBundle

use of org.springframework.roo.obr.addon.search.model.ObrBundle in project spring-roo by spring-projects.

the class ObrAddonSearchOperationsImpl method printResultList.

private void printResultList(List<ObrBundle> bundles) {
    final StringBuilder sb = new StringBuilder();
    int bundleId = 1;
    int maxSymbolicNameLength = getSymbolicNameMaxLength(bundles);
    LOGGER.warning(String.format("ID   BUNDLE SYMBOLIC NAME%s   DESCRIPTION", printSpaces(maxSymbolicNameLength - "BUNDLE SYMBOLIC NAME".length())));
    LOGGER.warning("--------------------------------------------------------------------------------");
    for (final ObrBundle bundle : bundles) {
        final String bundleKey = String.format("%02d", bundleId++);
        sb.append(bundleKey);
        sb.append("   ");
        sb.append(bundle.getSymbolicName());
        sb.append(String.format("%s   ", printSpaces(maxSymbolicNameLength - bundle.getSymbolicName().length())));
        sb.append(bundle.getPresentationName());
        if (sb.toString().trim().length() > 0) {
            LOGGER.info(sb.toString());
        }
        sb.setLength(0);
    }
    LOGGER.warning("--------------------------------------------------------------------------------");
    LOGGER.info("[HINT] use 'addon info bundle --bundleSymbolicName' to see details about a search result");
    LOGGER.info("[HINT] use 'addon install bundle --bundleSymbolicName' to install a specific add-on version");
}
Also used : ObrBundle(org.springframework.roo.obr.addon.search.model.ObrBundle)

Example 7 with ObrBundle

use of org.springframework.roo.obr.addon.search.model.ObrBundle in project spring-roo by spring-projects.

the class ObrAddonSearchOperationsImpl method addOnInfo.

@Override
public void addOnInfo(String bundleId) {
    Validate.notBlank(bundleId, "A valid bundle ID is required");
    synchronized (mutex) {
        ObrBundle bundle = null;
        if (searchResultCache != null) {
            bundle = searchResultCache.get(String.format("%02d", Integer.parseInt(bundleId)));
        }
        if (bundle == null) {
            LOGGER.warning("A valid bundle ID is required");
            return;
        }
        addOnInfo(bundle, bundle.getVersion());
    }
}
Also used : ObrBundle(org.springframework.roo.obr.addon.search.model.ObrBundle)

Example 8 with ObrBundle

use of org.springframework.roo.obr.addon.search.model.ObrBundle in project spring-roo by spring-projects.

the class ObrAddOnBundleSymbolicNameConverter method getAllPossibleValues.

public boolean getAllPossibleValues(final List<Completion> completions, final Class<?> requiredType, final String originalUserInput, final String optionContext, final MethodTarget target) {
    final Map<String, ObrBundle> bundles = operations.getAddOnCache();
    for (final Entry<String, ObrBundle> entry : bundles.entrySet()) {
        final String bsn = entry.getKey();
        final ObrBundle bundle = entry.getValue();
        completions.add(new Completion(bsn));
    }
    return false;
}
Also used : Completion(org.springframework.roo.shell.Completion) ObrBundle(org.springframework.roo.obr.addon.search.model.ObrBundle)

Aggregations

ObrBundle (org.springframework.roo.obr.addon.search.model.ObrBundle)8 Entry (java.util.Map.Entry)2 Capability (org.apache.felix.bundlerepository.Capability)2 Repository (org.apache.felix.bundlerepository.Repository)2 Resource (org.apache.felix.bundlerepository.Resource)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Completion (org.springframework.roo.shell.Completion)1