• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • How to install bnd
      • Guided Tour
      • Guided Tour Workspace & Projects
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Introduction
      • Concepts
      • Best practices
    • Build and Development
      • Project Setup
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • repodigests ( ';' NAME )*
    Workspace

    Get the repository digests (describing their contents) for all or the specified names

    public Object _repodigests(String[] args) throws Exception {
    	Macro.verifyCommand(args, "${repodigests;[;<repo names>]...}, get the repository digests", null, 1, 10000);
    	List<RepositoryPlugin> repos = getRepositories();
    	if (args.length > 1) {
    		repos: for (Iterator<RepositoryPlugin> it = repos.iterator(); it.hasNext();) {
    			String name = it.next().getName();
    			for (int i = 1; i < args.length; i++) {
    				if (name.equals(args[i])) {
    					it.remove();
    					continue repos;
    				}
    			}
    			it.remove();
    		}
    	}
    	List<String> digests = new ArrayList<String>();
    	for (RepositoryPlugin repo : repos) {
    		try {
    			// TODO use RepositoryDigest interface when it is widely
    			// implemented
    			Method m = repo.getClass().getMethod("getDigest");
    			byte[] digest = (byte[]) m.invoke(repo);
    			digests.add(Hex.toHexString(digest));
    		}
    		catch (Exception e) {
    			if (args.length != 1)
    				error("Specified repo %s for digests is not found", repo.getName());
    			// else Ignore
    		}
    	}
    	return join(digests, ",");
    }
    
Search
    • Home