Examples of Directives


Examples of org.xembly.Directives

        final int number;
        try {
            number = 1 + this.storage.xml()
                .nodes("//comment/number").size();
            this.storage.apply(
                new Directives().xpath(this.xpath()).add("comment")
                    .add("number").set(Integer.toString(number)).up()
                    .add("body").set(text).up()
                    .add("user").add("login").set(this.self).up()
                    .add("created_at").set(new Github.Time().toString()).up()
                    .add("updated_at").set(new Github.Time().toString())
View Full Code Here

Examples of org.xembly.Directives

     * @throws IOException If there is any I/O problem
     */
    @Override
    public void remove() throws IOException {
        this.storage.apply(
            new Directives().xpath(this.xpath()).strict(1).remove()
        );
    }
View Full Code Here

Examples of org.xembly.Directives

     */
    public void patch(
        @NotNull(message = "xpath can't be NULL") final String xpath,
        @NotNull(message = "obj can't be NULL") final JsonObject obj
    ) throws IOException {
        final Directives dirs = new Directives().xpath(xpath);
        for (final Map.Entry<String, JsonValue> entry : obj.entrySet()) {
            dirs.addIf(entry.getKey())
                .set(StringUtils.strip(entry.getValue().toString(), "\""))
                .up();
        }
        this.storage.apply(dirs);
    }
View Full Code Here

Examples of org.xembly.Directives

        @NotNull(message = "stg can't be NULL") final MkStorage stg,
        @NotNull(message = "login can't be NULL") final String login
    ) throws IOException {
        this.storage = stg;
        this.self = login;
        this.storage.apply(new Directives().xpath("/github").addIf("repos"));
    }
View Full Code Here

Examples of org.xembly.Directives

        @NotNull(message = "json can't be NULL") final JsonObject json
    ) throws IOException {
        final String name = json.getString("name");
        final Coordinates coords = new Coordinates.Simple(this.self, name);
        this.storage.apply(
            new Directives().xpath(this.xpath()).add("repo")
                .attr("coords", coords.toString())
                .add("name").set(name).up()
                .add("description").set("test repository").up()
                .add("private").set("false").up()
        );
View Full Code Here

Examples of org.xembly.Directives

    public void remove(
        @NotNull(message = "coordinates can't be NULL")
        final Coordinates coords) {
        try {
            this.storage.apply(
                new Directives().xpath(
                    String.format("%s/repo[@coords='%s']", this.xpath(), coords)
                ).remove()
            );
        } catch (final IOException ex) {
            throw new IllegalStateException(ex);
View Full Code Here

Examples of org.xembly.Directives

    ) throws IOException {
        this.storage = stg;
        this.self = login;
        this.coords = rep;
        this.storage.apply(
            new Directives().xpath(
                String.format(
                    "/github/repos/repo[@coords='%s']/git",
                    this.coords
                )
            ).addIf("refs")
View Full Code Here

Examples of org.xembly.Directives

    public Reference create(
        @NotNull(message = "ref can't be NULL") final String ref,
        @NotNull(message = "sha can't be NULL") final String sha
    ) throws IOException {
        this.storage.apply(
            new Directives().xpath(this.xpath()).add("reference")
                .add("ref").set(ref).up()
                .add("sha").set(sha).up()
        );
        return this.get(ref);
    }
View Full Code Here

Examples of org.xembly.Directives

    public void remove(
        @NotNull(message = "identifier shouldn't be NULL")
        final String identifier
    ) throws IOException {
        this.storage.apply(
            new Directives().xpath(
                String.format(
                    "%s/reference[ref='%s']", this.xpath(), identifier
                )
            ).remove()
        );
View Full Code Here

Examples of org.xembly.Directives

     */
    @Test
    public void canGetJson() throws Exception {
        final MkStorage storage = new MkStorage.InFile();
        storage.apply(
            new Directives().xpath("/github").add("repos")
                .add("repo").attr("coords", "test_login/test_repo")
                .add("commits").add("commit").add("sha").set(SHA1)
        );
        final MkRepoCommit repoCommit = new MkRepoCommit(
            storage, this.repo(storage), SHA1
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.