Search in sources :

Example 1 with RepositoryProvider

use of org.apache.jackrabbit.vault.util.RepositoryProvider in project sling by apache.

the class VltSerializationManager method main.

public static void main(String[] args) throws RepositoryException, URISyntaxException, IOException {
    RepositoryAddress address = new RepositoryAddress("http://localhost:8080/server/root");
    Repository repo = new RepositoryProvider().getRepository(address);
    Session session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));
    VaultFileSystem fs = Mounter.mount(null, null, address, "/", session);
    String[] attempts = new String[] { "/rep:policy", "/var" };
    for (String attempt : attempts) {
        VaultFile vaultFile = fs.getFile(attempt);
        System.out.println(attempt + " -> " + vaultFile);
    }
    for (String attempt : attempts) {
        attempt = PlatformNameFormat.getPlatformPath(attempt) + EXTENSION_XML;
        VaultFile vaultFile = fs.getFile(attempt);
        System.out.println(attempt + " -> " + vaultFile);
    }
}
Also used : SimpleCredentials(javax.jcr.SimpleCredentials) RepositoryAddress(org.apache.jackrabbit.vault.fs.api.RepositoryAddress) Repository(javax.jcr.Repository) VaultFileSystem(org.apache.jackrabbit.vault.fs.api.VaultFileSystem) VaultFile(org.apache.jackrabbit.vault.fs.api.VaultFile) RepositoryProvider(org.apache.jackrabbit.vault.util.RepositoryProvider) Session(javax.jcr.Session)

Aggregations

Repository (javax.jcr.Repository)1 Session (javax.jcr.Session)1 SimpleCredentials (javax.jcr.SimpleCredentials)1 RepositoryAddress (org.apache.jackrabbit.vault.fs.api.RepositoryAddress)1 VaultFile (org.apache.jackrabbit.vault.fs.api.VaultFile)1 VaultFileSystem (org.apache.jackrabbit.vault.fs.api.VaultFileSystem)1 RepositoryProvider (org.apache.jackrabbit.vault.util.RepositoryProvider)1