You need to adapt the resource to a Node.class
Node node = resource.adaptTo(Node.class);
to create a child node you can use the "addNode" methods which returns the new created node
Node childNode = node.addNode("newNode");
to read it from its parent you can do the following
Node childNode = node.getNode("newNode");
to update its properties you can use the methods "setProperty", but you can add or remove mixin types and more with other methods if I remember properly
Property property = childNode.setProperty("propertyName", "itsValue")
to remove a node (or a property) you can use the remove method of the superclass Item
childNode.getProperty("propertyName").remove();
childNode.remove();
https://developer.adobe.com/experience-manager/reference-materials/spec/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html
https://developer.adobe.com/experience-manager/reference-materials/spec/jsr170/javadocs/jcr-2.0/javax/jcr/Property.html
The same operations, with the absolute paths can be done with the java.jcr.Session instance, which in any case it's necessary to commit or discard the changes. With the JCR API you have to use the save() and the refresh(boolean keepChanges) methods.
https://developer.adobe.com/experience-manager/reference-materials/spec/jsr170/javadocs/jcr-2.0/javax/jcr/Session.html#save()