-
1. Re: modeshape webdave and web explorer
antonid May 6, 2014 8:33 AM (in response to antonid)is it obiligatory to have the jboss to connect webexplorer with modeshape ?
advance thanks
-
2. Re: modeshape webdave and web explorer
rhauch May 6, 2014 9:39 AM (in response to antonid)You have to have a web server of some kind, so at the moment that means some servlet container in which ModeShape and the web apps can be deployed. There may be simple ways of running a web server within your application so that our web apps can be deployed, but that'd be something you'd have to do in your application.
-
3. Re: modeshape webdave and web explorer
antonid May 7, 2014 9:38 AM (in response to rhauch)i work with tomcat ; the example found in this page (http://www.mastertheboss.com/modeshape/modeshape-with-as7-example-application)sjows that one needsJboss as7 or wildfly. tomcat is a servlet and web server. jboss is an application server. i have a constraint that my company wants to do it in tomcat.
-
4. Re: modeshape webdave and web explorer
rhauch May 7, 2014 9:46 AM (in response to antonid)1 of 1 people found this helpfulAll of our web apps can be deployed to Tomcat, and we even have an example of custom application that uses JSF and ModeShape on Tomcat.
-
5. Re: modeshape webdave and web explorer
antonid May 7, 2014 11:13 AM (in response to rhauch)[MODE-1820] Add a web app for viewing/editing repository content - JBoss Issue Tracker ; i saw (the images)your application. got inspired by it. --------------------------------------- I want to make client web (html or (bootstrap)angular.js) to connect modeshape repository using rest api and storing the nodes in sql server. i use eclispe kepler ; tomcat ; ( i dont have rights to use jboss server(as7) ; wildfly or eap) etc .... (is it possible do with tomcat alone. i think of creation of the repository to put at the entry point ie the servlet. advance thanks
-
6. Re: modeshape webdave and web explorer
rhauch May 7, 2014 11:51 AM (in response to antonid)I'm not sure what you're asking. No, you don't need to run things in JBoss Wildfly or EAP, and yes you can run the repository, our web apps (including our explorer, WebDAV, and REST services), and your web apps in Tomcat.
-
7. Re: modeshape webdave and web explorer
antonid May 7, 2014 12:05 PM (in response to rhauch)In your document :
You can deploy ModeShape (3.4 or later) and its RESTful and WebDAV services to JBoss EAP 6.1.1 by downloading the Kit and extracting the ZIP contents on top of your EAP 6.1.1 installation.
so i thought that to do webdav one needs jboss as7 or eap like that....
i want to create a web client and display my repository(as in your exemple) using RESTful service. extraction from database storing it in repository and making the repsitory visible and editable by clients (adding deleting nodes).
-
8. Re: modeshape webdave and web explorer
rhauch May 7, 2014 12:14 PM (in response to antonid)In your document :
You can deploy ModeShape (3.4 or later) and its RESTful and WebDAV services to JBoss EAP 6.1.1 by downloading the Kit and extracting the ZIP contents on top of your EAP 6.1.1 installation.
That's because that page is the documentation for when someone wants to use EAP.
-
9. Re: modeshape webdave and web explorer
antonid May 13, 2014 2:53 AM (in response to rhauch)hello, where can i download this exemple https://github.com/ModeShape/modeshape/tree/master/web/modeshape-web-explorer
-
10. Re: modeshape webdave and web explorer
rhauch May 13, 2014 12:38 PM (in response to antonid)You can download them from Maven Central, or they are in our distribution on our Downloads page.
-
11. Re: modeshape webdave and web explorer
antonid May 19, 2014 11:10 AM (in response to rhauch)hello, I try to create a webservice for modeshape; actually i want to visualise create a web directory. to do this work i make use of resteasy .
i have created a rest client .
package client;
import java.net.URI;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
public class RESTfulTestClient {
public static void main(String[] args) {
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource service = client.resource(getBaseURI());
System.out.println(service.path("rest/user/helloWorld").accept(MediaType.TEXT_HTML).get(String.class));
}
private static URI getBaseURI() {
return UriBuilder.fromUri("http://localhost:8080/RestFulService/").build();
}
}
The server :
package com.server;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.modeshape.*;
@Path("/user")
public class HelloWorld {
@GET
@Path("/helloWorld")
@Produces(MediaType.TEXT_HTML)
public String helloWorld() {
Modeshape m = new Modeshape();
return "<html> " + "<title>" + " TEST Hello World! "+ "</title>"+ "<body><h1>" + " TEST Hello World! m "+ m.modeShapeEngine() + "</body></h1>" + "</html> ";
}
@GET
@Produces(MediaType.TEXT_XML)
public String sayXMLHello() {
return "<?xml version=\"1.0\"?>" + "<hello> Hello Jersey" + "</hello>";
}
}
i have created another package where i use my modeshape engine etc....
public static ArrayList<Node> modeShapeEngine() {
Random rnd = new Random();
JcrTools tools = new JcrTools();
// Create and start the engine ...
ModeShapeEngine engine = new ModeShapeEngine();
engine.start();
Repository repository = null;
String repositoryName = null;
ArrayList<Node> nodeList = new ArrayList<Node>();
try {
URL url = Modeshape.class.getClassLoader().getResource(
"my-repository-config.json");
RepositoryConfiguration config = RepositoryConfiguration.read(url);
// We could change the name of the repository programmatically ...
// config = config.withName("Some Other Repository");w
// Verify the configuration for the repository ...
Problems problems = config.validate();
if (problems.hasErrors()) {
System.err.println("Problems starting the engine.");
System.err.println(problems);
System.exit(-1);
}
// Deploy the repository ...
repository = engine.deploy(config);
repositoryName = config.getName();
} catch (Throwable e) {
e.printStackTrace();
System.exit(-1);
// return;
}
Session session = null;
try {
// Get the repository
repository = engine.getRepository(repositoryName);
// Create a session ...
session = repository.login("default");
// Get the root node ...
Node root = session.getRootNode();
assert root != null;
System.out.println("Found the root node in the \""
+ session.getWorkspace().getName() + "\" workspace");
/* ------------creation of folders debut ---------------- */
// Create the '/files' node that is an 'nt:folder' ...
Node filesNode = root.addNode("files", "nt:folder"); // 1st folder
Node filesNode1 = root.addNode("files1", "nt:folder"); // 2nd
// folder to root
Node filesNode2 = root.addNode("files2", "nt:folder"); // 3rd
// folder to root
/* ------------creation of folders fin ---------------- */
InputStream stream = new BufferedInputStream(new FileInputStream(
"C:\\test_modeshape\\modeshape_logo.jpg"));// Introducing_ModeShape_3.0
InputStream stream1 = new BufferedInputStream(new FileInputStream(
"C:\\test_modeshape\\Introducing_ModeShape_3.0.pdf"));// Introducing_ModeShape_3.0
InputStream stream2 = new BufferedInputStream(new FileInputStream(
"C:\\test_modeshape\\test.txt"));// Introducing_ModeShape_3.0
/* il converti tout a binary */
Binary binary = session.getValueFactory().createBinary(stream);
Binary binary1 = session.getValueFactory().createBinary(stream1);
Binary binary2 = session.getValueFactory().createBinary(stream2);
// Create an 'nt:file' node at the supplied path ...
Node fileNode = filesNode.addNode("modeshape_logo.jpg", "nt:file");
Node fileNode1 = filesNode.addNode("test.txt", "nt:file");
Node fileNode2 = filesNode1.addNode("Introducing_ModeShape_3.0.pdf", "nt:file");
// Upload the file to that node ...
Node contentNode = fileNode.addNode("jcr:content", "nt:resource");
Node contentNode1 = fileNode1.addNode("jcr:content", "nt:resource");
Node contentNode2 = fileNode2.addNode("jcr:content", "nt:resource");
contentNode.setProperty("jcr:data", binary);
// contentNode.setProperty("mix:versionable", binary);
contentNode1.setProperty("jcr:data", binary1);
contentNode2.setProperty("jcr:data", binary2);
// contentNode2.setProperty("mix:mimeType", "/application/pdf");
/* creation de la requ�te */
// QueryManager qm = (QueryManager) session.getWorkspace()
// .getQueryManager();
session.save(); // itz here we save into the database
/* finding the nodes by relative path ; */
// Node doc = session.getNode("/files/modeshape_logo.jpg");
// Node doc1 = session.getNode("/files/test.txt");
// Node doc2 =
// session.getNode("/files1/Introducing_ModeShape_3.0.pdf");
//
// /* getting the contents of the nodes */
// Node img = doc.getNode("jcr:content");
// Node text = doc1.getNode("jcr:content");
// Node pdf = doc2.getNode("jcr:content");
//
nodeList.add(doc);
nodeList.add(doc1);
nodeList.add(doc2);
//
// /* ....getting its values ..... */
// // Binary content = text.getProperty("jcr:data").getBinary();
// Binary content = img.getProperty("jcr:data").getBinary(); // for
// // image
// String content1 = text.getProperty("jcr:data").getString(); //
// for
// // text
// String content2 = pdf.getProperty("jcr:data").getString(); // for
// // pdf
//
// /*----pour l'affichage de l'image----- Debut */
// InputStream is = content.getStream();
// Image image = ImageIO.read(is);
//
// JFrame frame = new JFrame();
// JLabel label = new JLabel(new ImageIcon(image));
// frame.getContentPane().add(label, BorderLayout.CENTER);
// frame.pack();
// frame.setVisible(true);
// /*----pour l'affichage de l'image----- Fin*/
//
// System.out.println("the content is text " + content2);
// // System.out.println("the content of pdf is " + content1);
//
// System.out.println(" the root is ");
// tools.printSubgraph(root);
//
// NodeIterator it = root.getNodes();
// while (it.hasNext()) {
// System.out.println(it.nextNode().getName() + " == the type == "
// + it.nextNode());
// }
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session!= null)
session.logout();
System.out.println("Shutting down engine ...");
try {
engine.shutdown().get();
System.out.println("Success!");
} catch (Exception e) {
e.printStackTrace();
}
}
return nodeList;
}
I have the error on the session.
i use modeshape 3.7.2 and infinispan INFO: ISPN000128: Infinispan version: Infinispan 'Delirium' 5.2.7.Final.
Caused by: org.modeshape.jcr.ConfigurationException: The 'Persisted-Repository' repository cannot be started because transactions are not enabled. Please check your configuration.
My idea is to create nodes and put the them in a arraylist and to display them in the web pages.
first of all i would like to know is the correct method to do it ?
is there any exemple for it ?
advance thanks
-
12. Re: modeshape webdave and web explorer
rhauch May 19, 2014 11:19 AM (in response to antonid)I have the error on the session.
i use modeshape 3.7.2 and infinispan INFO: ISPN000128: Infinispan version: Infinispan 'Delirium' 5.2.7.Final.
Caused by: org.modeshape.jcr.ConfigurationException: The 'Persisted-Repository' repository cannot be started because transactions are not enabled. Please check your configuration.
This is because the Infinispan cache used by your repository does not have transactions enabled. But a common mistake is for your repository configuration to not reference the correct ISPN cache by name, resulting in ModeShape asking Infinispan for an in-memory cache that you've not configured at all using the default ISPN configuration.
You didn't share your configuration, so I cannot tell you exactly how to fix this.
-
13. Re: modeshape webdave and web explorer
rhauch May 19, 2014 11:27 AM (in response to antonid)My idea is to create nodes and put the them in a arraylist and to display them in the web pages.
first of all i would like to know is the correct method to do it ?
is there any exemple for it ?
advance thanks
There is no standard conversion from JCR Node objects to JSON or XML, so this is something you'll have to work on yourself. For ideas you can look at how our REST service does this (it's VERY generic and may not be suitable for some apps), but you probably want to tailor the JSON (or other) representation to your application.
-
14. Re: modeshape webdave and web explorer
antonid May 19, 2014 1:42 PM (in response to rhauch)I have transaction tag in my xml INFINISPAN : =================
------------------------------ JSON ============= { "name" : "Persisted-Repository", "workspaces" : { "predefined" : ["otherWorkspace"], "default" : "default", "allowCreation" : true }, "security" : { "anonymous" : { "roles" : ["readonly","readwrite","admin"], "useOnFailedLogin" : false } }, "storage" : { "cacheConfiguration" : "infinispan-configuration.xml", "cacheName" : "persisted_repository", "binaryStorage" : { "type" : "file", "directory": "target/content/binaries", "minimumBinarySizeInBytes" : 4096 } }, "query":{ "enabled":true, "rebuildUponStartup":"if_missing", "indexStorage": { "type":"filesystem", "location":"target/content/index", "lockingStrategy":"simple", "fileSystemAccessType":"auto" } }, }