Author: areshetnyak
Date: 2010-10-29 03:04:16 -0400 (Fri, 29 Oct 2010)
New Revision: 3362
Added:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
Log:
JCR-1481 : Adding support form authentication in backup console
Added:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh
(rev 0)
+++
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh 2010-10-29
07:04:16 UTC (rev 3362)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+./jcrbackup.sh
http://127.0.0.1:8080/portal/rest form POST
"/portal/login?username=root&password=gtn" info
+#!/bin/sh
+
+./jcrbackup.sh
http://127.0.0.1:8080/portal/rest form POST
"/portal/login?username=root&password=gtn" info
\ No newline at end of file
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml
===================================================================
---
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml 2010-10-28
13:02:02 UTC (rev 3361)
+++
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml 2010-10-29
07:04:16 UTC (rev 3362)
@@ -46,7 +46,6 @@
<exclude>javax.portlet:portlet-api</exclude>
<exclude>javax.faces:jsf-api</exclude>
<exclude>javax.servlet:servlet-api</exclude>
- <exclude>picocontainer:picocontainer</exclude>
<exclude>jmock:jmock</exclude>
<exclude>xstream:xstream</exclude>
<exclude>commons-beanutils:commons-beanutils</exclude>
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
---
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2010-10-28
13:02:02 UTC (rev 3361)
+++
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2010-10-29
07:04:16 UTC (rev 3362)
@@ -81,27 +81,37 @@
private final String path;
/**
- * User login.
+ * Form authentication parameters.
*/
- private final String userName;
+ private FormAuthentication formAuthentication;;
/**
- * User password.
+ * Constructor.
+ *
+ * @param transport ClientTransport implementation.
+ * @param urlPath url path.
*/
- private final String pass;
+ public BackupClientImpl(ClientTransport transport, String urlPath)
+ {
+ this.transport = transport;
+ if (urlPath == null)
+ path = "/rest";
+ else
+ path = urlPath;
+ }
+
/**
* Constructor.
*
* @param transport ClientTransport implementation.
* @param login user login.
* @param pass user password.
+ * @param urlPath url path.
*/
public BackupClientImpl(ClientTransport transport, String login, String pass, String
urlPath)
{
this.transport = transport;
- this.userName = login;
- this.pass = pass;
if (urlPath == null)
path = "/rest";
@@ -110,6 +120,19 @@
}
/**
+ * Constructor.
+ *
+ * @param transport ClientTransport implementation.
+ * @param formAuthentication form authentication.
+ * @param urlPath url path.
+ */
+ public BackupClientImpl(ClientTransport transport, FormAuthentication
formAuthentication, String urlPath)
+ {
+ this(transport, urlPath);
+ this.formAuthentication = formAuthentication;
+ }
+
+ /**
* {@inheritDoc}
*/
public String startBackUp(String repositoryName, String workspaceName, String
backupDir) throws IOException,
@@ -327,8 +350,9 @@
+ info.getWorkspaceName() + "\n")
+ "\t\tbackup type : "
+ (configBean.getBackupType() ==
BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal"
- : "full only") + "\n" +
"\t\tfull backup state : " + getState(info
- .getState()))
+ : "full only") + "\n" +
"\t\tfull backup state : " + (info
+ .getWorkspaceName().equals("") ?
getRepositoryBackupToFullState(info.getState())
+ : getState(info.getState())))
+ "\n"
+ (info.getBackupType() == BackupManager.FULL_BACKUP_ONLY ?
""
: "\t\tincremental backup state : " +
"working" + "\n")
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
===================================================================
---
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java 2010-10-28
13:02:02 UTC (rev 3361)
+++
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java 2010-10-29
07:04:16 UTC (rev 3362)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashMap;
/**
* Created by The eXo Platform SAS. <br/>Date:
@@ -57,7 +58,15 @@
* Help string.
*/
private static final String HELP_INFO =
- "Help info:\n" + " <url> <cmd> \n" + "
<url> : http(s)//login:password@host:port/<context> \n"
+ "Help info:\n"
+ + " <url_basic_authentication>|<url form
authentication> <cmd> \n"
+ + " <url_basic_authentication> :
http(s)//login:password@host:port/<context> \n\n"
+ + " <url form authentication> :
http(s)//host:port/<context> \"<form auth parm>\" \n"
+ + " <form auth parm> : form <method>
<form path>\n"
+ + " <method> : POST or GET\n"
+ + " <form path> :
/path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...\n"
+ + " Example to <url form authentication> :
http://127.0.0.1:8080/portal/rest form POST
/portal/login?username=root&password=gtn\n\n"
+
+ " <cmd> : start <repo[/ws]> <backup_dir>
[<incr>] \n"
+ " stop <backup_id> \n"
+ " status <backup_id> \n"
@@ -65,7 +74,7 @@
+ " restore <repo[/ws]> <backup_id>
<pathToConfigFile> \n"
+ " list [completed] \n"
+ " info \n"
- + " drop [force-close-session] <repo[/ws]> \n"
+ + " drop [force-close-session] <repo[/ws]>
\n"
+ " help \n\n"
+ " start - start backup of repositpry or workspace \n"
@@ -79,7 +88,7 @@
+ " drop - delete the repository or workspace \n"
+ " help - print help information about backup console
\n\n"
- + " <repo[/ws]> -
/<reponsitory-name>[/<workspace-name>] the repository or workspace \n"
+ + " <repo[/ws]> -
/<reponsitory-name>[/<workspace-name>] the repository or workspace \n"
+ " <backup_dir> - path to folder for backup on remote server
\n"
+ " <backup_id> - the identifier for backup \n"
+ " <incr> - incemental job period \n"
@@ -128,25 +137,116 @@
if (!("".equals(url.getPath())))
urlPath = url.getPath();
+ // try form
+ String form = null;
+ if (curArg < args.length)
+ {
+ if (args[curArg].equals("form"))
+ {
+ form = args[curArg++];
+
+ if (url.getUserInfo() != null)
+ {
+ System.out.println(INCORRECT_PARAM + "Parameters Login:Password
should not be specified in url parameter to form authentication - " + sUrl);
+ return;
+ }
+ }
+ }
+
// login:password
String login = url.getUserInfo();
- if (login == null)
+
+ FormAuthentication formAuthentication = null;
+ if (form != null && form.equals("form"))
{
- System.out.println(INCORRECT_PARAM + "There is no specific Login:Password
in url parameter - " + sUrl);
- return;
+ //check POST or GET
+ if (curArg == args.length)
+ {
+ System.out.println(INCORRECT_PARAM + "No specified POST or GET
parameter to form parameter.");
+ return;
+ }
+ String method = args[curArg++];
+
+ if (!method.equalsIgnoreCase("GET") &&
!method.equalsIgnoreCase("POST"))
+ {
+ System.out.println(INCORRECT_PARAM + "Method to form authentication
shulde be GET or POST to form parameter - " + method);
+ return;
+ }
+
+ //url to form authentication
+ if (curArg == args.length)
+ {
+ System.out.println(INCORRECT_PARAM + "No specified url and form
properties to form parameter.");
+ return;
+ }
+ String[] params = args[curArg++].split("[?]");
+
+ if (params.length != 2)
+ {
+ System.out.println(INCORRECT_PARAM + "From parameters is not spacified
to form parameter - " + args[curArg]);
+ return;
+ }
+ String formUrl = params[0];
+
+ // parameters to form
+ String[] formParams = params[1].split("&");
+
+ if (formParams.length < 2)
+ {
+ System.out.println(INCORRECT_PARAM
+ + "From parameters shoulde be conatains at least two (for login
and for pasword) parameters - "
+ + params[1]);
+ return;
+ }
+
+ HashMap<String, String> mapFormParams = new HashMap<String,
String>();
+
+ for (String fParam : formParams)
+ {
+ String[] para = fParam.split("=");
+
+ if (para.length != 2)
+ {
+ System.out.println(INCORRECT_PARAM + "From parameters is incorect,
shoulde be as \"name=value\" - " + fParam);
+ return;
+ }
+
+ mapFormParams.put(para[0], para[1]);
+ }
+
+ formAuthentication = new FormAuthentication(method, formUrl, mapFormParams);
}
- else if (!login.matches("[^:]+:[^:]+"))
+ else
{
- System.out.println(INCORRECT_PARAM + "There is incorrect Login:Password
parameter - " + login);
- return;
+ if (login == null)
+ {
+ System.out.println(INCORRECT_PARAM + "There is no specific
Login:Password in url parameter - " + sUrl);
+ return;
+ }
+ else if (!login.matches("[^:]+:[^:]+"))
+ {
+ System.out.println(INCORRECT_PARAM + "There is incorrect Login:Password
parameter - " + login);
+ return;
+ }
}
String host = url.getHost() + ":" + url.getPort();
// initialize transport and backup client
- String[] lp = login.split(LOGIN_PASS_SPLITTER);
- ClientTransport transport = new ClientTransportImpl(lp[0], lp[1], host,
url.getProtocol());
- BackupClient client = new BackupClientImpl(transport, lp[0], lp[1], urlPath);
+ ClientTransport transport;
+ BackupClient client;
+
+ if (formAuthentication != null)
+ {
+ transport = new ClientTransportImpl(formAuthentication, host,
url.getProtocol());
+ client = new BackupClientImpl(transport, formAuthentication, urlPath);
+ }
+ else
+ {
+ String[] lp = login.split(LOGIN_PASS_SPLITTER);
+ transport = new ClientTransportImpl(lp[0], lp[1], host, url.getProtocol());
+ client = new BackupClientImpl(transport, urlPath);
+ }
// commands
if (curArg == args.length)
@@ -155,7 +255,6 @@
return;
}
String command = args[curArg++];
-
try
{
if (command.equalsIgnoreCase("start"))
@@ -376,6 +475,8 @@
System.out.println("ERROR: " + e.getMessage());
e.printStackTrace();
}
+
+ System.exit(0);
}
/**
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java
===================================================================
---
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java 2010-10-28
13:02:02 UTC (rev 3361)
+++
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java 2010-10-29
07:04:16 UTC (rev 3362)
@@ -18,6 +18,11 @@
*/
package org.exoplatform.jcr.backupconsole;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.ws.rs.core.Response;
+
import org.exoplatform.common.http.client.AuthorizationHandler;
import org.exoplatform.common.http.client.AuthorizationInfo;
import org.exoplatform.common.http.client.CookieModule;
@@ -26,9 +31,6 @@
import org.exoplatform.common.http.client.ModuleException;
import org.exoplatform.common.http.client.NVPair;
-import java.io.IOException;
-import java.net.URL;
-
/**
* Created by The eXo Platform SAS. <br/>Date:
*
@@ -67,6 +69,11 @@
* Realm to connection
*/
private String realm;
+
+ /**
+ * Form authentication parameters.
+ */
+ private FormAuthentication formAuthentication;
/**
* Constructor.
@@ -74,7 +81,6 @@
* @param login Login string.
* @param password Password string.
* @param host host string.
- * @param isSSL isSSL flag.
*/
public ClientTransportImpl(String login, String password, String host, String
protocol)
{
@@ -85,6 +91,20 @@
}
/**
+ * Constructor.
+
+ * @param formAuthentication form authentication parameters.
+ * @param login Login string.
+ * @param password Password string.
+ * @param host host string.
+ */
+ public ClientTransportImpl(FormAuthentication formAuthentication, String host, String
protocol)
+ {
+ this(null, null, host, protocol);
+ this.formAuthentication = formAuthentication;
+ }
+
+ /**
* Get realm by URL.
*
* @param sUrl URL string.
@@ -132,16 +152,53 @@
URL url = new URL(complURL);
HTTPConnection connection = new HTTPConnection(url);
- connection.removeModule(CookieModule.class);
+ connection.setAllowUserInteraction(false);
- if (!isRealmGet)
+ //authentication
+ if (formAuthentication != null)
{
- realm = getRealm(complURL);
- isRealmGet = true;
+ //form authentication
+ HTTPResponse respLogin;
+
+ URL urlLogin = new URL(protocol + "://" + host +
formAuthentication.getFormPath());
+
+ HTTPConnection connectionLogin = new HTTPConnection(urlLogin);
+ connectionLogin.setAllowUserInteraction(false);
+
+ NVPair[] formParams = new NVPair[formAuthentication.getFormParams().size()];
+ int pairCount = 0;
+ for (String key : formAuthentication.getFormParams().keySet())
+ {
+ formParams[pairCount++] = new NVPair(key,
formAuthentication.getFormParams().get(key));
+ }
+
+ if ("POST".equalsIgnoreCase(formAuthentication.getMethod()))
+ {
+ respLogin = connectionLogin.Post(urlLogin.getFile(), formParams);
+ }
+ else
+ {
+ respLogin = connectionLogin.Get(urlLogin.getFile(), formParams);
+ }
+
+ if (Response.Status.OK.getStatusCode() != respLogin.getStatusCode())
+ {
+ System.out.println("Form authentication is fail, status code : "
+ respLogin.getStatusCode());
+ System.exit(0);
+ }
}
-
- connection.addBasicAuthorization(realm, login, password);
+ else
+ {
+ // basic authorization
+ if (!isRealmGet)
+ {
+ realm = getRealm(complURL);
+ isRealmGet = true;
+ }
+ connection.addBasicAuthorization(realm, login, password);
+ }
+
HTTPResponse resp;
if (postData == null)
{
@@ -173,21 +230,58 @@
{
try
{
- // execute the POST
+ // execute the GET
String complURL = protocol + "://" + host + sURL;
URL url = new URL(complURL);
HTTPConnection connection = new HTTPConnection(url);
- connection.removeModule(CookieModule.class);
+ connection.setAllowUserInteraction(false);
- if (!isRealmGet)
+ //authentication
+ if (formAuthentication != null)
{
- realm = getRealm(complURL);
- isRealmGet = true;
+ //form authentication
+ HTTPResponse respLogin;
+
+ URL urlLogin = new URL(protocol + "://" + host +
formAuthentication.getFormPath());
+
+ HTTPConnection connectionLogin = new HTTPConnection(urlLogin);
+ connectionLogin.setAllowUserInteraction(false);
+
+ NVPair[] formParams = new NVPair[formAuthentication.getFormParams().size()];
+ int pairCount = 0;
+ for (String key : formAuthentication.getFormParams().keySet())
+ {
+ formParams[pairCount++] = new NVPair(key,
formAuthentication.getFormParams().get(key));
+ }
+
+ if ("POST".equalsIgnoreCase(formAuthentication.getMethod()))
+ {
+ respLogin = connectionLogin.Post(urlLogin.getFile(), formParams);
+ }
+ else
+ {
+ respLogin = connectionLogin.Get(urlLogin.getFile(), formParams);
+ }
+
+ if (Response.Status.OK.getStatusCode() != respLogin.getStatusCode())
+ {
+ System.out.println("Form authentication is fail, status code : "
+ respLogin.getStatusCode());
+ System.exit(0);
+ }
}
-
- connection.addBasicAuthorization(realm, login, password);
+ else
+ {
+ // basic authorization
+ if (!isRealmGet)
+ {
+ realm = getRealm(complURL);
+ isRealmGet = true;
+ }
+ connection.addBasicAuthorization(realm, login, password);
+ }
+
HTTPResponse resp = connection.Get(url.getFile());
BackupAgentResponse responce = new BackupAgentResponse(resp.getData(),
resp.getStatusCode());
Added:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java
===================================================================
---
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java
(rev 0)
+++
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java 2010-10-29
07:04:16 UTC (rev 3362)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not,
see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.jcr.backupconsole;
+
+import java.util.HashMap;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex
Reshetnyak</a>
+ * @version $Id: FormAuthntication.java 111 2010-11-11 11:11:11Z rainf0x $
+ */
+public class FormAuthentication
+{
+ private String method;
+
+ private String formPath;
+
+ private HashMap<String, String> formParams;
+
+ public FormAuthentication(String method, String formPath, HashMap<String,
String> formParams)
+ {
+ this.method = method;
+ this.formPath = formPath;
+ this.formParams = formParams;
+ }
+
+ public String getMethod()
+ {
+ return method;
+ }
+
+ public String getFormPath()
+ {
+ return formPath;
+ }
+
+ public HashMap<String, String> getFormParams()
+ {
+ return formParams;
+ }
+
+}
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
===================================================================
---
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2010-10-28
13:02:02 UTC (rev 3361)
+++
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2010-10-29
07:04:16 UTC (rev 3362)
@@ -16,6 +16,15 @@
configuration'</link> .</para>
</warning>
+ <highlights>
+ <para>GateIn uses context /portal/rest, therefore you need to use
+
http://host:port/portal/rest/ instread of
http://host:port/rest/</para>
+
+ <para>GateIn uses form authentication, so first you need to login (url to
+ form authentication is
http://host:port/portal/login) and then perform
+ requests.</para>
+ </highlights>
+
<section>
<title>Introduction</title>
@@ -911,6 +920,10 @@
</component>
<component>
+
<type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
+</component>
+
+<component>
<key>org.exoplatform.services.jcr.ext.backup.BackupManager</key>
<type>org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl</type>
<init-params>
@@ -923,12 +936,55 @@
</properties-param>
</init-params>
</component></programlisting>
+
+ <para>In case, if you will restore backup in same workspace (so you will
+ drop previous workspace), you need configure
+ RepositoryServiceConfiguration in order to save the changes of the
+ repository configuration. For example</para>
+
+ <programlisting><component>
+
<key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+
<type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR repositories configuration
file</description>
+ <value>jar:/conf/portal/exo-jcr-config.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="hsqldb" />
+ <property name="persister-class-name"
value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister"
/>
+ </properties-param>
+ </init-params>
+</component></programlisting>
+
+ <para>See the <link
+
linkend="JCR.eXoJCRconfiguration.PortalAndStandaloneConfiguration">eXo
+ JCR Configuration article at chapter '2 Portal and Standalone
+ configuration'</link> for details.</para>
</section>
</section>
<section>
<title>Backup Client</title>
+ <highlights>
+ <para>For GateIn should use context "/portal/rest". GateIn uses
form
+ authentication, so first you need to login (url to form authentication
+ is
http://host:port/portal/login) and then perform requests.</para>
+
+ <para></para>
+
+ <para>Backup client is support form authentication. For example call
+ command "info" with form authentication to GateIn :</para>
+
+ <para>./jcrbackup.sh
http://127.0.0.1:8080/portal/rest form POST
+ "/portal/login?username=root&password=gtn" info</para>
+ </highlights>
+
<para>Backup client is console application.</para>
<para>The backup client is http client for HTTPBackupAgent.</para>
@@ -936,19 +992,26 @@
<para>Command signature:</para>
<programlisting>Help info:
- <url> <cmd>
- <url> : http(s)//login:password@host:port/<context>
+ <url_basic_authentication>|<url form authentication>
<cmd>
+ <url_basic_authentication> :
http(s)//login:password@host:port/<context>
+
+ <url form authentication> : http(s)//host:port/<context>
"<form auth parm>"
+ <form auth parm> : form <method> <form
path>
+ <method> : POST or GET
+ <form path> :
/path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...
+ Example to <url form authentication> :
http://127.0.0.1:8080/portal/rest form POST
/portal/login?username=root&password=gtn
+
<cmd> : start <repo[/ws]> <backup_dir>
[<incr>]
stop <backup_id>
status <backup_id>
restores <repo[/ws]>
- restore <repo[/ws]> <backup_id>
<pathToConfigFile>
+ restore <repo[/ws]> <backup_id>
<pathToConfigFile>
list [completed]
info
- drop [force-close-session] <repo[/ws]>
+ drop [force-close-session] <repo[/ws]>
help
- start - start backup of repository or workspace
+ start - start backup of repositpry or workspace
stop - stop backup
status - information about the current or completed backup by
'backup_id'
restores - information about the last restore on specific repository or workspace
@@ -959,12 +1022,12 @@
drop - delete the repository or workspace
help - print help information about backup console
- <repo[/ws]> -
/<reponsitory-name>[/<workspace-name>] the repository or
workspace
+ <repo[/ws]> -
/<reponsitory-name>[/<workspace-name>] the repository or
workspace
<backup_dir> - path to folder for backup on remote server
<backup_id> - the identifier for backup
<incr> - incemental job period
<pathToConfigFile> - path (local) to repository or workspace
configuration
- force-close-session - close opened sessions on repositpry or
workspace</programlisting>
+ force-close-session - close opened sessions on repositpry or
workspace.</programlisting>
</section>
<section>
@@ -977,10 +1040,7 @@
<listitem>
<para>Go to folder of "backup client" <emphasis
role="bold">${JCR-SRC-HOME}/applications/exo.jcr.applications.backupconsole</emphasis>
- . - build the application :<programlisting>
- mvn clean install -P deploy
-
-</programlisting></para>
+ . - build the application :<programlisting>mvn clean install -P
deploy</programlisting></para>
</listitem>
<listitem>
@@ -1001,8 +1061,8 @@
<itemizedlist>
<listitem>
- <para>Run jar<programlisting>java -jar
exo.jcr.applications.backupconsole-binary.jar <command>
-</programlisting>or use jcrbackup.cmd (or .sh);</para>
+ <para>Run jar<programlisting>java -jar
exo.jcr.applications.backupconsole-binary.jar
<command></programlisting>or
+ use jcrbackup.cmd (or .sh);</para>
</listitem>
</itemizedlist>
</section>
@@ -1233,12 +1293,9 @@
<listitem>
<para>Delete/clean the database for workspace <emphasis
role="bold">"backup"</emphasis> : When we use
"single-db", then we
- will run the SQL queries for clean database :<programlisting>
- delete from JCR_SREF where NODE_ID in (select ID from JCR_SITEM where
CONTAINER_NAME = 'backup')
- delete from JCR_SVALUE where PROPERTY_ID in (select ID from JCR_SITEM where
CONTAINER_NAME = 'backup')
- delete from JCR_SITEM where CONTAINER_NAME='backup'
-
-</programlisting></para>
+ will run the SQL queries for clean database :<programlisting>delete from
JCR_SREF where NODE_ID in (select ID from JCR_SITEM where CONTAINER_NAME =
'backup')
+delete from JCR_SVALUE where PROPERTY_ID in (select ID from JCR_SITEM where
CONTAINER_NAME = 'backup')
+delete from JCR_SITEM where
CONTAINER_NAME='backup'</programlisting></para>
</listitem>
<listitem>
@@ -1250,8 +1307,7 @@
status code = 200</programlisting>The
/home/rainf0x/java/exo-working/JCR-839/exo-jcr-config_backup.xml
content the configuration for restored workspace <emphasis
- role="bold">"backup"</emphasis>
:<programlisting>
-<repository-service default-repository="repository">
+ role="bold">"backup"</emphasis>
:<programlisting><repository-service
default-repository="repository">
<repositories>
<repository name="repository"
system-workspace="production" default-workspace="production">
<security-domain>exo-domain</security-domain>
@@ -1329,6 +1385,16 @@
<title>Full example about creating backup and restoring it for repository
'repository'</title>
+ <note>
+ <para>If delete default repository that should be restored repository
+ with name as default repository.</para>
+ </note>
+
+ <para>This usecase needs RestRepositoryService enabled. (Deleting the
+ repository needs it)<programlisting><component>
+
<type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
+</component></programlisting></para>
+
<section>
<title>Creating backup</title>
@@ -1382,7 +1448,7 @@
</section>
<section>
- <title>Restoring the workspace "backup"</title>
+ <title>Restoring the repository "repository"</title>
<itemizedlist>
<listitem>
@@ -1404,7 +1470,7 @@
</listitem>
<listitem>
- <para>Restore:<programlisting>jcrbackup
http://root:exo@127.0.0.1:8080 restore /repository/backup 9a6dba327f000001325dfb228a181b07
/home/rainf0x/exo-jcr-config_backup.xml</programlisting>Return
+ <para>Restore:<programlisting>jcrbackup
http://root:exo@127.0.0.1:8080 restore /repository 9a6dba327f000001325dfb228a181b07
/home/rainf0x/exo-jcr-config_backup.xml</programlisting>Return
:<programlisting>Successful :
status code = 200</programlisting>The
/home/rainf0x/exo-jcr-config_backup.xml content the configuration